diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..098364d --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +node_modules +.git +test-repo +playwright-report +test-results diff --git a/.github/workflows/test-setup.yml b/.github/workflows/test-setup.yml new file mode 100644 index 0000000..7a81d03 --- /dev/null +++ b/.github/workflows/test-setup.yml @@ -0,0 +1,34 @@ +name: Test Setup Script + +on: + push: + branches: [main, git-stunts] + paths: + - 'scripts/setup.sh' + - 'test/setup.bats' + - 'test/run-setup-tests.sh' + - 'test/Dockerfile.bats' + pull_request: + paths: + - 'scripts/setup.sh' + - 'test/setup.bats' + - 'test/run-setup-tests.sh' + - 'test/Dockerfile.bats' + +jobs: + test-setup-script: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Run BATS tests + run: npm run test:setup + + - name: Upload test results + if: always() + uses: actions/upload-artifact@v3 + with: + name: bats-test-results + path: test-results/ diff --git a/.gitignore b/.gitignore index 92f5139..fd7b939 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,10 @@ playwright-report/ cms-chunks-*/ cms-upload-*/ git-cms-test-*/ +.obsidian/ + +# LaTeX artifacts +*.aux +*.log +*.out +*.toc diff --git a/Dockerfile b/Dockerfile index cdc94b2..87fa1f2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,21 +3,31 @@ # Base stage FROM node:20-slim AS base ENV NODE_ENV=production -# Install Git (Required for git-cms) RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* WORKDIR /app +# IMPORTANT: This Dockerfile expects the build context to be the PARENT directory +# so it can access both git-cms/ and git-stunts/ directories. +# See docker-compose.yml which sets context: .. and dockerfile: git-cms/Dockerfile +# +# Directory structure expected: +# ~/git/ +# git-cms/ ← This repo +# git-stunts/ ← Lego blocks repo + # Deps stage FROM base AS deps -COPY package.json package-lock.json* ./ +# Copy the lego blocks first so npm install can link them +COPY git-stunts /git-stunts +COPY git-cms/package.json git-cms/package-lock.json* ./ RUN npm ci --include=dev # Development stage FROM base AS dev ENV NODE_ENV=development +COPY --from=deps /git-stunts /git-stunts COPY --from=deps /app/node_modules ./node_modules -COPY . . -# Configure Git for Dev +COPY git-cms . RUN git config --global user.email "dev@git-cms.local" RUN git config --global user.name "Git CMS Dev" RUN git config --global init.defaultBranch main @@ -26,10 +36,10 @@ CMD ["npm", "run", "serve"] # Test stage FROM base AS test ENV NODE_ENV=test +COPY --from=deps /git-stunts /git-stunts COPY --from=deps /app/node_modules ./node_modules -COPY . . -# Configure Git for Test +COPY git-cms . RUN git config --global user.email "bot@git-cms.local" RUN git config --global user.name "Git CMS Bot" RUN git config --global init.defaultBranch main -CMD ["npm", "run", "test:local"] +CMD ["npm", "run", "test:local"] \ No newline at end of file diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md new file mode 100644 index 0000000..b7c498c --- /dev/null +++ b/GETTING_STARTED.md @@ -0,0 +1,111 @@ +# Getting Started with Git CMS + +Welcome to **Git CMS**! This tool allows you to write and manage blog posts using Git—the same technology developers use to track code—but with a simple interface that works like a regular app. + +Follow these steps to get up and running. + +--- + +## 1. Prerequisites + +Before you start, you need two things installed on your computer: + +1. **Git**: [Download and install Git here](https://git-scm.com/downloads). (Choose the default options during installation). +2. **Node.js**: [Download and install Node.js here](https://nodejs.org/). (Choose the "LTS" version). + +--- + +## 2. Installation + +You can install Git CMS directly on your computer or run it using **Docker**. + +### Option A: Direct Installation +1. Open your **Terminal** (on Mac/Linux) or **Command Prompt/PowerShell** (on Windows). +2. Type the following commands one by one: + ```bash + # Download the tool + git clone https://github.com/clduab11/git-cms.git + + # Enter the folder + cd git-cms + + # Install the helper files + npm install + + # Make the 'git-cms' command available everywhere on your computer + npm link + ``` + +### Option B: Using Docker (Recommended for isolation) +If you have [Docker Desktop](https://www.docker.com/products/docker-desktop/) installed, you can run the CMS without installing Node.js: +1. Download the tool: `git clone https://github.com/clduab11/git-cms.git` +2. Enter the folder: `cd git-cms` +3. Run with Docker: `docker compose up app` + *Note: By default, this will save posts inside the `git-cms` folder. See Section 3 to change this.* + +--- + +## 3. Setting Up Your "Content Home" + +Git CMS doesn't save your posts inside the tool itself; it saves them in a "Repository" (a special folder) of your choice. + +1. Create a new folder for your blog posts (e.g., `my-awesome-blog`). +2. Enter that folder in your terminal and "initialize" it: + ```bash + mkdir my-awesome-blog + cd my-awesome-blog + git init + ``` +3. **Crucial Step**: Tell Git CMS to use this folder. You do this by setting an "Environment Variable" named `GIT_CMS_REPO` to the path of this folder. + * **Mac/Linux**: `export GIT_CMS_REPO=/Users/yourname/my-awesome-blog` + * **Windows**: `$env:GIT_CMS_REPO="C:\Users\yourname\my-awesome-blog"` + +--- + +## 4. Running the CMS + +Now you are ready to start the interface! + +1. In your terminal, type: + ```bash + git-cms serve + ``` +2. You will see a message: `[git-cms] Admin UI: http://localhost:4638/` +3. Open your web browser (Chrome, Safari, or Edge) and go to **http://localhost:4638/**. + +--- + +## 5. Writing Your First Post + +1. Click the **+ New Article** button on the left. +2. **Slug**: Enter a short ID for your post (e.g., `my-first-post`). No spaces! +3. **Title**: Enter the title of your article. +4. **Content**: Type your post in the large box. You can use [Markdown](https://www.markdownguide.org/basic-syntax/) to add formatting like **bold** or *italics*. +5. Click **Save Draft**. + +### To Make it Public: +When you are happy with your post, click the **Publish** button. This marks the post as "live." + +--- + +## 6. Managing Images and Files + +You can add images to your posts easily: +1. In the editor, click the **Attach File** button at the bottom. +2. Select an image from your computer. +3. Git CMS will "chunk" the image, store it safely in Git, and automatically add the code to your post so the image shows up. + +--- + +## 7. Advanced: CLI Power (Optional) + +If you prefer using the terminal instead of the web browser, you can use these commands: +* `git-cms list`: See all your drafts. +* `git-cms show `: Read a post in the terminal. +* `git-cms publish `: Publish a draft. + +--- + +### Troubleshooting +* **"Command not found"**: Ensure you ran `npm link` in the `git-cms` folder. +* **"Not a git repository"**: Ensure you ran `git init` inside your content folder and that your `GIT_CMS_REPO` path is correct. diff --git a/QUICK_REFERENCE.md b/QUICK_REFERENCE.md new file mode 100644 index 0000000..d3a4228 --- /dev/null +++ b/QUICK_REFERENCE.md @@ -0,0 +1,236 @@ +# Git CMS Quick Reference + +**One-page cheat sheet for Git CMS commands and concepts.** + +--- + +## 🚀 First Time Setup + +```bash +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms +npm run setup # Clones git-stunts, checks Docker +npm run demo # See it work! +``` + +--- + +## 📦 npm Commands + +| Command | Purpose | +|---------|---------| +| `npm run setup` | One-time setup (clones dependencies) | +| `npm run demo` | Automated demo with explanations | +| `npm run quickstart` | Interactive menu | +| `npm run dev` | Start HTTP server (http://localhost:4638) | +| `npm test` | Run integration tests | +| `npm run test:setup` | Run setup script tests (BATS) | + +--- + +## 🔧 CLI Commands (Inside Container) + +```bash +# Enter container +docker compose run --rm app sh + +# Draft an article +echo "# My Post" | node bin/git-cms.js draft my-slug "My Title" + +# List articles +node bin/git-cms.js list +node bin/git-cms.js list --kind=published + +# Publish an article +node bin/git-cms.js publish my-slug + +# Read an article +node bin/git-cms.js show my-slug + +# Exit container +exit +``` + +--- + +## 🎯 The Core Concept + +### Traditional CMS +``` +Article → Database Row → SQL Query +``` + +### Git CMS +``` +Article → Commit Message → git log +``` + +**The Trick:** Commits point to the "empty tree" so no files are changed. + +--- + +## 📂 Key Refs (Git References) + +| Ref | Purpose | +|-----|---------| +| `refs/_blog/articles/` | Draft version (moves forward with each save) | +| `refs/_blog/published/` | Published version (fast-forward only) | +| `refs/_blog/chunks/@current` | Encrypted asset manifest | + +--- + +## 🔍 Inspecting with Git + +```bash +# View all CMS refs +git for-each-ref refs/_blog/ + +# Read an article (it's just a commit message!) +git log refs/_blog/articles/hello-world -1 --format="%B" + +# See version history +git log refs/_blog/articles/hello-world --oneline + +# Check what tree the commit points to +git log refs/_blog/articles/hello-world -1 --format="%T" +# → 4b825dc... (the empty tree!) + +# View the DAG +git log --all --graph --oneline refs/_blog/ +``` + +--- + +## 🏗️ Architecture (Lego Blocks) + +``` +git-cms + └─ CmsService (orchestrator) + ├─ @git-stunts/plumbing (Git commands) + ├─ @git-stunts/trailer-codec (RFC 822 trailers) + ├─ @git-stunts/empty-graph (commits on empty tree) + ├─ @git-stunts/cas (encrypted asset storage) + └─ @git-stunts/vault (OS keychain for secrets) +``` + +--- + +## 📄 Commit Message Format + +``` +# My Article Title + +This is the article body. + +Status: draft +Author: James Ross +Tags: git, cms +Slug: my-article +UpdatedAt: 2026-01-11T12:34:56Z +``` + +**Trailers** (key-value pairs at end) are parsed by `@git-stunts/trailer-codec`. + +--- + +## 🔐 Publishing Workflow + +```bash +# Save draft (creates commit) +echo "# Post" | git cms draft my-post "Title" +→ refs/_blog/articles/my-post points to abc123 + +# Publish (copies pointer) +git cms publish my-post +→ refs/_blog/published/my-post points to abc123 + +# Edit (creates new commit) +echo "# Updated" | git cms draft my-post "Title" +→ refs/_blog/articles/my-post points to def456 +→ refs/_blog/published/my-post still points to abc123 +``` + +Publishing is **atomic** and **fast-forward only**. + +--- + +## 🛡️ Safety + +**Everything runs in Docker by default.** + +- ✅ Your host Git repos are never touched +- ✅ Tests run in isolated containers +- ✅ Easy cleanup: `docker compose down -v` + +**Never** run `git cms` commands in repos you care about until you understand what's happening. + +--- + +## 📚 Documentation + +| File | Purpose | +|------|---------| +| `README.md` | Overview + quick start | +| `TESTING_GUIDE.md` | How to test safely | +| `docs/GETTING_STARTED.md` | Comprehensive walkthrough | +| `docs/ADR.md` | **Architecture Decision Record** (deep dive) | +| `test/README.md` | Test suite documentation | +| `scripts/README.md` | Script documentation | +| `QUICK_REFERENCE.md` | This file! | + +--- + +## 🐛 Troubleshooting + +### "Cannot find module '@git-stunts/...'" +```bash +npm run setup # Clones git-stunts automatically +``` + +### "Port 4638 already in use" +Edit `docker-compose.yml`: +```yaml +ports: + - "5000:4638" # Use port 5000 instead +``` + +### "Docker daemon not running" +Start Docker Desktop (macOS/Windows) or `sudo systemctl start docker` (Linux). + +--- + +## 🎓 Key Concepts to Understand + +1. **Empty Tree:** `4b825dc642cb6eb9a060e54bf8d69288fbee4904` is Git's canonical empty tree. All commits point here. + +2. **Trailers:** RFC 822 key-value pairs at end of commit messages (like `Signed-off-by` in Linux kernel). + +3. **Fast-Forward Only:** Published refs can only move forward in history, never rewrite. + +4. **Content Addressability:** Assets stored by SHA-1 hash, automatic deduplication. + +5. **Compare-and-Swap (CAS):** `git update-ref` is atomic at ref level, prevents concurrent write conflicts. + +--- + +## 💡 The "Linus Threshold" + +This project exists at the edge of technical sanity. It's designed to make you think: + +> "I would never use this in production, but now I understand Git way better." + +If you're considering production use: +- Read `docs/ADR.md` cover to cover +- Understand every tradeoff +- Run in Docker for months +- Ask yourself: "Would a database be better?" (probably yes) + +Then, if you're still convinced... **go for it!** Just don't say we didn't warn you. 😄 + +--- + +## 🎉 Have Fun! + +This is a **thought experiment** that happens to work. Use it to learn, explore, and understand Git's plumbing from first principles. + +*"You know what? Have fun."* — Linus (probably) diff --git a/README.md b/README.md index f86d44e..e083b21 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,44 @@ A serverless, database-free CMS built on Git plumbing. **git-cms** treats your Git repository as a distributed, cryptographically verifiable database. Instead of files, it stores content as commit messages on "empty trees," creating a linear, append-only ledger for articles, comments, or any other structured data. -### Features +## Quick Start (Docker - Safe!) + +### One-Time Setup + +```bash +# Clone this repo +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms + +# Run setup (clones dependencies, checks Docker) +npm run setup +``` + +### Try It Out + +```bash +# Option 1: See a demo (recommended first time) +npm run demo + +# Option 2: Interactive menu +npm run quickstart + +# Option 3: Just start the server +npm run dev +# Open http://localhost:4638 +``` + +**Everything runs in Docker - completely safe for your local Git setup.** + +## ⚠️ SAFETY WARNING + +**This project manipulates Git repositories at a low level. ALWAYS use Docker for testing.** + +The tests create, destroy, and manipulate Git repositories. Running low-level plumbing commands on your host filesystem is risky - a typo could affect your local Git setup. That's why we built Docker isolation into everything. + +**Read more:** [TESTING_GUIDE.md](./TESTING_GUIDE.md) | [docs/GETTING_STARTED.md](./docs/GETTING_STARTED.md) + +## Features - **Database-Free:** No SQL, No NoSQL. Just Git objects (Merkle DAG). - **Fast-Forward Only:** Enforces strict linear history for provenance. diff --git a/REPO_WALKTHROUGH.md b/REPO_WALKTHROUGH.md new file mode 100644 index 0000000..814c35c --- /dev/null +++ b/REPO_WALKTHROUGH.md @@ -0,0 +1,61 @@ +# Git CMS: Technical Repo Walkthrough + +This document provides a top-to-bottom technical walkthrough of the Git CMS architecture, linking concepts to their implementation evidence in the codebase. + +## 1. Core Philosophy: The "Empty Tree" Database +Instead of tracking files on disk, Git CMS treats the Git object store as a NoSQL-style graph database. + +* **Evidence:** `src/lib/git.js` defines the [EMPTY_TREE constant](https://github.com/clduab11/git-cms/blob/main/src/lib/git.js#L6) (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`). +* **Implementation:** All content commits are generated using `commit-tree` against this empty tree OID, ensuring the "working tree" of these commits is always empty. See [writeSnapshot in src/lib/git.js](https://github.com/clduab11/git-cms/blob/main/src/lib/git.js#L54). +* **NOTE:** + > [!note] + > This architectural decision is not formally documented in the `docs/` folder; it is only described in the `README.md` and visible in the source code logic. + +## 2. Refspace Organization +The CMS partitions the Git namespace to separate drafts, published content, and assets. + +* **Evidence:** The `refFor` helper in [src/lib/git.js](https://github.com/clduab11/git-cms/blob/main/src/lib/git.js#L18-L23) defines the structure: + * `refs/_blog/articles/` (Drafts) + * `refs/_blog/published/` (Published) + * `refs/_blog/comments/` (Comments) +* **NOTE:** + > [!note] + > The specific schema for the `refs/_blog` namespace lacks documentation regarding collision prevention or migration strategies. + +## 3. Article Serialization (The "Commit Article" Format) +Articles are stored entirely within Git commit messages using a header/body/trailer format. + +* **Evidence:** [src/lib/parse.js](https://github.com/clduab11/git-cms/blob/main/src/lib/parse.js) contains the logic for splitting the commit message into `title`, `body`, and `trailers`. +* **Evidence:** The CLI implementation in [bin/git-cms.js](https://github.com/clduab11/git-cms/blob/main/bin/git-cms.js#L17-L21) demonstrates the construction of this message. + +## 4. Asset Management: Git-Native CAS +Assets are handled via a Content Addressable Store (CAS) implemented using Git blobs and manifests. + +* **Chunking Logic:** Files are split into 256KB chunks in [src/lib/chunks.js](https://github.com/clduab11/git-cms/blob/main/src/lib/chunks.js#L48). +* **Encryption:** AES-256-GCM encryption is applied if a key is resolved, seen in [encryptBuffer](https://github.com/clduab11/git-cms/blob/main/src/lib/chunks.js#L34). +* **Manifests:** The file structure is preserved in a `manifest.json` stored as a Git blob, which is then committed to a chunk-specific ref. See [chunkFileToRef](https://github.com/clduab11/git-cms/blob/main/src/lib/chunks.js#L48). +* **NOTE:** + > [!note] + > The chunking and encryption feature is complex but lacks a specification document describing the manifest JSON schema. + +## 5. Secret Management +The project avoids plain-text secrets by integrating with OS-native keychains. + +* **Implementation:** [src/lib/secrets.js](https://github.com/clduab11/git-cms/blob/main/src/lib/secrets.js) contains drivers for: + * macOS `security` + * Linux `secret-tool` + * Windows `CredentialManager` +* **Usage:** Used by the CAS system to retrieve the `CHUNK_ENC_KEY` via [resolveSecret](https://github.com/clduab11/git-cms/blob/main/src/lib/secrets.js#L206). + +## 6. API and Admin UI +The system provides a zero-dependency management interface. + +* **Server:** [src/server/index.js](https://github.com/clduab11/git-cms/blob/main/src/server/index.js) uses Node's `http` module to provide a REST API. +* **UI:** [public/index.html](https://github.com/clduab11/git-cms/blob/main/public/index.html) is a vanilla JS SPA that communicates with the `/api/cms` endpoints. +* **NOTE:** + > [!note] + > The REST API endpoints are not documented with an OpenAPI spec or similar reference. + +## 7. Operational Environment +* **Configuration:** The project uses `GIT_CMS_REPO` to target the data repository. Evidence: [src/server/index.js](https://github.com/clduab11/git-cms/blob/main/src/server/index.js#L14). +* **Verification:** E2E tests in [test/e2e/admin.spec.js](https://github.com/clduab11/git-cms/blob/main/test/e2e/admin.spec.js) verify the full flow from draft creation to publishing. diff --git a/ROADMAP.md b/ROADMAP.md new file mode 100644 index 0000000..c7024dd --- /dev/null +++ b/ROADMAP.md @@ -0,0 +1,597 @@ +# git-cms Roadmap + +## Milestone Overview + +| Milestone | Focus | Description | +|-----------|-------|-------------| +| **M0** | Packaging + Infra Guardrails | Ship the engine to npm; hermetic test harness | +| **M1** | Core Content Model + State Machine | Content IDs, slug rules, Draft→Publish transitions | +| **M2** | Editor UX | Preview, autosave, version history | +| **M3** | Delivery | Public API, SSG integration, scheduling | +| **M4** | Media | Media library, drag-and-drop uploads | +| **M5** | Security + Roles | Authentication, multi-user, RBAC | +| **M6** | Polish | Search, keyboard shortcuts, responsive UI | + +--- + +## Blocking Graph + +``` +PP1, PP2 → PP3 → PP4 +M1.1 (Content ID + State Machine) → PD1 → (PD2, PD3) +CM1 → UX3 +CM2 → PD3 +CE2 → (UX1, CE3) +SEC1 → SEC2 +MED1 → MED2 +INF3 (UI Redesign) ideally after M1.1 +``` + +--- + +## M0 — Packaging + Infra Guardrails + +### PP1 — Publish @git-stunts/cas to npm *(in progress)* + +- **User Story:** As a developer, I can install @git-stunts/cas from npm and rely on semver'd releases. +- **Requirements:** Build + types published; ESM/CJS policy decided; README usage; license; provenance of build (lockfile); CI publish. +- **Acceptance Criteria:** `npm i @git-stunts/cas` works; basic example runs; exports map correct; no `file:` deps. +- **Scope:** Packaging + CI publish. +- **Out of Scope:** API changes unrelated to packaging. +- **Est. Complexity:** ~120–250 LoC +- **Est. Hours:** 2–4h +- **Test Plan:** + - Golden: install in temp project; run minimal CAS write/read. + - Failure: missing files in package; wrong exports; types not found. + - Edges: Node versions; ESM-only consumer. +- **Def of Done:** Published tag; CI green; smoke install verified. +- **Blocking:** PP3 +- **Blocked By:** None (but may require minor API stabilization) + +--- + +### PP2 — Publish @git-stunts/empty-graph to npm *(nearly ready)* + +- **User Story:** As a dev, I can install empty-graph and run core graph ops from npm. +- **Requirements:** Same packaging checklist; peer deps correct; build artifacts correct. +- **Acceptance Criteria:** Install + run minimal "create graph → write → read → sync" example. +- **Scope:** Packaging + CI release. +- **Out of Scope:** Feature work. +- **Est. Complexity:** ~150–300 LoC +- **Est. Hours:** 3–6h +- **Test Plan:** Smoke install; run minimal integration tests in a fresh project. +- **Def of Done:** Published; release notes; semver tag. +- **Blocking:** PP3 +- **Blocked By:** Depends on remaining readiness items in repo + +--- + +### PP3 — Swap file: paths to versioned npm ranges *(blocked by PP1, PP2)* + +- **User Story:** As a maintainer, I can build git-cms from clean installs without monorepo path hacks. +- **Requirements:** Replace all `file:`; ensure lockfile updates; CI uses `npm ci`; avoid dependency loops. +- **Acceptance Criteria:** Clean clone + `npm ci` + tests pass. +- **Scope:** Dependency graph + CI. +- **Out of Scope:** Refactors. +- **Est. Complexity:** ~30–80 LoC +- **Est. Hours:** 1–2h +- **Test Plan:** + - Golden: CI passes. + - Failure: transitive dependency mismatch. + - Edges: hoisting differences. +- **Def of Done:** No `file:` remains; green pipeline. +- **Blocking:** PP4 +- **Blocked By:** PP1, PP2 + +--- + +### PP4 — Publish git-cms to npm *(blocked by PP3)* + +- **User Story:** As a user, I can install git-cms and run it via documented entrypoints. +- **Requirements:** CLI or API entry defined; docs; versioning; minimal example. +- **Acceptance Criteria:** Install + `npx git-cms --help` works; sample repo runs end-to-end. +- **Scope:** Packaging + docs + smoke path. +- **Out of Scope:** New features. +- **Est. Complexity:** ~100–250 LoC +- **Est. Hours:** 2–5h +- **Test Plan:** + - Golden: quickstart works. + - Failure: missing assets. + - Edges: OS differences. +- **Def of Done:** Published; "Getting Started" verified. +- **Blocking:** Unlocks downstream adoption +- **Blocked By:** PP3 + +--- + +### INF1 — Integrate docker-guard into test setup + +- **User Story:** As a maintainer, I prevent tests from silently depending on host state / flaky env. +- **Requirements:** Dockerized test harness; consistent node version; filesystem guards; CI parity. +- **Acceptance Criteria:** Tests run via docker-guard locally + CI; documented. +- **Scope:** Test harness only. +- **Out of Scope:** Rewriting tests unless required. +- **Est. Complexity:** ~150–400 LoC +- **Est. Hours:** 4–8h +- **Test Plan:** + - Golden: run tests. + - Failure: missing docker. + - Edges: Apple Silicon. + - Stress: repeated runs. +- **Def of Done:** One command runs tests hermetically; CI uses it. +- **Blocking:** Reduces future pain +- **Blocked By:** None + +--- + +### INF2 — Integrate Alfred resilience policies into CmsService + +- **User Story:** As a user, transient git/fs/network failures retry safely instead of corrupting state. +- **Requirements:** Define retry policy per operation; idempotency requirements; structured errors; timeouts. +- **Acceptance Criteria:** Injected policies; visible status; retries don't duplicate publishes/writes. +- **Scope:** Service layer operations (publish, save, sync, media upload). +- **Out of Scope:** UI polish beyond surfaced error states. +- **Est. Complexity:** ~200–500 LoC +- **Est. Hours:** 5–10h +- **Test Plan:** + - Golden: normal ops. + - Failure: simulate IO errors. + - Edges: partial write. + - Stress: retry storms. +- **Def of Done:** Policies applied + tested; no double-commit behavior. +- **Blocking:** Safer future features +- **Blocked By:** Basic CmsService API stability + +--- + +## M1 — Core Content Model + State Machine + +### M1.1 — Define canonical Content IDs + paths *(ADD — MUST EXIST)* + +- **User Story:** As a developer, I understand how content is identified and where it lives. +- **Requirements:** Slug rules (charset, length, uniqueness); rename semantics; ref naming conventions; content ID immutability policy. +- **Acceptance Criteria:** Documented spec; validation enforced in CmsService; tests for edge cases. +- **Scope:** Spec + validation + tests. +- **Out of Scope:** Migration of existing content (see M1.3). +- **Est. Complexity:** ~200–500 LoC +- **Est. Hours:** 4–10h +- **Test Plan:** + - Golden: valid slugs accepted. + - Failure: invalid slugs rejected with clear error. + - Edges: unicode, reserved names, collisions. +- **Def of Done:** Spec documented; validation in place. +- **Blocking:** Everything else in content model +- **Blocked By:** None + +--- + +### M1.2 — Draft/Published state machine + transitions *(ADD — MUST EXIST)* + +- **User Story:** As a developer, the Draft→Published→Unpublished→Reverted states are explicit and deterministic. +- **Requirements:** State enum; allowed transitions; revert semantics (new commit vs ref move); unpublish semantics (tombstone vs delete). +- **Acceptance Criteria:** State machine documented; CmsService enforces transitions; invalid transitions error clearly. +- **Scope:** State machine spec + enforcement + tests. +- **Out of Scope:** Scheduling (PD2). +- **Est. Complexity:** ~300–700 LoC +- **Est. Hours:** 6–14h +- **Test Plan:** + - Golden: all valid transitions. + - Failure: invalid transitions rejected. + - Edges: concurrent transitions, crash recovery. +- **Def of Done:** State machine is law; no undefined states. +- **Blocking:** PD1, CE3, INF3 +- **Blocked By:** M1.1 + +--- + +### M1.3 — Migration + repo layout spec *(ADD — MUST EXIST)* + +- **User Story:** As a maintainer, I know where content lives and how to migrate between versions. +- **Requirements:** Ref namespace spec; index structure; migration strategy; backward compatibility policy. +- **Acceptance Criteria:** Layout documented; migration script exists (even if no-op for v1). +- **Scope:** Spec + tooling. +- **Out of Scope:** Automatic migrations for external repos. +- **Est. Complexity:** ~150–400 LoC +- **Est. Hours:** 4–8h +- **Test Plan:** + - Golden: fresh repo + migrated repo both work. + - Failure: corrupt layout detected. +- **Def of Done:** Spec is versioned; migration path exists. +- **Blocking:** Safe upgrades +- **Blocked By:** M1.1 + +--- + +### M1.4 — Backup/restore + integrity verification *(ADD — MUST EXIST)* + +- **User Story:** As an admin, I can verify repo integrity and restore from backup. +- **Requirements:** Integrity check command; backup instructions (even if "git clone"); restore procedure; fsck-like verification. +- **Acceptance Criteria:** `git-cms verify` reports issues; documented backup/restore. +- **Scope:** CLI command + docs. +- **Out of Scope:** Automated backups. +- **Est. Complexity:** ~200–500 LoC +- **Est. Hours:** 5–10h +- **Test Plan:** + - Golden: clean repo passes. + - Failure: corrupted repo detected. + - Edges: partial corruption. +- **Def of Done:** Verification exists; backup/restore documented. +- **Blocking:** Production readiness +- **Blocked By:** M1.3 + +--- + +### CM1 — Add categories, tags, custom metadata fields + +- **User Story:** As a publisher, I can organize and filter content without inventing folder voodoo. +- **Requirements:** Metadata schema (trailers); validation; indexing/search hooks. +- **Acceptance Criteria:** Create/edit metadata; list filters work; metadata persists through publish. +- **Scope:** Metadata storage + basic UI controls + query. +- **Out of Scope:** Advanced taxonomies (hierarchies) unless needed. +- **Est. Complexity:** ~400–1200 LoC +- **Est. Hours:** 10–24h +- **Test Plan:** + - Golden: add tags, filter list. + - Failure: invalid metadata. + - Edges: unicode tags. + - Fuzz: random meta. +- **Def of Done:** Schema documented; migrations for existing content. +- **Blocking:** UX3 +- **Blocked By:** M1.1 + +--- + +### CM2 — Support multiple content types (pages, posts, etc.) + +- **User Story:** As a publisher, I can model pages vs posts with different fields and routes. +- **Requirements:** Type registry; per-type templates; per-type validation; routing rules. +- **Acceptance Criteria:** At least 2 types supported end-to-end; type-specific fields render and publish. +- **Scope:** Type system + UI select + delivery mapping. +- **Out of Scope:** Plugin marketplace. +- **Est. Complexity:** ~500–1600 LoC +- **Est. Hours:** 12–30h +- **Test Plan:** + - Golden: create each type. + - Failure: unknown type. + - Edges: type change. + - Stress: many items. +- **Def of Done:** Documented type model; backward compatible default type. +- **Blocking:** PD3 +- **Blocked By:** CM1, M1.1 + +--- + +## M2 — Editor UX + +### INF3 — Redesign browser-based admin UI + +- **User Story:** As an editor, the admin feels coherent and fast, not like a dev panel accident. +- **Requirements:** New IA (nav/content list/editor/settings); component library decisions; performance budget. +- **Acceptance Criteria:** New layout shipped; key workflows require fewer clicks; Lighthouse baseline not awful. +- **Scope:** UI structure + styling + routing. +- **Out of Scope:** New backend features. +- **Est. Complexity:** ~600–2000 LoC +- **Est. Hours:** 16–40h +- **Test Plan:** + - Golden: create/edit/publish. + - Failure: routing errors. + - Edges: mobile. + - Stress: large lists. +- **Def of Done:** Design implemented; no regressions; basic a11y. +- **Blocking:** Makes everything else less miserable +- **Blocked By:** M1.2 (state machine) ideally + +--- + +### CE1 — Add markdown preview/rendering to editor + +- **User Story:** As an author, I can see rendered Markdown as I write. +- **Requirements:** Renderer (remark/markdown-it); sanitization policy; preview toggle/split view. +- **Acceptance Criteria:** Preview matches published rendering; no XSS injection. +- **Scope:** Editor preview only. +- **Out of Scope:** Custom MD extensions unless required. +- **Est. Complexity:** ~200–600 LoC +- **Est. Hours:** 4–10h +- **Test Plan:** + - Golden: headings/lists/code. + - Failure: invalid MD. + - Edges: huge docs. + - Fuzz: random markdown. +- **Def of Done:** Stable preview; security checks. +- **Blocking:** Improves authoring +- **Blocked By:** INF3 + +--- + +### CE2 — Add autosave for drafts + +- **User Story:** As an author, my draft is never lost because I sneezed near a browser tab. +- **Requirements:** Debounce; conflict strategy; "last saved" indicator; local vs repo save decision. +- **Acceptance Criteria:** Changes persist across refresh; no publish commits triggered by autosave. +- **Scope:** Draft save path. +- **Out of Scope:** Scheduled publishing. +- **Est. Complexity:** ~250–700 LoC +- **Est. Hours:** 6–12h +- **Test Plan:** + - Golden: type → autosave. + - Failure: disk full. + - Edges: offline. + - Stress: rapid edits. +- **Def of Done:** Robust autosave; telemetry/logging optional. +- **Blocking:** CE3, UX1 +- **Blocked By:** M1.2 + +--- + +### CE3 — Add version history browser + +- **User Story:** As an editor, I can browse and diff prior versions and restore one. +- **Requirements:** Map commits to content IDs; diff view; restore action creates new commit; permissions later. +- **Acceptance Criteria:** Select version → view diff → restore → new head reflects restored content. +- **Scope:** History + restore for one content item. +- **Out of Scope:** Cross-item history; multi-user audit (later). +- **Est. Complexity:** ~400–1200 LoC +- **Est. Hours:** 10–24h +- **Test Plan:** + - Golden: restore. + - Failure: missing commit. + - Edges: rename. + - Stress: long history. +- **Def of Done:** History UI + tested restore semantics. +- **Blocking:** Publishing rollback UX +- **Blocked By:** M1.2, CE2 + +--- + +## M3 — Delivery + +### PD1 — Published articles list + management (unpublish, revert to draft) + +- **User Story:** As an editor, I can manage what's live without manual git archaeology. +- **Requirements:** Publish state machine; unpublish semantics; revert to draft semantics; UI list. +- **Acceptance Criteria:** Published list accurate; unpublish removes from public API; revert creates new draft. +- **Scope:** Management UI + service operations. +- **Out of Scope:** Scheduling. +- **Est. Complexity:** ~400–1200 LoC +- **Est. Hours:** 10–22h +- **Test Plan:** + - Golden: publish/unpublish. + - Failure: conflict. + - Edges: deleted item. + - Stress: many publishes. +- **Def of Done:** State transitions are deterministic + tested. +- **Blocking:** PD2, PD3 +- **Blocked By:** M1.2 + +--- + +### PD2 — Scheduled publishing + +- **User Story:** As a publisher, I can schedule content to go live automatically. +- **Requirements:** Scheduler (cron-like); time zone policy (UTC); persistence; retry; idempotent publish. +- **Acceptance Criteria:** Schedule → content publishes at time; missed schedule recovers on restart. +- **Scope:** Schedule storage + runner. +- **Out of Scope:** Complex editorial calendars. +- **Est. Complexity:** ~350–900 LoC +- **Est. Hours:** 8–18h +- **Test Plan:** + - Golden: schedule soon. + - Failure: system clock skew. + - Edges: DST. + - Stress: lots of schedules. +- **Def of Done:** Deterministic behavior; tests use fake timers. +- **Blocking:** "Real CMS" vibes +- **Blocked By:** PD1 + +--- + +### PD3 — Public-facing content API / SSG integration + +- **User Story:** As a site builder, I can fetch published content for SSR/SSG without poking internals. +- **Requirements:** Stable read API; pagination; filtering; caching headers; content type mapping; auth later. +- **Acceptance Criteria:** Next/SSG sample pulls content; API returns only published unless auth. +- **Scope:** Read-only API + example integration. +- **Out of Scope:** Comments, search backend. +- **Est. Complexity:** ~500–1500 LoC +- **Est. Hours:** 12–28h +- **Test Plan:** + - Golden: list + get. + - Failure: missing content. + - Edges: large payloads. + - Fuzz: random queries. +- **Def of Done:** Documented API + versioned response schema. +- **Blocking:** "People can use it" +- **Blocked By:** PD1, CM2 (strongly recommended) + +--- + +## M4 — Media + +### MED1 — Build a media library + +- **User Story:** As an editor, I can see and reuse uploaded images/files. +- **Requirements:** Storage strategy (git-lfs? CAS blobs?); metadata (size/type/hash); listing + delete policy. +- **Acceptance Criteria:** Upload appears in library; can insert reference into content. +- **Scope:** Media index + UI. +- **Out of Scope:** Transformations/CDN. +- **Est. Complexity:** ~600–1800 LoC +- **Est. Hours:** 16–40h +- **Test Plan:** + - Golden: upload & reuse. + - Failure: unsupported type. + - Edges: huge files. + - Stress: many items. +- **Def of Done:** Storage documented; integrity checks. +- **Blocking:** MED2 +- **Blocked By:** PD3 decisions (public delivery), CAS integration maturity + +--- + +### MED2 — Drag-and-drop file uploads + +- **User Story:** As an editor, I can drop files into the UI and they just work. +- **Requirements:** DnD UX; progress; cancellation; retry; validation. +- **Acceptance Criteria:** Drag → upload → available; errors clear. +- **Scope:** UI + API endpoint + persistence. +- **Out of Scope:** Batch transformations. +- **Est. Complexity:** ~300–900 LoC +- **Est. Hours:** 8–18h +- **Test Plan:** + - Golden: drag upload. + - Failure: network drop. + - Edges: duplicate name. + - Stress: big uploads. +- **Def of Done:** Robust UX; no partial-corrupt artifacts. +- **Blocking:** Improves author velocity +- **Blocked By:** MED1 + +--- + +## M5 — Security + Roles + +### SEC1 — Add authentication + +- **User Story:** As an admin, only authorized users can access the CMS. +- **Requirements:** Auth method (session/cookie/JWT); login/logout; protected routes; CSRF policy. +- **Acceptance Criteria:** Unauth users blocked; login persists; logout clears session. +- **Scope:** Auth layer + route guards. +- **Out of Scope:** Roles/permissions beyond "logged in". +- **Est. Complexity:** ~400–1200 LoC +- **Est. Hours:** 12–24h +- **Test Plan:** + - Golden: login. + - Failure: invalid creds. + - Edges: token expiry. + - Stress: brute attempts (rate limit optional). +- **Def of Done:** Threat model notes; security basics in place. +- **Blocking:** SEC2 +- **Blocked By:** Delivery architecture decisions (API boundary) + +--- + +### SEC2 — Multi-user support + roles *(blocked by SEC1)* + +- **User Story:** As an org, multiple editors can work with controlled permissions. +- **Requirements:** User model; roles; permission checks in service + UI; audit trail (at least attribution). +- **Acceptance Criteria:** At least 3 roles (admin/editor/viewer) enforced; actions denied correctly. +- **Scope:** RBAC enforcement + UI gating. +- **Out of Scope:** SSO/SCIM. +- **Est. Complexity:** ~600–1800 LoC +- **Est. Hours:** 18–45h +- **Test Plan:** + - Golden: role actions. + - Failure: privilege escalation attempts. + - Edges: role change mid-session. + - Stress: many users. +- **Def of Done:** Permissions tested; no "UI-only security." +- **Blocking:** "Real multi-user CMS" +- **Blocked By:** SEC1 + +--- + +## M6 — Polish + +### UX1 — Unsaved changes confirmation + +- **User Story:** As an editor, I don't accidentally lose edits. +- **Requirements:** Dirty state tracking; route change intercept; close-tab warning. +- **Acceptance Criteria:** Navigating away prompts; saving clears prompt. +- **Scope:** Editor pages. +- **Out of Scope:** Global app. +- **Est. Complexity:** ~80–200 LoC +- **Est. Hours:** 2–4h +- **Test Plan:** + - Golden: prompt appears. + - Failure: false positives. + - Edges: programmatic nav. +- **Def of Done:** No regressions in navigation. +- **Blocking:** Pairs with autosave +- **Blocked By:** CE2 + +--- + +### UX2 — Error handling + loading states in UI + +- **User Story:** As a user, I understand what's happening instead of staring at a frozen vibe. +- **Requirements:** Standard error boundary; retry UI; skeletons/spinners; consistent toasts. +- **Acceptance Criteria:** No blank screens; actionable errors; loading visible for async ops. +- **Scope:** UI patterns across app. +- **Out of Scope:** Pixel-perfect redesign. +- **Est. Complexity:** ~200–700 LoC +- **Est. Hours:** 6–14h +- **Test Plan:** + - Golden: happy path. + - Failure: simulate API 500. + - Edges: slow network. + - Stress: repeated actions. +- **Def of Done:** Consistent system-wide pattern. +- **Blocking:** Everything feels better +- **Blocked By:** Stable service API (CmsService) + +--- + +### UX3 — Search + filtering + +- **User Story:** As an editor, I can find content fast. +- **Requirements:** Filter by title/tag/category/type/status; fuzzy search optional; pagination. +- **Acceptance Criteria:** Filters work and persist in URL. +- **Scope:** Admin list view. +- **Out of Scope:** Full-text search across bodies (later). +- **Est. Complexity:** ~250–800 LoC +- **Est. Hours:** 6–16h +- **Test Plan:** + - Golden: filter combos. + - Failure: invalid query params. + - Edges: unicode. + - Stress: large datasets. +- **Def of Done:** Performant on 10k items (or documented limit). +- **Blocking:** Usability +- **Blocked By:** CM1, CM2, PD1 + +--- + +### UX4 — Keyboard shortcuts + +- **User Story:** As a power user, I can publish/save/navigate without the mouse. +- **Requirements:** Shortcut map; conflict avoidance; discoverability (help modal). +- **Acceptance Criteria:** Save/publish shortcuts work; no broken browser shortcuts. +- **Scope:** Editor + list. +- **Out of Scope:** Fully customizable shortcuts. +- **Est. Complexity:** ~150–400 LoC +- **Est. Hours:** 4–8h +- **Test Plan:** + - Golden: shortcuts trigger. + - Failure: focus issues. + - Edges: input fields. + - Stress: rapid use. +- **Def of Done:** Docs + UI hint. +- **Blocking:** Polish tier +- **Blocked By:** Core actions stable (save/publish) + +--- + +### UX5 — Responsive mobile UI + +- **User Story:** As a user, I can do basic admin tasks on mobile. +- **Requirements:** Responsive layout; touch targets; editor experience at least usable. +- **Acceptance Criteria:** List + edit + publish works on small screens. +- **Scope:** Responsiveness pass. +- **Out of Scope:** Perfect mobile-first editor. +- **Est. Complexity:** ~300–1200 LoC +- **Est. Hours:** 10–24h +- **Test Plan:** + - Golden: key flows. + - Failure: overflow. + - Edges: landscape. + - Stress: long content. +- **Def of Done:** No broken layouts; basic a11y. +- **Blocking:** Adoption +- **Blocked By:** INF3 (UI redesign) ideally + +--- + +## Already Published + +- `@git-stunts/plumbing` +- `@git-stunts/trailer-codec` +- `@git-stunts/vault` diff --git a/TESTING_GUIDE.md b/TESTING_GUIDE.md new file mode 100644 index 0000000..becb2a2 --- /dev/null +++ b/TESTING_GUIDE.md @@ -0,0 +1,368 @@ +# How to Safely Test Git CMS + +This guide explains how to try out git-cms without any risk to your local Git setup or existing repositories. + +## TL;DR - Just Show Me The Commands + +```bash +# One-time setup +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms +npm run setup + +# Then use any of these: +npm run demo # Automated demo +npm run quickstart # Interactive menu +npm run dev # Start server +``` + +**Everything runs in Docker. Your host system is safe.** + +--- + +## Prerequisites + +### Required Directory Structure + +Git CMS depends on "Lego Block" modules from the `git-stunts` repository. Your directory structure must be: + +``` +~/git/ ← Can be anywhere, doesn't have to be ~/git + ├── git-cms/ ← This repository + └── git-stunts/ ← Required dependency +``` + +### Clone and Setup + +```bash +cd ~/git # Or wherever you want to keep these + +# Clone git-cms +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms + +# Run setup (this clones git-stunts and checks Docker) +npm run setup +``` + +**What `npm run setup` does:** +- Checks Docker is installed and running +- Clones git-stunts (Lego Blocks) to `../git-stunts/` +- Verifies the directory structure is correct + +After setup, your structure will be: +``` +~/git/ + ├── git-cms/ ← You are here + └── git-stunts/ ← Auto-cloned by setup +``` + +### Install Docker + +- **macOS:** [Docker Desktop](https://docs.docker.com/desktop/install/mac-install/) +- **Linux:** [Docker Engine](https://docs.docker.com/engine/install/) +- **Windows:** [Docker Desktop](https://docs.docker.com/desktop/install/windows-install/) + +Verify Docker is working: +```bash +docker --version +docker compose version +``` + +--- + +## Safety Guarantees + +### What's Protected + +✅ **Your host Git repositories** - Never touched +✅ **Your Git global config** - Never modified +✅ **Your filesystem** - Only the git-cms directory is mounted (read-only for git operations) +✅ **Your Git history** - Tests run in isolated containers + +### How Docker Provides Isolation + +1. **Separate Filesystem**: The container has its own isolated filesystem +2. **Separate Git Config**: Container sets its own `user.name` and `user.email` +3. **Temporary Repos**: Tests create repos in `/tmp` inside the container +4. **Easy Cleanup**: `docker compose down -v` destroys everything + +--- + +## Testing Scenarios + +### Scenario 1: Interactive Quick Start (Recommended) + +```bash +cd git-cms +./scripts/quickstart.sh +``` + +**What it does:** +- Checks Docker prerequisites +- Provides a menu with options: + 1. Start the HTTP server + 2. Run tests + 3. Open a shell + 4. View logs + 5. Clean up + +**Safe because:** Everything runs in Docker containers that are destroyed after use. + +--- + +### Scenario 2: Automated Demo + +```bash +cd git-cms +./scripts/demo.sh +``` + +**What it does:** +- Creates a demo article +- Shows how Git stores the data +- Demonstrates publishing +- Shows version history +- Explains the "empty tree" trick + +**Safe because:** Runs entirely in a Docker container with a temporary Git repo. + +--- + +### Scenario 3: HTTP Server + Web UI + +```bash +cd git-cms +npm run dev +# OR +docker compose up app +``` + +Open your browser to: **http://localhost:4638** + +**What it does:** +- Starts Node.js HTTP server in Docker +- Serves the admin UI +- Creates a Git repo inside the container at `/app/.git` + +**Safe because:** +- Repository is inside the container, not on your host +- Stopping the container (`Ctrl+C` or `docker compose down`) stops all Git operations +- No risk to your local repositories + +**To clean up:** +```bash +docker compose down -v # Removes container and volumes +``` + +--- + +### Scenario 4: CLI Commands (Inside Container) + +```bash +cd git-cms +docker compose run --rm app sh + +# Now you're in the container +node bin/git-cms.js draft hello-world "My First Post" +node bin/git-cms.js list +node bin/git-cms.js publish hello-world + +# Explore what Git sees +git log --all --oneline --graph +git for-each-ref refs/_blog/ + +exit +``` + +**Safe because:** You're running commands inside the container, which has its own isolated Git environment. + +--- + +### Scenario 5: Run Tests + +```bash +cd git-cms +npm test +# OR +./test/run-docker.sh +# OR +docker compose run --rm test +``` + +**What it does:** +- Runs Vitest integration tests +- Creates temporary Git repos in `/tmp` +- Tests CRUD operations, encryption, API endpoints +- Cleans up after completion + +**Safe because:** All tests run in an isolated Docker container with temporary repos. + +--- + +## Advanced: Local Installation (Not Recommended Initially) + +If you understand what git-cms does and want to install it globally on your host: + +```bash +npm install -g git-cms +# OR +cd git-cms && npm link +``` + +**⚠️ WARNING:** Only use git-cms in dedicated repositories: + +```bash +# Create a fresh repo for testing +mkdir ~/git-cms-playground +cd ~/git-cms-playground +git init + +# Configure +git config user.name "Your Name" +git config user.email "you@example.com" + +# Now safe to use +echo "# Test" | git cms draft test-post "Test Post" +``` + +**NEVER run `git cms` commands in:** +- Your active project repositories +- Repositories with uncommitted work +- Any repository you care about until you understand what's happening + +--- + +## What Could Go Wrong? (And Why It Won't) + +### Myth: "Git CMS will mess up my local Git" + +**Reality:** If you use Docker (as recommended), git-cms never touches your host Git installation. It runs in a container with its own Git binary, config, and repositories. + +### Myth: "Tests will create files all over my filesystem" + +**Reality:** Tests run in Docker containers with temporary directories. When the container stops, everything is cleaned up automatically. + +### Myth: "I'll accidentally run commands in my project repo" + +**Reality:** The CLI checks what directory you're in. If you're in a repo with important files, you'll notice. Plus, git-cms operates in the `refs/_blog/*` namespace, separate from your normal branches. + +### Actual Risk: Running Tests Outside Docker + +**IF** you run `npm run test:local` (bypassing Docker), tests WILL create temporary repos in your `/tmp` directory. While these are deleted after, there's a non-zero risk if tests fail mid-execution. + +**Solution:** Always use `npm test` which automatically uses Docker. + +--- + +## Cleanup + +### Remove Everything + +```bash +# Stop containers +cd git-cms +docker compose down + +# Remove containers AND volumes (fresh start) +docker compose down -v + +# Remove images (if you want to reclaim disk space) +docker rmi $(docker images | grep git-cms | awk '{print $3}') +``` + +### Uninstall CLI (if installed globally) + +```bash +npm uninstall -g git-cms +# OR +cd git-cms && npm unlink +``` + +--- + +## Troubleshooting + +### "Cannot find module '@git-stunts/...'" + +**Cause:** The `git-stunts` directory is not in the expected location. + +**Solution:** +```bash +# Verify structure +ls -l .. +# Should show both git-cms and git-stunts + +# If git-stunts is missing +cd .. +git clone https://github.com/flyingrobots/git-stunts.git +cd git-cms + +# Rebuild Docker images +docker compose build +``` + +### "Port 4638 already in use" + +**Solution:** Either stop the process using that port, or change the port in `docker-compose.yml`: + +```yaml +ports: + - "5000:4638" # Maps localhost:5000 → container:4638 +``` + +### "Docker daemon not running" + +**Solution:** Start Docker Desktop (macOS/Windows) or start the Docker service (Linux): + +```bash +# Linux +sudo systemctl start docker +``` + +### Tests fail with "EACCES: permission denied" + +**Cause:** Docker doesn't have permission to bind volumes. + +**Solution:** +- On macOS/Windows: Check Docker Desktop → Settings → Resources → File Sharing +- On Linux: Ensure your user is in the `docker` group + +--- + +## What's Next? + +Once you're comfortable with the basics: + +1. **Read the Architecture Decision Record**: `docs/ADR.md` + - Comprehensive technical documentation + - Design decisions and tradeoffs + - Full system architecture + +2. **Explore the Code**: `src/lib/CmsService.js` + - See how the Lego Blocks are composed + - Understand the domain orchestration + - Study the Git plumbing operations + +3. **Set Up Stargate Gateway**: `./scripts/bootstrap-stargate.sh` + - Enforces fast-forward only + - Verifies GPG signatures + - Mirrors to public repositories + +4. **Experiment with Encryption**: See `docs/GETTING_STARTED.md` + - Client-side AES-256-GCM encryption + - OS keychain integration + - Row-level access control + +--- + +## Remember + +Git CMS is a **learning project** and **thought experiment**. It's designed to teach you: +- How Git's plumbing actually works +- Content-addressable storage patterns +- Building unconventional systems from first principles + +Use it to learn, experiment, and explore. Don't use it in production unless you **really** understand what you're getting into. + +Have fun! 🎉 diff --git a/bin/git-cms.js b/bin/git-cms.js index 67fd2f4..e7c5bb4 100755 --- a/bin/git-cms.js +++ b/bin/git-cms.js @@ -1,13 +1,13 @@ #!/usr/bin/env node -import { writeSnapshot, fastForwardPublished, listRefs, readTipMessage } from '../src/lib/git.js'; -import { parseArticleCommit } from '../src/lib/parse.js'; -import { startServer } from '../src/server/index.js'; +import CmsService from '../src/lib/CmsService.js'; async function main() { const [,, cmd, ...args] = process.argv; const cwd = process.cwd(); - const refPrefix = process.env.CMS_REF_PREFIX; + const refPrefix = process.env.CMS_REF_PREFIX || 'refs/_blog/dev'; + + const cms = new CmsService({ cwd, refPrefix }); try { switch (cmd) { @@ -18,9 +18,8 @@ async function main() { const chunks = []; for await (const chunk of process.stdin) chunks.push(chunk); const body = Buffer.concat(chunks).toString('utf8'); - const message = `${title}\n\n${body}\n\nStatus: draft\n`; - const res = writeSnapshot({ slug, message, cwd, refPrefix }); + const res = await cms.saveSnapshot({ slug, title, body }); console.log(`Saved draft: ${res.sha} (${res.ref})`); break; } @@ -28,26 +27,25 @@ async function main() { const [slug] = args; if (!slug) throw new Error('Usage: git cms publish '); - const tip = readTipMessage(slug, 'draft', { cwd, refPrefix }); - const res = fastForwardPublished(slug, tip.sha, { cwd, refPrefix }); + const res = await cms.publishArticle({ slug }); console.log(`Published: ${res.sha} (${res.ref})`); break; } case 'list': { - const items = listRefs('draft', { cwd, refPrefix }); + const items = await cms.listArticles(); if (items.length === 0) console.log("No articles found."); - items.forEach(i => console.log(`- ${i.slug}: ${i.ref}`)); + items.forEach(i => console.log(`- ${i.slug}: ${i.sha}`)); break; } case 'show': { const [slug] = args; if (!slug) throw new Error('Usage: git cms show '); - const { message } = readTipMessage(slug, 'draft', { cwd, refPrefix }); - const { title, body } = parseArticleCommit(message); - console.log(`# ${title}\n\n${body}`); + const article = await cms.readArticle({ slug }); + console.log(`# ${article.title}\n\n${article.body}`); break; } case 'serve': { + const { startServer } = await import('../src/server/index.js'); startServer(); break; } @@ -61,4 +59,4 @@ async function main() { } } -main(); \ No newline at end of file +main(); diff --git a/docker-compose.yml b/docker-compose.yml index f26046f..bd6e981 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,17 @@ +# IMPORTANT: Run docker compose from THIS directory (git-cms/) +# The build context is set to parent (..) so Docker can access both +# git-cms/ and git-stunts/ directories for the build. +# +# Expected structure: +# ~/git/ +# git-cms/ ← Run docker compose here +# git-stunts/ ← Lego blocks (required) + services: app: build: - context: . + context: .. # Parent dir so we can access both git-cms and git-stunts + dockerfile: git-cms/Dockerfile target: dev volumes: - .:/app @@ -15,7 +25,8 @@ services: test: build: - context: . + context: .. # Parent dir so we can access both git-cms and git-stunts + dockerfile: git-cms/Dockerfile target: test volumes: - .:/app diff --git a/docs/ADR.md b/docs/ADR.md new file mode 100644 index 0000000..3ac5272 --- /dev/null +++ b/docs/ADR.md @@ -0,0 +1,1770 @@ +# Architecture Decision Record: Git CMS +## Database-Free Content Management via Git Plumbing + +**Status:** Active +**Version:** 1.0.0 +**Last Updated:** 2026-01-11 +**Author:** James Ross + +--- + +## 1. Introduction & Goals + +### Project Overview + +**git-cms** is a serverless, database-free Content Management System that treats Git's object store as a distributed, cryptographically verifiable document database. Instead of storing content in traditional databases (SQL or NoSQL), it leverages Git's Merkle DAG to create an append-only ledger for articles, metadata, and encrypted assets. + +The fundamental innovation: **`git push` becomes the API endpoint.** + +### Fundamental Requirements + +#### FR-1: Zero-Database Architecture +The system MUST NOT depend on external database systems (SQL, NoSQL, or key-value stores). All persistent state resides within Git's native object store (`.git/objects`). + +**Rationale:** Eliminates operational complexity, deployment dependencies, and schema migration challenges inherent to traditional database-backed CMSs. + +#### FR-2: Cryptographic Verifiability +Every content mutation MUST be recorded as a Git commit with cryptographic integrity guarantees via SHA-1 hashing (with optional GPG signing for non-repudiation). + +**Rationale:** Provides immutable audit trails and tamper detection without additional infrastructure. + +#### FR-3: Fast-Forward Only Publishing +The publish operation MUST enforce strict linear history (fast-forward only) to prevent rewriting published content. + +**Rationale:** Guarantees provenance and prevents content manipulation after publication. + +#### FR-4: Client-Side Encryption +All uploaded assets MUST be encrypted client-side (AES-256-GCM) before touching the repository. + +**Rationale:** Achieves row-level security without database-level access controls. The Git gateway receives only opaque encrypted blobs. + +#### FR-5: Infinite Point-in-Time Recovery +Users MUST be able to access any historical version of any article without data loss. + +**Rationale:** Git's DAG structure provides this naturally; the CMS simply exposes it as a first-class feature. + +### Quality Goals + +| Priority | Quality Attribute | Description | Measurement | +|----------|------------------|-------------|-------------| +| 1 | **Security** | Cryptographic integrity, client-side encryption, signed commits | GPG verification, AES-256-GCM encryption strength | +| 2 | **Simplicity** | Minimal dependencies, no database, composable architecture | Lines of code, dependency count, Docker image size | +| 3 | **Auditability** | Complete provenance of all content changes | Git log completeness, trailer metadata coverage | +| 4 | **Performance** | Sub-second reads for typical blog workloads | Response time for `readArticle()` | +| 5 | **Portability** | Multi-runtime support (Node, Bun, Deno) | Test suite pass rate across runtimes | + +### Non-Goals + +This system is **intentionally NOT designed for**: + +- **High-velocity writes:** Content publishing happens in minutes/hours, not milliseconds. +- **Complex queries:** No SQL-like JOINs or aggregations. Queries are limited to ref enumeration and commit message parsing. +- **Large-scale collaboration:** Designed for single-author or small-team blogs, not Wikipedia-scale editing. +- **Real-time updates:** Publishing is atomic but not instantaneous across distributed clones. + +--- + +## 2. Constraints + +### Technical Constraints + +#### TC-1: Git's Content Addressability Model +Git uses SHA-1 hashing for object addressing. While SHA-1 has known collision vulnerabilities, Git is transitioning to SHA-256. The system assumes SHA-1 is "good enough" for content addressing (not for security-critical signing). + +**Mitigation:** Use GPG signing (`CMS_SIGN=1`) for cryptographic non-repudiation. + +#### TC-2: Filesystem I/O Performance +All Git operations are ultimately filesystem operations. Performance is bounded by disk I/O, especially for large repositories. + +**Mitigation:** Content is stored as commit messages (small), not files (large). Asset chunking (256KB) reduces blob size. + +#### TC-3: POSIX Shell Dependency +The `@git-stunts/plumbing` module executes Git via shell commands (`child_process.spawn`). This requires a POSIX-compliant shell and Git CLI. + +**Mitigation:** All tests run in Docker (Alpine Linux) to ensure consistent environments. + +#### TC-4: No Database Indexes +Traditional databases provide B-tree indexes for fast lookups. Git's ref enumeration is linear (`O(n)` for listing all refs in a namespace). + +**Mitigation:** Use ref namespaces strategically (e.g., `refs/_blog/articles/`) to avoid polluting the global ref space. + +### Regulatory Constraints + +#### RC-1: GDPR Right to Erasure +Git's immutability conflicts with GDPR's "right to be forgotten." Deleting a commit requires rewriting history, which breaks cryptographic integrity. + +**Mitigation:** Use encrypted assets with key rotation. Deleting the encryption key renders historical content unreadable without altering Git history. + +#### RC-2: Cryptographic Export Restrictions +AES-256-GCM encryption may face export restrictions in certain jurisdictions. + +**Mitigation:** The `@git-stunts/vault` module uses Node's built-in `crypto` module, which is widely available. + +### Operational Constraints + +#### OC-1: Single-Writer Assumption +Git's ref updates are atomic *locally* but not across distributed clones. Concurrent writes to the same ref can cause conflicts. + +**Mitigation:** Use **git-stargate** (a companion project) to enforce serialized writes via SSH. + +#### OC-2: Repository Growth +Every draft save creates a new commit. Repositories can grow unbounded over time. + +**Mitigation:** Use `git gc` aggressively. Consider ref pruning for old drafts. + +--- + +## 3. Context & Scope + +### System Context Diagram + +```mermaid +graph TB + Author[Author
Human] + GitCMS[git-cms
Node.js Application] + Stargate[git-stargate
Git Gateway] + LocalRepo[.git/objects/
Local Repository] + PublicMirror[GitHub/GitLab
Public Mirror] + + Author -->|CLI/HTTP API| GitCMS + GitCMS -->|git push| Stargate + GitCMS -->|read/write| LocalRepo + Stargate -->|mirror| PublicMirror + + style GitCMS fill:#e1f5ff + style LocalRepo fill:#fff4e1 + style Stargate fill:#ffe1e1 + style PublicMirror fill:#e1ffe1 +``` + +### External Interfaces + +#### Interface 1: CLI (Binary) +- **Entry Point:** `bin/git-cms.js` +- **Commands:** `draft`, `publish`, `list`, `show`, `serve` +- **Protocol:** POSIX command-line arguments +- **Example:** + ```bash + echo "# Hello World" | git cms draft hello-world "My First Post" + ``` + +#### Interface 2: HTTP API (REST) +- **Server:** `src/server/index.js` +- **Port:** 4638 (configurable via `PORT` env var) +- **Endpoints:** + - `POST /api/cms/snapshot` – Save draft + - `POST /api/cms/publish` – Publish article + - `GET /api/cms/list` – List articles + - `GET /api/cms/show?slug=` – Read article +- **Authentication:** None (assumes private network or SSH tunneling) + +#### Interface 3: Git Plumbing (Shell) +- **Protocol:** Git CLI commands via `child_process.spawn` +- **Critical Commands:** + - `git commit-tree` – Create commits on empty trees + - `git update-ref` – Atomic ref updates + - `git for-each-ref` – List refs in namespace + - `git cat-file` – Read commit messages + +#### Interface 4: OS Keychain (Secrets) +- **Platforms:** + - macOS: `security` command-line tool + - Linux: `secret-tool` (GNOME Keyring) + - Windows: `CredentialManager` (PowerShell) +- **Purpose:** Store AES-256-GCM encryption keys for assets + +### Scope Boundaries + +#### In Scope +- Article drafting, editing, and publishing +- Encrypted asset storage (images, PDFs) +- Full version history via Git log +- CLI and HTTP API access +- Multi-runtime support (Node, Bun, Deno) + +#### Out of Scope +- **User Authentication:** Delegated to git-stargate or SSH +- **Search Indexing:** No full-text search (could be built via external indexer reading Git log) +- **Media Transcoding:** Assets stored as-is (no ImageMagick, FFmpeg) +- **Real-Time Collaboration:** No operational transformation (OT) or CRDTs +- **Analytics:** No built-in pageview tracking + +--- + +## 4. Solution Strategy + +### Core Architectural Principles + +#### P-1: Composition over Inheritance +The system is built from **five independent "Lego Block" modules** (`@git-stunts/*`), each with a single responsibility. These modules are composed in `CmsService` to create higher-order functionality. + +**Benefit:** Each module can be tested, versioned, and published independently. + +#### P-2: Hexagonal Architecture (Ports & Adapters) +The domain layer (`CmsService`) depends on abstractions (`GitPlumbing`, `TrailerCodec`), not implementations. This allows swapping out Git for other backends (e.g., a pure JavaScript implementation for testing). + +**Benefit:** Decouples domain logic from infrastructure concerns. + +#### P-3: Content Addressability +Assets are stored by their SHA-1 hash, enabling automatic deduplication. If two articles reference the same image, it's stored once. + +**Benefit:** Reduces repository bloat. + +#### P-4: Cryptographic Integrity +Every operation produces a cryptographically signed commit (when `CMS_SIGN=1`). The Merkle DAG ensures tamper detection. + +**Benefit:** Audit trails are mathematically verifiable, not just trust-based. + +### Solution Approach: The "Empty Tree" Stunt + +#### The Problem +Traditional CMSs store content in database rows. Git is designed to track *files*, not arbitrary data. Storing blog posts as files (e.g., `posts/hello-world.md`) clutters the working directory and causes merge conflicts. + +#### The Solution +Store content as **commit messages on empty trees**, not as files. Every article is a commit that points to the well-known empty tree (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`). + +**How It Works:** +1. Encode the article (title, body, metadata) into a Git commit message using RFC 822 trailers. +2. Create a commit that points to the empty tree (no files touched). +3. Update a ref (e.g., `refs/_blog/articles/hello-world`) to point to this commit. + +**Result:** The repository's working directory remains clean. All content lives in `.git/objects/` and `.git/refs/`. + +#### Architectural Pattern: Event Sourcing +Each draft save creates a new commit. The "current" article is the ref's tip, but the full history is a linked list of commits. + +**Benefit:** Point-in-time recovery is trivial (`git log refs/_blog/articles/`). + +### Key Design Decisions + +#### D-1: Why Commit Messages, Not Blobs? +**Alternative:** Store articles as Git blobs and reference them via trees. + +**Decision:** Use commit messages. + +**Rationale:** +- Commits have parent pointers (enabling version history). +- Commits support GPG signing (enabling non-repudiation). +- Blobs are opaque; commit messages are human-readable. + +#### D-2: Why Trailers, Not JSON in Commit Messages? +**Alternative:** Store `{"title": "Hello", "body": "..."}` as the commit message. + +**Decision:** Use RFC 822 trailers (inspired by Linux kernel `Signed-off-by` footers). + +**Rationale:** +- Trailers are Git-native (supported by `git interpret-trailers`). +- They're human-readable and diff-friendly. +- Backward parser is more efficient than Git's own parser. + +#### D-3: Why Encrypt Assets, Not Entire Repos? +**Alternative:** Use `git-crypt` to encrypt the entire repository. + +**Decision:** Encrypt individual assets client-side. + +**Rationale:** +- `git-crypt` requires shared keys across all collaborators. +- Client-side encryption enables row-level access control (different keys for different assets). +- The gateway (git-stargate) never sees plaintext. + +--- + +## 5. Building Block View + +### Level 1: System Decomposition + +```mermaid +graph TD + subgraph "git-cms Application Layer" + CLI[CLI
bin/git-cms.js] + HTTP[HTTP Server
src/server/index.js] + CMS[CmsService
src/lib/CmsService.js] + end + + subgraph "Lego Blocks (@git-stunts)" + Plumbing[@git-stunts/plumbing
Git Protocol Wrapper] + Codec[@git-stunts/trailer-codec
RFC 822 Parser] + Graph[@git-stunts/empty-graph
Graph DB Primitive] + CAS[@git-stunts/cas
Content Store] + Vault[@git-stunts/vault
Secret Management] + end + + CLI --> CMS + HTTP --> CMS + CMS --> Plumbing + CMS --> Codec + CMS --> Graph + CMS --> CAS + CMS --> Vault + Graph --> Plumbing + CAS --> Plumbing + + style CMS fill:#e1f5ff + style Plumbing fill:#fff4e1 + style Codec fill:#fff4e1 + style Graph fill:#fff4e1 + style CAS fill:#fff4e1 + style Vault fill:#fff4e1 +``` + +### Level 2: Lego Block Responsibilities + +```mermaid +graph LR + subgraph "CmsService Orchestration" + CMS[CmsService] + end + + subgraph "@git-stunts/plumbing" + PL_Exec[execute] + PL_Rev[revParse] + PL_Commit[createCommit] + PL_Ref[updateRef] + end + + subgraph "@git-stunts/trailer-codec" + TC_Encode[encode] + TC_Decode[decode] + end + + subgraph "@git-stunts/empty-graph" + EG_Create[createNode] + EG_Read[readNode] + end + + subgraph "@git-stunts/cas" + CAS_Store[storeFile] + CAS_Tree[createTree] + CAS_Retrieve[retrieveFile] + end + + subgraph "@git-stunts/vault" + V_Resolve[resolveSecret] + end + + CMS -->|uses| PL_Exec + CMS -->|uses| PL_Rev + CMS -->|uses| PL_Ref + CMS -->|uses| TC_Encode + CMS -->|uses| TC_Decode + CMS -->|uses| EG_Create + CMS -->|uses| EG_Read + CMS -->|uses| CAS_Store + CMS -->|uses| V_Resolve + + EG_Create -->|calls| PL_Commit + EG_Read -->|calls| PL_Exec + CAS_Store -->|calls| PL_Exec + CAS_Tree -->|calls| PL_Exec + + style CMS fill:#e1f5ff +``` + +### Level 2: Lego Block Responsibilities + +#### Module 1: `@git-stunts/plumbing` (v2.7.0) +**Purpose:** Low-level Git protocol implementation. + +**Public API:** +```javascript +class GitPlumbing { + async execute({ args }) // Run arbitrary Git command + async revParse({ revision }) // Resolve ref → SHA + async createCommit({ tree, parents, message, sign }) + async updateRef({ ref, newSha, oldSha }) // Atomic CAS +} +``` + +**Key Characteristics:** +- Stream-first (async iterators for large outputs) +- Shell-based (no `libgit2` or `nodegit` dependencies) +- Multi-runtime (Node, Bun, Deno) + +**Boundary:** Abstracts `child_process.spawn` and stderr parsing. + +--- + +#### Module 2: `@git-stunts/trailer-codec` (v2.0.0) +**Purpose:** Encode/decode RFC 822 trailers in commit messages. + +**Public API:** +```javascript +class TrailerCodec { + encode({ title, body, trailers }) // → message string + decode({ message }) // → { title, body, trailers } +} +``` + +**Example:** +``` +Input: { title: "Hello", body: "World", trailers: { Status: "draft" } } +Output: + # Hello + + World + + Status: draft +``` + +**Key Algorithm:** +- **Backward parser:** Walks from end of message, stops at first non-trailer line. +- **Normalization:** Lowercases trailer keys (like Git). + +**Boundary:** Encapsulates commit message parsing logic. + +--- + +#### Module 3: `@git-stunts/empty-graph` (v1.0.0) +**Purpose:** Graph database primitive using commits on empty trees. + +**Public API:** +```javascript +class EmptyGraph { + async createNode({ message, parents, sign }) + async readNode({ sha }) // Returns commit message +} +``` + +**Implementation:** +```javascript +async createNode({ message, parents, sign }) { + const emptyTree = '4b825dc642cb6eb9a060e54bf8d69288fbee4904'; + return this.plumbing.createCommit({ + tree: emptyTree, + parents, + message, + sign + }); +} +``` + +**Key Insight:** By pointing all commits at the empty tree, the working directory never changes. + +**Boundary:** Abstracts the "empty tree trick." + +--- + +#### Module 4: `@git-stunts/cas` (v1.0.0) +**Purpose:** Content-Addressable Store for large files. + +**Public API:** +```javascript +class ContentAddressableStore { + async storeFile({ filePath, slug, filename, encryptionKey }) + async createTree({ manifest }) // Returns tree OID + async retrieveFile({ manifest, outputPath, decryptionKey }) +} +``` + +**Architecture:** +1. **Chunking:** Split file into 256KB chunks. +2. **Encryption:** AES-256-GCM per chunk (if key provided). +3. **Storage:** Write chunks as Git blobs. +4. **Manifest:** CBOR-encoded list of `{ oid, iv, authTag }`. + +**Example Manifest:** +```javascript +{ + slug: 'hello-world', + filename: 'hero.png', + chunks: [ + { oid: 'abc123...', iv: '...', authTag: '...' }, + { oid: 'def456...', iv: '...', authTag: '...' } + ] +} +``` + +**Boundary:** Handles encryption, chunking, and blob creation. + +--- + +#### Module 5: `@git-stunts/vault` (v1.0.0) +**Purpose:** OS keychain integration for secrets. + +**Public API:** +```javascript +class Vault { + resolveSecret({ envKey, vaultTarget }) + // Returns secret from process.env[envKey] or OS keychain +} +``` + +**Keychain Targets:** +- macOS: `security find-generic-password -s -w` +- Linux: `secret-tool lookup service ` +- Windows: `Get-Credential` (PowerShell) + +**Boundary:** Abstracts OS-specific secret retrieval. + +--- + +### Level 3: CmsService (Domain Orchestrator) + +**File:** `src/lib/CmsService.js` + +**Constructor:** +```javascript +constructor({ cwd, refPrefix }) { + this.plumbing = new GitPlumbing({ runner: ShellRunner.run, cwd }); + this.graph = new EmptyGraph({ plumbing: this.plumbing }); + this.codec = new TrailerCodec(); + this.cas = new ContentAddressableStore({ plumbing: this.plumbing }); + this.vault = new Vault(); +} +``` + +**Key Methods:** +```javascript +async saveSnapshot({ slug, title, body, trailers }) +async publishArticle({ slug, sha }) +async readArticle({ slug, kind }) +async listArticles({ kind }) +async uploadAsset({ slug, filePath, filename }) +``` + +**Orchestration Example:** +```javascript +// saveSnapshot() orchestrates: +// 1. Resolve parent SHA (plumbing.revParse) +// 2. Encode message (codec.encode) +// 3. Create commit (graph.createNode) +// 4. Update ref (plumbing.updateRef) +``` + +**Boundary:** Implements domain logic without knowing Git internals. + +--- + +## 6. Runtime View + +### Scenario 1: Create Draft Article + +**Actors:** Author (CLI), CmsService, GitPlumbing, EmptyGraph, TrailerCodec + +```mermaid +sequenceDiagram + participant Author + participant CLI + participant CmsService + participant TrailerCodec + participant EmptyGraph + participant GitPlumbing + participant Git + + Author->>CLI: echo "# Hello" | git cms draft hello-world "My First Post" + CLI->>CmsService: saveSnapshot({ slug, title, body }) + + CmsService->>GitPlumbing: revParse('refs/_blog/articles/hello-world') + GitPlumbing->>Git: git rev-parse refs/_blog/articles/hello-world + Git-->>GitPlumbing: (ref doesn't exist) + GitPlumbing-->>CmsService: null + + CmsService->>TrailerCodec: encode({ title, body, trailers }) + TrailerCodec-->>CmsService: "# My First Post\n\nHello\n\nStatus: draft" + + CmsService->>EmptyGraph: createNode({ message, parents: [] }) + EmptyGraph->>GitPlumbing: createCommit({ tree: '4b825dc...', message }) + GitPlumbing->>Git: git commit-tree 4b825dc... -m "..." + Git-->>GitPlumbing: abc123def... (commit SHA) + GitPlumbing-->>EmptyGraph: abc123def... + EmptyGraph-->>CmsService: abc123def... + + CmsService->>GitPlumbing: updateRef({ ref, newSha: 'abc123...', oldSha: null }) + GitPlumbing->>Git: git update-ref refs/_blog/articles/hello-world abc123... + Git-->>GitPlumbing: OK + GitPlumbing-->>CmsService: OK + + CmsService-->>CLI: { ref, sha: 'abc123...', parent: null } + CLI-->>Author: "Draft saved: refs/_blog/articles/hello-world (abc123...)" + + Note over CmsService,Git: Time Complexity: O(1)
Objects Created: 1 commit, 1 ref +``` + +**Time Complexity:** O(1) – Single commit creation, single ref update. + +**Git Objects Created:** +- 1 commit object (`abc123def...`) +- 1 ref (`refs/_blog/articles/hello-world`) + +--- + +### Scenario 2: Publish Article + +**Precondition:** Draft already exists at `refs/_blog/articles/hello-world`. + +```mermaid +sequenceDiagram + participant Author + participant CLI + participant CmsService + participant GitPlumbing + participant Git + + Author->>CLI: git cms publish hello-world + CLI->>CmsService: publishArticle({ slug: 'hello-world' }) + + CmsService->>GitPlumbing: revParse('refs/_blog/articles/hello-world') + GitPlumbing->>Git: git rev-parse refs/_blog/articles/hello-world + Git-->>GitPlumbing: abc123def... (draft commit) + GitPlumbing-->>CmsService: abc123def... + + CmsService->>GitPlumbing: revParse('refs/_blog/published/hello-world') + GitPlumbing->>Git: git rev-parse refs/_blog/published/hello-world + Git-->>GitPlumbing: (not published yet) + GitPlumbing-->>CmsService: null + + CmsService->>GitPlumbing: updateRef({ ref: 'refs/_blog/published/hello-world', newSha: 'abc123...', oldSha: null }) + GitPlumbing->>Git: git update-ref refs/_blog/published/hello-world abc123... + Git-->>GitPlumbing: OK + GitPlumbing-->>CmsService: OK + + CmsService-->>CLI: { ref, sha: 'abc123...', prev: null } + CLI-->>Author: "Published: refs/_blog/published/hello-world" + + Note over CmsService,Git: Publishing = Ref Copy (No New Commits)
Idempotent + Fast-Forward Enforced +``` + +**Key Insight:** Publishing is **just a ref copy**. No new commits created. This is idempotent. + +**Fast-Forward Enforcement:** If `oldSha` doesn't match (concurrent publish), Git's `update-ref` fails. + +--- + +### Scenario 3: Upload Encrypted Asset + +**Actors:** Author (HTTP), CmsService, CAS, Vault, GitPlumbing + +```mermaid +sequenceDiagram + participant Author + participant HTTP + participant CmsService + participant Vault + participant CAS + participant Crypto + participant GitPlumbing + participant Git + + Author->>HTTP: POST /api/cms/upload (hero.png) + HTTP->>CmsService: uploadAsset({ slug, filePath, filename }) + + CmsService->>Vault: resolveSecret({ envKey: 'CHUNK_ENC_KEY' }) + Vault->>Vault: Check macOS Keychain + Vault-->>CmsService: Buffer (AES-256 key) + + CmsService->>CAS: storeFile({ filePath, encryptionKey }) + + loop For each 256KB chunk + CAS->>Crypto: AES-256-GCM encrypt(chunk, key, iv) + Crypto-->>CAS: { ciphertext, authTag } + CAS->>GitPlumbing: hashObject({ type: 'blob', content: ciphertext }) + GitPlumbing->>Git: git hash-object -w + Git-->>GitPlumbing: def456... (blob OID) + GitPlumbing-->>CAS: def456... + end + + CAS-->>CmsService: manifest = [{ oid, iv, authTag }, ...] + + CmsService->>CAS: createTree({ manifest }) + CAS->>GitPlumbing: execute(['mktree']) + CBOR manifest + GitPlumbing->>Git: git mktree + Git-->>GitPlumbing: tree123... (tree OID) + GitPlumbing-->>CAS: tree123... + CAS-->>CmsService: tree123... + + CmsService->>GitPlumbing: updateRef('refs/_blog/chunks/hello-world@current', ...) + GitPlumbing->>Git: git update-ref + Git-->>GitPlumbing: OK + GitPlumbing-->>CmsService: OK + + CmsService-->>HTTP: { manifest, treeOid, commitSha } + HTTP-->>Author: 201 Created + + Note over CAS,Git: Security: Plaintext NEVER touches .git/objects/
Only encrypted chunks stored +``` + +**Security Property:** The plaintext file never touches `.git/objects/`. Only encrypted chunks do. + +--- + +### Scenario 4: List All Published Articles + +```mermaid +sequenceDiagram + participant Reader + participant HTTP + participant CmsService + participant GitPlumbing + participant Git + + Reader->>HTTP: GET /api/cms/list?kind=published + HTTP->>CmsService: listArticles({ kind: 'published' }) + + CmsService->>GitPlumbing: execute(['for-each-ref', 'refs/_blog/published/', ...]) + GitPlumbing->>Git: git for-each-ref refs/_blog/published/ --format=... + Git-->>GitPlumbing: refs/_blog/published/hello-world abc123...
refs/_blog/published/goodbye-world 789xyz... + GitPlumbing-->>CmsService: Output (multi-line text) + + CmsService->>CmsService: Parse output into array + CmsService-->>HTTP: [{ ref, sha, slug }, ...] + HTTP-->>Reader: 200 OK + JSON + + Note over CmsService,Git: Time Complexity: O(n)
Performance: Linear scan of all refs +``` + +**Time Complexity:** O(n) where n = number of published articles. + +**Performance Note:** Git's `for-each-ref` is linear. For 10,000 articles, this could be slow. Mitigation: build an external index (e.g., SQLite) that reads from Git log. + +--- + +## 7. Deployment View + +### Infrastructure Overview + +git-cms is designed for **minimal infrastructure**. It can run as: +1. **Local CLI:** Direct Git operations on user's machine. +2. **HTTP Server:** Node.js process serving REST API + static HTML. +3. **Docker Container:** Isolated environment for testing or deployment. + +### Deployment Topology + +#### Topology 1: Single-Author Local Blog + +```mermaid +graph TB + subgraph "Author's Laptop" + CLI[git-cms CLI
Node.js] + Repo[~/blog/.git/
Local Repository] + CLI -->|read/write| Repo + end + + style CLI fill:#e1f5ff + style Repo fill:#fff4e1 +``` + +**Deployment Steps:** +```bash +cd ~/blog +git init +npm install -g git-cms +echo "# My Post" | git cms draft my-post "Title" +git cms publish my-post +``` + +**No Server Required:** All operations are local Git commands. + +--- + +#### Topology 2: Team Blog with Stargate Gateway + +```mermaid +graph LR + subgraph "Author A Laptop" + CMS_A[git-cms CLI] + Repo_A[.git/] + CMS_A --> Repo_A + end + + subgraph "Author B Laptop" + CMS_B[git-cms CLI] + Repo_B[.git/] + CMS_B --> Repo_B + end + + subgraph "VPS (Cloud Server)" + Stargate[git-stargate
Bare Repo + Hooks] + end + + subgraph "GitHub (Public)" + Mirror[Public Mirror
Read-Only] + end + + CMS_A -->|git push
SSH| Stargate + CMS_B -->|git push
SSH| Stargate + Stargate -->|post-receive
mirror| Mirror + + style Stargate fill:#ffe1e1 + style Mirror fill:#e1ffe1 + style CMS_A fill:#e1f5ff + style CMS_B fill:#e1f5ff +``` + +**Component Breakdown:** + +1. **Author Laptops:** + - Run `git-cms` CLI locally. + - Push to `git-stargate` via SSH. + +2. **git-stargate (VPS):** + - Bare Git repository (`~/git/_blog-stargate.git`). + - `pre-receive` hook enforces: + - Fast-forward only (no `git push --force`). + - GPG signature verification. + - `post-receive` hook mirrors to GitHub. + +3. **GitHub (Public Mirror):** + - Read-only public clone. + - CI/CD builds static site from `refs/_blog/published/*`. + +**Deployment Steps:** +```bash +# On VPS (as git-cms user): +git init --bare ~/git/_blog-stargate.git +cd ~/git/_blog-stargate.git/hooks +# Install pre-receive and post-receive hooks from git-stargate repo + +# On Author Laptop: +git remote add stargate git-cms@vps.example.com:~/git/_blog-stargate.git +git config remote.stargate.push "+refs/_blog/*:refs/_blog/*" +echo "# Post" | git cms draft my-post "Title" +git cms publish my-post +git push stargate +``` + +--- + +#### Topology 3: Dockerized Development + +**File:** `docker-compose.yml` + +```yaml +services: + app: + build: + context: . + target: dev + ports: + - "4638:4638" + environment: + - PORT=4638 + - GIT_CMS_ENV=dev +``` + +```mermaid +graph TB + subgraph "Host Machine" + DevMachine[Developer Workstation
macOS/Linux/Windows] + Browser[Web Browser
http://localhost:4638] + end + + subgraph "Docker Container (app)" + NodeApp[Node.js 20
git-cms HTTP Server] + GitBin[Git CLI
Plumbing Commands] + Repo[/app/.git/
In-Container Repo] + + NodeApp --> GitBin + GitBin --> Repo + end + + subgraph "Docker Container (test)" + TestRunner[Vitest
Test Suite] + TempRepos[/tmp/test-repos/
Temporary Git Repos] + + TestRunner --> TempRepos + end + + DevMachine -->|docker compose up app| NodeApp + Browser -->|HTTP:4638| NodeApp + DevMachine -->|docker compose run test| TestRunner + + style NodeApp fill:#e1f5ff + style TestRunner fill:#fff4e1 + style Repo fill:#ffe1e1 +``` + +**Multi-Stage Dockerfile:** + +```mermaid +graph TB + subgraph "Dockerfile Build Stages" + Base[base
node:20-slim + git] + Deps[deps
npm ci + Lego Blocks] + Dev[dev
Development Server] + Test[test
Test Runner] + + Base --> Deps + Base --> Dev + Base --> Test + Deps -.->|COPY --from=deps| Dev + Deps -.->|COPY --from=deps| Test + end + + subgraph "Final Images" + DevImage[git-cms:dev
Runs HTTP Server] + TestImage[git-cms:test
Runs Vitest] + end + + Dev --> DevImage + Test --> TestImage + + style Base fill:#fff4e1 + style Deps fill:#fff4e1 + style Dev fill:#e1f5ff + style Test fill:#ffe1e1 +``` + +```dockerfile +# Base: Node 20 + Git +FROM node:20-slim AS base +RUN apt-get update && apt-get install -y git + +# Deps: Install dependencies +FROM base AS deps +COPY ../git-stunts /git-stunts # Lego Blocks +COPY package.json ./ +RUN npm ci + +# Dev: Development server +FROM base AS dev +ENV NODE_ENV=development +COPY --from=deps /git-stunts /git-stunts +COPY . . +RUN git config --global user.email "dev@git-cms.local" +CMD ["npm", "run", "serve"] + +# Test: Run tests in isolation +FROM base AS test +ENV NODE_ENV=test +COPY --from=deps /git-stunts /git-stunts +COPY . . +CMD ["npm", "run", "test:local"] +``` + +**Deployment Steps:** +```bash +docker compose up app # Start dev server on http://localhost:4638 +docker compose run --rm test # Run tests in isolated container +``` + +**Why Docker?** +- Ensures consistent Git version across dev/test/prod. +- Protects host filesystem from destructive Git operations. +- Simplifies CI/CD (just `docker compose run --rm test`). + +--- + +### Resource Requirements + +| Deployment Type | CPU | Memory | Disk | Network | +|----------------|-----|---------|------|---------| +| CLI (Local) | Negligible | <50MB | 100MB (`.git/objects`) | None | +| HTTP Server | 0.5 vCPU | 256MB | 100MB + repo size | 1Mbps | +| Docker Dev | 1 vCPU | 512MB | 1GB (includes Node + layers) | 10Mbps | + +**Scaling Notes:** +- **Horizontal scaling:** Not applicable (single-writer constraint). +- **Vertical scaling:** Limited by Git performance (mostly I/O bound). + +--- + +## 8. Crosscutting Concepts + +### Concept 1: Merkle DAG as Event Log + +**Pattern:** Every operation creates an immutable commit. The ref is a pointer to the "current" state. + +```mermaid +graph LR + subgraph "Git Object Store (.git/objects/)" + Commit1[Commit abc123
tree: 4b825dc
parent: null
msg: Draft v1] + Commit2[Commit def456
tree: 4b825dc
parent: abc123
msg: Draft v2] + Commit3[Commit 789xyz
tree: 4b825dc
parent: def456
msg: Draft v3] + EmptyTree[Tree 4b825dc...
Empty Tree] + + Commit1 --> EmptyTree + Commit2 --> EmptyTree + Commit2 --> Commit1 + Commit3 --> EmptyTree + Commit3 --> Commit2 + end + + subgraph "Refs (.git/refs/)" + DraftRef[refs/_blog/articles/hello-world] + PubRef[refs/_blog/published/hello-world] + + DraftRef -.->|points to| Commit3 + PubRef -.->|points to| Commit2 + end + + style EmptyTree fill:#ffe1e1 + style Commit3 fill:#e1f5ff + style Commit2 fill:#e1ffe1 +``` + +**Implementation:** +- Drafts: `refs/_blog/articles/` points to latest draft commit. +- Published: `refs/_blog/published/` points to published commit. +- History: `git log ` shows all versions. + +**Benefit:** Event sourcing without Kafka or Event Store. + +--- + +### Concept 2: Compare-and-Swap (CAS) via `git update-ref` + +**Problem:** Prevent concurrent writes from corrupting refs. + +**Solution:** Use `git update-ref --stdin` with expected old value: + +```bash +git update-ref refs/_blog/articles/hello-world +``` + +If `expectedOldSHA` doesn't match, Git returns exit code 1. + +**Implementation:** `src/lib/CmsService.js:95` + +```javascript +await this.plumbing.updateRef({ ref, newSha, oldSha: parentSha }); +``` + +**Concurrency Guarantee:** Atomic at the ref level (not across refs). + +--- + +### Concept 3: Client-Side Encryption (Defense in Depth) + +**Threat Model:** Untrusted Git gateway (e.g., compromised VPS). + +```mermaid +graph TB + subgraph "Client Side (Trusted)" + File[hero.png
Plaintext File] + Chunk1[Chunk 1
256KB plaintext] + Chunk2[Chunk 2
256KB plaintext] + Key[AES-256 Key
from Vault] + + File -->|chunk| Chunk1 + File -->|chunk| Chunk2 + end + + subgraph "Encryption Layer" + Enc1[AES-256-GCM
Encrypt Chunk 1] + Enc2[AES-256-GCM
Encrypt Chunk 2] + + Chunk1 --> Enc1 + Chunk2 --> Enc2 + Key --> Enc1 + Key --> Enc2 + end + + subgraph "Git Objects (Untrusted Gateway)" + Blob1[Blob def456...
Ciphertext 1] + Blob2[Blob 789abc...
Ciphertext 2] + Manifest[Tree + Manifest
CBOR: oids, ivs, authTags] + + Enc1 -->|git hash-object| Blob1 + Enc2 -->|git hash-object| Blob2 + Blob1 --> Manifest + Blob2 --> Manifest + end + + style File fill:#e1f5ff + style Key fill:#ffe1e1 + style Blob1 fill:#fff4e1 + style Blob2 fill:#fff4e1 + style Manifest fill:#e1ffe1 +``` + +**Mitigation:** +1. **Encrypt on write:** Author's machine encrypts asset before `git push`. +2. **Decrypt on read:** Author's machine decrypts after `git pull`. + +**Key Management:** +- Dev: `Vault` retrieves key from macOS Keychain. +- Prod: Key injected via env var (`CHUNK_ENC_KEY`). + +**Cryptographic Primitive:** AES-256-GCM (authenticated encryption). + +**Implementation:** `@git-stunts/cas/src/index.js` + +```javascript +const cipher = crypto.createCipheriv('aes-256-gcm', encryptionKey, iv); +const encrypted = Buffer.concat([cipher.update(chunk), cipher.final()]); +const authTag = cipher.getAuthTag(); +``` + +--- + +### Concept 4: Zero-Copy Streaming (Performance) + +**Challenge:** Reading large commit logs without loading entire output into memory. + +**Solution:** `@git-stunts/plumbing` uses async iterators: + +```javascript +for await (const line of plumbing.logStream({ ref })) { + console.log(line); +} +``` + +**Benefit:** Constant memory usage, even for repos with millions of commits. + +--- + +### Concept 5: Trailer Normalization (Compatibility) + +**Git's Behavior:** Trailer keys are case-insensitive (`Author` == `author`). + +```mermaid +graph TB + subgraph "Input: Article Data" + Input["title: 'My First Post'
body: 'Hello World'
trailers: { Status: 'draft', Author: 'James' }"] + end + + subgraph "Encoding (TrailerCodec.encode)" + Encode[Normalize Keys
Build Message String] + Input --> Encode + end + + subgraph "Output: Git Commit Message" + Output["# My First Post

Hello World

Status: draft
Author: james"] + Encode --> Output + end + + subgraph "Decoding (TrailerCodec.decode)" + Decode[Backward Parser
Walk from end] + Output --> Decode + end + + subgraph "Parsed Output" + Parsed["title: 'My First Post'
body: 'Hello World'
trailers: { status: 'draft', author: 'james' }"] + Decode --> Parsed + end + + style Encode fill:#e1f5ff + style Decode fill:#ffe1e1 + style Output fill:#fff4e1 +``` + +**Implementation:** `TrailerCodecService` lowercases all keys: + +```javascript +normalizeTrailerKey(k) { + return k.toLowerCase().replace(/-/g, ''); +} +``` + +**Rationale:** Matches Git's own trailer normalization logic. + +--- + +### Concept 6: Fail-Fast Validation (Security) + +**Threat:** Malicious commit messages with oversized trailers (DoS). + +**Mitigation:** Impose hard limits: + +```javascript +const MAX_TRAILER_KEYS = 50; +const MAX_TRAILER_VALUE_LENGTH = 10_000; +``` + +**Enforcement:** `TrailerCodecService.decode()` throws if exceeded. + +--- + +### Concept 7: Ubiquitous Language (DDD) + +| Term | Definition | +|------|------------| +| **Article** | A blog post (title + body + metadata). | +| **Slug** | URL-friendly identifier (e.g., `hello-world`). | +| **Draft** | Unpublished version of an article. | +| **Published** | Article visible to readers. | +| **Snapshot** | A single version in the article's history. | +| **Trailer** | Key-value metadata (e.g., `Status: draft`). | +| **Empty Tree** | Git's canonical empty tree (`4b825dc...`). | +| **Lego Block** | Independent `@git-stunts/*` module. | + +--- + +## 9. Architectural Decisions + +### ADR-001: Use Commit Messages, Not Files + +**Context:** Need to store articles in Git without polluting working directory. + +**Decision:** Store articles as commit messages on the empty tree. + +**Alternatives Considered:** +1. **Files in `posts/`:** Causes merge conflicts, clutters working tree. +2. **Git notes:** Harder to query, no parent pointers. +3. **Blobs in orphan branches:** No GPG signing support. + +**Rationale:** Commit messages support: +- Linear history via parent pointers. +- GPG signing for non-repudiation. +- Human-readable `git log` output. + +**Consequences:** +- ✅ Clean working directory. +- ✅ Full version history. +- ❌ Commit messages limited to ~100KB (Git's internal buffer). + +**Status:** Accepted. + +--- + +### ADR-002: Use RFC 822 Trailers, Not JSON + +**Context:** Need structured metadata in commit messages. + +**Decision:** Use RFC 822 trailers (e.g., `Status: draft`). + +**Alternatives Considered:** +1. **JSON in message:** Not diff-friendly, requires escaping. +2. **YAML front matter:** Not Git-native, requires parser. + +**Rationale:** +- Git already uses trailers (`Signed-off-by`, `Co-authored-by`). +- Human-readable and diff-friendly. +- Backward parser is more efficient than Git's own. + +**Consequences:** +- ✅ Git-native format. +- ✅ Efficient parsing. +- ❌ Limited to key-value pairs (no nested objects). + +**Status:** Accepted. + +--- + +### ADR-003: Fast-Forward Only Publishing + +**Context:** Prevent published content from being altered after release. + +**Decision:** Publishing must be a fast-forward from draft to published ref. + +**Alternatives Considered:** +1. **Allow force updates:** Breaks audit trail. +2. **Separate publish commit:** Creates duplicate content. + +**Rationale:** Fast-forward guarantees: +- Published content is immutable. +- Provenance is verifiable. + +**Enforcement:** `git-stargate` pre-receive hook rejects non-fast-forward pushes. + +**Consequences:** +- ✅ Immutable publications. +- ❌ Cannot "unpublish" (must publish a new version with `Status: deleted`). + +**Status:** Accepted. + +--- + +### ADR-004: Client-Side Encryption for Assets + +**Context:** Git gateways may be untrusted (e.g., hosted VPS). + +**Decision:** Encrypt assets (AES-256-GCM) before `git push`. + +**Alternatives Considered:** +1. **git-crypt:** Requires shared keys, all-or-nothing encryption. +2. **Server-side encryption:** Gateway sees plaintext. + +**Rationale:** +- Row-level encryption (different keys per asset). +- Zero-trust gateway (only receives ciphertext). + +**Consequences:** +- ✅ Defense in depth. +- ✅ Granular access control. +- ❌ Key management complexity. + +**Status:** Accepted. + +--- + +### ADR-005: Shell-Based Git Plumbing, Not libgit2 + +**Context:** Need Git operations in JavaScript. + +**Decision:** Use `child_process.spawn` to call Git CLI. + +**Alternatives Considered:** +1. **nodegit (libgit2):** Native dependencies, build complexity. +2. **isomorphic-git:** Pure JS, but incomplete (no GPG signing). + +**Rationale:** +- Git CLI is stable, well-tested, and available everywhere. +- No native build dependencies. +- Multi-runtime support (Node, Bun, Deno). + +**Consequences:** +- ✅ Zero native dependencies. +- ✅ Multi-runtime compatibility. +- ❌ Slower than libgit2 (process spawn overhead). + +**Status:** Accepted. + +--- + +## 10. Quality Requirements + +### Quality Tree + +``` +git-cms Quality +├── Security (Critical) +│ ├── Cryptographic Integrity (SHA-1, GPG) +│ ├── Client-Side Encryption (AES-256-GCM) +│ └── DoS Protection (Trailer limits) +├── Simplicity (High) +│ ├── Zero Database Dependencies +│ ├── Composable Lego Blocks +│ └── Minimal Lines of Code +├── Auditability (High) +│ ├── Complete Provenance (Git log) +│ └── Trailer Metadata +├── Performance (Medium) +│ ├── Sub-Second Reads (<1s for typical blog) +│ └── Acceptable Writes (<5s for publish) +└── Portability (Medium) + ├── Multi-Runtime (Node, Bun, Deno) + └── Dockerized Tests +``` + +### Quality Scenarios + +#### QS-1: Tamper Detection + +**Scenario:** Attacker modifies published article on Git gateway. + +**Stimulus:** Malicious `git filter-branch` rewriting history. + +**Response:** Readers detect tampered commits via SHA-1 mismatch. + +**Metric:** 100% tamper detection (via Merkle DAG). + +**Test:** +```bash +# Modify commit message +git filter-branch --msg-filter 'sed s/Original/Modified/' +# Push to reader's clone +git pull +# Reader's Git detects non-fast-forward (rejects) +``` + +--- + +#### QS-2: Encrypted Asset Confidentiality + +**Scenario:** Untrusted gateway operator accesses repository. + +**Stimulus:** Admin runs `git cat-file blob ` on encrypted chunk. + +**Response:** Only ciphertext visible (plaintext unrecoverable without key). + +**Metric:** 0% plaintext leakage. + +**Test:** +```bash +# Upload encrypted asset +git cms upload --encrypt hero.png +# Admin views blob +git cat-file blob abc123... +# Output: Binary garbage (AES-256-GCM ciphertext) +``` + +--- + +#### QS-3: Concurrent Publish Conflict + +**Scenario:** Two authors publish the same article simultaneously. + +**Stimulus:** Author A and B both run `git cms publish my-post` at T=0. + +**Response:** One succeeds, one fails with "ref update rejected." + +**Metric:** 100% consistency (no lost updates). + +**Test:** +```bash +# Author A +git cms publish my-post & +# Author B (concurrent) +git cms publish my-post & +# One sees: "Published" +# Other sees: "Error: ref update failed (old SHA mismatch)" +``` + +--- + +#### QS-4: Large Repository Performance + +**Scenario:** Blog with 10,000 published articles. + +**Stimulus:** Reader requests `GET /api/cms/list?kind=published`. + +**Response:** API responds in <2 seconds. + +**Metric:** 95th percentile latency <2s. + +**Bottleneck:** `git for-each-ref` is O(n). + +**Mitigation:** Build external index (e.g., SQLite) in post-receive hook. + +--- + +#### QS-5: Docker Test Isolation + +**Scenario:** Developer runs `npm test` on host machine. + +**Stimulus:** Test creates temporary Git repos in `/tmp`. + +**Response:** Test script aborts with "Run tests in Docker!" + +**Metric:** 0% risk of host filesystem corruption. + +**Enforcement:** `test/run-docker.sh` checks for Docker environment. + +--- + +## 11. Risks & Technical Debt + +### Risk 1: SHA-1 Collision Vulnerability + +**Severity:** Medium +**Likelihood:** Low (but increasing) + +**Description:** Git uses SHA-1 for object addressing. SHA-1 is cryptographically broken (SHAttered attack, 2017). + +**Impact:** Attackers could craft colliding commits to inject malicious content. + +**Mitigation:** +1. **Short-term:** Use GPG signing (`CMS_SIGN=1`) for non-repudiation. +2. **Long-term:** Migrate to Git's SHA-256 mode (available in Git 2.29+). + +**Status:** Monitored. + +--- + +### Risk 2: Repository Growth (Unbounded) + +**Severity:** High +**Likelihood:** High (for active blogs) + +**Description:** Every draft save creates a commit. Over time, `.git/objects/` grows unbounded. + +**Impact:** Slow clones, high disk usage. + +**Mitigation:** +1. **Aggressive GC:** Run `git gc --aggressive` weekly. +2. **Ref Pruning:** Delete old draft refs (keep only last N versions). +3. **Shallow Clones:** Readers use `git clone --depth=1`. + +**Technical Debt:** No automated pruning implemented yet. + +**Status:** Unresolved. + +--- + +### Risk 3: Concurrent Write Conflicts + +**Severity:** Medium +**Likelihood:** Medium (multi-author blogs) + +**Description:** Git's CAS (compare-and-swap) is per-ref, not global. Two authors can create conflicting drafts. + +**Impact:** Lost updates, user frustration. + +**Mitigation:** +1. **git-stargate:** Serialize writes via SSH (single-writer gateway). +2. **Retry Logic:** Client retries `updateRef` on conflict. + +**Technical Debt:** No retry logic in CmsService. + +**Status:** Partially mitigated. + +--- + +### Risk 4: Commit Message Size Limit + +**Severity:** Low +**Likelihood:** Low + +**Description:** Git's `commit-tree` buffers messages in memory (~100KB limit). + +**Impact:** Very long articles (>50,000 words) may fail to save. + +**Mitigation:** Split long articles into multiple parts (e.g., chapters). + +**Technical Debt:** No validation of message size. + +**Status:** Accepted risk. + +--- + +### Risk 5: GDPR Right to Erasure + +**Severity:** High (for EU users) +**Likelihood:** Medium + +**Description:** Git's immutability conflicts with GDPR Article 17 (right to be forgotten). + +**Impact:** Cannot delete historical commits without rewriting history (breaks Merkle DAG). + +**Mitigation:** +1. **Encryption:** Delete encryption key instead of commits. +2. **Legal:** Argue "legitimate interest" (journalistic records). + +**Technical Debt:** No automated key rotation. + +**Status:** Legal review pending. + +--- + +### Technical Debt Summary + +| Item | Priority | Effort | Impact | +|------|---------|--------|--------| +| Implement automated ref pruning | High | Medium | Reduces repo growth | +| Add retry logic to CmsService | Medium | Low | Improves concurrency | +| Validate commit message size | Low | Low | Prevents edge-case failures | +| Migrate to SHA-256 | Low | High | Future-proofs cryptography | +| Build external index for `listArticles` | Medium | High | Scales to 10,000+ articles | + +--- + +## 12. Glossary + +### A + +**AES-256-GCM:** Advanced Encryption Standard with 256-bit keys in Galois/Counter Mode. Provides authenticated encryption (confidentiality + integrity). + +**Append-Only Ledger:** A data structure where records can only be added, never modified or deleted. Git's commit history is an append-only ledger. + +**Atomic Operation:** An operation that either completes fully or not at all (no partial states). Git's `update-ref` is atomic at the ref level. + +### B + +**Bare Repository:** A Git repository without a working directory (only `.git/` contents). Used for servers/gateways. + +**Blob:** A Git object type storing raw file content. Identified by SHA-1 hash of content. + +### C + +**CAS (Compare-and-Swap):** A concurrency primitive ensuring a value is updated only if it matches an expected old value. Git's `update-ref` uses CAS semantics. + +**CAS (Content-Addressable Store):** A storage system where data is retrieved by its cryptographic hash, not by location. Git is a CAS. + +**Chunking:** Splitting large files into fixed-size pieces (e.g., 256KB). Enables streaming and deduplication. + +**Commit:** A Git object representing a snapshot of the repository at a point in time. Contains tree, parent(s), author, message. + +**Ciphertext:** Encrypted data. Unreadable without the decryption key. + +### D + +**DAG (Directed Acyclic Graph):** A graph with directed edges and no cycles. Git's commit history is a DAG (parent pointers form edges). + +**Draft:** An unpublished version of an article, stored at `refs/_blog/articles/`. + +### E + +**Empty Tree:** Git's canonical empty tree object (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`). Points to no files. + +**Event Sourcing:** An architectural pattern where state changes are stored as a sequence of events. Git commits are events. + +### F + +**Fast-Forward:** A Git merge where the target ref simply moves forward (no merge commit). Requires linear history. + +### G + +**GPG (GNU Privacy Guard):** Open-source implementation of OpenPGP. Used for signing Git commits. + +### H + +**Hexagonal Architecture:** A software design pattern separating domain logic from infrastructure (also called "Ports and Adapters"). + +**HMAC (Hash-based Message Authentication Code):** A cryptographic construction for verifying integrity and authenticity. + +### I + +**Immutability:** Property of data that cannot be changed after creation. Git objects are immutable (identified by hash of content). + +### K + +**Keychain:** OS-level secure storage for secrets (passwords, encryption keys). Examples: macOS Keychain, GNOME Keyring. + +### L + +**Lego Block:** In this project, an independent `@git-stunts/*` module with a single responsibility (plumbing, codec, CAS, vault, empty-graph). + +### M + +**Merkle DAG:** A Directed Acyclic Graph where each node is identified by a cryptographic hash of its contents and children. Git's object model is a Merkle DAG. + +**Manifest:** A metadata structure describing chunked file layout. Contains OIDs, IVs, and auth tags for encrypted chunks. + +### N + +**Namespace:** A prefix for Git refs to avoid collisions. Example: `refs/_blog/articles/` vs `refs/_blog/published/`. + +**Non-Repudiation:** Property where the author of a message cannot deny authorship. Achieved via GPG signing. + +### O + +**OID (Object Identifier):** Git's SHA-1 hash of an object (commit, tree, blob, tag). + +**Orphan Branch:** A Git branch with no parent commits (disconnected from main history). + +### P + +**Plumbing:** Git's low-level commands (`commit-tree`, `update-ref`) vs. high-level "porcelain" commands (`commit`, `push`). + +**Porcelain:** Git's user-friendly commands (`commit`, `push`, `pull`) built on top of plumbing. + +**Provenance:** The origin and history of an artifact. Git provides cryptographic provenance via commit chains. + +**Published:** An article visible to readers, stored at `refs/_blog/published/`. + +### R + +**Ref (Reference):** A pointer to a commit (e.g., `refs/heads/main`, `refs/tags/v1.0`). + +**RFC 822:** Internet Message Format standard. Used for email headers and Git trailers. + +### S + +**SHA-1:** Secure Hash Algorithm 1. Produces 160-bit (40-character hex) hashes. Used by Git for object IDs. + +**SHA-256:** Secure Hash Algorithm 2 (256-bit variant). Git's future default. + +**Slug:** A URL-friendly identifier (lowercase, hyphens, no spaces). Example: `hello-world`. + +**Snapshot:** A single version in an article's history (represented as a Git commit). + +### T + +**Trailer:** Key-value metadata at the end of a Git commit message. Example: `Status: draft`. + +**Tree:** A Git object representing a directory (mapping filenames → blob OIDs or subtree OIDs). + +### U + +**Ubiquitous Language:** Domain-Driven Design term for a shared vocabulary between developers and domain experts. + +### V + +**Vault:** In this project, the `@git-stunts/vault` module for retrieving secrets from OS keychains. + +--- + +## Appendix A: Example Commands + +### Draft an Article +```bash +echo "# My First Post" | git cms draft hello-world "My First Post" +``` + +### Publish an Article +```bash +git cms publish hello-world +``` + +### List All Drafts +```bash +git cms list +``` + +### List All Published +```bash +git cms list --kind=published +``` + +### Read an Article +```bash +git cms show hello-world +``` + +### Upload Encrypted Asset +```bash +git cms upload hello-world hero.png +``` + +### Start HTTP Server +```bash +git cms serve +# → Listening on http://localhost:4638 +``` + +--- + +## Appendix B: Directory Structure + +``` +git-cms/ +├── bin/ +│ └── git-cms.js # CLI entry point +├── src/ +│ ├── lib/ +│ │ └── CmsService.js # Core orchestrator +│ └── server/ +│ └── index.js # HTTP API server +├── test/ +│ ├── git.test.js # Integration tests (Vitest) +│ ├── chunks.test.js # Asset encryption tests +│ ├── server.test.js # API tests +│ └── e2e/ # Playwright tests +│ └── publish.spec.js +├── public/ # Static admin UI (vanilla JS) +│ ├── index.html +│ └── app.js +├── docs/ +│ ├── GETTING_STARTED.md +│ ├── REPO_WALKTHROUGH.md +│ └── ADR.md # This document +├── Dockerfile # Multi-stage build +├── docker-compose.yml # Dev/test orchestration +├── package.json # Dependencies +└── README.md # Overview +``` + +--- + +## Appendix C: Related Projects + +### git-stargate +**URL:** https://github.com/flyingrobots/git-stargate +**Purpose:** Git gateway enforcing fast-forward only, GPG signing, and public mirroring. + +### git-stunts (Lego Blocks) +**URL:** https://github.com/flyingrobots/git-stunts +**Modules:** +- `@git-stunts/plumbing` – Low-level Git protocol wrapper +- `@git-stunts/trailer-codec` – RFC 822 trailer parser +- `@git-stunts/empty-graph` – Graph database primitive +- `@git-stunts/cas` – Content-addressable store with encryption +- `@git-stunts/vault` – OS keychain integration + +--- + +## Appendix D: References + +1. **Git Internals (Pro Git Book):** https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain +2. **RFC 822 (Internet Message Format):** https://tools.ietf.org/html/rfc822 +3. **Git Trailers Documentation:** https://git-scm.com/docs/git-interpret-trailers +4. **AES-GCM (NIST SP 800-38D):** https://csrc.nist.gov/publications/detail/sp/800-38d/final +5. **Event Sourcing (Martin Fowler):** https://martinfowler.com/eaaDev/EventSourcing.html +6. **Hexagonal Architecture:** https://alistair.cockburn.us/hexagonal-architecture/ + +--- + +## Conclusion + +**git-cms** demonstrates that Git's plumbing can be repurposed to build systems that shouldn't exist—yet do so elegantly. By treating commits as database records, refs as indexes, and the Merkle DAG as an audit log, we've created a CMS with cryptographic integrity, infinite history, and zero database dependencies. + +This architecture is not "production-ready" in the traditional sense. It violates assumptions about databases, scalability, and best practices. But it teaches us to think differently about constraints, to see tools for what they truly are, and to respect the power of simple primitives composed thoughtfully. + +If Linus saw this, he'd probably sigh, shake his head, and mutter: *"You know what? Have fun."* + +And we are. + +--- + +**End of Document** diff --git a/docs/GETTING_STARTED.md b/docs/GETTING_STARTED.md new file mode 100644 index 0000000..aaa1c56 --- /dev/null +++ b/docs/GETTING_STARTED.md @@ -0,0 +1,484 @@ +# Getting Started with Git CMS + +**⚠️ IMPORTANT: This project manipulates Git repositories at a low level. Always use Docker for testing to protect your local Git setup.** + +--- + +## TL;DR + +```bash +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms +npm run setup # One-time: clones dependencies, checks Docker +npm run demo # See it in action! +``` + +--- + +## Quick Start (Docker - Recommended) + +The safest way to try git-cms is in Docker, which provides complete isolation from your host system. + +### Prerequisites + +- Docker & Docker Compose installed +- 5 minutes of curiosity + +### Step 1: Clone and Run Setup + +```bash +# Clone the repository +git clone https://github.com/flyingrobots/git-cms.git +cd git-cms + +# Run one-time setup (clones git-stunts, checks Docker) +npm run setup +``` + +### Step 2: Try It Out + +**Option A: Watch the Demo (Recommended First Time)** +```bash +npm run demo +``` +This shows you how git-cms works step-by-step. + +**Option B: Start the Server** +```bash +npm run dev +# OR +docker compose up app +``` + +**What just happened?** +- Docker built a containerized environment with Node 20 + Git +- Created an isolated Git repository inside the container +- Started the HTTP server on port 4638 + +### Step 3: Open the Admin UI + +Open your browser to: **http://localhost:4638** + +You should see the Git CMS Admin interface with: +- Sidebar showing "Articles" and "Published" +- A form to create new articles +- Live preview of your content + +### Step 4: Create Your First Article + +**Option A: Via the Web UI** + +1. In the admin UI, enter: + - **Slug:** `hello-world` + - **Title:** `My First Post` + - **Body:** + ```markdown + # Hello World + + This is my first article using Git as a CMS! + + ## How Cool Is This? + + Every save creates a Git commit. Every publish is an atomic ref update. + ``` + +2. Click **"Save Draft"** + - Watch the terminal logs show the Git commit being created + - The article is now at `refs/_blog/articles/hello-world` + +3. Click **"Publish"** + - This fast-forwards `refs/_blog/published/hello-world` to match the draft + - The article is now "live" + +**Option B: Via the CLI (Inside Docker)** + +```bash +# Open a shell inside the running container +docker compose exec app sh + +# Create a draft +echo "# Hello World" | node bin/git-cms.js draft hello-world "My First Post" + +# List all drafts +node bin/git-cms.js list + +# Publish it +node bin/git-cms.js publish hello-world + +# Read it back +node bin/git-cms.js show hello-world + +# Exit the container +exit +``` + +### Step 5: Explore the Git Magic + +The coolest part: this is all just Git under the hood. + +```bash +# Enter the container +docker compose exec app sh + +# Check what Git sees +git log --all --oneline --graph + +# Look at the refs namespace +git for-each-ref refs/_blog/ + +# Read a commit message (this is your article!) +git log refs/_blog/articles/hello-world -1 --format="%B" + +# Exit +exit +``` + +**What you'll see:** +- Your article stored as a commit message +- Commits pointing to the "empty tree" (no files touched!) +- Refs acting as pointers to "current" versions + +--- + +## Understanding the Safety Model + +### Why Docker is Essential + +Git CMS uses **low-level Git plumbing commands** like: +- `git commit-tree` (creates commits on empty trees) +- `git update-ref` (atomic ref updates) +- `git hash-object` (writes blobs directly) + +While these operations are safe *when used correctly*, running tests or experiments on your host machine could: +- Create unexpected refs in your current repository +- Write test blobs to `.git/objects/` +- Modify your Git configuration + +**Docker provides complete isolation** - the container has its own filesystem, its own Git repos, and can be destroyed without a trace. + +### What's Safe? + +✅ **Running in Docker:** Completely safe. Destroy the container anytime with `docker compose down -v` + +✅ **Creating a dedicated test repo:** If you want to try the CLI locally: +```bash +mkdir ~/git-cms-playground +cd ~/git-cms-playground +git init +# Now use git-cms here - it's isolated from your other repos +``` + +❌ **Running tests in your git-cms clone on host:** Not recommended (see next section) + +❌ **Running git-cms commands in your active project repos:** NEVER do this until you understand what's happening + +--- + +## Running Tests + +Tests create and destroy temporary Git repositories. **Always use Docker.** + +```bash +# Run all tests (automatically uses Docker) +npm test + +# This is equivalent to: +./test/run-docker.sh + +# Which runs: +docker compose run --rm test +``` + +**What the tests do:** +- Create temporary repos in `/tmp/git-cms-test-*` +- Test all CRUD operations (create, read, update, publish) +- Test asset encryption and chunking +- Clean up afterward + +**Never run tests on your host** unless you're comfortable with low-level Git operations. + +--- + +## Advanced: Local CLI Installation + +If you want to use git-cms as a command-line tool on your host machine, you can install it globally - **but only use it in dedicated Git repositories.** + +### Install Globally + +```bash +npm install -g git-cms +# OR, from source: +cd git-cms +npm link +``` + +### Create a Dedicated Blog Repo + +```bash +# Create a fresh repo for your blog +mkdir ~/my-blog +cd ~/my-blog +git init + +# Configure Git +git config user.name "Your Name" +git config user.email "you@example.com" + +# Now use git-cms safely +echo "# My First Post" | git cms draft hello-world "Hello World" +git cms publish hello-world +``` + +**Critical:** Only use `git cms` commands in repositories where: +- You understand you're creating commits with empty trees +- You're okay with refs in `refs/_blog/*` namespace +- You've read the docs and understand what's happening + +--- + +## How to Clean Up + +### Stop Docker + +```bash +# Stop containers +docker compose down + +# Stop containers AND delete all data (fresh start) +docker compose down -v +``` + +### Uninstall CLI + +```bash +npm uninstall -g git-cms +# OR, if linked: +cd git-cms && npm unlink +``` + +### Delete a Test Blog Repo + +```bash +# If you created ~/my-blog for testing: +rm -rf ~/my-blog +``` + +--- + +## What's Actually Happening? (The "Stunt" Explained) + +Traditional CMS architecture: +``` +Article → JSON → POST /api → Parse → INSERT INTO posts → Database +``` + +Git CMS architecture: +``` +Article → Commit Message → git commit-tree → .git/objects/ → Git +``` + +### The Empty Tree Trick + +Every article commit points to Git's "empty tree" (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`): + +```bash +# Traditional Git commit +git add article.md # Stage file +git commit -m "Add article" # Commit references changed files + +# Git CMS commit +git commit-tree 4b825dc... -m "Article content here" # No files touched! +``` + +This means: +- Your working directory stays clean +- All content lives in `.git/objects/` and `.git/refs/` +- No merge conflicts from content changes +- Every save is a commit (infinite history) + +### Publishing is Just a Pointer + +```bash +# Draft ref points to latest commit +refs/_blog/articles/hello-world → abc123def... + +# Publishing copies the pointer +refs/_blog/published/hello-world → abc123def... + +# No new commits created! +# Atomic operation via git update-ref +``` + +--- + +## Next Steps + +Once you're comfortable with the basics: + +1. **Read the ADR** (`docs/ADR.md`) for deep architectural details +2. **Try the Stargate Gateway** (enforces fast-forward only + GPG signing) + ```bash + ./scripts/bootstrap-stargate.sh ~/git/_blog-stargate.git + git remote add stargate ~/git/_blog-stargate.git + git config remote.stargate.push "+refs/_blog/*:refs/_blog/*" + git push stargate + ``` +3. **Experiment with encryption** (see below) +4. **Explore the Lego Blocks** in `../git-stunts/` (plumbing, codec, cas, vault, empty-graph) + +--- + +## Asset Encryption (Optional) + +Assets (images, PDFs) can be encrypted client-side before they touch Git. + +### Setup (macOS) + +```bash +# Generate a 256-bit key +openssl rand -base64 32 + +# Store in macOS Keychain +security add-generic-password -s git-cms-dev-enc-key -a $USER -w "" +``` + +### Setup (Linux) + +```bash +# Generate key +openssl rand -base64 32 + +# Store in GNOME Keyring (if available) +secret-tool store --label="Git CMS Dev Key" service git-cms-dev-enc-key +# Paste key when prompted +``` + +### Test Encryption + +```bash +# Inside Docker container +docker compose exec app sh + +# Upload an encrypted file (if you've set up Vault) +node bin/git-cms.js upload hello-world /path/to/image.png + +# The blob in Git is encrypted ciphertext +# Only you (with the key) can decrypt it +``` + +--- + +## Troubleshooting + +### "Permission denied" when running Docker + +**Solution:** Make sure Docker Desktop is running, or add your user to the `docker` group: +```bash +sudo usermod -aG docker $USER +# Log out and back in +``` + +### "Port 4638 already in use" + +**Solution:** Change the port in `docker-compose.yml`: +```yaml +ports: + - "5000:4638" # Maps localhost:5000 → container:4638 +``` + +### "Cannot find module '@git-stunts/...'" + +**Solution:** The Lego Blocks need to be in the parent directory: +```bash +# Ensure directory structure: +~/git/ + git-cms/ ← You are here + git-stunts/ ← Lego Blocks should be here +``` + +If you only cloned `git-cms`, you need to clone `git-stunts` too: +```bash +cd ~/git +git clone https://github.com/flyingrobots/git-stunts.git +cd git-cms +docker compose build # Rebuild with Lego Blocks +``` + +### "Tests fail immediately" + +**Cause:** You might be running tests on your host without Docker. + +**Solution:** Always use: +```bash +npm test # Uses Docker automatically +``` + +--- + +## FAQ + +### Is this production-ready? + +**For small personal blogs:** Yes, with caveats. +**For high-traffic sites:** No. + +This is an educational project demonstrating Git's capabilities. Use it to: +- Learn Git internals +- Build prototype CMS systems +- Understand content-addressable storage + +Don't use it for: +- Mission-critical applications +- Sites with >100 concurrent writers +- Anything requiring complex queries or full-text search + +### Can I use this with GitHub? + +Yes! Use the **git-stargate** gateway to: +1. Enforce fast-forward only (no force pushes) +2. Verify GPG signatures +3. Mirror to GitHub automatically + +See: https://github.com/flyingrobots/git-stargate + +### What about GDPR / right to be forgotten? + +Git's immutability conflicts with GDPR Article 17. Mitigation strategies: +- Use client-side encryption and delete keys (content becomes unreadable) +- Legal argument: journalistic/archival "legitimate interest" +- Don't store PII in articles + +Consult a lawyer before using this for user-generated content in the EU. + +### Why not use a real database? + +That's the point. This is a "Git Stunt" - using Git in unconventional ways to understand: +- How content-addressable storage works +- How to build systems from first principles +- What Git's plumbing can *actually* do + +You're supposed to walk away thinking "I would never use this in production, but now I understand Git (and databases) way better." + +--- + +## Getting Help + +- **Issues:** https://github.com/flyingrobots/git-cms/issues +- **Blog Series:** https://flyingrobots.dev/posts/git-stunts +- **ADR:** `docs/ADR.md` (comprehensive architecture docs) + +--- + +## One Last Warning + +Git CMS is a **thought experiment** that happens to work. It's designed to teach you how Git's plumbing works by building something that shouldn't exist. + +If you're considering using this in production: +1. Read the entire ADR (`docs/ADR.md`) +2. Understand every decision and tradeoff +3. Run it in Docker for at least a month +4. Consider whether a traditional database might be... better + +Then, if you're still convinced, **go for it**. Just remember: when you tell people you're using Git as your database, don't say I didn't warn you. + +Have fun, and remember: _"You know what? Have fun."_ — Linus (probably) diff --git a/docs/adr-tex-2/Makefile b/docs/adr-tex-2/Makefile new file mode 100644 index 0000000..cfa4838 --- /dev/null +++ b/docs/adr-tex-2/Makefile @@ -0,0 +1,8 @@ +all: main.pdf + +main.pdf: main.tex $(wildcard sections/*.tex) $(wildcard figures/*.tex) + pdflatex -interaction=nonstopmode main.tex + pdflatex -interaction=nonstopmode main.tex + +clean: + rm -f *.aux *.log *.out *.toc *.pdf diff --git a/docs/adr-tex-2/figures/context.tex b/docs/adr-tex-2/figures/context.tex new file mode 100644 index 0000000..ac296f9 --- /dev/null +++ b/docs/adr-tex-2/figures/context.tex @@ -0,0 +1,12 @@ +\begin{tikzpicture}[node distance=2cm, auto] + \node [block] (Author) {Author\\(Human)}; + \node [block, below=1cm of Author] (GitCMS) {\textbf{git-cms}\\(Node.js App)}; + \node [block, right=2cm of GitCMS] (Stargate) {git-stargate\\(Git Gateway)}; + \node [block, below=1cm of GitCMS] (LocalRepo) {.git/objects/\\(Local Repository)}; + \node [block, right=2cm of Stargate] (PublicMirror) {Public Mirror\\(GitHub/GitLab)}; + + \draw [line] (Author) -- node [align=center, scale=0.8] {CLI/HTTP API} (GitCMS); + \draw [line] (GitCMS) -- node [scale=0.8] {git push} (Stargate); + \draw [line] (GitCMS) -- node [scale=0.8] {read/write} (LocalRepo); + \draw [line] (Stargate) -- node [scale=0.8] {mirror} (PublicMirror); +\end{tikzpicture} \ No newline at end of file diff --git a/docs/adr-tex-2/figures/decomposition.tex b/docs/adr-tex-2/figures/decomposition.tex new file mode 100644 index 0000000..1c7c121 --- /dev/null +++ b/docs/adr-tex-2/figures/decomposition.tex @@ -0,0 +1,21 @@ +\begin{tikzpicture}[node distance=1.5cm, auto] + \node [blockshaded] (CMS) {\textbf{CmsService}\\\texttt{src/lib}}; + \node [block, above left=1cm and 0.5cm of CMS] (CLI) {CLI\\\texttt{bin/git-cms.js}}; + \node [block, above right=1cm and 0.5cm of CMS] (HTTP) {HTTP Server\\\texttt{src/server}}; + \node [draw, dashed, thick, inner sep=10pt, fit=(CLI) (HTTP) (CMS)] (AppLayer) {}; + \node [anchor=south] at (AppLayer.north) {\small\textbf{Application Layer}}; + + \node [block, below=1.5cm of CMS] (Graph) {Graph\\empty-graph}; + \node [block, left=0.5cm of Graph] (Codec) {Codec\\trailer-codec}; + \node [block, right=0.5cm of Graph] (CAS) {CAS\\cas}; + \node [block, below=1cm of Graph] (Plumbing) {Plumbing\\git-protocol}; + \node [block, right=0.5cm of CAS] (Vault) {Vault\\secrets}; + \node [draw, dashed, thick, inner sep=10pt, fit=(Plumbing) (Codec) (Graph) (CAS) (Vault)] (LegoLayer) {}; + \node [anchor=north] at (LegoLayer.south) {\small\textbf{Lego Blocks (@git-stunts)}}; + + \draw [line] (CLI) -- (CMS); \draw [line] (HTTP) -- (CMS); + \draw [line] (CMS) -- (Codec); \draw [line] (CMS) -- (Graph); + \draw [line] (CMS) -- (CAS); \draw [line] (CMS) -- (Vault); + \draw [line] (CMS) -- (Plumbing); \draw [line] (Graph) -- (Plumbing); + \draw [line] (CAS) -- (Plumbing); +\end{tikzpicture} \ No newline at end of file diff --git a/docs/adr-tex-2/figures/draft-sequence.tex b/docs/adr-tex-2/figures/draft-sequence.tex new file mode 100644 index 0000000..ccca1b0 --- /dev/null +++ b/docs/adr-tex-2/figures/draft-sequence.tex @@ -0,0 +1,18 @@ +\begin{tikzpicture}[node distance=3cm, auto] + \node (Author) {Author}; + \node [right=of Author] (CLI) {CLI}; + \node [right=of CLI] (CMS) {Service}; + \node [right=of CMS] (PL) {Plumbing}; + + \foreach \n in {Author, CLI, CMS, PL} { + \draw [dashed] (\n) -- ++(0,-6.5); + } + + \draw [->] ($(Author)+(0,-1)$) -- node [scale=0.7] {draft hello-world} ($(CLI)+(0,-1)$); + \draw [->] ($(CLI)+(0,-1.5)$) -- node [scale=0.7] {saveSnapshot()} ($(CMS)+(0,-1.5)$); + \draw [->] ($(CMS)+(0,-2.2)$) -- node [scale=0.7] {revParse(ref)} ($(PL)+(0,-2.2)$); + \draw [<-] ($(CMS)+(0,-3)$) -- node [scale=0.7] {null} ($(PL)+(0,-3)$); + \draw [->] ($(CMS)+(0,-4)$) -- node [scale=0.7] {createNode()} ($(CMS)+(0.8,-4.2)$); + \draw [->] ($(CMS)+(0,-5)$) -- node [scale=0.7] {updateRef()} ($(PL)+(0,-5)$); + \draw [<-] ($(CLI)+(0,-6)$) -- node [scale=0.7] {OK} ($(CMS)+(0,-6)$); +\end{tikzpicture} \ No newline at end of file diff --git a/docs/adr-tex-2/figures/responsibilities.tex b/docs/adr-tex-2/figures/responsibilities.tex new file mode 100644 index 0000000..ad4a4a2 --- /dev/null +++ b/docs/adr-tex-2/figures/responsibilities.tex @@ -0,0 +1,17 @@ +\begin{tikzpicture}[node distance=1cm, auto, font=\small] + \node [blockshaded, text width=2.5cm, minimum height=8cm] (CMS) {\textbf{CmsService}}; + \node [block, text width=4.5cm, right=3cm of CMS.north, anchor=north] (PL) {\textbf{@git-stunts/plumbing}\\execute, revParse}; + \node [block, text width=4.5cm, below=0.5cm of PL] (TC) {\textbf{@git-stunts/trailer-codec}\\encode, decode}; + \node [block, text width=4.5cm, below=0.5cm of TC] (EG) {\textbf{@git-stunts/empty-graph}\\createNode, readNode}; + \node [block, text width=4.5cm, below=0.5cm of EG] (CAS) {\textbf{@git-stunts/cas}\\storeFile, retrieveFile}; + \node [block, text width=4.5cm, below=0.5cm of CAS] (V) {\textbf{@git-stunts/vault}\\resolveSecret}; + + \draw [line] (CMS.east |- PL.west) -- (PL.west); + \draw [line] (CMS.east |- TC.west) -- (TC.west); + \draw [line] (CMS.east |- EG.west) -- (EG.west); + \draw [line] (CMS.east |- CAS.west) -- (CAS.west); + \draw [line] (CMS.east |- V.west) -- (V.west); + + \draw [dashed-line] (EG.east) -- ++(0.5,0) |- (PL.east); + \draw [dashed-line] (CAS.east) -- ++(0.5,0) |- (PL.east); +\end{tikzpicture} diff --git a/docs/adr-tex-2/main.pdf b/docs/adr-tex-2/main.pdf new file mode 100644 index 0000000..4d4dad2 Binary files /dev/null and b/docs/adr-tex-2/main.pdf differ diff --git a/docs/adr-tex-2/main.tex b/docs/adr-tex-2/main.tex new file mode 100644 index 0000000..cb06b18 --- /dev/null +++ b/docs/adr-tex-2/main.tex @@ -0,0 +1,113 @@ +\documentclass[11pt,a4paper]{article} + +% --- Packages --- +\usepackage[utf8]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{lmodern} +\usepackage[margin=1in, headheight=14pt]{geometry} +\usepackage{titlesec} +\usepackage{titletoc} +\usepackage{fancyhdr} +\usepackage{graphicx} +\usepackage{booktabs} +\usepackage{longtable} +\usepackage{array} +\usepackage{enumitem} +\usepackage{float} +\usepackage{listings} +\usepackage{xcolor} +\usepackage{tikz} +\usetikzlibrary{shapes, arrows.meta, positioning, fit, backgrounds, calc, shadows, trees} +\usepackage{amssymb} +\usepackage{xurl} +\usepackage[hidelinks]{hyperref} + +% --- Typography & Layout --- +\hypersetup{ + colorlinks=false, + pdftitle={Architecture Decision Record: Git CMS}, + pdfauthor={James Ross} +} + +\usepackage{parskip} +\setlength{\parindent}{0pt} +\setlength{\parskip}{0.8em} + +\pagestyle{fancy} +\fancyhf{} +\fancyhead[L]{\nouppercase{\leftmark}} +\fancyhead[R]{Git CMS ADR} +\fancyfoot[C]{\thepage} + +\titleformat{\section}{\Large\bfseries\sffamily}{\thesection}{1em}{} +\titleformat{\subsection}{\large\bfseries\sffamily}{\thesubsection}{1em}{} +\titleformat{\subsubsection}{\bfseries\sffamily}{\thesubsubsection}{1em}{} + +\lstset{ + basicstyle=\ttfamily\small, + breaklines=true, + frame=single, + numbers=left, + numberstyle=\tiny\color{gray}, + captionpos=b, + keepspaces=true, + showstringspaces=false, + keywordstyle=\bfseries, + commentstyle=\itshape, + stringstyle=, +} + +% --- Textbook B&W TikZ Styles --- +\tikzset{ + base/.style={draw=black, thick, font=\sffamily\small, align=center, inner sep=8pt}, + block/.style={base, rectangle, rounded corners=2pt, fill=white}, + blockshaded/.style={base, rectangle, rounded corners=2pt, fill=gray!10}, + line/.style={draw=black, thick, -Latex}, + dashed-line/.style={draw=black, thick, dashed, -Latex} +} + +\begin{document} + +\input{meta} + +\begin{titlepage} + \centering + \vspace*{3cm} + {\fontsize{30}{36}\selectfont \textbf{Architecture Decision Record}\\[0.5em]} + {\fontsize{20}{24}\selectfont \textit{Git CMS}\\[1.5cm]} + + \rule{\textwidth}{1pt}\\[0.5cm] + {\Large Database-Free Content Management via Git Plumbing}\\[3cm] + + \textbf{Author:} James Ross \\ + \textbf{Version:} 1.0.0 \\ + \textbf{Date:} 2026-01-11 + + \vfill + \textit{Prepared for Engineering Review} + \vspace{2cm} +\end{titlepage} + +\tableofcontents +\newpage + +\input{sections/01-introduction} +\input{sections/02-constraints} +\input{sections/03-context} +\input{sections/04-solution} +\input{sections/05-building-blocks} +\input{sections/06-runtime} +\input{sections/07-deployment} +\input{sections/08-crosscutting} +\input{sections/09-decisions} +\input{sections/10-quality} +\input{sections/11-risks} +\input{sections/12-glossary} + +\appendix +\input{sections/A-commands} +\input{sections/B-structure} +\input{sections/C-related} +\input{sections/D-references} + +\end{document} diff --git a/docs/adr-tex-2/meta.tex b/docs/adr-tex-2/meta.tex new file mode 100644 index 0000000..d09034f --- /dev/null +++ b/docs/adr-tex-2/meta.tex @@ -0,0 +1,5 @@ +% meta.tex +\title{\textbf{Architecture Decision Record: Git CMS}\\ \large Database-Free Content Management via Git Plumbing} +\author{James Ross} +\date{Version 1.0.0 -- Last Updated: 2026-01-11} + diff --git a/docs/adr-tex-2/sections/01-introduction.tex b/docs/adr-tex-2/sections/01-introduction.tex new file mode 100644 index 0000000..4eee04b --- /dev/null +++ b/docs/adr-tex-2/sections/01-introduction.tex @@ -0,0 +1,64 @@ +\section{Introduction \& Goals} + +\subsection{Project Overview} + +\textbf{git-cms} is a serverless, database-free Content Management System that treats Git's object store as a distributed, cryptographically verifiable document database. Instead of storing content in traditional databases (SQL or NoSQL), it leverages Git's Merkle DAG to create an append-only ledger for articles, metadata, and encrypted assets. + +The fundamental innovation: \texttt{git push} becomes the API endpoint. + +\subsection{Fundamental Requirements} + +\subsubsection{FR-1: Zero-Database Architecture} +The system MUST NOT depend on external database systems (SQL, NoSQL, or key-value stores). All persistent state resides within Git's native object store (\texttt{.git/objects}). + +\textbf{Rationale:} Eliminates operational complexity, deployment dependencies, and schema migration challenges inherent to traditional database-backed CMSs. + +\subsubsection{FR-2: Cryptographic Verifiability} +Every content mutation MUST be recorded as a Git commit with cryptographic integrity guarantees via SHA-1 hashing (with optional GPG signing for non-repudiation). + +\textbf{Rationale:} Provides immutable audit trails and tamper detection without additional infrastructure. + +\subsubsection{FR-3: Fast-Forward Only Publishing} +The publish operation MUST enforce strict linear history (fast-forward only) to prevent rewriting published content. + +\textbf{Rationale:} Guarantees provenance and prevents content manipulation after publication. + +\subsubsection{FR-4: Client-Side Encryption} +All uploaded assets MUST be encrypted client-side (AES-256-GCM) before touching the repository. + +\textbf{Rationale:} Achieves row-level security without database-level access controls. The Git gateway receives only opaque encrypted blobs. + +\subsubsection{FR-5: Infinite Point-in-Time Recovery} +Users MUST be able to access any historical version of any article without data loss. + +\textbf{Rationale:} Git's DAG structure provides this naturally; the CMS simply exposes it as a first-class feature. + +\subsection{Quality Goals} + +\begin{table}[H] +\centering +\small +\begin{tabular}{llp{5cm}p{4cm}} +\toprule +\textbf{Prio} & \textbf{Attribute} & \textbf{Description} & \textbf{Measurement} \\ +\midrule +1 & Security & Cryptographic integrity, signed commits & GPG verification, AES-256 strength \\ +2 & Simplicity & Minimal dependencies, composable architecture & Lines of code, dependency count \\ +3 & Auditability & Complete provenance of all content changes & Git log completeness \\ +4 & Performance & Sub-second reads for blog workloads & Response time for \texttt{readArticle()} \\ +5 & Portability & Multi-runtime support (Node, Bun, Deno) & Test suite pass rate \\ +\bottomrule +\end{tabular} +\caption{Quality goals and their measurements.} +\end{table} + +\subsection{Non-Goals} + +This system is \textbf{intentionally NOT designed for}: + +\begin{itemize}[noitemsep] + \item \textbf{High-velocity writes:} Content publishing happens in minutes/hours, not milliseconds. + \item \textbf{Complex queries:} No SQL-like JOINs or aggregations. Queries are limited to ref enumeration and commit message parsing. + \item \textbf{Large-scale collaboration:} Designed for single-author or small-team blogs. + \item \textbf{Real-time updates:} Publishing is atomic but not instantaneous. +\end{itemize} \ No newline at end of file diff --git a/docs/adr-tex-2/sections/02-constraints.tex b/docs/adr-tex-2/sections/02-constraints.tex new file mode 100644 index 0000000..8a13caa --- /dev/null +++ b/docs/adr-tex-2/sections/02-constraints.tex @@ -0,0 +1,47 @@ +\section{Constraints} + +\subsection{Technical Constraints} + +\textbf{TC-1: Git's Content Addressability Model} \\ +Git uses SHA-1 hashing for object addressing. While SHA-1 has known collision vulnerabilities, Git is transitioning to SHA-256. The system assumes SHA-1 is ``good enough'' for content addressing (not for security-critical signing). + +\textbf{Mitigation:} Use GPG signing (\texttt{CMS\_SIGN=1}) for cryptographic non-repudiation. + +\textbf{TC-2: Filesystem I/O Performance} \\ +All Git operations are ultimately filesystem operations. Performance is bounded by disk I/O, especially for large repositories. + +\textbf{Mitigation:} Content is stored as commit messages (small), not files (large). Asset chunking (256KB) reduces blob size. + +\textbf{TC-3: POSIX Shell Dependency} \\ +The \texttt{@git-stunts/plumbing} module executes Git via shell commands (\texttt{child\_process.spawn}). This requires a POSIX-compliant shell and Git CLI. + +\textbf{Mitigation:} All tests run in Docker (Alpine Linux) to ensure consistent environments. + +\textbf{TC-4: No Database Indexes} \\ +Traditional databases provide B-tree indexes for fast lookups. Git's ref enumeration is linear (\texttt{O(n)} for listing all refs in a namespace). + +\textbf{Mitigation:} Use ref namespaces strategically (e.g., \texttt{refs/\_blog/articles/}) to avoid polluting the global ref space. + +\subsection{Regulatory Constraints} + +\textbf{RC-1: GDPR Right to Erasure} \\ +Git's immutability conflicts with GDPR's ``right to be forgotten.'' Deleting a commit requires rewriting history, which breaks cryptographic integrity. + +\textbf{Mitigation:} Use encrypted assets with key rotation. Deleting the encryption key renders historical content unreadable without altering Git history. + +\textbf{RC-2: Cryptographic Export Restrictions} \\ +AES-256-GCM encryption may face export restrictions in certain jurisdictions. + +\textbf{Mitigation:} The \texttt{@git-stunts/vault} module uses Node's built-in \texttt{crypto} module, which is widely available. + +\subsection{Operational Constraints} + +\textbf{OC-1: Single-Writer Assumption} \\ +Git's ref updates are atomic \textit{locally} but not across distributed clones. Concurrent writes to the same ref can cause conflicts. + +\textbf{Mitigation:} Use \textbf{git-stargate} (a companion project) to enforce serialized writes via SSH. + +\textbf{OC-2: Repository Growth} \\ +Every draft save creates a new commit. Repositories can grow unbounded over time. + +\textbf{Mitigation:} Use \texttt{git gc} aggressively. Consider ref pruning for old drafts. \ No newline at end of file diff --git a/docs/adr-tex-2/sections/03-context.tex b/docs/adr-tex-2/sections/03-context.tex new file mode 100644 index 0000000..3c076a9 --- /dev/null +++ b/docs/adr-tex-2/sections/03-context.tex @@ -0,0 +1,93 @@ +\section{Context \& Scope} + +\subsection{System Context Diagram} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture}[node distance=2cm, auto] + \node [block] (Author) {Author\\(Human)}; + \node [block, below=1cm of Author] (GitCMS) {\textbf{git-cms}\\(Node.js App)}; + \node [block, right=2.5cm of GitCMS] (Stargate) {git-stargate\\(Git Gateway)}; + \node [block, below=1.5cm of GitCMS] (LocalRepo) {.git/objects/\\(Local Repo)}; + \node [block, right=2.5cm of Stargate] (PublicMirror) {Public Mirror\\(GitHub/GitLab)}; + + \path [line] (Author) -- node [align=center, scale=0.8] {CLI /\\ HTTP API} (GitCMS); + \path [line] (GitCMS) -- node [align=center, scale=0.8] {git push} (Stargate); + \path [line] (GitCMS) -- node [align=center, scale=0.8, swap] {read /\\ write} (LocalRepo); + \path [line] (Stargate) -- node [align=center, scale=0.8] {mirror} (PublicMirror); +\end{tikzpicture} +} +\caption{System context diagram showing the high-level relationship between the Author, Git CMS, and external components.} +\end{figure} + +\subsection{External Interfaces} + +\subsubsection{Interface 1: CLI (Binary)} +\begin{itemize}[noitemsep] + \item \textbf{Entry Point:} \texttt{bin/git-cms.js} + \item \textbf{Commands:} \texttt{draft}, \texttt{publish}, \texttt{list}, \texttt{show}, \texttt{serve} + \item \textbf{Protocol:} POSIX command-line arguments + \item \textbf{Example:} +\end{itemize} + +\begin{lstlisting}[language=bash] +echo "# Hello World" | git cms draft hello-world "My First Post" +\end{lstlisting} + +\subsubsection{Interface 2: HTTP API (REST)} +\begin{itemize}[noitemsep] + \item \textbf{Server:} \texttt{src/server/index.js} + \item \textbf{Port:} 4638 (configurable via \texttt{PORT} env var) + \item \textbf{Endpoints:} + \begin{itemize}[noitemsep] + \item \texttt{POST /api/cms/snapshot} -- Save draft + \item \texttt{POST /api/cms/publish} -- Publish article + \item \texttt{GET /api/cms/list} -- List articles + \item \texttt{GET /api/cms/show?slug=} -- Read article + \end{itemize} + \item \textbf{Authentication:} None (assumes private network or SSH tunneling) +\end{itemize} + +\subsubsection{Interface 3: Git Plumbing (Shell)} +\begin{itemize}[noitemsep] + \item \textbf{Protocol:} Git CLI commands via \texttt{child\_process.spawn} + \item \textbf{Critical Commands:} + \begin{itemize}[noitemsep] + \item \texttt{git commit-tree} -- Create commits on empty trees + \item \texttt{git update-ref} -- Atomic ref updates + \item \texttt{git for-each-ref} -- List refs in namespace + \item \texttt{git cat-file} -- Read commit messages + \end{itemize} +\end{itemize} + +\subsubsection{Interface 4: OS Keychain (Secrets)} +\begin{itemize}[noitemsep] + \item \textbf{Platforms:} + \begin{itemize}[noitemsep] + \item macOS: \texttt{security} tool + \item Linux: \texttt{secret-tool} (GNOME Keyring) + \item Windows: \texttt{CredentialManager} (PowerShell) + \end{itemize} + \item \textbf{Purpose:} Store AES-256-GCM encryption keys for assets +\end{itemize} + +\subsection{Scope Boundaries} + +\subsubsection{In Scope} +\begin{itemize}[noitemsep] + \item Article drafting, editing, and publishing + \item Encrypted asset storage (images, PDFs) + \item Full version history via Git log + \item CLI and HTTP API access + \item Multi-runtime support (Node, Bun, Deno) +\end{itemize} + +\subsubsection{Out of Scope} +\begin{itemize}[noitemsep] + \item \textbf{User Authentication:} Delegated to git-stargate or SSH + \item \textbf{Search Indexing:} No full-text search (external indexer required) + \item \textbf{Media Transcoding:} Assets stored as-is + \item \textbf{Real-Time Collaboration:} No OT or CRDTs + \item \textbf{Analytics:} No built-in tracking +\end{itemize} diff --git a/docs/adr-tex-2/sections/04-solution.tex b/docs/adr-tex-2/sections/04-solution.tex new file mode 100644 index 0000000..0156f7d --- /dev/null +++ b/docs/adr-tex-2/sections/04-solution.tex @@ -0,0 +1,62 @@ +\section{Solution Strategy} + +\subsection{Core Architectural Principles} + +\paragraph{P-1: Composition over Inheritance} +The system is built from \textbf{five independent Lego Block modules} (\texttt{@git-stunts/*}), each with a single responsibility. These modules are composed in \texttt{CmsService} to create higher-order functionality. + +\textbf{Benefit:} Each module can be tested, versioned, and published independently. + +\paragraph{P-2: Hexagonal Architecture (Ports \& Adapters)} +The domain layer (\texttt{CmsService}) depends on abstractions (\texttt{GitPlumbing}, \texttt{TrailerCodec}), not implementations. This allows swapping out Git for other backends (e.g., a pure JavaScript implementation for testing). + +\textbf{Benefit:} Decouples domain logic from infrastructure concerns. + +\paragraph{P-3: Content Addressability} +Assets are stored by their SHA-1 hash, enabling automatic deduplication. If two articles reference the same image, it's stored once. + +\textbf{Benefit:} Reduces repository bloat. + +\paragraph{P-4: Cryptographic Integrity} +Every operation produces a cryptographically signed commit (when \texttt{CMS\_SIGN=1}). The Merkle DAG ensures tamper detection. + +\textbf{Benefit:} Audit trails are mathematically verifiable, not just trust-based. + +\subsection{Solution Approach: The \"Empty Tree\" Stunt} + +\paragraph{The Problem} +Traditional CMSs store content in database rows. Git is designed to track \textit{files}, not arbitrary data. Storing blog posts as files (e.g., \texttt{posts/hello-world.md}) clutters the working directory and causes merge conflicts. + +\paragraph{The Solution} +Store content as \textbf{commit messages on empty trees}, not as files. Every article is a commit that points to the well-known empty tree (\texttt{4b825dc642cb6eb9a060e54bf8d69288fbee4904}). + +\textbf{How It Works:} +\begin{enumerate}[noitemsep] + \item Encode the article (title, body, metadata) into a Git commit message using RFC 822 trailers. + \item Create a commit that points to the empty tree (no files touched). + \item Update a ref (e.g., \texttt{refs/\_blog/articles/hello-world}) to point to this commit. +\end{enumerate} + +\textbf{Result:} The repository's working directory remains clean. All content lives in \texttt{.git/objects/} and \texttt{.git/refs/}. + +\paragraph{Architectural Pattern: Event Sourcing} +Each draft save creates a new commit. The \"current\" article is the ref's tip, but the full history is a linked list of commits. + +\textbf{Benefit:} Point-in-time recovery is trivial (\texttt{git log refs/\_blog/articles/}). + +\subsection{Key Design Decisions} + +\paragraph{D-1: Why Commit Messages, Not Blobs?} +\textbf{Alternative:} Store articles as Git blobs and reference them via trees. \\ +\textbf{Decision:} Use commit messages. \\ +\textbf{Rationale:} Commits have parent pointers (version history) and support GPG signing (non-repudiation). Blobs are opaque; messages are human-readable. + +\paragraph{D-2: Why Trailers, Not JSON?} +\textbf{Alternative:} Store \texttt{\{\"title\": \"Hello\", ...\}} as the message. \\ +\textbf{Decision:} Use RFC 822 trailers. \\ +\textbf{Rationale:} Trailers are Git-native, human-readable, and diff-friendly. Backward parsing is efficient. + +\paragraph{D-3: Why Encrypt Assets, Not Repos?} +\textbf{Alternative:} Use \texttt{git-crypt} for the whole repo. \\ +\textbf{Decision:} Encrypt individual assets client-side. \\ +\textbf{Rationale:} Granular control; the gateway never sees plaintext. \ No newline at end of file diff --git a/docs/adr-tex-2/sections/05-building-blocks.tex b/docs/adr-tex-2/sections/05-building-blocks.tex new file mode 100644 index 0000000..b8d0f9f --- /dev/null +++ b/docs/adr-tex-2/sections/05-building-blocks.tex @@ -0,0 +1,21 @@ +\section{Building Block View} + +\subsection{Level 1: System Decomposition} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ + \input{figures/decomposition} +} +\caption{System decomposition showing the interaction between the application layer and the independent Lego block modules.} +\end{figure} + +\subsection{Level 2: Lego Block Responsibilities} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ + \input{figures/responsibilities} +} +\caption{Detailed responsibilities and API surfaces of the Git CMS modules.} +\end{figure} \ No newline at end of file diff --git a/docs/adr-tex-2/sections/06-runtime.tex b/docs/adr-tex-2/sections/06-runtime.tex new file mode 100644 index 0000000..7f55b19 --- /dev/null +++ b/docs/adr-tex-2/sections/06-runtime.tex @@ -0,0 +1,20 @@ +\section{Runtime View} + +\subsection{Scenario 1: Create Draft Article} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ + \input{figures/draft-sequence} +} +\caption{Sequence diagram for creating a new draft article.} +\end{figure} + +\subsection{Scenario 2: Publish Article} +Publishing is \textbf{just a ref copy}. No new commits are created. This operation is idempotent and enforces fast-forward updates. + +\subsection{Scenario 3: Upload Encrypted Asset} +The system splits files into 256KB chunks, encrypts them via AES-256-GCM, and stores them as Git blobs. The plaintext never touches the object store. + +\subsection{Scenario 4: List All Published Articles} +Listing articles involves a linear scan of the ref namespace (\texttt{O(n)}). For large workloads, an external index is recommended. \ No newline at end of file diff --git a/docs/adr-tex-2/sections/07-deployment.tex b/docs/adr-tex-2/sections/07-deployment.tex new file mode 100644 index 0000000..4cd81eb --- /dev/null +++ b/docs/adr-tex-2/sections/07-deployment.tex @@ -0,0 +1,58 @@ +\section{Deployment View} + +\subsection{Topology 1: Single-Author Local Blog} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture} + \node [block] (CLI) {git-cms CLI\\(Node.js)}; + \node [block, right=2cm of CLI] (Repo) {Local Repo\\(\.git/objects)}; + \draw [line] (CLI) -- node [above, scale=0.8] {I/O} (Repo); + \node [draw, dashed, thick, inner sep=15pt, fit=(CLI) (Repo)] (Box) {}; + \node [anchor=south, font=\bfseries] at (Box.north) {Author's Laptop}; +\end{tikzpicture} +} +\caption{Local deployment topology.} +\end{figure} + +\subsection{Topology 2: Team Blog with Stargate Gateway} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture}[node distance=2.5cm] + \node [block] (CMS_A) {git-cms CLI}; + \node [block, below of=CMS_A] (CMS_B) {git-cms CLI}; + \node [block, right=3cm of CMS_A, yshift=-1.25cm] (Stargate) {\textbf{git-stargate}\\(Bare Repo + Hooks)}; + \node [block, right=2.5cm of Stargate] (GitHub) {GitHub\\(Mirror)}; + + \draw [line] (CMS_A) -- node [above, sloped, scale=0.7] {git push (SSH)} (Stargate); + \draw [line] (CMS_B) -- node [below, sloped, scale=0.7] {git push (SSH)} (Stargate); + \draw [line] (Stargate) -- node [above, scale=0.7] {mirror} (GitHub); +\end{tikzpicture} +} +\caption{Collaborative deployment topology using a central gateway.} +\end{figure} + +\subsection{Topology 3: Dockerized Development} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture}[node distance=1.5cm] + \node [block] (Node) {HTTP Server\\Node.js}; + \node [block, below=of Node] (Git) {Git CLI}; + \node [block, below=of Git] (Repo) {\.git/objects}; + + \node [draw, dashed, thick, inner sep=10pt, fit=(Node) (Git) (Repo)] (Cont) {}; + \node [anchor=east, font=\bfseries] at (Cont.west) {Docker Container}; + + \node [block, left=2cm of Node] (Browser) {Web Browser}; + \draw [line] (Browser) -- node [above, scale=0.7] {HTTP:4638} (Node); + \draw [line] (Node) -- (Git); + \draw [line] (Git) -- (Repo); +\end{tikzpicture} +} +\caption{Dockerized development topology.} +\end{figure} diff --git a/docs/adr-tex-2/sections/08-crosscutting.tex b/docs/adr-tex-2/sections/08-crosscutting.tex new file mode 100644 index 0000000..b139bcd --- /dev/null +++ b/docs/adr-tex-2/sections/08-crosscutting.tex @@ -0,0 +1,56 @@ +\section{Crosscutting Concepts} + +\subsection{Concept 1: Merkle DAG as Event Log} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture}[node distance=1.5cm, auto] + \node [block, dashed] (Empty) {Empty Tree\\4b825dc...}; + \node [block, right=of Empty] (C1) {Commit 1\\(Draft v1)}; + \node [block, right=of C1] (C2) {Commit 2\\(Draft v2)}; + \node [block, right=of C2] (C3) {Commit 3\\(Draft v3)}; + + \draw [line] (C1) -- (Empty); + \draw [line] (C2) -- (C1); + \draw [line] (C2) to [bend left=30] (Empty); + \draw [line] (C3) -- (C2); + \draw [line] (C3) to [bend right=45] (Empty); + + \node [block, above=1cm of C3] (DraftRef) {\texttt{refs/.../hello-world}}; + \node [block, above=1cm of C2] (PubRef) {\texttt{refs/published/...}}; + + \draw [dashed-line] (DraftRef) -- (C3); + \draw [dashed-line] (PubRef) -- (C2); +\end{tikzpicture} +} +\caption{The Merkle DAG structure acting as an immutable event log.} +\end{figure} + +\subsection{Concept 2: Compare-and-Swap (CAS)} +The system uses \texttt{git update-ref } to ensure atomic updates and prevent race conditions. If the \texttt{oldSHA} has changed since it was last read, the update is rejected. + +\subsection{Concept 3: Client-Side Encryption} + +\begin{figure}[H] +\centering +\resizebox{\textwidth}{!}{ +\begin{tikzpicture}[node distance=1.5cm] + \node [block] (Input) {Plaintext File}; + \node [block, below=of Input] (Enc) {\textbf{Encryption}\\AES-256-GCM}; + \node [block, below=of Enc, fill=gray!5] (Blob) {Encrypted Blobs\\(Git Objects)}; + \node [block, right=2cm of Blob] (Manifest) {CBOR Manifest\\(OID, IV, AuthTag)}; + + \draw [line] (Input) -- (Enc); + \draw [line] (Enc) -- (Blob); + \draw [line] (Blob) -- (Manifest); + + \node [draw, dashed, thick, inner sep=10pt, fit=(Input) (Enc)] (AuthorBox) {}; + \node [anchor=south, font=\small\itshape] at (AuthorBox.north) {Author Laptop}; + + \node [draw, dashed, thick, inner sep=10pt, fit=(Blob)] (GatewayBox) {}; + \node [anchor=south, font=\small\itshape] at (GatewayBox.north) {Untrusted Gateway}; +\end{tikzpicture} +} +\caption{End-to-end encryption pipeline for assets.} +\end{figure} diff --git a/docs/adr-tex-2/sections/09-decisions.tex b/docs/adr-tex-2/sections/09-decisions.tex new file mode 100644 index 0000000..7cbafab --- /dev/null +++ b/docs/adr-tex-2/sections/09-decisions.tex @@ -0,0 +1,47 @@ +\section{Architectural Decisions} + +\subsection*{ADR-001: Use Commit Messages, Not Files} +\textbf{Context:} Need to store articles in Git without polluting the working directory or causing merge conflicts on files. + +\textbf{Decision:} Store article content (title, body, trailers) as Git commit messages pointing to the canonical empty tree (\texttt{4b825dc...}). + +\textbf{Rationale:} +\begin{itemize}[noitemsep] + \item Commits have parent pointers, enabling native version history. + \item Commits support GPG signing for non-repudiation. + \item Keeps the working directory completely clean for application code. +\end{itemize} + +\textbf{Status:} Accepted. + +\subsection*{ADR-002: Use RFC 822 Trailers, Not JSON} +\textbf{Context:} Need structured metadata (Status, Author, etc.) inside commit messages. + +\textbf{Decision:} Use RFC 822 trailers (key-value pairs at the end of the message). + +\textbf{Rationale:} +\begin{itemize}[noitemsep] + \item Git-native format (compatible with \texttt{git interpret-trailers}). + \item Human-readable and extremely diff-friendly. + \item Faster to parse from the end of the message. +\end{itemize} + +\textbf{Status:} Accepted. + +\subsection*{ADR-003: Fast-Forward Only Publishing} +\textbf{Context:} Prevent published content from being altered or rewritten after release. + +\textbf{Decision:} The publishing operation must be a strict fast-forward from the draft ref to the published ref. + +\textbf{Rationale:} Guarantees that the exact same commit SHA that was reviewed/drafted is the one being published. + +\textbf{Status:} Accepted. + +\subsection*{ADR-004: Client-Side Encryption for Assets} +\textbf{Context:} Git gateways or mirror repositories may be untrusted. + +\textbf{Decision:} Encrypt all binary assets (images, PDFs) client-side using AES-256-GCM before uploading. + +\textbf{Rationale:} defense-in-depth; the gateway only ever receives opaque encrypted blobs and an authenticated manifest. + +\textbf{Status:} Accepted. \ No newline at end of file diff --git a/docs/adr-tex-2/sections/10-quality.tex b/docs/adr-tex-2/sections/10-quality.tex new file mode 100644 index 0000000..13162fa --- /dev/null +++ b/docs/adr-tex-2/sections/10-quality.tex @@ -0,0 +1,24 @@ +\section{Quality Requirements} + +\subsection{Quality Tree} +The primary quality attributes for Git CMS are prioritized as follows: +\begin{enumerate} + \item \textbf{Security:} Cryptographic integrity and asset confidentiality. + \item \textbf{Simplicity:} Zero external database dependencies. + \item \textbf{Auditability:} Full provenance via Git's Merkle DAG. + \item \textbf{Performance:} Sub-second reads for standard blog workloads. +\end{enumerate} + +\subsection{Quality Scenarios} + +\subsubsection{QS-1: Tamper Detection} +\textbf{Scenario:} An attacker modifies a published article directly on the Git gateway. \\ +\textbf{Stimulus:} Malicious rewrite of Git history (\texttt{filter-branch}). \\ +\textbf{Response:} The Merkle DAG checksum mismatch is immediately detected by any client pulling the update. \\ +\textbf{Metric:} 100\% detection of unauthorized history rewrites. + +\subsubsection{QS-2: Confidentiality} +\textbf{Scenario:} A repository mirror is compromised. \\ +\textbf{Stimulus:} Attacker attempts to view private image assets. \\ +\textbf{Response:} Only AES-256-GCM ciphertext is visible; plaintext remains unrecoverable without the client-side key. \\ +\textbf{Metric:} 0\% leakage of plaintext assets. \ No newline at end of file diff --git a/docs/adr-tex-2/sections/11-risks.tex b/docs/adr-tex-2/sections/11-risks.tex new file mode 100644 index 0000000..2805317 --- /dev/null +++ b/docs/adr-tex-2/sections/11-risks.tex @@ -0,0 +1,21 @@ +\section{Risks \& Technical Debt} + +\subsection{Risk 1: SHA-1 Collision} +Git's reliance on SHA-1 is a known cryptographic risk. While the likelihood of a practical attack on a blog is low, the system should monitor Git's transition to SHA-256. + +\subsection{Risk 2: Repository Growth} +Every draft save creates a permanent commit. Over years of active use, the object store could grow significantly. Regular \texttt{git gc --aggressive} and ref pruning strategies are needed. + +\subsection{Technical Debt Summary} +\begin{table}[H] +\centering +\begin{tabular}{lll} +\toprule +\textbf{Item} & \textbf{Priority} & \textbf{Impact} \\ +\midrule +Automated ref pruning & High & Reduces repo bloat \\ +Retry logic for CAS conflicts & Medium & Improves concurrent editing \\ +External index for large ref counts & Medium & Improves \texttt{listArticles} performance \\ +\bottomrule +\end{tabular} +\end{table} diff --git a/docs/adr-tex-2/sections/12-glossary.tex b/docs/adr-tex-2/sections/12-glossary.tex new file mode 100644 index 0000000..c685e93 --- /dev/null +++ b/docs/adr-tex-2/sections/12-glossary.tex @@ -0,0 +1,12 @@ +\section{Glossary} + +\begin{description} + \item[AES-256-GCM] Advanced Encryption Standard with 256-bit keys in Galois/Counter Mode. + \item[Bare Repository] A Git repository without a working directory, typically used on servers. + \item[CAS] Content-Addressable Store (or Compare-and-Swap, depending on context). + \item[Commit] A snapshot of the repository at a point in time. + \item[Empty Tree] The unique OID (\texttt{4b825dc...}) of a tree containing zero files. + \item[Merkle DAG] A directed acyclic graph where each node is identified by the hash of its content. + \item[Ref] A pointer to a Git object (e.g., branch, tag, or article slug). + \item[Trailer] RFC 822 metadata at the end of a commit message. +\end{description} \ No newline at end of file diff --git a/docs/adr-tex-2/sections/A-commands.tex b/docs/adr-tex-2/sections/A-commands.tex new file mode 100644 index 0000000..46c2d29 --- /dev/null +++ b/docs/adr-tex-2/sections/A-commands.tex @@ -0,0 +1,21 @@ +\section{Appendix A: Example Commands} + +\subsection{Draft an Article} +\begin{lstlisting}[language=bash] +echo "# My First Post" | git cms draft hello-world "My First Post" +\end{lstlisting} + +\subsection{Publish an Article} +\begin{lstlisting}[language=bash] +git cms publish hello-world +\end{lstlisting} + +\subsection{List All Drafts} +\begin{lstlisting}[language=bash] +git cms list +\end{lstlisting} + +\subsection{Upload Asset} +\begin{lstlisting}[language=bash] +git cms upload hello-world image.png +\end{lstlisting} \ No newline at end of file diff --git a/docs/adr-tex-2/sections/B-structure.tex b/docs/adr-tex-2/sections/B-structure.tex new file mode 100644 index 0000000..743862a --- /dev/null +++ b/docs/adr-tex-2/sections/B-structure.tex @@ -0,0 +1,17 @@ +\section{Appendix B: Directory Structure} + +\begin{lstlisting} +git-cms/ ++-- bin/ +| +-- git-cms.js # CLI entry point ++-- src/ +| +-- lib/ +| | +-- CmsService.js # Core orchestrator +| +-- server/ +| +-- index.js # HTTP API server ++-- test/ +| +-- git.test.js # Integration tests +| +-- e2e/ # Playwright tests ++-- public/ # Static admin UI ++-- docs/ # Documentation +\end{lstlisting} diff --git a/docs/adr-tex-2/sections/C-related.tex b/docs/adr-tex-2/sections/C-related.tex new file mode 100644 index 0000000..77a8f62 --- /dev/null +++ b/docs/adr-tex-2/sections/C-related.tex @@ -0,0 +1,12 @@ +\section{Appendix C: Related Projects} +\begin{itemize}[noitemsep] + \item \textbf{git-stargate:} Git gateway for enforcingFF-only and signing. + \item \textbf{git-stunts:} Lego blocks for Git plumbing. +\end{itemize} + +\section{Appendix D: References} +\begin{enumerate}[noitemsep] + \item Git Internals (Pro Git Book) + \item RFC 822 (Internet Message Format) + \item AES-GCM (NIST SP 800-38D) +\end{enumerate} \ No newline at end of file diff --git a/docs/adr-tex-2/sections/D-references.tex b/docs/adr-tex-2/sections/D-references.tex new file mode 100644 index 0000000..97200d2 --- /dev/null +++ b/docs/adr-tex-2/sections/D-references.tex @@ -0,0 +1,7 @@ +\section{Appendix D: References} + +\begin{enumerate} + \item \textbf{Git Internals (Pro Git Book):} \\ \url{https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain} + \item \textbf{RFC 822 (Internet Message Format):} \\ \url{https://tools.ietf.org/html/rfc822} + \item \textbf{AES-GCM (NIST SP 800-38D):} \\ \url{https://csrc.nist.gov/publications/detail/sp/800-38d/final} +\end{enumerate} \ No newline at end of file diff --git a/node_modules/.bin/esbuild b/node_modules/.bin/esbuild deleted file mode 120000 index c83ac07..0000000 --- a/node_modules/.bin/esbuild +++ /dev/null @@ -1 +0,0 @@ -../esbuild/bin/esbuild \ No newline at end of file diff --git a/node_modules/.bin/nanoid b/node_modules/.bin/nanoid deleted file mode 120000 index e2be547..0000000 --- a/node_modules/.bin/nanoid +++ /dev/null @@ -1 +0,0 @@ -../nanoid/bin/nanoid.cjs \ No newline at end of file diff --git a/node_modules/.bin/rollup b/node_modules/.bin/rollup deleted file mode 120000 index 5939621..0000000 --- a/node_modules/.bin/rollup +++ /dev/null @@ -1 +0,0 @@ -../rollup/dist/bin/rollup \ No newline at end of file diff --git a/node_modules/.bin/vite b/node_modules/.bin/vite deleted file mode 120000 index 6d1e3be..0000000 --- a/node_modules/.bin/vite +++ /dev/null @@ -1 +0,0 @@ -../vite/bin/vite.js \ No newline at end of file diff --git a/node_modules/.bin/vitest b/node_modules/.bin/vitest deleted file mode 120000 index 2273497..0000000 --- a/node_modules/.bin/vitest +++ /dev/null @@ -1 +0,0 @@ -../vitest/vitest.mjs \ No newline at end of file diff --git a/node_modules/.bin/why-is-node-running b/node_modules/.bin/why-is-node-running deleted file mode 120000 index f08a594..0000000 --- a/node_modules/.bin/why-is-node-running +++ /dev/null @@ -1 +0,0 @@ -../why-is-node-running/cli.js \ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json deleted file mode 100644 index e3ca308..0000000 --- a/node_modules/.package-lock.json +++ /dev/null @@ -1,762 +0,0 @@ -{ - "name": "git-cms", - "version": "1.0.0", - "lockfileVersion": 3, - "requires": true, - "packages": { - "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", - "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=18" - } - }, - "node_modules/@jridgewell/sourcemap-codec": { - "version": "1.5.5", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz", - "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==", - "dev": true, - "license": "MIT" - }, - "node_modules/@playwright/test": { - "version": "1.57.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.57.0.tgz", - "integrity": "sha512-6TyEnHgd6SArQO8UO2OMTxshln3QMWBtPGrOCgs3wVEmQmwyuNtB10IZMfmYDE0riwNR1cu4q+pPcxMVtaG3TA==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "playwright": "1.57.0" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.55.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.1.tgz", - "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@standard-schema/spec": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.1.0.tgz", - "integrity": "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/chai": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", - "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/deep-eql": "*", - "assertion-error": "^2.0.1" - } - }, - "node_modules/@types/deep-eql": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", - "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/estree": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", - "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", - "dev": true, - "license": "MIT" - }, - "node_modules/@vitest/expect": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-4.0.16.tgz", - "integrity": "sha512-eshqULT2It7McaJkQGLkPjPjNph+uevROGuIMJdG3V+0BSR2w9u6J9Lwu+E8cK5TETlfou8GRijhafIMhXsimA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@standard-schema/spec": "^1.0.0", - "@types/chai": "^5.2.2", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", - "chai": "^6.2.1", - "tinyrainbow": "^3.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/mocker": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-4.0.16.tgz", - "integrity": "sha512-yb6k4AZxJTB+q9ycAvsoxGn+j/po0UaPgajllBgt1PzoMAAmJGYFdDk0uCcRcxb3BrME34I6u8gHZTQlkqSZpg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "4.0.16", - "estree-walker": "^3.0.3", - "magic-string": "^0.30.21" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^6.0.0 || ^7.0.0-0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } - } - }, - "node_modules/@vitest/pretty-format": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-4.0.16.tgz", - "integrity": "sha512-eNCYNsSty9xJKi/UdVD8Ou16alu7AYiS2fCPRs0b1OdhJiV89buAXQLpTbe+X8V9L6qrs9CqyvU7OaAopJYPsA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyrainbow": "^3.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-4.0.16.tgz", - "integrity": "sha512-VWEDm5Wv9xEo80ctjORcTQRJ539EGPB3Pb9ApvVRAY1U/WkHXmmYISqU5E79uCwcW7xYUV38gwZD+RV755fu3Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/utils": "4.0.16", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-4.0.16.tgz", - "integrity": "sha512-sf6NcrYhYBsSYefxnry+DR8n3UV4xWZwWxYbCJUt2YdvtqzSPR7VfGrY0zsv090DAbjFZsi7ZaMi1KnSRyK1XA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "4.0.16", - "magic-string": "^0.30.21", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/spy": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-4.0.16.tgz", - "integrity": "sha512-4jIOWjKP0ZUaEmJm00E0cOBLU+5WE0BpeNr3XN6TEF05ltro6NJqHWxXD0kA8/Zc8Nh23AT8WQxwNG+WeROupw==", - "dev": true, - "license": "MIT", - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-4.0.16.tgz", - "integrity": "sha512-h8z9yYhV3e1LEfaQ3zdypIrnAg/9hguReGZoS7Gl0aBG5xgA410zBqECqmaF/+RkTggRsfnzc1XaAHA6bmUufA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "4.0.16", - "tinyrainbow": "^3.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, - "node_modules/chai": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-6.2.2.tgz", - "integrity": "sha512-NUPRluOfOiTKBKvWPtSD4PhFvWCqOi0BGStNWs57X9js7XGTprSmFoz5F0tWhR4WPjNeR9jXqdC7/UpSJTnlRg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "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.27.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", - "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.2", - "@esbuild/android-arm": "0.27.2", - "@esbuild/android-arm64": "0.27.2", - "@esbuild/android-x64": "0.27.2", - "@esbuild/darwin-arm64": "0.27.2", - "@esbuild/darwin-x64": "0.27.2", - "@esbuild/freebsd-arm64": "0.27.2", - "@esbuild/freebsd-x64": "0.27.2", - "@esbuild/linux-arm": "0.27.2", - "@esbuild/linux-arm64": "0.27.2", - "@esbuild/linux-ia32": "0.27.2", - "@esbuild/linux-loong64": "0.27.2", - "@esbuild/linux-mips64el": "0.27.2", - "@esbuild/linux-ppc64": "0.27.2", - "@esbuild/linux-riscv64": "0.27.2", - "@esbuild/linux-s390x": "0.27.2", - "@esbuild/linux-x64": "0.27.2", - "@esbuild/netbsd-arm64": "0.27.2", - "@esbuild/netbsd-x64": "0.27.2", - "@esbuild/openbsd-arm64": "0.27.2", - "@esbuild/openbsd-x64": "0.27.2", - "@esbuild/openharmony-arm64": "0.27.2", - "@esbuild/sunos-x64": "0.27.2", - "@esbuild/win32-arm64": "0.27.2", - "@esbuild/win32-ia32": "0.27.2", - "@esbuild/win32-x64": "0.27.2" - } - }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, - "node_modules/expect-type": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz", - "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/fdir": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", - "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/fsevents": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", - "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/magic-string": { - "version": "0.30.21", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz", - "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - } - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/obug": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/obug/-/obug-2.1.1.tgz", - "integrity": "sha512-uTqF9MuPraAQ+IsnPf366RG4cP9RtUi7MLO1N3KEc+wb0a6yKpeL0lmk2IB1jY5KHPAlTc6T/JRdC/YqxHNwkQ==", - "dev": true, - "funding": [ - "https://github.com/sponsors/sxzz", - "https://opencollective.com/debug" - ], - "license": "MIT" - }, - "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/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "peer": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/playwright": { - "version": "1.57.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz", - "integrity": "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==", - "dev": true, - "license": "Apache-2.0", - "dependencies": { - "playwright-core": "1.57.0" - }, - "bin": { - "playwright": "cli.js" - }, - "engines": { - "node": ">=18" - }, - "optionalDependencies": { - "fsevents": "2.3.2" - } - }, - "node_modules/playwright-core": { - "version": "1.57.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.57.0.tgz", - "integrity": "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "playwright-core": "cli.js" - }, - "engines": { - "node": ">=18" - } - }, - "node_modules/playwright/node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, - "node_modules/rollup": { - "version": "4.55.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.1.tgz", - "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.55.1", - "@rollup/rollup-android-arm64": "4.55.1", - "@rollup/rollup-darwin-arm64": "4.55.1", - "@rollup/rollup-darwin-x64": "4.55.1", - "@rollup/rollup-freebsd-arm64": "4.55.1", - "@rollup/rollup-freebsd-x64": "4.55.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.55.1", - "@rollup/rollup-linux-arm-musleabihf": "4.55.1", - "@rollup/rollup-linux-arm64-gnu": "4.55.1", - "@rollup/rollup-linux-arm64-musl": "4.55.1", - "@rollup/rollup-linux-loong64-gnu": "4.55.1", - "@rollup/rollup-linux-loong64-musl": "4.55.1", - "@rollup/rollup-linux-ppc64-gnu": "4.55.1", - "@rollup/rollup-linux-ppc64-musl": "4.55.1", - "@rollup/rollup-linux-riscv64-gnu": "4.55.1", - "@rollup/rollup-linux-riscv64-musl": "4.55.1", - "@rollup/rollup-linux-s390x-gnu": "4.55.1", - "@rollup/rollup-linux-x64-gnu": "4.55.1", - "@rollup/rollup-linux-x64-musl": "4.55.1", - "@rollup/rollup-openbsd-x64": "4.55.1", - "@rollup/rollup-openharmony-arm64": "4.55.1", - "@rollup/rollup-win32-arm64-msvc": "4.55.1", - "@rollup/rollup-win32-ia32-msvc": "4.55.1", - "@rollup/rollup-win32-x64-gnu": "4.55.1", - "@rollup/rollup-win32-x64-msvc": "4.55.1", - "fsevents": "~2.3.2" - } - }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true, - "license": "ISC" - }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true, - "license": "MIT" - }, - "node_modules/std-env": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz", - "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinybench": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", - "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyexec": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", - "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=18" - } - }, - "node_modules/tinyglobby": { - "version": "0.2.15", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", - "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.5.0", - "picomatch": "^4.0.3" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tinyrainbow": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-3.0.3.tgz", - "integrity": "sha512-PSkbLUoxOFRzJYjjxHJt9xro7D+iilgMX/C9lawzVuYiIdcihh9DXmVibBe8lmcFrRi/VzlPjBxbN7rH24q8/Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/vite": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.0.tgz", - "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", - "dev": true, - "license": "MIT", - "peer": true, - "dependencies": { - "esbuild": "^0.27.0", - "fdir": "^6.5.0", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.43.0", - "tinyglobby": "^0.2.15" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vitest": { - "version": "4.0.16", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-4.0.16.tgz", - "integrity": "sha512-E4t7DJ9pESL6E3I8nFjPa4xGUd3PmiWDLsDztS2qXSJWfHtbQnwAWylaBvSNY48I3vr8PTqIZlyK8TE3V3CA4Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/expect": "4.0.16", - "@vitest/mocker": "4.0.16", - "@vitest/pretty-format": "4.0.16", - "@vitest/runner": "4.0.16", - "@vitest/snapshot": "4.0.16", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16", - "es-module-lexer": "^1.7.0", - "expect-type": "^1.2.2", - "magic-string": "^0.30.21", - "obug": "^2.1.1", - "pathe": "^2.0.3", - "picomatch": "^4.0.3", - "std-env": "^3.10.0", - "tinybench": "^2.9.0", - "tinyexec": "^1.0.2", - "tinyglobby": "^0.2.15", - "tinyrainbow": "^3.0.3", - "vite": "^6.0.0 || ^7.0.0", - "why-is-node-running": "^2.3.0" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": "^20.0.0 || ^22.0.0 || >=24.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@opentelemetry/api": "^1.9.0", - "@types/node": "^20.0.0 || ^22.0.0 || >=24.0.0", - "@vitest/browser-playwright": "4.0.16", - "@vitest/browser-preview": "4.0.16", - "@vitest/browser-webdriverio": "4.0.16", - "@vitest/ui": "4.0.16", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@opentelemetry/api": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser-playwright": { - "optional": true - }, - "@vitest/browser-preview": { - "optional": true - }, - "@vitest/browser-webdriverio": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } - } - }, - "node_modules/why-is-node-running": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", - "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", - "dev": true, - "license": "MIT", - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - } - } -} diff --git a/node_modules/@esbuild/darwin-arm64/README.md b/node_modules/@esbuild/darwin-arm64/README.md deleted file mode 100644 index c2c0398..0000000 --- a/node_modules/@esbuild/darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# esbuild - -This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/node_modules/@esbuild/darwin-arm64/bin/esbuild b/node_modules/@esbuild/darwin-arm64/bin/esbuild deleted file mode 100755 index 8935f40..0000000 Binary files a/node_modules/@esbuild/darwin-arm64/bin/esbuild and /dev/null differ diff --git a/node_modules/@esbuild/darwin-arm64/package.json b/node_modules/@esbuild/darwin-arm64/package.json deleted file mode 100644 index d4d3c9f..0000000 --- a/node_modules/@esbuild/darwin-arm64/package.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "@esbuild/darwin-arm64", - "version": "0.27.2", - "description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.", - "repository": { - "type": "git", - "url": "git+https://github.com/evanw/esbuild.git" - }, - "license": "MIT", - "preferUnplugged": true, - "engines": { - "node": ">=18" - }, - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ] -} diff --git a/node_modules/@jridgewell/sourcemap-codec/LICENSE b/node_modules/@jridgewell/sourcemap-codec/LICENSE deleted file mode 100644 index 1f6ce94..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2024 Justin Ridgewell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@jridgewell/sourcemap-codec/README.md b/node_modules/@jridgewell/sourcemap-codec/README.md deleted file mode 100644 index b3e0708..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/README.md +++ /dev/null @@ -1,264 +0,0 @@ -# @jridgewell/sourcemap-codec - -Encode/decode the `mappings` property of a [sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). - - -## Why? - -Sourcemaps are difficult to generate and manipulate, because the `mappings` property – the part that actually links the generated code back to the original source – is encoded using an obscure method called [Variable-length quantity](https://en.wikipedia.org/wiki/Variable-length_quantity). On top of that, each segment in the mapping contains offsets rather than absolute indices, which means that you can't look at a segment in isolation – you have to understand the whole sourcemap. - -This package makes the process slightly easier. - - -## Installation - -```bash -npm install @jridgewell/sourcemap-codec -``` - - -## Usage - -```js -import { encode, decode } from '@jridgewell/sourcemap-codec'; - -var decoded = decode( ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); - -assert.deepEqual( decoded, [ - // the first line (of the generated code) has no mappings, - // as shown by the starting semi-colon (which separates lines) - [], - - // the second line contains four (comma-separated) segments - [ - // segments are encoded as you'd expect: - // [ generatedCodeColumn, sourceIndex, sourceCodeLine, sourceCodeColumn, nameIndex ] - - // i.e. the first segment begins at column 2, and maps back to the second column - // of the second line (both zero-based) of the 0th source, and uses the 0th - // name in the `map.names` array - [ 2, 0, 2, 2, 0 ], - - // the remaining segments are 4-length rather than 5-length, - // because they don't map a name - [ 4, 0, 2, 4 ], - [ 6, 0, 2, 5 ], - [ 7, 0, 2, 7 ] - ], - - // the final line contains two segments - [ - [ 2, 1, 10, 19 ], - [ 12, 1, 11, 20 ] - ] -]); - -var encoded = encode( decoded ); -assert.equal( encoded, ';EAEEA,EAAE,EAAC,CAAE;ECQY,UACC' ); -``` - -## Benchmarks - -``` -node v20.10.0 - -amp.js.map - 45120 segments - -Decode Memory Usage: -local code 5815135 bytes -@jridgewell/sourcemap-codec 1.4.15 5868160 bytes -sourcemap-codec 5492584 bytes -source-map-0.6.1 13569984 bytes -source-map-0.8.0 6390584 bytes -chrome dev tools 8011136 bytes -Smallest memory usage is sourcemap-codec - -Decode speed: -decode: local code x 492 ops/sec ±1.22% (90 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 499 ops/sec ±1.16% (89 runs sampled) -decode: sourcemap-codec x 376 ops/sec ±1.66% (89 runs sampled) -decode: source-map-0.6.1 x 34.99 ops/sec ±0.94% (48 runs sampled) -decode: source-map-0.8.0 x 351 ops/sec ±0.07% (95 runs sampled) -chrome dev tools x 165 ops/sec ±0.91% (86 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 444248 bytes -@jridgewell/sourcemap-codec 1.4.15 623024 bytes -sourcemap-codec 8696280 bytes -source-map-0.6.1 8745176 bytes -source-map-0.8.0 8736624 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 796 ops/sec ±0.11% (97 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 795 ops/sec ±0.25% (98 runs sampled) -encode: sourcemap-codec x 231 ops/sec ±0.83% (86 runs sampled) -encode: source-map-0.6.1 x 166 ops/sec ±0.57% (86 runs sampled) -encode: source-map-0.8.0 x 203 ops/sec ±0.45% (88 runs sampled) -Fastest is encode: local code,encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -babel.min.js.map - 347793 segments - -Decode Memory Usage: -local code 35424960 bytes -@jridgewell/sourcemap-codec 1.4.15 35424696 bytes -sourcemap-codec 36033464 bytes -source-map-0.6.1 62253704 bytes -source-map-0.8.0 43843920 bytes -chrome dev tools 45111400 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Decode speed: -decode: local code x 38.18 ops/sec ±5.44% (52 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 38.36 ops/sec ±5.02% (52 runs sampled) -decode: sourcemap-codec x 34.05 ops/sec ±4.45% (47 runs sampled) -decode: source-map-0.6.1 x 4.31 ops/sec ±2.76% (15 runs sampled) -decode: source-map-0.8.0 x 55.60 ops/sec ±0.13% (73 runs sampled) -chrome dev tools x 16.94 ops/sec ±3.78% (46 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 2606016 bytes -@jridgewell/sourcemap-codec 1.4.15 2626440 bytes -sourcemap-codec 21152576 bytes -source-map-0.6.1 25023928 bytes -source-map-0.8.0 25256448 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 127 ops/sec ±0.18% (83 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 128 ops/sec ±0.26% (83 runs sampled) -encode: sourcemap-codec x 29.31 ops/sec ±2.55% (53 runs sampled) -encode: source-map-0.6.1 x 18.85 ops/sec ±3.19% (36 runs sampled) -encode: source-map-0.8.0 x 19.34 ops/sec ±1.97% (36 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 - - -*** - - -preact.js.map - 1992 segments - -Decode Memory Usage: -local code 261696 bytes -@jridgewell/sourcemap-codec 1.4.15 244296 bytes -sourcemap-codec 302816 bytes -source-map-0.6.1 939176 bytes -source-map-0.8.0 336 bytes -chrome dev tools 587368 bytes -Smallest memory usage is source-map-0.8.0 - -Decode speed: -decode: local code x 17,782 ops/sec ±0.32% (97 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 17,863 ops/sec ±0.40% (100 runs sampled) -decode: sourcemap-codec x 12,453 ops/sec ±0.27% (101 runs sampled) -decode: source-map-0.6.1 x 1,288 ops/sec ±1.05% (96 runs sampled) -decode: source-map-0.8.0 x 9,289 ops/sec ±0.27% (101 runs sampled) -chrome dev tools x 4,769 ops/sec ±0.18% (100 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 262944 bytes -@jridgewell/sourcemap-codec 1.4.15 25544 bytes -sourcemap-codec 323048 bytes -source-map-0.6.1 507808 bytes -source-map-0.8.0 507480 bytes -Smallest memory usage is @jridgewell/sourcemap-codec 1.4.15 - -Encode speed: -encode: local code x 24,207 ops/sec ±0.79% (95 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 24,288 ops/sec ±0.48% (96 runs sampled) -encode: sourcemap-codec x 6,761 ops/sec ±0.21% (100 runs sampled) -encode: source-map-0.6.1 x 5,374 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 5,633 ops/sec ±0.32% (99 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15,encode: local code - - -*** - - -react.js.map - 5726 segments - -Decode Memory Usage: -local code 678816 bytes -@jridgewell/sourcemap-codec 1.4.15 678816 bytes -sourcemap-codec 816400 bytes -source-map-0.6.1 2288864 bytes -source-map-0.8.0 721360 bytes -chrome dev tools 1012512 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 6,178 ops/sec ±0.19% (98 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 6,261 ops/sec ±0.22% (100 runs sampled) -decode: sourcemap-codec x 4,472 ops/sec ±0.90% (99 runs sampled) -decode: source-map-0.6.1 x 449 ops/sec ±0.31% (95 runs sampled) -decode: source-map-0.8.0 x 3,219 ops/sec ±0.13% (100 runs sampled) -chrome dev tools x 1,743 ops/sec ±0.20% (99 runs sampled) -Fastest is decode: @jridgewell/sourcemap-codec 1.4.15 - -Encode Memory Usage: -local code 140960 bytes -@jridgewell/sourcemap-codec 1.4.15 159808 bytes -sourcemap-codec 969304 bytes -source-map-0.6.1 930520 bytes -source-map-0.8.0 930248 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 8,013 ops/sec ±0.19% (100 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 7,989 ops/sec ±0.20% (101 runs sampled) -encode: sourcemap-codec x 2,472 ops/sec ±0.21% (99 runs sampled) -encode: source-map-0.6.1 x 2,200 ops/sec ±0.17% (99 runs sampled) -encode: source-map-0.8.0 x 2,220 ops/sec ±0.37% (99 runs sampled) -Fastest is encode: local code - - -*** - - -vscode.map - 2141001 segments - -Decode Memory Usage: -local code 198955264 bytes -@jridgewell/sourcemap-codec 1.4.15 199175352 bytes -sourcemap-codec 199102688 bytes -source-map-0.6.1 386323432 bytes -source-map-0.8.0 244116432 bytes -chrome dev tools 293734280 bytes -Smallest memory usage is local code - -Decode speed: -decode: local code x 3.90 ops/sec ±22.21% (15 runs sampled) -decode: @jridgewell/sourcemap-codec 1.4.15 x 3.95 ops/sec ±23.53% (15 runs sampled) -decode: sourcemap-codec x 3.82 ops/sec ±17.94% (14 runs sampled) -decode: source-map-0.6.1 x 0.61 ops/sec ±7.81% (6 runs sampled) -decode: source-map-0.8.0 x 9.54 ops/sec ±0.28% (28 runs sampled) -chrome dev tools x 2.18 ops/sec ±10.58% (10 runs sampled) -Fastest is decode: source-map-0.8.0 - -Encode Memory Usage: -local code 13509880 bytes -@jridgewell/sourcemap-codec 1.4.15 13537648 bytes -sourcemap-codec 32540104 bytes -source-map-0.6.1 127531040 bytes -source-map-0.8.0 127535312 bytes -Smallest memory usage is local code - -Encode speed: -encode: local code x 20.10 ops/sec ±0.19% (38 runs sampled) -encode: @jridgewell/sourcemap-codec 1.4.15 x 20.26 ops/sec ±0.32% (38 runs sampled) -encode: sourcemap-codec x 5.44 ops/sec ±1.64% (18 runs sampled) -encode: source-map-0.6.1 x 2.30 ops/sec ±4.79% (10 runs sampled) -encode: source-map-0.8.0 x 2.46 ops/sec ±6.53% (10 runs sampled) -Fastest is encode: @jridgewell/sourcemap-codec 1.4.15 -``` - -# License - -MIT diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs deleted file mode 100644 index 532bab3..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +++ /dev/null @@ -1,423 +0,0 @@ -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -export { - decode, - decodeGeneratedRanges, - decodeOriginalScopes, - encode, - encodeGeneratedRanges, - encodeOriginalScopes -}; -//# sourceMappingURL=sourcemap-codec.mjs.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map deleted file mode 100644 index c276844..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts", "../src/sourcemap-codec.ts"], - "mappings": ";AAEO,IAAM,QAAQ,IAAI,WAAW,CAAC;AAC9B,IAAM,YAAY,IAAI,WAAW,CAAC;AAEzC,IAAM,QAAQ;AACd,IAAM,YAAY,IAAI,WAAW,EAAE;AACnC,IAAM,YAAY,IAAI,WAAW,GAAG;AAEpC,SAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,YAAU,CAAC,IAAI;AACf,YAAU,CAAC,IAAI;AACjB;AAEO,SAAS,cAAc,QAAsB,UAA0B;AAC5E,MAAI,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AI;AACjB,WAAO,MAAM,OAAO;AAAA,EACtB,SAAS,OAAO,OAAO;AAEvB,SAAO;AACT;AAEA,SAAS,KAAK,MAA0B;AACtC,OAAK,KAAK,cAAc;AAC1B;AAEA,SAAS,eAAe,GAAqB,GAA6B;AACxE,SAAO,EAAE,CAAC,IAAI,EAAE,CAAC;AACnB;AAIO,SAAS,OAAO,SAA8C;AACnE,QAAM,SAAS,IAAI,aAAa;AAChC,MAAI,eAAe;AACnB,MAAI,aAAa;AACjB,MAAI,eAAe;AACnB,MAAI,aAAa;AAEjB,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;AACvC,UAAM,OAAO,QAAQ,CAAC;AACtB,QAAI,IAAI,EAAG,QAAO,MAAM,SAAS;AACjC,QAAI,KAAK,WAAW,EAAG;AAEvB,QAAI,YAAY;AAEhB,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,YAAM,UAAU,KAAK,CAAC;AACtB,UAAI,IAAI,EAAG,QAAO,MAAM,KAAK;AAE7B,kBAAY,cAAc,QAAQ,QAAQ,CAAC,GAAG,SAAS;AAEvD,UAAI,QAAQ,WAAW,EAAG;AAC1B,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAC7D,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AACzD,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAE7D,UAAI,QAAQ,WAAW,EAAG;AAC1B,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AACtB;", - "names": [] -} diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js deleted file mode 100644 index 2d8e459..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +++ /dev/null @@ -1,464 +0,0 @@ -(function (global, factory) { - if (typeof exports === 'object' && typeof module !== 'undefined') { - factory(module); - module.exports = def(module); - } else if (typeof define === 'function' && define.amd) { - define(['module'], function(mod) { - factory.apply(this, arguments); - mod.exports = def(mod); - }); - } else { - const mod = { exports: {} }; - factory(mod); - global = typeof globalThis !== 'undefined' ? globalThis : global || self; - global.sourcemapCodec = def(mod); - } - function def(m) { return 'default' in m.exports ? m.exports.default : m.exports; } -})(this, (function (module) { -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/sourcemap-codec.ts -var sourcemap_codec_exports = {}; -__export(sourcemap_codec_exports, { - decode: () => decode, - decodeGeneratedRanges: () => decodeGeneratedRanges, - decodeOriginalScopes: () => decodeOriginalScopes, - encode: () => encode, - encodeGeneratedRanges: () => encodeGeneratedRanges, - encodeOriginalScopes: () => encodeOriginalScopes -}); -module.exports = __toCommonJS(sourcemap_codec_exports); - -// src/vlq.ts -var comma = ",".charCodeAt(0); -var semicolon = ";".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} - -// src/strings.ts -var bufLength = 1024 * 16; -var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } -} : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } -}; -var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -}; -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/scopes.ts -var EMPTY = []; -function decodeOriginalScopes(input) { - const { length } = input; - const reader = new StringReader(input); - const scopes = []; - const stack = []; - let line = 0; - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - if (!hasMoreVlq(reader, length)) { - const last = stack.pop(); - last[2] = line; - last[3] = column; - continue; - } - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 1; - const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind]; - let vars = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - scopes.push(scope); - stack.push(scope); - } - return scopes; -} -function encodeOriginalScopes(scopes) { - const writer = new StringWriter(); - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - return writer.flush(); -} -function _encodeOriginalScopes(scopes, index, writer, state) { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - if (index > 0) writer.write(comma); - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - const fields = scope.length === 6 ? 1 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - for (const v of vars) { - encodeInteger(writer, v, 0); - } - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - return index; -} -function decodeGeneratedRanges(input) { - const { length } = input; - const reader = new StringReader(input); - const ranges = []; - const stack = []; - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - do { - const semi = reader.indexOf(";"); - let genColumn = 0; - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop(); - last[2] = genLine; - last[3] = genColumn; - continue; - } - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 1; - const hasCallsite = fields & 2; - const hasScope = fields & 4; - let callsite = null; - let bindings = EMPTY; - let range; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0 - ); - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex]; - } else { - range = [genLine, genColumn, 0, 0]; - } - range.isScope = !!hasScope; - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0 - ); - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - ranges.push(range); - stack.push(range); - } - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - return ranges; -} -function encodeGeneratedRanges(ranges) { - if (ranges.length === 0) return ""; - const writer = new StringWriter(); - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - return writer.flush(); -} -function _encodeGeneratedRanges(ranges, index, writer, state) { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings - } = range; - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - state[1] = encodeInteger(writer, range[1], state[1]); - const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0); - encodeInteger(writer, fields, 0); - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn); - encodeInteger(writer, expRange[0], 0); - } - } - } - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || l === endLine && c >= endColumn) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - return index; -} -function catchupLine(writer, lastLine, line) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} -function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); -} -})); -//# sourceMappingURL=sourcemap-codec.umd.js.map diff --git a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map b/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map deleted file mode 100644 index abc18d2..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 3, - "sources": ["../src/sourcemap-codec.ts", "../src/vlq.ts", "../src/strings.ts", "../src/scopes.ts"], - "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACEO,IAAM,QAAQ,IAAI,WAAW,CAAC;AAC9B,IAAM,YAAY,IAAI,WAAW,CAAC;AAEzC,IAAM,QAAQ;AACd,IAAM,YAAY,IAAI,WAAW,EAAE;AACnC,IAAM,YAAY,IAAI,WAAW,GAAG;AAEpC,SAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,QAAM,IAAI,MAAM,WAAW,CAAC;AAC5B,YAAU,CAAC,IAAI;AACf,YAAU,CAAC,IAAI;AACjB;AAEO,SAAS,cAAc,QAAsB,UAA0B;AAC5E,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,MAAI,UAAU;AAEd,KAAG;AACD,UAAM,IAAI,OAAO,KAAK;AACtB,cAAU,UAAU,CAAC;AACrB,cAAU,UAAU,OAAO;AAC3B,aAAS;AAAA,EACX,SAAS,UAAU;AAEnB,QAAM,eAAe,QAAQ;AAC7B,aAAW;AAEX,MAAI,cAAc;AAChB,YAAQ,cAAc,CAAC;AAAA,EACzB;AAEA,SAAO,WAAW;AACpB;AAEO,SAAS,cAAc,SAAuB,KAAa,UAA0B;AAC1F,MAAI,QAAQ,MAAM;AAElB,UAAQ,QAAQ,IAAK,CAAC,SAAS,IAAK,IAAI,SAAS;AACjD,KAAG;AACD,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B,QAAI,IAAI,EAAG,QAAO,MAAM,SAAS;AACjC,QAAI,KAAK,WAAW,EAAG;AAEvB,QAAI,YAAY;AAEhB,aAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,KAAK;AACpC,YAAM,UAAU,KAAK,CAAC;AACtB,UAAI,IAAI,EAAG,QAAO,MAAM,KAAK;AAE7B,kBAAY,cAAc,QAAQ,QAAQ,CAAC,GAAG,SAAS;AAEvD,UAAI,QAAQ,WAAW,EAAG;AAC1B,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAC7D,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AACzD,qBAAe,cAAc,QAAQ,QAAQ,CAAC,GAAG,YAAY;AAE7D,UAAI,QAAQ,WAAW,EAAG;AAC1B,mBAAa,cAAc,QAAQ,QAAQ,CAAC,GAAG,UAAU;AAAA,IAC3D;AAAA,EACF;AAEA,SAAO,OAAO,MAAM;AACtB;", - "names": [] -} diff --git a/node_modules/@jridgewell/sourcemap-codec/package.json b/node_modules/@jridgewell/sourcemap-codec/package.json deleted file mode 100644 index da55137..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "@jridgewell/sourcemap-codec", - "version": "1.5.5", - "description": "Encode/decode sourcemap mappings", - "keywords": [ - "sourcemap", - "vlq" - ], - "main": "dist/sourcemap-codec.umd.js", - "module": "dist/sourcemap-codec.mjs", - "types": "types/sourcemap-codec.d.cts", - "files": [ - "dist", - "src", - "types" - ], - "exports": { - ".": [ - { - "import": { - "types": "./types/sourcemap-codec.d.mts", - "default": "./dist/sourcemap-codec.mjs" - }, - "default": { - "types": "./types/sourcemap-codec.d.cts", - "default": "./dist/sourcemap-codec.umd.js" - } - }, - "./dist/sourcemap-codec.umd.js" - ], - "./package.json": "./package.json" - }, - "scripts": { - "benchmark": "run-s build:code benchmark:*", - "benchmark:install": "cd benchmark && npm install", - "benchmark:only": "node --expose-gc benchmark/index.js", - "build": "run-s -n build:code build:types", - "build:code": "node ../../esbuild.mjs sourcemap-codec.ts", - "build:types": "run-s build:types:force build:types:emit build:types:mts", - "build:types:force": "rimraf tsconfig.build.tsbuildinfo", - "build:types:emit": "tsc --project tsconfig.build.json", - "build:types:mts": "node ../../mts-types.mjs", - "clean": "run-s -n clean:code clean:types", - "clean:code": "tsc --build --clean tsconfig.build.json", - "clean:types": "rimraf dist types", - "test": "run-s -n test:types test:only test:format", - "test:format": "prettier --check '{src,test}/**/*.ts'", - "test:only": "mocha", - "test:types": "eslint '{src,test}/**/*.ts'", - "lint": "run-s -n lint:types lint:format", - "lint:format": "npm run test:format -- --write", - "lint:types": "npm run test:types -- --fix", - "prepublishOnly": "npm run-s -n build test" - }, - "homepage": "https://github.com/jridgewell/sourcemaps/tree/main/packages/sourcemap-codec", - "repository": { - "type": "git", - "url": "git+https://github.com/jridgewell/sourcemaps.git", - "directory": "packages/sourcemap-codec" - }, - "author": "Justin Ridgewell ", - "license": "MIT" -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts b/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts deleted file mode 100644 index d194c2f..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts +++ /dev/null @@ -1,345 +0,0 @@ -import { StringReader, StringWriter } from './strings'; -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; - -const EMPTY: any[] = []; - -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; - -type Mix = (A & O) | (B & O); - -export type OriginalScope = Mix< - [Line, Column, Line, Column, Kind], - [Line, Column, Line, Column, Kind, Name], - { vars: Var[] } ->; - -export type GeneratedRange = Mix< - [Line, Column, Line, Column], - [Line, Column, Line, Column, SourcesIndex, ScopesIndex], - { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; - } ->; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; - -export function decodeOriginalScopes(input: string): OriginalScope[] { - const { length } = input; - const reader = new StringReader(input); - const scopes: OriginalScope[] = []; - const stack: OriginalScope[] = []; - let line = 0; - - for (; reader.pos < length; reader.pos++) { - line = decodeInteger(reader, line); - const column = decodeInteger(reader, 0); - - if (!hasMoreVlq(reader, length)) { - const last = stack.pop()!; - last[2] = line; - last[3] = column; - continue; - } - - const kind = decodeInteger(reader, 0); - const fields = decodeInteger(reader, 0); - const hasName = fields & 0b0001; - - const scope: OriginalScope = ( - hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind] - ) as OriginalScope; - - let vars: Var[] = EMPTY; - if (hasMoreVlq(reader, length)) { - vars = []; - do { - const varsIndex = decodeInteger(reader, 0); - vars.push(varsIndex); - } while (hasMoreVlq(reader, length)); - } - scope.vars = vars; - - scopes.push(scope); - stack.push(scope); - } - - return scopes; -} - -export function encodeOriginalScopes(scopes: OriginalScope[]): string { - const writer = new StringWriter(); - - for (let i = 0; i < scopes.length; ) { - i = _encodeOriginalScopes(scopes, i, writer, [0]); - } - - return writer.flush(); -} - -function _encodeOriginalScopes( - scopes: OriginalScope[], - index: number, - writer: StringWriter, - state: [ - number, // GenColumn - ], -): number { - const scope = scopes[index]; - const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope; - - if (index > 0) writer.write(comma); - - state[0] = encodeInteger(writer, startLine, state[0]); - encodeInteger(writer, startColumn, 0); - encodeInteger(writer, kind, 0); - - const fields = scope.length === 6 ? 0b0001 : 0; - encodeInteger(writer, fields, 0); - if (scope.length === 6) encodeInteger(writer, scope[5], 0); - - for (const v of vars) { - encodeInteger(writer, v, 0); - } - - for (index++; index < scopes.length; ) { - const next = scopes[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeOriginalScopes(scopes, index, writer, state); - } - - writer.write(comma); - state[0] = encodeInteger(writer, endLine, state[0]); - encodeInteger(writer, endColumn, 0); - - return index; -} - -export function decodeGeneratedRanges(input: string): GeneratedRange[] { - const { length } = input; - const reader = new StringReader(input); - const ranges: GeneratedRange[] = []; - const stack: GeneratedRange[] = []; - - let genLine = 0; - let definitionSourcesIndex = 0; - let definitionScopeIndex = 0; - let callsiteSourcesIndex = 0; - let callsiteLine = 0; - let callsiteColumn = 0; - let bindingLine = 0; - let bindingColumn = 0; - - do { - const semi = reader.indexOf(';'); - let genColumn = 0; - - for (; reader.pos < semi; reader.pos++) { - genColumn = decodeInteger(reader, genColumn); - - if (!hasMoreVlq(reader, semi)) { - const last = stack.pop()!; - last[2] = genLine; - last[3] = genColumn; - continue; - } - - const fields = decodeInteger(reader, 0); - const hasDefinition = fields & 0b0001; - const hasCallsite = fields & 0b0010; - const hasScope = fields & 0b0100; - - let callsite: CallSite | null = null; - let bindings: Binding[] = EMPTY; - let range: GeneratedRange; - if (hasDefinition) { - const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex); - definitionScopeIndex = decodeInteger( - reader, - definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0, - ); - - definitionSourcesIndex = defSourcesIndex; - range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex] as GeneratedRange; - } else { - range = [genLine, genColumn, 0, 0] as GeneratedRange; - } - - range.isScope = !!hasScope; - - if (hasCallsite) { - const prevCsi = callsiteSourcesIndex; - const prevLine = callsiteLine; - callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex); - const sameSource = prevCsi === callsiteSourcesIndex; - callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0); - callsiteColumn = decodeInteger( - reader, - sameSource && prevLine === callsiteLine ? callsiteColumn : 0, - ); - - callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn]; - } - range.callsite = callsite; - - if (hasMoreVlq(reader, semi)) { - bindings = []; - do { - bindingLine = genLine; - bindingColumn = genColumn; - const expressionsCount = decodeInteger(reader, 0); - let expressionRanges: BindingExpressionRange[]; - if (expressionsCount < -1) { - expressionRanges = [[decodeInteger(reader, 0)]]; - for (let i = -1; i > expressionsCount; i--) { - const prevBl = bindingLine; - bindingLine = decodeInteger(reader, bindingLine); - bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0); - const expression = decodeInteger(reader, 0); - expressionRanges.push([expression, bindingLine, bindingColumn]); - } - } else { - expressionRanges = [[expressionsCount]]; - } - bindings.push(expressionRanges); - } while (hasMoreVlq(reader, semi)); - } - range.bindings = bindings; - - ranges.push(range); - stack.push(range); - } - - genLine++; - reader.pos = semi + 1; - } while (reader.pos < length); - - return ranges; -} - -export function encodeGeneratedRanges(ranges: GeneratedRange[]): string { - if (ranges.length === 0) return ''; - - const writer = new StringWriter(); - - for (let i = 0; i < ranges.length; ) { - i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]); - } - - return writer.flush(); -} - -function _encodeGeneratedRanges( - ranges: GeneratedRange[], - index: number, - writer: StringWriter, - state: [ - number, // GenLine - number, // GenColumn - number, // DefSourcesIndex - number, // DefScopesIndex - number, // CallSourcesIndex - number, // CallLine - number, // CallColumn - ], -): number { - const range = ranges[index]; - const { - 0: startLine, - 1: startColumn, - 2: endLine, - 3: endColumn, - isScope, - callsite, - bindings, - } = range; - - if (state[0] < startLine) { - catchupLine(writer, state[0], startLine); - state[0] = startLine; - state[1] = 0; - } else if (index > 0) { - writer.write(comma); - } - - state[1] = encodeInteger(writer, range[1], state[1]); - - const fields = - (range.length === 6 ? 0b0001 : 0) | (callsite ? 0b0010 : 0) | (isScope ? 0b0100 : 0); - encodeInteger(writer, fields, 0); - - if (range.length === 6) { - const { 4: sourcesIndex, 5: scopesIndex } = range; - if (sourcesIndex !== state[2]) { - state[3] = 0; - } - state[2] = encodeInteger(writer, sourcesIndex, state[2]); - state[3] = encodeInteger(writer, scopesIndex, state[3]); - } - - if (callsite) { - const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite!; - if (sourcesIndex !== state[4]) { - state[5] = 0; - state[6] = 0; - } else if (callLine !== state[5]) { - state[6] = 0; - } - state[4] = encodeInteger(writer, sourcesIndex, state[4]); - state[5] = encodeInteger(writer, callLine, state[5]); - state[6] = encodeInteger(writer, callColumn, state[6]); - } - - if (bindings) { - for (const binding of bindings) { - if (binding.length > 1) encodeInteger(writer, -binding.length, 0); - const expression = binding[0][0]; - encodeInteger(writer, expression, 0); - let bindingStartLine = startLine; - let bindingStartColumn = startColumn; - for (let i = 1; i < binding.length; i++) { - const expRange = binding[i]; - bindingStartLine = encodeInteger(writer, expRange[1]!, bindingStartLine); - bindingStartColumn = encodeInteger(writer, expRange[2]!, bindingStartColumn); - encodeInteger(writer, expRange[0]!, 0); - } - } - } - - for (index++; index < ranges.length; ) { - const next = ranges[index]; - const { 0: l, 1: c } = next; - if (l > endLine || (l === endLine && c >= endColumn)) { - break; - } - index = _encodeGeneratedRanges(ranges, index, writer, state); - } - - if (state[0] < endLine) { - catchupLine(writer, state[0], endLine); - state[0] = endLine; - state[1] = 0; - } else { - writer.write(comma); - } - state[1] = encodeInteger(writer, endColumn, state[1]); - - return index; -} - -function catchupLine(writer: StringWriter, lastLine: number, line: number) { - do { - writer.write(semicolon); - } while (++lastLine < line); -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts b/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts deleted file mode 100644 index a81f894..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { comma, decodeInteger, encodeInteger, hasMoreVlq, semicolon } from './vlq'; -import { StringWriter, StringReader } from './strings'; - -export { - decodeOriginalScopes, - encodeOriginalScopes, - decodeGeneratedRanges, - encodeGeneratedRanges, -} from './scopes'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes'; - -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; - -export function decode(mappings: string): SourceMapMappings { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded: SourceMapMappings = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - do { - const semi = reader.indexOf(';'); - const line: SourceMapLine = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - - while (reader.pos < semi) { - let seg: SourceMapSegment; - - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - - line.push(seg); - reader.pos++; - } - - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - - return decoded; -} - -function sort(line: SourceMapSegment[]) { - line.sort(sortComparator); -} - -function sortComparator(a: SourceMapSegment, b: SourceMapSegment): number { - return a[0] - b[0]; -} - -export function encode(decoded: SourceMapMappings): string; -export function encode(decoded: Readonly): string; -export function encode(decoded: Readonly): string { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - - let genColumn = 0; - - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - - genColumn = encodeInteger(writer, segment[0], genColumn); - - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - - return writer.flush(); -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/strings.ts b/node_modules/@jridgewell/sourcemap-codec/src/strings.ts deleted file mode 100644 index d161965..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/strings.ts +++ /dev/null @@ -1,65 +0,0 @@ -const bufLength = 1024 * 16; - -// Provide a fallback for older environments. -const td = - typeof TextDecoder !== 'undefined' - ? /* #__PURE__ */ new TextDecoder() - : typeof Buffer !== 'undefined' - ? { - decode(buf: Uint8Array): string { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - }, - } - : { - decode(buf: Uint8Array): string { - let out = ''; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - }, - }; - -export class StringWriter { - pos = 0; - private out = ''; - private buffer = new Uint8Array(bufLength); - - write(v: number): void { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - - flush(): string { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } -} - -export class StringReader { - pos = 0; - declare private buffer: string; - - constructor(buffer: string) { - this.buffer = buffer; - } - - next(): number { - return this.buffer.charCodeAt(this.pos++); - } - - peek(): number { - return this.buffer.charCodeAt(this.pos); - } - - indexOf(char: string): number { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -} diff --git a/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts b/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts deleted file mode 100644 index a42c681..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { StringReader, StringWriter } from './strings'; - -export const comma = ','.charCodeAt(0); -export const semicolon = ';'.charCodeAt(0); - -const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; -const intToChar = new Uint8Array(64); // 64 possible chars. -const charToInt = new Uint8Array(128); // z is 122 in ASCII - -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} - -export function decodeInteger(reader: StringReader, relative: number): number { - let value = 0; - let shift = 0; - let integer = 0; - - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - - const shouldNegate = value & 1; - value >>>= 1; - - if (shouldNegate) { - value = -0x80000000 | -value; - } - - return relative + value; -} - -export function encodeInteger(builder: StringWriter, num: number, relative: number): number { - let delta = num - relative; - - delta = delta < 0 ? (-delta << 1) | 1 : delta << 1; - do { - let clamped = delta & 0b011111; - delta >>>= 5; - if (delta > 0) clamped |= 0b100000; - builder.write(intToChar[clamped]); - } while (delta > 0); - - return num; -} - -export function hasMoreVlq(reader: StringReader, max: number) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts deleted file mode 100644 index c583c75..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map deleted file mode 100644 index 630e647..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts deleted file mode 100644 index c583c75..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts +++ /dev/null @@ -1,50 +0,0 @@ -type Line = number; -type Column = number; -type Kind = number; -type Name = number; -type Var = number; -type SourcesIndex = number; -type ScopesIndex = number; -type Mix = (A & O) | (B & O); -export type OriginalScope = Mix<[ - Line, - Column, - Line, - Column, - Kind -], [ - Line, - Column, - Line, - Column, - Kind, - Name -], { - vars: Var[]; -}>; -export type GeneratedRange = Mix<[ - Line, - Column, - Line, - Column -], [ - Line, - Column, - Line, - Column, - SourcesIndex, - ScopesIndex -], { - callsite: CallSite | null; - bindings: Binding[]; - isScope: boolean; -}>; -export type CallSite = [SourcesIndex, Line, Column]; -type Binding = BindingExpressionRange[]; -export type BindingExpressionRange = [Name] | [Name, Line, Column]; -export declare function decodeOriginalScopes(input: string): OriginalScope[]; -export declare function encodeOriginalScopes(scopes: OriginalScope[]): string; -export declare function decodeGeneratedRanges(input: string): GeneratedRange[]; -export declare function encodeGeneratedRanges(ranges: GeneratedRange[]): string; -export {}; -//# sourceMappingURL=scopes.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map deleted file mode 100644 index 630e647..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"scopes.d.ts","sourceRoot":"","sources":["../src/scopes.ts"],"names":[],"mappings":"AAKA,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,MAAM,GAAG,MAAM,CAAC;AACrB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,IAAI,GAAG,MAAM,CAAC;AACnB,KAAK,GAAG,GAAG,MAAM,CAAC;AAClB,KAAK,YAAY,GAAG,MAAM,CAAC;AAC3B,KAAK,WAAW,GAAG,MAAM,CAAC;AAE1B,KAAK,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAEtC,MAAM,MAAM,aAAa,GAAG,GAAG,CAC7B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;CAAC,EAClC;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,IAAI;CAAC,EACxC;IAAE,IAAI,EAAE,GAAG,EAAE,CAAA;CAAE,CAChB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,GAAG,CAC9B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;CAAC,EAC5B;IAAC,IAAI;IAAE,MAAM;IAAE,IAAI;IAAE,MAAM;IAAE,YAAY;IAAE,WAAW;CAAC,EACvD;IACE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;CAClB,CACF,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AACpD,KAAK,OAAO,GAAG,sBAAsB,EAAE,CAAC;AACxC,MAAM,MAAM,sBAAsB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAEnE,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,EAAE,CAyCnE;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,CAQpE;AA2CD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,EAAE,CAoGrE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAUtE"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts deleted file mode 100644 index 5f35e22..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.cts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.cts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map deleted file mode 100644 index 7123d52..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts deleted file mode 100644 index 199fb9f..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts +++ /dev/null @@ -1,9 +0,0 @@ -export { decodeOriginalScopes, encodeOriginalScopes, decodeGeneratedRanges, encodeGeneratedRanges, } from './scopes.mts'; -export type { OriginalScope, GeneratedRange, CallSite, BindingExpressionRange } from './scopes.mts'; -export type SourceMapSegment = [number] | [number, number, number, number] | [number, number, number, number, number]; -export type SourceMapLine = SourceMapSegment[]; -export type SourceMapMappings = SourceMapLine[]; -export declare function decode(mappings: string): SourceMapMappings; -export declare function encode(decoded: SourceMapMappings): string; -export declare function encode(decoded: Readonly): string; -//# sourceMappingURL=sourcemap-codec.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map deleted file mode 100644 index 7123d52..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"sourcemap-codec.d.ts","sourceRoot":"","sources":["../src/sourcemap-codec.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,UAAU,CAAC;AAClB,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,QAAQ,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAC;AAEhG,MAAM,MAAM,gBAAgB,GACxB,CAAC,MAAM,CAAC,GACR,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAC7C,MAAM,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;AAC/C,MAAM,MAAM,iBAAiB,GAAG,aAAa,EAAE,CAAC;AAEhD,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAiD1D;AAUD,wBAAgB,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAAC;AAC3D,wBAAgB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts deleted file mode 100644 index 62faceb..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map deleted file mode 100644 index d3602da..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts deleted file mode 100644 index 62faceb..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts +++ /dev/null @@ -1,16 +0,0 @@ -export declare class StringWriter { - pos: number; - private out; - private buffer; - write(v: number): void; - flush(): string; -} -export declare class StringReader { - pos: number; - private buffer; - constructor(buffer: string); - next(): number; - peek(): number; - indexOf(char: string): number; -} -//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map deleted file mode 100644 index d3602da..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/strings.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAuBA,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,MAAM,CAA6B;IAE3C,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,KAAK,IAAI,MAAM;CAIhB;AAED,qBAAa,YAAY;IACvB,GAAG,SAAK;IACR,QAAgB,MAAM,CAAS;gBAEnB,MAAM,EAAE,MAAM;IAI1B,IAAI,IAAI,MAAM;IAId,IAAI,IAAI,MAAM;IAId,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAK9B"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts deleted file mode 100644 index dbd6602..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.cts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map deleted file mode 100644 index 6fdc356..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.cts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts deleted file mode 100644 index 2c739bc..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts +++ /dev/null @@ -1,7 +0,0 @@ -import type { StringReader, StringWriter } from './strings.mts'; -export declare const comma: number; -export declare const semicolon: number; -export declare function decodeInteger(reader: StringReader, relative: number): number; -export declare function encodeInteger(builder: StringWriter, num: number, relative: number): number; -export declare function hasMoreVlq(reader: StringReader, max: number): boolean; -//# sourceMappingURL=vlq.d.ts.map \ No newline at end of file diff --git a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map b/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map deleted file mode 100644 index 6fdc356..0000000 --- a/node_modules/@jridgewell/sourcemap-codec/types/vlq.d.mts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"vlq.d.ts","sourceRoot":"","sources":["../src/vlq.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAE5D,eAAO,MAAM,KAAK,QAAoB,CAAC;AACvC,eAAO,MAAM,SAAS,QAAoB,CAAC;AAY3C,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAY1F;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,WAG3D"} \ No newline at end of file diff --git a/node_modules/@rollup/rollup-darwin-arm64/README.md b/node_modules/@rollup/rollup-darwin-arm64/README.md deleted file mode 100644 index c29619c..0000000 --- a/node_modules/@rollup/rollup-darwin-arm64/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# `@rollup/rollup-darwin-arm64` - -This is the **aarch64-apple-darwin** binary for `rollup` diff --git a/node_modules/@rollup/rollup-darwin-arm64/package.json b/node_modules/@rollup/rollup-darwin-arm64/package.json deleted file mode 100644 index bc7b21a..0000000 --- a/node_modules/@rollup/rollup-darwin-arm64/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@rollup/rollup-darwin-arm64", - "version": "4.55.1", - "os": [ - "darwin" - ], - "cpu": [ - "arm64" - ], - "files": [ - "rollup.darwin-arm64.node" - ], - "description": "Native bindings for Rollup", - "author": "Lukas Taegert-Atkinson", - "homepage": "https://rollupjs.org/", - "license": "MIT", - "repository": { - "type": "git", - "url": "git+https://github.com/rollup/rollup.git" - }, - "main": "./rollup.darwin-arm64.node" -} \ No newline at end of file diff --git a/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node b/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node deleted file mode 100644 index bc3701e..0000000 Binary files a/node_modules/@rollup/rollup-darwin-arm64/rollup.darwin-arm64.node and /dev/null differ diff --git a/node_modules/@standard-schema/spec/LICENSE b/node_modules/@standard-schema/spec/LICENSE deleted file mode 100644 index ea54e0d..0000000 --- a/node_modules/@standard-schema/spec/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2024 Colin McDonnell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/node_modules/@standard-schema/spec/README.md b/node_modules/@standard-schema/spec/README.md deleted file mode 100644 index f9813ff..0000000 --- a/node_modules/@standard-schema/spec/README.md +++ /dev/null @@ -1,198 +0,0 @@ -

- Standard Schema fire logo -
- Standard Schema

-

- A family of specs for interoperable TypeScript -
- standardschema.dev -

-
- - - -The Standard Schema project is a set of interfaces that standardize the provision and consumption of shared functionality in the TypeScript ecosystem. - -Its goal is to allow tools to accept a single input that includes all the types and capabilities they need— no library-specific adapters, no extra dependencies. The result is an ecosystem that's fair for implementers, friendly for consumers, and open for end users. - -## The specifications - -The specifications can be found below in their entirety. Libraries wishing to implement a spec can copy/paste the code block below into their codebase. They're also available at `@standard-schema/spec` on [npm](https://www.npmjs.com/package/@standard-schema/spec) and [JSR](https://jsr.io/@standard-schema/spec). - -```ts -// ######################### -// ### Standard Typed ### -// ######################### - -/** The Standard Typed interface. This is a base type extended by other specs. */ -export interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} - -export declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - export interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - - /** The Standard Typed types interface. */ - export interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - - /** Infers the input type of a Standard Typed. */ - export type InferInput = NonNullable< - Schema["~standard"]["types"] - >["input"]; - - /** Infers the output type of a Standard Typed. */ - export type InferOutput = NonNullable< - Schema["~standard"]["types"] - >["output"]; -} - -// ########################## -// ### Standard Schema ### -// ########################## - -/** The Standard Schema interface. */ -export interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} - -export declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - export interface Props - extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: ( - value: unknown, - options?: StandardSchemaV1.Options | undefined - ) => Result | Promise>; - } - - /** The result interface of the validate function. */ - export type Result = SuccessResult | FailureResult; - - /** The result interface if validation succeeds. */ - export interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - - export interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - - /** The result interface if validation fails. */ - export interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - - /** The issue interface of the failure output. */ - export interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - - /** The path segment interface of the issue. */ - export interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - - /** The Standard types interface. */ - export interface Types - extends StandardTypedV1.Types {} - - /** Infers the input type of a Standard. */ - export type InferInput = - StandardTypedV1.InferInput; - - /** Infers the output type of a Standard. */ - export type InferOutput = - StandardTypedV1.InferOutput; -} - -// ############################### -// ### Standard JSON Schema ### -// ############################### - -/** The Standard JSON Schema interface. */ -export interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} - -export declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - export interface Props - extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - - /** The Standard JSON Schema converter interface. */ - export interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: ( - options: StandardJSONSchemaV1.Options - ) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: ( - options: StandardJSONSchemaV1.Options - ) => Record; - } - - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - export type Target = - | "draft-2020-12" - | "draft-07" - | "openapi-3.0" - // Accepts any string for future targets while preserving autocomplete - | ({} & string); - - /** The options for the input/output methods. */ - export interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - - /** The Standard types interface. */ - export interface Types - extends StandardTypedV1.Types {} - - /** Infers the input type of a Standard. */ - export type InferInput = - StandardTypedV1.InferInput; - - /** Infers the output type of a Standard. */ - export type InferOutput = - StandardTypedV1.InferOutput; -} -``` diff --git a/node_modules/@standard-schema/spec/dist/index.cjs b/node_modules/@standard-schema/spec/dist/index.cjs deleted file mode 100644 index 321666e..0000000 --- a/node_modules/@standard-schema/spec/dist/index.cjs +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// src/index.ts -var src_exports = {}; -module.exports = __toCommonJS(src_exports); diff --git a/node_modules/@standard-schema/spec/dist/index.d.cts b/node_modules/@standard-schema/spec/dist/index.d.cts deleted file mode 100644 index 5e4acaa..0000000 --- a/node_modules/@standard-schema/spec/dist/index.d.cts +++ /dev/null @@ -1,119 +0,0 @@ -/** The Standard Typed interface. This is a base type extended by other specs. */ -interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} -declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - /** The Standard Typed types interface. */ - interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - /** Infers the input type of a Standard Typed. */ - type InferInput = NonNullable["input"]; - /** Infers the output type of a Standard Typed. */ - type InferOutput = NonNullable["output"]; -} -/** The Standard Schema interface. */ -interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} -declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; - } - /** The result interface of the validate function. */ - type Result = SuccessResult | FailureResult; - /** The result interface if validation succeeds. */ - interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The result interface if validation fails. */ - interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - /** The issue interface of the failure output. */ - interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - /** The path segment interface of the issue. */ - interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -/** The Standard JSON Schema interface. */ -interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} -declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - /** The Standard JSON Schema converter interface. */ - interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: (options: StandardJSONSchemaV1.Options) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: (options: StandardJSONSchemaV1.Options) => Record; - } - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); - /** The options for the input/output methods. */ - interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} - -export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/node_modules/@standard-schema/spec/dist/index.d.ts b/node_modules/@standard-schema/spec/dist/index.d.ts deleted file mode 100644 index 5e4acaa..0000000 --- a/node_modules/@standard-schema/spec/dist/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -/** The Standard Typed interface. This is a base type extended by other specs. */ -interface StandardTypedV1 { - /** The Standard properties. */ - readonly "~standard": StandardTypedV1.Props; -} -declare namespace StandardTypedV1 { - /** The Standard Typed properties interface. */ - interface Props { - /** The version number of the standard. */ - readonly version: 1; - /** The vendor name of the schema library. */ - readonly vendor: string; - /** Inferred types associated with the schema. */ - readonly types?: Types | undefined; - } - /** The Standard Typed types interface. */ - interface Types { - /** The input type of the schema. */ - readonly input: Input; - /** The output type of the schema. */ - readonly output: Output; - } - /** Infers the input type of a Standard Typed. */ - type InferInput = NonNullable["input"]; - /** Infers the output type of a Standard Typed. */ - type InferOutput = NonNullable["output"]; -} -/** The Standard Schema interface. */ -interface StandardSchemaV1 { - /** The Standard Schema properties. */ - readonly "~standard": StandardSchemaV1.Props; -} -declare namespace StandardSchemaV1 { - /** The Standard Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Validates unknown input values. */ - readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; - } - /** The result interface of the validate function. */ - type Result = SuccessResult | FailureResult; - /** The result interface if validation succeeds. */ - interface SuccessResult { - /** The typed output value. */ - readonly value: Output; - /** A falsy value for `issues` indicates success. */ - readonly issues?: undefined; - } - interface Options { - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The result interface if validation fails. */ - interface FailureResult { - /** The issues of failed validation. */ - readonly issues: ReadonlyArray; - } - /** The issue interface of the failure output. */ - interface Issue { - /** The error message of the issue. */ - readonly message: string; - /** The path of the issue, if any. */ - readonly path?: ReadonlyArray | undefined; - } - /** The path segment interface of the issue. */ - interface PathSegment { - /** The key representing a path segment. */ - readonly key: PropertyKey; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} -/** The Standard JSON Schema interface. */ -interface StandardJSONSchemaV1 { - /** The Standard JSON Schema properties. */ - readonly "~standard": StandardJSONSchemaV1.Props; -} -declare namespace StandardJSONSchemaV1 { - /** The Standard JSON Schema properties interface. */ - interface Props extends StandardTypedV1.Props { - /** Methods for generating the input/output JSON Schema. */ - readonly jsonSchema: StandardJSONSchemaV1.Converter; - } - /** The Standard JSON Schema converter interface. */ - interface Converter { - /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ - readonly input: (options: StandardJSONSchemaV1.Options) => Record; - /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ - readonly output: (options: StandardJSONSchemaV1.Options) => Record; - } - /** - * The target version of the generated JSON Schema. - * - * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. - * - * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. - */ - type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); - /** The options for the input/output methods. */ - interface Options { - /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ - readonly target: Target; - /** Explicit support for additional vendor-specific parameters, if needed. */ - readonly libraryOptions?: Record | undefined; - } - /** The Standard types interface. */ - interface Types extends StandardTypedV1.Types { - } - /** Infers the input type of a Standard. */ - type InferInput = StandardTypedV1.InferInput; - /** Infers the output type of a Standard. */ - type InferOutput = StandardTypedV1.InferOutput; -} - -export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/node_modules/@standard-schema/spec/dist/index.js b/node_modules/@standard-schema/spec/dist/index.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/@standard-schema/spec/package.json b/node_modules/@standard-schema/spec/package.json deleted file mode 100644 index 62bb551..0000000 --- a/node_modules/@standard-schema/spec/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@standard-schema/spec", - "description": "A family of specs for interoperable TypeScript", - "version": "1.1.0", - "license": "MIT", - "author": "Colin McDonnell", - "homepage": "https://standardschema.dev", - "repository": { - "type": "git", - "url": "https://github.com/standard-schema/standard-schema" - }, - "keywords": [ - "typescript", - "schema", - "validation", - "standard", - "interface" - ], - "type": "module", - "main": "./dist/index.js", - "types": "./dist/index.d.ts", - "exports": { - ".": { - "standard-schema-spec": "./src/index.ts", - "import": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - } - }, - "sideEffects": false, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "devDependencies": { - "tsup": "^8.3.0", - "typescript": "^5.6.2" - }, - "scripts": { - "lint": "pnpm biome lint ./src", - "format": "pnpm biome format --write ./src", - "check": "pnpm biome check ./src", - "build": "tsup" - } -} \ No newline at end of file diff --git a/node_modules/@types/chai/LICENSE b/node_modules/@types/chai/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/chai/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/chai/README.md b/node_modules/@types/chai/README.md deleted file mode 100644 index 27c1356..0000000 --- a/node_modules/@types/chai/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/chai` - -# Summary -This package contains type definitions for chai (http://chaijs.com/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai. - -### Additional Details - * Last updated: Mon, 20 Oct 2025 23:32:35 GMT - * Dependencies: [@types/deep-eql](https://npmjs.com/package/@types/deep-eql), [assertion-error](https://npmjs.com/package/assertion-error) - -# Credits -These definitions were written by [Bart van der Schoor](https://github.com/Bartvds), [Andrew Brown](https://github.com/AGBrown), [Olivier Chevet](https://github.com/olivr70), [Matt Wistrand](https://github.com/mwistrand), [Shaun Luttin](https://github.com/shaunluttin), [Satana Charuwichitratana](https://github.com/micksatana), [Erik Schierboom](https://github.com/ErikSchierboom), [Bogdan Paranytsia](https://github.com/bparan), [CXuesong](https://github.com/CXuesong), and [Joey Kilpatrick](https://github.com/joeykilpatrick). diff --git a/node_modules/@types/chai/index.d.ts b/node_modules/@types/chai/index.d.ts deleted file mode 100644 index 4fed6b9..0000000 --- a/node_modules/@types/chai/index.d.ts +++ /dev/null @@ -1,2145 +0,0 @@ -import deepEqual = require("deep-eql"); -import { AssertionError as ImportedAssertionError } from "assertion-error"; - -declare global { - namespace Chai { - export type Message = string | (() => string); - export type ObjectProperty = string | symbol | number; - - export interface PathInfo { - parent: object; - name: string; - value?: any; - exists: boolean; - } - - export interface Constructor { - new(...args: any[]): T; - } - - export interface ErrorConstructor { - new(...args: any[]): Error; - } - - export interface ChaiUtils { - addChainableMethod( - // object to define the method on, e.g. chai.Assertion.prototype - ctx: object, - // method name - name: string, - // method itself; any arguments - method: (...args: any[]) => void, - // called when property is accessed - chainingBehavior?: () => void, - ): void; - overwriteChainableMethod( - ctx: object, - name: string, - method: (...args: any[]) => void, - chainingBehavior?: () => void, - ): void; - addLengthGuard( - fn: Function, - assertionName: string, - isChainable: boolean, - ): void; - addMethod(ctx: object, name: string, method: Function): void; - addProperty(ctx: object, name: string, getter: () => any): void; - overwriteMethod(ctx: object, name: string, method: Function): void; - overwriteProperty(ctx: object, name: string, getter: (this: AssertionStatic, _super: any) => any): void; - compareByInspect(a: object, b: object): -1 | 1; - expectTypes(obj: object, types: string[]): void; - flag(obj: object, key: string, value?: any): any; - getActual(obj: object, args: AssertionArgs): any; - getProperties(obj: object): string[]; - getEnumerableProperties(obj: object): string[]; - getOwnEnumerablePropertySymbols(obj: object): symbol[]; - getOwnEnumerableProperties(obj: object): Array; - getMessage(errorLike: Error | string): string; - getMessage(obj: any, args: AssertionArgs): string; - inspect(obj: any, showHidden?: boolean, depth?: number, colors?: boolean): string; - isProxyEnabled(): boolean; - objDisplay(obj: object): void; - proxify(obj: object, nonChainableMethodName: string): object; - test(obj: object, args: AssertionArgs): boolean; - transferFlags(assertion: Assertion, obj: object, includeAll?: boolean): void; - compatibleInstance(thrown: Error, errorLike: Error | ErrorConstructor): boolean; - compatibleConstructor(thrown: Error, errorLike: Error | ErrorConstructor): boolean; - compatibleMessage(thrown: Error, errMatcher: string | RegExp): boolean; - getConstructorName(constructorFn: Function): string; - getFuncName(constructorFn: Function): string | null; - - // Reexports from pathval: - hasProperty(obj: object | undefined | null, name: ObjectProperty): boolean; - getPathInfo(obj: object, path: string): PathInfo; - getPathValue(obj: object, path: string): object | undefined; - - eql: typeof deepEqual; - } - - export type ChaiPlugin = (chai: ChaiStatic, utils: ChaiUtils) => void; - - export interface ChaiStatic { - expect: ExpectStatic; - should(): Should; - /** - * Provides a way to extend the internals of Chai - */ - use(fn: ChaiPlugin): ChaiStatic; - util: ChaiUtils; - assert: AssertStatic; - config: Config; - Assertion: AssertionStatic; - AssertionError: typeof AssertionError; - version: string; - } - - export interface ExpectStatic { - (val: any, message?: string): Assertion; - fail(message?: string): never; - fail(actual: any, expected: any, message?: string, operator?: Operator): never; - } - - export interface AssertStatic extends Assert { - } - - // chai.Assertion.prototype.assert arguments - export type AssertionArgs = [ - any, // expression to be tested - Message, // message or function that returns message to display if expression fails - Message, // negatedMessage or function that returns negatedMessage to display if expression fails - any?, // expected value - any?, // actual value - boolean?, // showDiff, when set to `true`, assert will display a diff in addition to the message if expression fails - ]; - - export interface AssertionPrototype { - assert(...args: AssertionArgs): void; - _obj: any; - } - - export interface AssertionStatic extends AssertionPrototype { - prototype: AssertionPrototype; - - new(target: any, message?: string, ssfi?: Function, lockSsfi?: boolean): Assertion; - - // Deprecated properties: - includeStack: boolean; - showDiff: boolean; - - // Partials of functions on ChaiUtils: - addProperty(name: string, getter: (this: AssertionStatic) => any): void; - addMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; - addChainableMethod( - name: string, - method: (this: AssertionStatic, ...args: any[]) => void, - chainingBehavior?: () => void, - ): void; - overwriteProperty(name: string, getter: (this: AssertionStatic, _super: any) => any): void; - overwriteMethod(name: string, method: (this: AssertionStatic, ...args: any[]) => any): void; - overwriteChainableMethod( - name: string, - method: (this: AssertionStatic, ...args: any[]) => void, - chainingBehavior?: () => void, - ): void; - } - - export type Operator = string; // "==" | "===" | ">" | ">=" | "<" | "<=" | "!=" | "!=="; - - export type OperatorComparable = boolean | null | number | string | undefined | Date; - - export interface ShouldAssertion { - equal(value1: any, value2: any, message?: string): void; - Throw: ShouldThrow; - throw: ShouldThrow; - exist(value: any, message?: string): void; - } - - export interface Should extends ShouldAssertion { - not: ShouldAssertion; - fail(message?: string): never; - fail(actual: any, expected: any, message?: string, operator?: Operator): never; - } - - export interface ShouldThrow { - (actual: Function, expected?: string | RegExp, message?: string): void; - (actual: Function, constructor: Error | Function, expected?: string | RegExp, message?: string): void; - } - - export interface Assertion extends LanguageChains, NumericComparison, TypeComparison { - not: Assertion; - deep: Deep; - ordered: Ordered; - nested: Nested; - own: Own; - any: KeyFilter; - all: KeyFilter; - a: Assertion; - an: Assertion; - include: Include; - includes: Include; - contain: Include; - contains: Include; - ok: Assertion; - true: Assertion; - false: Assertion; - null: Assertion; - undefined: Assertion; - NaN: Assertion; - exist: Assertion; - empty: Assertion; - arguments: Assertion; - Arguments: Assertion; - finite: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - eql: Equal; - eqls: Equal; - containSubset: ContainSubset; - property: Property; - ownProperty: Property; - haveOwnProperty: Property; - ownPropertyDescriptor: OwnPropertyDescriptor; - haveOwnPropertyDescriptor: OwnPropertyDescriptor; - length: Length; - lengthOf: Length; - match: Match; - matches: Match; - string(string: string, message?: string): Assertion; - keys: Keys; - key(string: string): Assertion; - throw: Throw; - throws: Throw; - Throw: Throw; - respondTo: RespondTo; - respondsTo: RespondTo; - itself: Assertion; - satisfy: Satisfy; - satisfies: Satisfy; - closeTo: CloseTo; - approximately: CloseTo; - members: Members; - increase: PropertyChange; - increases: PropertyChange; - decrease: PropertyChange; - decreases: PropertyChange; - change: PropertyChange; - changes: PropertyChange; - extensible: Assertion; - sealed: Assertion; - frozen: Assertion; - oneOf: OneOf; - } - - export interface LanguageChains { - to: Assertion; - be: Assertion; - been: Assertion; - is: Assertion; - that: Assertion; - which: Assertion; - and: Assertion; - has: Assertion; - have: Assertion; - with: Assertion; - at: Assertion; - of: Assertion; - same: Assertion; - but: Assertion; - does: Assertion; - } - - export interface NumericComparison { - above: NumberComparer; - gt: NumberComparer; - greaterThan: NumberComparer; - least: NumberComparer; - gte: NumberComparer; - greaterThanOrEqual: NumberComparer; - below: NumberComparer; - lt: NumberComparer; - lessThan: NumberComparer; - most: NumberComparer; - lte: NumberComparer; - lessThanOrEqual: NumberComparer; - within(start: number, finish: number, message?: string): Assertion; - within(start: Date, finish: Date, message?: string): Assertion; - } - - export interface NumberComparer { - (value: number | Date, message?: string): Assertion; - } - - export interface TypeComparison { - (type: string, message?: string): Assertion; - instanceof: InstanceOf; - instanceOf: InstanceOf; - } - - export interface InstanceOf { - (constructor: any, message?: string): Assertion; - } - - export interface CloseTo { - (expected: number, delta: number, message?: string): Assertion; - } - - export interface Nested { - include: Include; - includes: Include; - contain: Include; - contains: Include; - property: Property; - members: Members; - } - - export interface Own { - include: Include; - includes: Include; - contain: Include; - contains: Include; - property: Property; - } - - export interface Deep extends KeyFilter { - be: Assertion; - equal: Equal; - equals: Equal; - eq: Equal; - include: Include; - includes: Include; - contain: Include; - contains: Include; - property: Property; - ordered: Ordered; - nested: Nested; - oneOf: OneOf; - own: Own; - } - - export interface Ordered { - members: Members; - } - - export interface KeyFilter { - keys: Keys; - members: Members; - } - - export interface Equal { - (value: any, message?: string): Assertion; - } - - export interface ContainSubset { - (expected: any): Assertion; - } - - export interface Property { - (name: string | symbol, value: any, message?: string): Assertion; - (name: string | symbol, message?: string): Assertion; - } - - export interface OwnPropertyDescriptor { - (name: string | symbol, descriptor: PropertyDescriptor, message?: string): Assertion; - (name: string | symbol, message?: string): Assertion; - } - - export interface Length extends LanguageChains, NumericComparison { - (length: number, message?: string): Assertion; - } - - export interface Include { - (value: any, message?: string): Assertion; - keys: Keys; - deep: Deep; - ordered: Ordered; - members: Members; - any: KeyFilter; - all: KeyFilter; - oneOf: OneOf; - } - - export interface OneOf { - (list: readonly unknown[], message?: string): Assertion; - } - - export interface Match { - (regexp: RegExp, message?: string): Assertion; - } - - export interface Keys { - (...keys: string[]): Assertion; - (keys: readonly any[] | Object): Assertion; - } - - export interface Throw { - (expected?: string | RegExp, message?: string): Assertion; - (constructor: Error | Function, expected?: string | RegExp, message?: string): Assertion; - } - - export interface RespondTo { - (method: string, message?: string): Assertion; - } - - export interface Satisfy { - (matcher: Function, message?: string): Assertion; - } - - export interface Members { - (set: readonly any[], message?: string): Assertion; - } - - export interface PropertyChange { - (object: Object, property?: string, message?: string): DeltaAssertion; - } - - export interface DeltaAssertion extends Assertion { - by(delta: number, msg?: string): Assertion; - } - - export interface Assert { - /** - * @param expression Expression to test for truthiness. - * @param message Message to display on error. - */ - (expression: any, message?: string): asserts expression; - - /** - * Throws a failure. - * - * @param message Message to display on error. - * @remarks Node.js assert module-compatible. - */ - fail(message?: string): never; - - /** - * Throws a failure. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - * @param operator Comparison operator, if not strict equality. - * @remarks Node.js assert module-compatible. - */ - fail(actual: T, expected: T, message?: string, operator?: Operator): never; - - /** - * Asserts that object is truthy. - * - * @param object Object to test. - * @param message Message to display on error. - */ - isOk(value: unknown, message?: string): asserts value; - - /** - * Asserts that object is truthy. - * - * @param object Object to test. - * @param message Message to display on error. - */ - ok(value: unknown, message?: string): asserts value; - - /** - * Asserts that object is falsy. - * - * T Type of object. - * @param object Object to test. - * @param message Message to display on error. - */ - isNotOk(value: T, message?: string): void; - - /** - * Asserts that object is falsy. - * - * T Type of object. - * @param object Object to test. - * @param message Message to display on error. - */ - notOk(value: T, message?: string): void; - - /** - * Asserts non-strict equality (==) of actual and expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - equal(actual: T, expected: T, message?: string): void; - - /** - * Asserts non-strict inequality (!=) of actual and expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - notEqual(actual: T, expected: T, message?: string): void; - - /** - * Asserts strict equality (===) of actual and expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - strictEqual(actual: T, expected: T, message?: string): void; - - /** - * Asserts strict inequality (!==) of actual and expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - notStrictEqual(actual: T, expected: T, message?: string): void; - - /** - * Asserts that actual is deeply equal to expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - deepEqual(actual: T, expected: T, message?: string): void; - - /** - * Asserts that actual is not deeply equal to expected. - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - notDeepEqual(actual: T, expected: T, message?: string): void; - - /** - * Alias to deepEqual - * - * T Type of the objects. - * @param actual Actual value. - * @param expected Potential expected value. - * @param message Message to display on error. - */ - deepStrictEqual(actual: T, expected: T, message?: string): void; - - /** - * Partially matches actual and expected. - * - * @param actual Actual value. - * @param expected Potential subset of the value. - * @param message Message to display on error. - */ - containSubset(val: any, exp: any, msg?: string): void; - - /** - * Partially matches actual and expected. - * - * @param actual Actual value. - * @param expected Potential subset of the value. - * @param message Message to display on error. - */ - containsSubset(val: any, exp: any, msg?: string): void; - - /** - * No partial match between actual and expected exists. - * - * @param actual Actual value. - * @param expected Potential subset of the value. - * @param message Message to display on error. - */ - doesNotContainSubset(val: any, exp: any, msg?: string): void; - - /** - * Asserts valueToCheck is strictly greater than (>) valueToBeAbove. - * - * @param valueToCheck Actual value. - * @param valueToBeAbove Minimum Potential expected value. - * @param message Message to display on error. - */ - isAbove(valueToCheck: number, valueToBeAbove: number, message?: string): void; - - /** - * Asserts valueToCheck is greater than or equal to (>=) valueToBeAtLeast. - * - * @param valueToCheck Actual value. - * @param valueToBeAtLeast Minimum Potential expected value. - * @param message Message to display on error. - */ - isAtLeast(valueToCheck: number, valueToBeAtLeast: number, message?: string): void; - - /** - * Asserts valueToCheck is strictly less than (<) valueToBeBelow. - * - * @param valueToCheck Actual value. - * @param valueToBeBelow Minimum Potential expected value. - * @param message Message to display on error. - */ - isBelow(valueToCheck: number, valueToBeBelow: number, message?: string): void; - - /** - * Asserts valueToCheck is less than or equal to (<=) valueToBeAtMost. - * - * @param valueToCheck Actual value. - * @param valueToBeAtMost Minimum Potential expected value. - * @param message Message to display on error. - */ - isAtMost(valueToCheck: number, valueToBeAtMost: number, message?: string): void; - - /** - * Asserts that value is true. - * - * @param value Actual value. - * @param message Message to display on error. - */ - isTrue(value: unknown, message?: string): asserts value is true; - - /** - * Asserts that value is false. - * - * @param value Actual value. - * @param message Message to display on error. - */ - isFalse(value: unknown, message?: string): asserts value is false; - - /** - * Asserts that value is not true. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotTrue(value: T, message?: string): asserts value is Exclude; - - /** - * Asserts that value is not false. - * - * @param value Actual value. - * @param message Message to display on error. - */ - isNotFalse(value: T, message?: string): asserts value is Exclude; - - /** - * Asserts that value is null. - * - * @param value Actual value. - * @param message Message to display on error. - */ - isNull(value: unknown, message?: string): asserts value is null; - - /** - * Asserts that value is not null. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotNull(value: T, message?: string): asserts value is Exclude; - - /** - * Asserts that value is NaN. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNaN(value: T, message?: string): void; - - /** - * Asserts that value is not NaN. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotNaN(value: T, message?: string): void; - - /** - * Asserts that the target is neither null nor undefined. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - exists(value: T, message?: string): asserts value is NonNullable; - - /** - * Asserts that the target is either null or undefined. - * - * @param value Actual value. - * @param message Message to display on error. - */ - notExists(value: unknown, message?: string): asserts value is - | null - | undefined; - - /** - * Asserts that value is undefined. - * - * @param value Actual value. - * @param message Message to display on error. - */ - isUndefined(value: unknown, message?: string): asserts value is undefined; - - /** - * Asserts that value is not undefined. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isDefined(value: T, message?: string): asserts value is Exclude; - - /** - * Asserts that value is a function. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isFunction(value: T, message?: string): void; - - /** - * Asserts that value is not a function. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotFunction(value: T, message?: string): void; - - /** - * Asserts that value is an object of type 'Object' - * (as revealed by Object.prototype.toString). - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - * @remarks The assertion does not match subclassed objects. - */ - isObject(value: T, message?: string): void; - - /** - * Asserts that value is not an object of type 'Object' - * (as revealed by Object.prototype.toString). - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotObject(value: T, message?: string): void; - - /** - * Asserts that value is an array. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isArray(value: T, message?: string): void; - - /** - * Asserts that value is not an array. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotArray(value: T, message?: string): void; - - /** - * Asserts that value is a string. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isString(value: T, message?: string): void; - - /** - * Asserts that value is not a string. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotString(value: T, message?: string): void; - - /** - * Asserts that value is a number. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNumber(value: T, message?: string): void; - - /** - * Asserts that value is not a number. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotNumber(value: T, message?: string): void; - - /** - * Asserts that value is a finite number. - * Unlike `.isNumber`, this will fail for `NaN` and `Infinity`. - * - * T Type of value - * @param value Actual value - * @param message Message to display on error. - */ - isFinite(value: T, message?: string): void; - - /** - * Asserts that value is a boolean. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isBoolean(value: T, message?: string): void; - - /** - * Asserts that value is not a boolean. - * - * T Type of value. - * @param value Actual value. - * @param message Message to display on error. - */ - isNotBoolean(value: T, message?: string): void; - - /** - * Asserts that value's type is name, as determined by Object.prototype.toString. - * - * T Type of value. - * @param value Actual value. - * @param name Potential expected type name of value. - * @param message Message to display on error. - */ - typeOf(value: T, name: string, message?: string): void; - - /** - * Asserts that value's type is not name, as determined by Object.prototype.toString. - * - * T Type of value. - * @param value Actual value. - * @param name Potential expected type name of value. - * @param message Message to display on error. - */ - notTypeOf(value: T, name: string, message?: string): void; - - /** - * Asserts that value is an instance of constructor. - * - * T Expected type of value. - * @param value Actual value. - * @param constructor Potential expected contructor of value. - * @param message Message to display on error. - */ - instanceOf( - value: unknown, - constructor: Constructor, - message?: string, - ): asserts value is T; - - /** - * Asserts that value is not an instance of constructor. - * - * T Type of value. - * U Type that value shouldn't be an instance of. - * @param value Actual value. - * @param constructor Potential expected contructor of value. - * @param message Message to display on error. - */ - notInstanceOf(value: T, type: Constructor, message?: string): asserts value is Exclude; - - /** - * Asserts that haystack includes needle. - * - * @param haystack Container string. - * @param needle Potential substring of haystack. - * @param message Message to display on error. - */ - include(haystack: string, needle: string, message?: string): void; - - /** - * Asserts that haystack includes needle. - * - * T Type of values in haystack. - * @param haystack Container array, set or map. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - include( - haystack: readonly T[] | ReadonlySet | ReadonlyMap, - needle: T, - message?: string, - ): void; - - /** - * Asserts that haystack includes needle. - * - * T Type of values in haystack. - * @param haystack WeakSet container. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - include(haystack: WeakSet, needle: T, message?: string): void; - - /** - * Asserts that haystack includes needle. - * - * T Type of haystack. - * @param haystack Object. - * @param needle Potential subset of the haystack's properties. - * @param message Message to display on error. - */ - include(haystack: T, needle: Partial, message?: string): void; - - /** - * Asserts that haystack does not include needle. - * - * @param haystack Container string. - * @param needle Potential substring of haystack. - * @param message Message to display on error. - */ - notInclude(haystack: string, needle: string, message?: string): void; - - /** - * Asserts that haystack does not include needle. - * - * T Type of values in haystack. - * @param haystack Container array, set or map. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - notInclude( - haystack: readonly T[] | ReadonlySet | ReadonlyMap, - needle: T, - message?: string, - ): void; - - /** - * Asserts that haystack does not include needle. - * - * T Type of values in haystack. - * @param haystack WeakSet container. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - notInclude(haystack: WeakSet, needle: T, message?: string): void; - - /** - * Asserts that haystack does not include needle. - * - * T Type of haystack. - * @param haystack Object. - * @param needle Potential subset of the haystack's properties. - * @param message Message to display on error. - */ - notInclude(haystack: T, needle: Partial, message?: string): void; - - /** - * Asserts that haystack includes needle. Deep equality is used. - * - * @param haystack Container string. - * @param needle Potential substring of haystack. - * @param message Message to display on error. - * - * @deprecated Does not have any effect on string. Use {@link Assert#include} instead. - */ - deepInclude(haystack: string, needle: string, message?: string): void; - - /** - * Asserts that haystack includes needle. Deep equality is used. - * - * T Type of values in haystack. - * @param haystack Container array, set or map. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - deepInclude( - haystack: readonly T[] | ReadonlySet | ReadonlyMap, - needle: T, - message?: string, - ): void; - - /** - * Asserts that haystack includes needle. Deep equality is used. - * - * T Type of haystack. - * @param haystack Object. - * @param needle Potential subset of the haystack's properties. - * @param message Message to display on error. - */ - deepInclude(haystack: T, needle: T extends WeakSet ? never : Partial, message?: string): void; - - /** - * Asserts that haystack does not include needle. Deep equality is used. - * - * @param haystack Container string. - * @param needle Potential substring of haystack. - * @param message Message to display on error. - * - * @deprecated Does not have any effect on string. Use {@link Assert#notInclude} instead. - */ - notDeepInclude(haystack: string, needle: string, message?: string): void; - - /** - * Asserts that haystack does not include needle. Deep equality is used. - * - * T Type of values in haystack. - * @param haystack Container array, set or map. - * @param needle Potential value contained in haystack. - * @param message Message to display on error. - */ - notDeepInclude( - haystack: readonly T[] | ReadonlySet | ReadonlyMap, - needle: T, - message?: string, - ): void; - - /** - * Asserts that haystack does not include needle. Deep equality is used. - * - * T Type of haystack. - * @param haystack Object. - * @param needle Potential subset of the haystack's properties. - * @param message Message to display on error. - */ - notDeepInclude(haystack: T, needle: T extends WeakSet ? never : Partial, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object. - * - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. - * Can be used to assert the inclusion of a subset of properties in an object. - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - nestedInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object. - * - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. - * Can be used to assert the inclusion of a subset of properties in an object. - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - notNestedInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while checking for deep equality - * - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. - * Can be used to assert the inclusion of a subset of properties in an object. - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - deepNestedInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ does not include ‘needle’. Can be used to assert the absence of a subset of properties in an object while checking for deep equality. - * - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes.Asserts that ‘haystack’ includes ‘needle’. - * Can be used to assert the inclusion of a subset of properties in an object. - * Enables the use of dot- and bracket-notation for referencing nested properties. - * ‘[]’ and ‘.’ in property names can be escaped using double backslashes. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - notDeepNestedInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - ownInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - notOwnInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the inclusion of a subset of properties in an object while ignoring inherited properties and checking for deep - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - deepOwnInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that ‘haystack’ includes ‘needle’. Can be used to assert the absence of a subset of properties in an object while ignoring inherited properties and checking for deep equality. - * - * @param haystack - * @param needle - * @param message Message to display on error. - */ - notDeepOwnInclude(haystack: any, needle: any, message?: string): void; - - /** - * Asserts that value matches the regular expression regexp. - * - * @param value Actual value. - * @param regexp Potential match of value. - * @param message Message to display on error. - */ - match(value: string, regexp: RegExp, message?: string): void; - - /** - * Asserts that value does not match the regular expression regexp. - * - * @param value Actual value. - * @param regexp Potential match of value. - * @param message Message to display on error. - */ - notMatch(expected: any, regexp: RegExp, message?: string): void; - - /** - * Asserts that object has a property named by property. - * - * T Type of object. - * @param object Container object. - * @param property Potential contained property of object. - * @param message Message to display on error. - */ - property(object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that object does not have a property named by property. - * - * T Type of object. - * @param object Container object. - * @param property Potential contained property of object. - * @param message Message to display on error. - */ - notProperty(object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that object has a property named by property, which can be a string - * using dot- and bracket-notation for deep reference. - * - * T Type of object. - * @param object Container object. - * @param property Potential contained property of object. - * @param message Message to display on error. - */ - deepProperty(object: T, property: string, message?: string): void; - - /** - * Asserts that object does not have a property named by property, which can be a - * string using dot- and bracket-notation for deep reference. - * - * T Type of object. - * @param object Container object. - * @param property Potential contained property of object. - * @param message Message to display on error. - */ - notDeepProperty(object: T, property: string, message?: string): void; - - /** - * Asserts that object has a property named by property with value given by value. - * - * T Type of object. - * V Type of value. - * @param object Container object. - * @param property Potential contained property of object. - * @param value Potential expected property value. - * @param message Message to display on error. - */ - propertyVal(object: T, property: string, /* keyof T */ value: V, message?: string): void; - - /** - * Asserts that object has a property named by property with value given by value. - * - * T Type of object. - * V Type of value. - * @param object Container object. - * @param property Potential contained property of object. - * @param value Potential expected property value. - * @param message Message to display on error. - */ - notPropertyVal(object: T, property: string, /* keyof T */ value: V, message?: string): void; - - /** - * Asserts that object has a property named by property, which can be a string - * using dot- and bracket-notation for deep reference. - * - * T Type of object. - * V Type of value. - * @param object Container object. - * @param property Potential contained property of object. - * @param value Potential expected property value. - * @param message Message to display on error. - */ - deepPropertyVal(object: T, property: string, value: V, message?: string): void; - - /** - * Asserts that object does not have a property named by property, which can be a - * string using dot- and bracket-notation for deep reference. - * - * T Type of object. - * V Type of value. - * @param object Container object. - * @param property Potential contained property of object. - * @param value Potential expected property value. - * @param message Message to display on error. - */ - notDeepPropertyVal(object: T, property: string, value: V, message?: string): void; - - /** - * Asserts that object has a length property with the expected value. - * - * T Type of object. - * @param object Container object. - * @param length Potential expected length of object. - * @param message Message to display on error. - */ - lengthOf( - object: T, - length: number, - message?: string, - ): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errMsgMatcher Expected error message matcher. - * @param ignored Ignored parameter. - * @param message Message to display on error. - */ - throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errorLike Expected error constructor or error instance. - * @param errMsgMatcher Expected error message matcher. - * @param message Message to display on error. - */ - throw( - fn: () => void, - errorLike?: ErrorConstructor | Error | null, - errMsgMatcher?: RegExp | string | null, - message?: string, - ): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errMsgMatcher Expected error message matcher. - * @param ignored Ignored parameter. - * @param message Message to display on error. - */ - throws(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errorLike Expected error constructor or error instance. - * @param errMsgMatcher Expected error message matcher. - * @param message Message to display on error. - */ - throws( - fn: () => void, - errorLike?: ErrorConstructor | Error | null, - errMsgMatcher?: RegExp | string | null, - message?: string, - ): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errMsgMatcher Expected error message matcher. - * @param ignored Ignored parameter. - * @param message Message to display on error. - */ - Throw(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; - - /** - * Asserts that fn will throw an error. - * - * @param fn Function that may throw. - * @param errorLike Expected error constructor or error instance. - * @param errMsgMatcher Expected error message matcher. - * @param message Message to display on error. - */ - Throw( - fn: () => void, - errorLike?: ErrorConstructor | Error | null, - errMsgMatcher?: RegExp | string | null, - message?: string, - ): void; - - /** - * Asserts that fn will not throw an error. - * - * @param fn Function that may throw. - * @param errMsgMatcher Expected error message matcher. - * @param ignored Ignored parameter. - * @param message Message to display on error. - */ - doesNotThrow(fn: () => void, errMsgMatcher?: RegExp | string, ignored?: any, message?: string): void; - - /** - * Asserts that fn will not throw an error. - * - * @param fn Function that may throw. - * @param errorLike Expected error constructor or error instance. - * @param errMsgMatcher Expected error message matcher. - * @param message Message to display on error. - */ - doesNotThrow( - fn: () => void, - errorLike?: ErrorConstructor | Error | null, - errMsgMatcher?: RegExp | string | null, - message?: string, - ): void; - - /** - * Compares two values using operator. - * - * @param val1 Left value during comparison. - * @param operator Comparison operator. - * @param val2 Right value during comparison. - * @param message Message to display on error. - */ - operator(val1: OperatorComparable, operator: Operator, val2: OperatorComparable, message?: string): void; - - /** - * Asserts that the target is equal to expected, to within a +/- delta range. - * - * @param actual Actual value - * @param expected Potential expected value. - * @param delta Maximum differenced between values. - * @param message Message to display on error. - */ - closeTo(actual: number, expected: number, delta: number, message?: string): void; - - /** - * Asserts that the target is equal to expected, to within a +/- delta range. - * - * @param actual Actual value - * @param expected Potential expected value. - * @param delta Maximum differenced between values. - * @param message Message to display on error. - */ - approximately(act: number, exp: number, delta: number, message?: string): void; - - /** - * Asserts that set1 and set2 have the same members. Order is not take into account. - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - sameMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that set1 and set2 have the same members using deep equality checking. - * Order is not take into account. - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - sameDeepMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that `set1` and `set2` don't have the same members in any order. - * Uses a deep equality check. - * - * T Type of set values. - * @param set1 - * @param set2 - * @param message - */ - notSameDeepMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that set1 and set2 have the same members in the same order. - * Uses a strict equality check (===). - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - sameOrderedMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that set1 and set2 don’t have the same members in the same order. - * Uses a strict equality check (===). - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - notSameOrderedMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that set1 and set2 have the same members in the same order. - * Uses a deep equality check. - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - sameDeepOrderedMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that set1 and set2 don’t have the same members in the same order. - * Uses a deep equality check. - * - * T Type of set values. - * @param set1 Actual set of values. - * @param set2 Potential expected set of values. - * @param message Message to display on error. - */ - notSameDeepOrderedMembers(set1: T[], set2: T[], message?: string): void; - - /** - * Asserts that subset is included in superset in the same order beginning with the first element in superset. - * Uses a strict equality check (===). - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - includeOrderedMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. - * Uses a strict equality check (===). - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - notIncludeOrderedMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset is included in superset in the same order beginning with the first element in superset. - * Uses a deep equality check. - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - includeDeepOrderedMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset isn’t included in superset in the same order beginning with the first element in superset. - * Uses a deep equality check. - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - notIncludeDeepOrderedMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset is included in superset. Order is not take into account. - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - includeMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset isn’t included in superset in any order. - * Uses a strict equality check (===). Duplicates are ignored. - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential not contained set of values. - * @param message Message to display on error. - */ - notIncludeMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that subset is included in superset using deep equality checking. - * Order is not take into account. - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - includeDeepMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that `subset` isn't included in `superset` in any order. Uses a - * deep equality check. Duplicates are ignored. - * - * assert.notIncludeDeepMembers([ { a: 1 }, { b: 2 }, { c: 3 } ], [ { b: 2 }, { f: 5 } ], 'not include deep members'); - * - * T Type of set values. - * @param superset Actual set of values. - * @param subset Potential contained set of values. - * @param message Message to display on error. - */ - notIncludeDeepMembers(superset: T[], subset: T[], message?: string): void; - - /** - * Asserts that non-object, non-array value inList appears in the flat array list. - * - * T Type of list values. - * @param inList Value expected to be in the list. - * @param list List of values. - * @param message Message to display on error. - */ - oneOf(inList: T, list: T[], message?: string): void; - - /** - * Asserts that a function changes the value of a property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected to be modified. - * @param message Message to display on error. - */ - changes(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function changes the value of a property by an amount (delta). - * - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - changesBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - changesBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts that a function does not change the value of a property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected not to be modified. - * @param message Message to display on error. - */ - doesNotChange(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function increases an object property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected to be increased. - * @param message Message to display on error. - */ - increases(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function increases a numeric object property or a function's return value by an amount (delta). - * - * T Type of object or function. - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - increasesBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - increasesBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts that a function does not increase an object property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected not to be increased. - * @param message Message to display on error. - */ - doesNotIncrease(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function does not increase a numeric object property or function's return value by an amount (delta). - * - * T Type of object or function. - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - - increasesButNotBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - increasesButNotBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts that a function decreases an object property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected to be decreased. - * @param message Message to display on error. - */ - decreases(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function decreases a numeric object property or a function's return value by an amount (delta) - * - * T Type of object or function. - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - - decreasesBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - decreasesBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts that a function does not decrease an object property. - * - * T Type of object. - * @param modifier Function to run. - * @param object Container object. - * @param property Property of object expected not to be decreased. - * @param message Message to display on error. - */ - doesNotDecrease(modifier: Function, object: T, property: string, /* keyof T */ message?: string): void; - - /** - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * T Type of object or function. - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - - doesNotDecreaseBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - doesNotDecreaseBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts that a function does not decreases a numeric object property or a function's return value by an amount (delta) - * - * T Type of object or function. - * @param modifier function - * @param object or getter function - * @param property name _optional_ - * @param change amount (delta) - * @param message _optional_ - */ - - decreasesButNotBy( - modifier: Function, - object: T, - property: string, - /* keyof T */ change: number, - message?: string, - ): void; - decreasesButNotBy(modifier: Function, object: T, change: number, message?: string): void; - - /** - * Asserts if value is not a false value, and throws if it is a true value. - * - * T Type of object. - * @param object Actual value. - * @param message Message to display on error. - * @remarks This is added to allow for chai to be a drop-in replacement for - * Node’s assert class. - */ - ifError(object: T, message?: string): void; - - /** - * Asserts that object is extensible (can have new properties added to it). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isExtensible(object: T, message?: string): void; - - /** - * Asserts that object is extensible (can have new properties added to it). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - extensible(object: T, message?: string): void; - - /** - * Asserts that object is not extensible. - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isNotExtensible(object: T, message?: string): void; - - /** - * Asserts that object is not extensible. - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - notExtensible(object: T, message?: string): void; - - /** - * Asserts that object is sealed (can have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isSealed(object: T, message?: string): void; - - /** - * Asserts that object is sealed (can have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - sealed(object: T, message?: string): void; - - /** - * Asserts that object is not sealed. - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isNotSealed(object: T, message?: string): void; - - /** - * Asserts that object is not sealed. - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - notSealed(object: T, message?: string): void; - - /** - * Asserts that object is frozen (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isFrozen(object: T, message?: string): void; - - /** - * Asserts that object is frozen (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - frozen(object: T, message?: string): void; - - /** - * Asserts that object is not frozen (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isNotFrozen(object: T, message?: string): void; - - /** - * Asserts that object is not frozen (cannot have new properties added to it - * and its existing properties cannot be removed). - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - notFrozen(object: T, message?: string): void; - - /** - * Asserts that the target does not contain any values. For arrays and - * strings, it checks the length property. For Map and Set instances, it - * checks the size property. For non-function objects, it gets the count - * of own enumerable string keys. - * - * T Type of object - * @param object Actual value. - * @param message Message to display on error. - */ - isEmpty(object: T, message?: string): void; - - /** - * Asserts that the target contains values. For arrays and strings, it checks - * the length property. For Map and Set instances, it checks the size property. - * For non-function objects, it gets the count of own enumerable string keys. - * - * T Type of object. - * @param object Object to test. - * @param message Message to display on error. - */ - isNotEmpty(object: T, message?: string): void; - - /** - * Asserts that `object` has at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - hasAnyKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; - - /** - * Asserts that `object` has all and only all of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - hasAllKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; - - /** - * Asserts that `object` has all of the `keys` provided but may have more keys not listed. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - containsAllKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that `object` has none of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - doesNotHaveAnyKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that `object` does not have at least one of the `keys` provided. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - doesNotHaveAllKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that `object` has at least one of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - hasAnyDeepKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; - - /** - * Asserts that `object` has all and only all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - hasAllDeepKeys(object: T, keys: Array | { [key: string]: any }, message?: string): void; - - /** - * Asserts that `object` contains all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - containsAllDeepKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that `object` contains all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - doesNotHaveAnyDeepKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that `object` contains all of the `keys` provided. - * Since Sets and Maps can have objects as keys you can use this assertion to perform - * a deep comparison. - * You can also provide a single object instead of a `keys` array and its keys - * will be used as the expected set of keys. - * - * T Type of object. - * @param object Object to test. - * @param keys Keys to check - * @param message Message to display on error. - */ - doesNotHaveAllDeepKeys( - object: T, - keys: Array | { [key: string]: any }, - message?: string, - ): void; - - /** - * Asserts that object has a direct or inherited property named by property, - * which can be a string using dot- and bracket-notation for nested reference. - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param message Message to display on error. - */ - nestedProperty(object: T, property: string, message?: string): void; - - /** - * Asserts that object does not have a property named by property, - * which can be a string using dot- and bracket-notation for nested reference. - * The property cannot exist on the object nor anywhere in its prototype chain. - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param message Message to display on error. - */ - notNestedProperty(object: T, property: string, message?: string): void; - - /** - * Asserts that object has a property named by property with value given by value. - * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param value Value to test. - * @param message Message to display on error. - */ - nestedPropertyVal(object: T, property: string, value: any, message?: string): void; - - /** - * Asserts that object does not have a property named by property with value given by value. - * property can use dot- and bracket-notation for nested reference. Uses a strict equality check (===). - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param value Value to test. - * @param message Message to display on error. - */ - notNestedPropertyVal(object: T, property: string, value: any, message?: string): void; - - /** - * Asserts that object has a property named by property with a value given by value. - * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param value Value to test. - * @param message Message to display on error. - */ - deepNestedPropertyVal(object: T, property: string, value: any, message?: string): void; - - /** - * Asserts that object does not have a property named by property with value given by value. - * property can use dot- and bracket-notation for nested reference. Uses a deep equality check. - * - * T Type of object. - * @param object Object to test. - * @param property Property to test. - * @param value Value to test. - * @param message Message to display on error. - */ - notDeepNestedPropertyVal(object: T, property: string, value: any, message?: string): void; - } - - export interface Config { - /** - * Default: false - */ - includeStack: boolean; - - /** - * Default: true - */ - showDiff: boolean; - - /** - * Default: 40 - */ - truncateThreshold: number; - - /** - * Default: true - */ - useProxy: boolean; - - /** - * Default: ['then', 'catch', 'inspect', 'toJSON'] - */ - proxyExcludedKeys: string[]; - - deepEqual: (expected: L, actual: R) => void; - } - - export type { ImportedAssertionError as AssertionError }; - } -} - -export function use(fn: Chai.ChaiPlugin): Chai.ChaiStatic; - -export const util: Chai.ChaiUtils; -export const config: Chai.Config; -export const Assertion: Chai.AssertionStatic; -export const AssertionError: typeof ImportedAssertionError; -export function should(): Chai.Should; -export function Should(): Chai.Should; -export const assert: Chai.AssertStatic; -export const expect: Chai.ExpectStatic; diff --git a/node_modules/@types/chai/package.json b/node_modules/@types/chai/package.json deleted file mode 100644 index 7aec8d1..0000000 --- a/node_modules/@types/chai/package.json +++ /dev/null @@ -1,75 +0,0 @@ -{ - "name": "@types/chai", - "version": "5.2.3", - "description": "TypeScript definitions for chai", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chai", - "license": "MIT", - "contributors": [ - { - "name": "Bart van der Schoor", - "githubUsername": "Bartvds", - "url": "https://github.com/Bartvds" - }, - { - "name": "Andrew Brown", - "githubUsername": "AGBrown", - "url": "https://github.com/AGBrown" - }, - { - "name": "Olivier Chevet", - "githubUsername": "olivr70", - "url": "https://github.com/olivr70" - }, - { - "name": "Matt Wistrand", - "githubUsername": "mwistrand", - "url": "https://github.com/mwistrand" - }, - { - "name": "Shaun Luttin", - "githubUsername": "shaunluttin", - "url": "https://github.com/shaunluttin" - }, - { - "name": "Satana Charuwichitratana", - "githubUsername": "micksatana", - "url": "https://github.com/micksatana" - }, - { - "name": "Erik Schierboom", - "githubUsername": "ErikSchierboom", - "url": "https://github.com/ErikSchierboom" - }, - { - "name": "Bogdan Paranytsia", - "githubUsername": "bparan", - "url": "https://github.com/bparan" - }, - { - "name": "CXuesong", - "githubUsername": "CXuesong", - "url": "https://github.com/CXuesong" - }, - { - "name": "Joey Kilpatrick", - "githubUsername": "joeykilpatrick", - "url": "https://github.com/joeykilpatrick" - } - ], - "type": "module", - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/chai" - }, - "scripts": {}, - "dependencies": { - "@types/deep-eql": "*", - "assertion-error": "^2.0.1" - }, - "peerDependencies": {}, - "typesPublisherContentHash": "d9d83f1594f42010e624e46e4c8cfeee284bdd04cb05eb0730aec14140f2a833", - "typeScriptVersion": "5.2" -} \ No newline at end of file diff --git a/node_modules/@types/chai/register-should.d.ts b/node_modules/@types/chai/register-should.d.ts deleted file mode 100644 index 1e14f93..0000000 --- a/node_modules/@types/chai/register-should.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare global { - interface Object { - should: Chai.Assertion; - } -} - -export {}; diff --git a/node_modules/@types/deep-eql/LICENSE b/node_modules/@types/deep-eql/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/deep-eql/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/deep-eql/README.md b/node_modules/@types/deep-eql/README.md deleted file mode 100644 index 48d96fc..0000000 --- a/node_modules/@types/deep-eql/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Installation -> `npm install --save @types/deep-eql` - -# Summary -This package contains type definitions for deep-eql (https://github.com/chaijs/deep-eql). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql. -## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql/index.d.ts) -````ts -declare namespace deepEqual { - /** - * Memoization class used to speed up comparison. - */ - class MemoizeMap extends WeakMap {} - - interface DeepEqualOptions { - /** - * Override default algorithm, determining custom equality. - */ - comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null; - - /** - * Provide a custom memoization object which will cache the results of - * complex objects for a speed boost. - * - * By passing `false` you can disable memoization, but this will cause circular - * references to blow the stack. - */ - memoize?: MemoizeMap | false; - } -} - -/** - * Assert deeply nested sameValue equality between two objects of any type. - * - * @param leftHandOperand - * @param rightHandOperand - * @param [options] Additional options - * @return equal match - */ -declare function deepEqual( - leftHandOperand: T1, - rightHandOperand: T2, - options?: deepEqual.DeepEqualOptions, -): boolean; - -export = deepEqual; - -```` - -### Additional Details - * Last updated: Mon, 06 Nov 2023 22:41:05 GMT - * Dependencies: none - -# Credits -These definitions were written by [Rodrigo Pietnechuk](https://github.com/ghnoob). diff --git a/node_modules/@types/deep-eql/index.d.ts b/node_modules/@types/deep-eql/index.d.ts deleted file mode 100644 index 0cdbefe..0000000 --- a/node_modules/@types/deep-eql/index.d.ts +++ /dev/null @@ -1,38 +0,0 @@ -declare namespace deepEqual { - /** - * Memoization class used to speed up comparison. - */ - class MemoizeMap extends WeakMap {} - - interface DeepEqualOptions { - /** - * Override default algorithm, determining custom equality. - */ - comparator?: (leftHandOperand: T1, rightHandOperand: T2) => boolean | null; - - /** - * Provide a custom memoization object which will cache the results of - * complex objects for a speed boost. - * - * By passing `false` you can disable memoization, but this will cause circular - * references to blow the stack. - */ - memoize?: MemoizeMap | false; - } -} - -/** - * Assert deeply nested sameValue equality between two objects of any type. - * - * @param leftHandOperand - * @param rightHandOperand - * @param [options] Additional options - * @return equal match - */ -declare function deepEqual( - leftHandOperand: T1, - rightHandOperand: T2, - options?: deepEqual.DeepEqualOptions, -): boolean; - -export = deepEqual; diff --git a/node_modules/@types/deep-eql/package.json b/node_modules/@types/deep-eql/package.json deleted file mode 100644 index 8761581..0000000 --- a/node_modules/@types/deep-eql/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "@types/deep-eql", - "version": "4.0.2", - "description": "TypeScript definitions for deep-eql", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/deep-eql", - "license": "MIT", - "contributors": [ - { - "name": "Rodrigo Pietnechuk", - "githubUsername": "ghnoob", - "url": "https://github.com/ghnoob" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/deep-eql" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "3b8981ce557947fc00ca08cbd93b4206bfc0943360956867381a0a3f6b1eabf5", - "typeScriptVersion": "4.5" -} \ No newline at end of file diff --git a/node_modules/@types/estree/LICENSE b/node_modules/@types/estree/LICENSE deleted file mode 100644 index 9e841e7..0000000 --- a/node_modules/@types/estree/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/estree/README.md b/node_modules/@types/estree/README.md deleted file mode 100644 index 2af760b..0000000 --- a/node_modules/@types/estree/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/estree` - -# Summary -This package contains type definitions for estree (https://github.com/estree/estree). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree. - -### Additional Details - * Last updated: Fri, 06 Jun 2025 00:04:33 GMT - * Dependencies: none - -# Credits -These definitions were written by [RReverser](https://github.com/RReverser). diff --git a/node_modules/@types/estree/flow.d.ts b/node_modules/@types/estree/flow.d.ts deleted file mode 100644 index 9d001a9..0000000 --- a/node_modules/@types/estree/flow.d.ts +++ /dev/null @@ -1,167 +0,0 @@ -declare namespace ESTree { - interface FlowTypeAnnotation extends Node {} - - interface FlowBaseTypeAnnotation extends FlowTypeAnnotation {} - - interface FlowLiteralTypeAnnotation extends FlowTypeAnnotation, Literal {} - - interface FlowDeclaration extends Declaration {} - - interface AnyTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface ArrayTypeAnnotation extends FlowTypeAnnotation { - elementType: FlowTypeAnnotation; - } - - interface BooleanLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface BooleanTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface ClassImplements extends Node { - id: Identifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface ClassProperty { - key: Expression; - value?: Expression | null; - typeAnnotation?: TypeAnnotation | null; - computed: boolean; - static: boolean; - } - - interface DeclareClass extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - body: ObjectTypeAnnotation; - extends: InterfaceExtends[]; - } - - interface DeclareFunction extends FlowDeclaration { - id: Identifier; - } - - interface DeclareModule extends FlowDeclaration { - id: Literal | Identifier; - body: BlockStatement; - } - - interface DeclareVariable extends FlowDeclaration { - id: Identifier; - } - - interface FunctionTypeAnnotation extends FlowTypeAnnotation { - params: FunctionTypeParam[]; - returnType: FlowTypeAnnotation; - rest?: FunctionTypeParam | null; - typeParameters?: TypeParameterDeclaration | null; - } - - interface FunctionTypeParam { - name: Identifier; - typeAnnotation: FlowTypeAnnotation; - optional: boolean; - } - - interface GenericTypeAnnotation extends FlowTypeAnnotation { - id: Identifier | QualifiedTypeIdentifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface InterfaceExtends extends Node { - id: Identifier | QualifiedTypeIdentifier; - typeParameters?: TypeParameterInstantiation | null; - } - - interface InterfaceDeclaration extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - extends: InterfaceExtends[]; - body: ObjectTypeAnnotation; - } - - interface IntersectionTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface MixedTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface NullableTypeAnnotation extends FlowTypeAnnotation { - typeAnnotation: TypeAnnotation; - } - - interface NumberLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface NumberTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface StringLiteralTypeAnnotation extends FlowLiteralTypeAnnotation {} - - interface StringTypeAnnotation extends FlowBaseTypeAnnotation {} - - interface TupleTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface TypeofTypeAnnotation extends FlowTypeAnnotation { - argument: FlowTypeAnnotation; - } - - interface TypeAlias extends FlowDeclaration { - id: Identifier; - typeParameters?: TypeParameterDeclaration | null; - right: FlowTypeAnnotation; - } - - interface TypeAnnotation extends Node { - typeAnnotation: FlowTypeAnnotation; - } - - interface TypeCastExpression extends Expression { - expression: Expression; - typeAnnotation: TypeAnnotation; - } - - interface TypeParameterDeclaration extends Node { - params: Identifier[]; - } - - interface TypeParameterInstantiation extends Node { - params: FlowTypeAnnotation[]; - } - - interface ObjectTypeAnnotation extends FlowTypeAnnotation { - properties: ObjectTypeProperty[]; - indexers: ObjectTypeIndexer[]; - callProperties: ObjectTypeCallProperty[]; - } - - interface ObjectTypeCallProperty extends Node { - value: FunctionTypeAnnotation; - static: boolean; - } - - interface ObjectTypeIndexer extends Node { - id: Identifier; - key: FlowTypeAnnotation; - value: FlowTypeAnnotation; - static: boolean; - } - - interface ObjectTypeProperty extends Node { - key: Expression; - value: FlowTypeAnnotation; - optional: boolean; - static: boolean; - } - - interface QualifiedTypeIdentifier extends Node { - qualification: Identifier | QualifiedTypeIdentifier; - id: Identifier; - } - - interface UnionTypeAnnotation extends FlowTypeAnnotation { - types: FlowTypeAnnotation[]; - } - - interface VoidTypeAnnotation extends FlowBaseTypeAnnotation {} -} diff --git a/node_modules/@types/estree/index.d.ts b/node_modules/@types/estree/index.d.ts deleted file mode 100644 index 2bc66fb..0000000 --- a/node_modules/@types/estree/index.d.ts +++ /dev/null @@ -1,694 +0,0 @@ -// This definition file follows a somewhat unusual format. ESTree allows -// runtime type checks based on the `type` parameter. In order to explain this -// to typescript we want to use discriminated union types: -// https://github.com/Microsoft/TypeScript/pull/9163 -// -// For ESTree this is a bit tricky because the high level interfaces like -// Node or Function are pulling double duty. We want to pass common fields down -// to the interfaces that extend them (like Identifier or -// ArrowFunctionExpression), but you can't extend a type union or enforce -// common fields on them. So we've split the high level interfaces into two -// types, a base type which passes down inherited fields, and a type union of -// all types which extend the base type. Only the type union is exported, and -// the union is how other types refer to the collection of inheriting types. -// -// This makes the definitions file here somewhat more difficult to maintain, -// but it has the notable advantage of making ESTree much easier to use as -// an end user. - -export interface BaseNodeWithoutComments { - // Every leaf interface that extends BaseNode must specify a type property. - // The type property should be a string literal. For example, Identifier - // has: `type: "Identifier"` - type: string; - loc?: SourceLocation | null | undefined; - range?: [number, number] | undefined; -} - -export interface BaseNode extends BaseNodeWithoutComments { - leadingComments?: Comment[] | undefined; - trailingComments?: Comment[] | undefined; -} - -export interface NodeMap { - AssignmentProperty: AssignmentProperty; - CatchClause: CatchClause; - Class: Class; - ClassBody: ClassBody; - Expression: Expression; - Function: Function; - Identifier: Identifier; - Literal: Literal; - MethodDefinition: MethodDefinition; - ModuleDeclaration: ModuleDeclaration; - ModuleSpecifier: ModuleSpecifier; - Pattern: Pattern; - PrivateIdentifier: PrivateIdentifier; - Program: Program; - Property: Property; - PropertyDefinition: PropertyDefinition; - SpreadElement: SpreadElement; - Statement: Statement; - Super: Super; - SwitchCase: SwitchCase; - TemplateElement: TemplateElement; - VariableDeclarator: VariableDeclarator; -} - -export type Node = NodeMap[keyof NodeMap]; - -export interface Comment extends BaseNodeWithoutComments { - type: "Line" | "Block"; - value: string; -} - -export interface SourceLocation { - source?: string | null | undefined; - start: Position; - end: Position; -} - -export interface Position { - /** >= 1 */ - line: number; - /** >= 0 */ - column: number; -} - -export interface Program extends BaseNode { - type: "Program"; - sourceType: "script" | "module"; - body: Array; - comments?: Comment[] | undefined; -} - -export interface Directive extends BaseNode { - type: "ExpressionStatement"; - expression: Literal; - directive: string; -} - -export interface BaseFunction extends BaseNode { - params: Pattern[]; - generator?: boolean | undefined; - async?: boolean | undefined; - // The body is either BlockStatement or Expression because arrow functions - // can have a body that's either. FunctionDeclarations and - // FunctionExpressions have only BlockStatement bodies. - body: BlockStatement | Expression; -} - -export type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; - -export type Statement = - | ExpressionStatement - | BlockStatement - | StaticBlock - | EmptyStatement - | DebuggerStatement - | WithStatement - | ReturnStatement - | LabeledStatement - | BreakStatement - | ContinueStatement - | IfStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | WhileStatement - | DoWhileStatement - | ForStatement - | ForInStatement - | ForOfStatement - | Declaration; - -export interface BaseStatement extends BaseNode {} - -export interface EmptyStatement extends BaseStatement { - type: "EmptyStatement"; -} - -export interface BlockStatement extends BaseStatement { - type: "BlockStatement"; - body: Statement[]; - innerComments?: Comment[] | undefined; -} - -export interface StaticBlock extends Omit { - type: "StaticBlock"; -} - -export interface ExpressionStatement extends BaseStatement { - type: "ExpressionStatement"; - expression: Expression; -} - -export interface IfStatement extends BaseStatement { - type: "IfStatement"; - test: Expression; - consequent: Statement; - alternate?: Statement | null | undefined; -} - -export interface LabeledStatement extends BaseStatement { - type: "LabeledStatement"; - label: Identifier; - body: Statement; -} - -export interface BreakStatement extends BaseStatement { - type: "BreakStatement"; - label?: Identifier | null | undefined; -} - -export interface ContinueStatement extends BaseStatement { - type: "ContinueStatement"; - label?: Identifier | null | undefined; -} - -export interface WithStatement extends BaseStatement { - type: "WithStatement"; - object: Expression; - body: Statement; -} - -export interface SwitchStatement extends BaseStatement { - type: "SwitchStatement"; - discriminant: Expression; - cases: SwitchCase[]; -} - -export interface ReturnStatement extends BaseStatement { - type: "ReturnStatement"; - argument?: Expression | null | undefined; -} - -export interface ThrowStatement extends BaseStatement { - type: "ThrowStatement"; - argument: Expression; -} - -export interface TryStatement extends BaseStatement { - type: "TryStatement"; - block: BlockStatement; - handler?: CatchClause | null | undefined; - finalizer?: BlockStatement | null | undefined; -} - -export interface WhileStatement extends BaseStatement { - type: "WhileStatement"; - test: Expression; - body: Statement; -} - -export interface DoWhileStatement extends BaseStatement { - type: "DoWhileStatement"; - body: Statement; - test: Expression; -} - -export interface ForStatement extends BaseStatement { - type: "ForStatement"; - init?: VariableDeclaration | Expression | null | undefined; - test?: Expression | null | undefined; - update?: Expression | null | undefined; - body: Statement; -} - -export interface BaseForXStatement extends BaseStatement { - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -export interface ForInStatement extends BaseForXStatement { - type: "ForInStatement"; -} - -export interface DebuggerStatement extends BaseStatement { - type: "DebuggerStatement"; -} - -export type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; - -export interface BaseDeclaration extends BaseStatement {} - -export interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { - type: "FunctionDeclaration"; - /** It is null when a function declaration is a part of the `export default function` statement */ - id: Identifier | null; - body: BlockStatement; -} - -export interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { - id: Identifier; -} - -export interface VariableDeclaration extends BaseDeclaration { - type: "VariableDeclaration"; - declarations: VariableDeclarator[]; - kind: "var" | "let" | "const" | "using" | "await using"; -} - -export interface VariableDeclarator extends BaseNode { - type: "VariableDeclarator"; - id: Pattern; - init?: Expression | null | undefined; -} - -export interface ExpressionMap { - ArrayExpression: ArrayExpression; - ArrowFunctionExpression: ArrowFunctionExpression; - AssignmentExpression: AssignmentExpression; - AwaitExpression: AwaitExpression; - BinaryExpression: BinaryExpression; - CallExpression: CallExpression; - ChainExpression: ChainExpression; - ClassExpression: ClassExpression; - ConditionalExpression: ConditionalExpression; - FunctionExpression: FunctionExpression; - Identifier: Identifier; - ImportExpression: ImportExpression; - Literal: Literal; - LogicalExpression: LogicalExpression; - MemberExpression: MemberExpression; - MetaProperty: MetaProperty; - NewExpression: NewExpression; - ObjectExpression: ObjectExpression; - SequenceExpression: SequenceExpression; - TaggedTemplateExpression: TaggedTemplateExpression; - TemplateLiteral: TemplateLiteral; - ThisExpression: ThisExpression; - UnaryExpression: UnaryExpression; - UpdateExpression: UpdateExpression; - YieldExpression: YieldExpression; -} - -export type Expression = ExpressionMap[keyof ExpressionMap]; - -export interface BaseExpression extends BaseNode {} - -export type ChainElement = SimpleCallExpression | MemberExpression; - -export interface ChainExpression extends BaseExpression { - type: "ChainExpression"; - expression: ChainElement; -} - -export interface ThisExpression extends BaseExpression { - type: "ThisExpression"; -} - -export interface ArrayExpression extends BaseExpression { - type: "ArrayExpression"; - elements: Array; -} - -export interface ObjectExpression extends BaseExpression { - type: "ObjectExpression"; - properties: Array; -} - -export interface PrivateIdentifier extends BaseNode { - type: "PrivateIdentifier"; - name: string; -} - -export interface Property extends BaseNode { - type: "Property"; - key: Expression | PrivateIdentifier; - value: Expression | Pattern; // Could be an AssignmentProperty - kind: "init" | "get" | "set"; - method: boolean; - shorthand: boolean; - computed: boolean; -} - -export interface PropertyDefinition extends BaseNode { - type: "PropertyDefinition"; - key: Expression | PrivateIdentifier; - value?: Expression | null | undefined; - computed: boolean; - static: boolean; -} - -export interface FunctionExpression extends BaseFunction, BaseExpression { - id?: Identifier | null | undefined; - type: "FunctionExpression"; - body: BlockStatement; -} - -export interface SequenceExpression extends BaseExpression { - type: "SequenceExpression"; - expressions: Expression[]; -} - -export interface UnaryExpression extends BaseExpression { - type: "UnaryExpression"; - operator: UnaryOperator; - prefix: true; - argument: Expression; -} - -export interface BinaryExpression extends BaseExpression { - type: "BinaryExpression"; - operator: BinaryOperator; - left: Expression | PrivateIdentifier; - right: Expression; -} - -export interface AssignmentExpression extends BaseExpression { - type: "AssignmentExpression"; - operator: AssignmentOperator; - left: Pattern | MemberExpression; - right: Expression; -} - -export interface UpdateExpression extends BaseExpression { - type: "UpdateExpression"; - operator: UpdateOperator; - argument: Expression; - prefix: boolean; -} - -export interface LogicalExpression extends BaseExpression { - type: "LogicalExpression"; - operator: LogicalOperator; - left: Expression; - right: Expression; -} - -export interface ConditionalExpression extends BaseExpression { - type: "ConditionalExpression"; - test: Expression; - alternate: Expression; - consequent: Expression; -} - -export interface BaseCallExpression extends BaseExpression { - callee: Expression | Super; - arguments: Array; -} -export type CallExpression = SimpleCallExpression | NewExpression; - -export interface SimpleCallExpression extends BaseCallExpression { - type: "CallExpression"; - optional: boolean; -} - -export interface NewExpression extends BaseCallExpression { - type: "NewExpression"; -} - -export interface MemberExpression extends BaseExpression, BasePattern { - type: "MemberExpression"; - object: Expression | Super; - property: Expression | PrivateIdentifier; - computed: boolean; - optional: boolean; -} - -export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; - -export interface BasePattern extends BaseNode {} - -export interface SwitchCase extends BaseNode { - type: "SwitchCase"; - test?: Expression | null | undefined; - consequent: Statement[]; -} - -export interface CatchClause extends BaseNode { - type: "CatchClause"; - param: Pattern | null; - body: BlockStatement; -} - -export interface Identifier extends BaseNode, BaseExpression, BasePattern { - type: "Identifier"; - name: string; -} - -export type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; - -export interface SimpleLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value: string | boolean | number | null; - raw?: string | undefined; -} - -export interface RegExpLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: RegExp | null | undefined; - regex: { - pattern: string; - flags: string; - }; - raw?: string | undefined; -} - -export interface BigIntLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: bigint | null | undefined; - bigint: string; - raw?: string | undefined; -} - -export type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; - -export type BinaryOperator = - | "==" - | "!=" - | "===" - | "!==" - | "<" - | "<=" - | ">" - | ">=" - | "<<" - | ">>" - | ">>>" - | "+" - | "-" - | "*" - | "/" - | "%" - | "**" - | "|" - | "^" - | "&" - | "in" - | "instanceof"; - -export type LogicalOperator = "||" | "&&" | "??"; - -export type AssignmentOperator = - | "=" - | "+=" - | "-=" - | "*=" - | "/=" - | "%=" - | "**=" - | "<<=" - | ">>=" - | ">>>=" - | "|=" - | "^=" - | "&=" - | "||=" - | "&&=" - | "??="; - -export type UpdateOperator = "++" | "--"; - -export interface ForOfStatement extends BaseForXStatement { - type: "ForOfStatement"; - await: boolean; -} - -export interface Super extends BaseNode { - type: "Super"; -} - -export interface SpreadElement extends BaseNode { - type: "SpreadElement"; - argument: Expression; -} - -export interface ArrowFunctionExpression extends BaseExpression, BaseFunction { - type: "ArrowFunctionExpression"; - expression: boolean; - body: BlockStatement | Expression; -} - -export interface YieldExpression extends BaseExpression { - type: "YieldExpression"; - argument?: Expression | null | undefined; - delegate: boolean; -} - -export interface TemplateLiteral extends BaseExpression { - type: "TemplateLiteral"; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -export interface TaggedTemplateExpression extends BaseExpression { - type: "TaggedTemplateExpression"; - tag: Expression; - quasi: TemplateLiteral; -} - -export interface TemplateElement extends BaseNode { - type: "TemplateElement"; - tail: boolean; - value: { - /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ - cooked?: string | null | undefined; - raw: string; - }; -} - -export interface AssignmentProperty extends Property { - value: Pattern; - kind: "init"; - method: boolean; // false -} - -export interface ObjectPattern extends BasePattern { - type: "ObjectPattern"; - properties: Array; -} - -export interface ArrayPattern extends BasePattern { - type: "ArrayPattern"; - elements: Array; -} - -export interface RestElement extends BasePattern { - type: "RestElement"; - argument: Pattern; -} - -export interface AssignmentPattern extends BasePattern { - type: "AssignmentPattern"; - left: Pattern; - right: Expression; -} - -export type Class = ClassDeclaration | ClassExpression; -export interface BaseClass extends BaseNode { - superClass?: Expression | null | undefined; - body: ClassBody; -} - -export interface ClassBody extends BaseNode { - type: "ClassBody"; - body: Array; -} - -export interface MethodDefinition extends BaseNode { - type: "MethodDefinition"; - key: Expression | PrivateIdentifier; - value: FunctionExpression; - kind: "constructor" | "method" | "get" | "set"; - computed: boolean; - static: boolean; -} - -export interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { - type: "ClassDeclaration"; - /** It is null when a class declaration is a part of the `export default class` statement */ - id: Identifier | null; -} - -export interface ClassDeclaration extends MaybeNamedClassDeclaration { - id: Identifier; -} - -export interface ClassExpression extends BaseClass, BaseExpression { - type: "ClassExpression"; - id?: Identifier | null | undefined; -} - -export interface MetaProperty extends BaseExpression { - type: "MetaProperty"; - meta: Identifier; - property: Identifier; -} - -export type ModuleDeclaration = - | ImportDeclaration - | ExportNamedDeclaration - | ExportDefaultDeclaration - | ExportAllDeclaration; -export interface BaseModuleDeclaration extends BaseNode {} - -export type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; -export interface BaseModuleSpecifier extends BaseNode { - local: Identifier; -} - -export interface ImportDeclaration extends BaseModuleDeclaration { - type: "ImportDeclaration"; - specifiers: Array; - attributes: ImportAttribute[]; - source: Literal; -} - -export interface ImportSpecifier extends BaseModuleSpecifier { - type: "ImportSpecifier"; - imported: Identifier | Literal; -} - -export interface ImportAttribute extends BaseNode { - type: "ImportAttribute"; - key: Identifier | Literal; - value: Literal; -} - -export interface ImportExpression extends BaseExpression { - type: "ImportExpression"; - source: Expression; - options?: Expression | null | undefined; -} - -export interface ImportDefaultSpecifier extends BaseModuleSpecifier { - type: "ImportDefaultSpecifier"; -} - -export interface ImportNamespaceSpecifier extends BaseModuleSpecifier { - type: "ImportNamespaceSpecifier"; -} - -export interface ExportNamedDeclaration extends BaseModuleDeclaration { - type: "ExportNamedDeclaration"; - declaration?: Declaration | null | undefined; - specifiers: ExportSpecifier[]; - attributes: ImportAttribute[]; - source?: Literal | null | undefined; -} - -export interface ExportSpecifier extends Omit { - type: "ExportSpecifier"; - local: Identifier | Literal; - exported: Identifier | Literal; -} - -export interface ExportDefaultDeclaration extends BaseModuleDeclaration { - type: "ExportDefaultDeclaration"; - declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; -} - -export interface ExportAllDeclaration extends BaseModuleDeclaration { - type: "ExportAllDeclaration"; - exported: Identifier | Literal | null; - attributes: ImportAttribute[]; - source: Literal; -} - -export interface AwaitExpression extends BaseExpression { - type: "AwaitExpression"; - argument: Expression; -} diff --git a/node_modules/@types/estree/package.json b/node_modules/@types/estree/package.json deleted file mode 100644 index 68c0782..0000000 --- a/node_modules/@types/estree/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@types/estree", - "version": "1.0.8", - "description": "TypeScript definitions for estree", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/estree", - "license": "MIT", - "contributors": [ - { - "name": "RReverser", - "githubUsername": "RReverser", - "url": "https://github.com/RReverser" - } - ], - "main": "", - "types": "index.d.ts", - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/estree" - }, - "scripts": {}, - "dependencies": {}, - "peerDependencies": {}, - "typesPublisherContentHash": "7a167b6e4a4d9f6e9a2cb9fd3fc45c885f89cbdeb44b3e5961bb057a45c082fd", - "typeScriptVersion": "5.1", - "nonNpm": true -} \ No newline at end of file diff --git a/node_modules/@vitest/expect/LICENSE b/node_modules/@vitest/expect/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/expect/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/expect/README.md b/node_modules/@vitest/expect/README.md deleted file mode 100644 index 4d7143b..0000000 --- a/node_modules/@vitest/expect/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# @vitest/expect - -Jest's expect matchers as a Chai plugin. - -## Usage - -```js -import { - JestAsymmetricMatchers, - JestChaiExpect, - JestExtend, -} from '@vitest/expect' -import * as chai from 'chai' - -// allows using expect.extend instead of chai.use to extend plugins -chai.use(JestExtend) -// adds all jest matchers to expect -chai.use(JestChaiExpect) -// adds asymmetric matchers like stringContaining, objectContaining -chai.use(JestAsymmetricMatchers) -``` diff --git a/node_modules/@vitest/expect/dist/index.d.ts b/node_modules/@vitest/expect/dist/index.d.ts deleted file mode 100644 index a296d58..0000000 --- a/node_modules/@vitest/expect/dist/index.d.ts +++ /dev/null @@ -1,806 +0,0 @@ -import { Test } from '@vitest/runner'; -import { MockInstance } from '@vitest/spy'; -import { Constructable } from '@vitest/utils'; -import { Formatter } from 'tinyrainbow'; -import { StandardSchemaV1 } from '@standard-schema/spec'; -import { diff, printDiffOrStringify } from '@vitest/utils/diff'; -export { DiffOptions } from '@vitest/utils/diff'; -import { stringify } from '@vitest/utils/display'; -import * as chai from 'chai'; -export { chai }; - -declare const MATCHERS_OBJECT: unique symbol; -declare const JEST_MATCHERS_OBJECT: unique symbol; -declare const GLOBAL_EXPECT: unique symbol; -declare const ASYMMETRIC_MATCHERS_OBJECT: unique symbol; - -interface AsymmetricMatcherInterface { - asymmetricMatch: (other: unknown, customTesters?: Array) => boolean; - toString: () => string; - getExpectedType?: () => string; - toAsymmetricMatcher?: () => string; -} -declare abstract class AsymmetricMatcher< - T, - State extends MatcherState = MatcherState -> implements AsymmetricMatcherInterface { - protected sample: T; - protected inverse: boolean; - $$typeof: symbol; - constructor(sample: T, inverse?: boolean); - protected getMatcherContext(expect?: Chai.ExpectStatic): State; - abstract asymmetricMatch(other: unknown, customTesters?: Array): boolean; - abstract toString(): string; - getExpectedType?(): string; - toAsymmetricMatcher?(): string; -} -declare class StringContaining extends AsymmetricMatcher { - constructor(sample: string, inverse?: boolean); - asymmetricMatch(other: string): boolean; - toString(): string; - getExpectedType(): string; -} -declare class Anything extends AsymmetricMatcher { - asymmetricMatch(other: unknown): boolean; - toString(): string; - toAsymmetricMatcher(): string; -} -declare class ObjectContaining extends AsymmetricMatcher> { - constructor(sample: Record, inverse?: boolean); - getPrototype(obj: object): any; - hasProperty(obj: object | null, property: string | symbol): boolean; - getProperties(obj: object): (string | symbol)[]; - asymmetricMatch(other: any, customTesters?: Array): boolean; - toString(): string; - getExpectedType(): string; -} -declare class ArrayContaining extends AsymmetricMatcher> { - constructor(sample: Array, inverse?: boolean); - asymmetricMatch(other: Array, customTesters?: Array): boolean; - toString(): string; - getExpectedType(): string; -} -declare class Any extends AsymmetricMatcher { - constructor(sample: unknown); - fnNameFor(func: Function): string; - asymmetricMatch(other: unknown): boolean; - toString(): string; - getExpectedType(): string; - toAsymmetricMatcher(): string; -} -declare class StringMatching extends AsymmetricMatcher { - constructor(sample: string | RegExp, inverse?: boolean); - asymmetricMatch(other: string): boolean; - toString(): string; - getExpectedType(): string; -} -declare class SchemaMatching extends AsymmetricMatcher> { - private result; - constructor(sample: StandardSchemaV1, inverse?: boolean); - asymmetricMatch(other: unknown): boolean; - toString(): string; - getExpectedType(): string; - toAsymmetricMatcher(): string; -} -declare const JestAsymmetricMatchers: ChaiPlugin; - -declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string; -declare function printReceived(object: unknown): string; -declare function printExpected(value: unknown): string; -declare function getMatcherUtils(): { - EXPECTED_COLOR: Formatter; - RECEIVED_COLOR: Formatter; - INVERTED_COLOR: Formatter; - BOLD_WEIGHT: Formatter; - DIM_COLOR: Formatter; - diff: typeof diff; - matcherHint: typeof matcherHint; - printReceived: typeof printReceived; - printExpected: typeof printExpected; - printDiffOrStringify: typeof printDiffOrStringify; - printWithType: typeof printWithType; -}; -declare function printWithType(name: string, value: T, print: (value: T) => string): string; -declare function addCustomEqualityTesters(newTesters: Array): void; - -/** -* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -*/ - -type ChaiPlugin = Chai.ChaiPlugin; -type Tester = (this: TesterContext, a: any, b: any, customTesters: Array) => boolean | undefined; -interface TesterContext { - equals: (a: unknown, b: unknown, customTesters?: Array, strictCheck?: boolean) => boolean; -} - -interface MatcherHintOptions { - comment?: string; - expectedColor?: Formatter; - isDirectExpectCall?: boolean; - isNot?: boolean; - promise?: string; - receivedColor?: Formatter; - secondArgument?: string; - secondArgumentColor?: Formatter; -} -interface MatcherState { - customTesters: Array; - assertionCalls: number; - currentTestName?: string; - dontThrow?: () => void; - error?: Error; - equals: (a: unknown, b: unknown, customTesters?: Array, strictCheck?: boolean) => boolean; - expand?: boolean; - expectedAssertionsNumber?: number | null; - expectedAssertionsNumberErrorGen?: (() => Error) | null; - isExpectingAssertions?: boolean; - isExpectingAssertionsError?: Error | null; - isNot: boolean; - promise: string; - suppressedErrors: Array; - testPath?: string; - utils: ReturnType & { - diff: typeof diff; - stringify: typeof stringify; - iterableEquality: Tester; - subsetEquality: Tester; - }; - soft?: boolean; - poll?: boolean; - task?: Readonly; -} -interface SyncExpectationResult { - pass: boolean; - message: () => string; - actual?: any; - expected?: any; -} -type AsyncExpectationResult = Promise; -type ExpectationResult = SyncExpectationResult | AsyncExpectationResult; -interface RawMatcherFn< - T extends MatcherState = MatcherState, - E extends Array = Array -> { - (this: T, received: any, ...expected: E): ExpectationResult; -} -interface Matchers {} -type MatchersObject = Record> & ThisType & { [K in keyof Matchers]? : RawMatcherFn[K]>> }; -interface ExpectStatic extends Chai.ExpectStatic, Matchers, AsymmetricMatchersContaining { - (actual: T, message?: string): Assertion; - extend: (expects: MatchersObject) => void; - anything: () => any; - any: (constructor: unknown) => any; - getState: () => MatcherState; - setState: (state: Partial) => void; - not: AsymmetricMatchersContaining; -} -interface CustomMatcher { - /** - * Checks that a value satisfies a custom matcher function. - * - * @param matcher - A function returning a boolean based on the custom condition - * @param message - Optional custom error message on failure - * - * @example - * expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18'); - * expect(age).toEqual(expect.toSatisfy(val => val >= 18, 'Age must be at least 18')); - */ - toSatisfy: (matcher: (value: any) => boolean, message?: string) => any; - /** - * Matches if the received value is one of the values in the expected array or set. - * - * @example - * expect(1).toBeOneOf([1, 2, 3]) - * expect('foo').toBeOneOf([expect.any(String)]) - * expect({ a: 1 }).toEqual({ a: expect.toBeOneOf(['1', '2', '3']) }) - */ - toBeOneOf: (sample: Array | Set) => any; -} -interface AsymmetricMatchersContaining extends CustomMatcher { - /** - * Matches if the received string contains the expected substring. - * - * @example - * expect('I have an apple').toEqual(expect.stringContaining('apple')); - * expect({ a: 'test string' }).toEqual({ a: expect.stringContaining('test') }); - */ - stringContaining: (expected: string) => any; - /** - * Matches if the received object contains all properties of the expected object. - * - * @example - * expect({ a: '1', b: 2 }).toEqual(expect.objectContaining({ a: '1' })) - */ - objectContaining: (expected: DeeplyAllowMatchers) => any; - /** - * Matches if the received array contains all elements in the expected array. - * - * @example - * expect(['a', 'b', 'c']).toEqual(expect.arrayContaining(['b', 'a'])); - */ - arrayContaining: (expected: Array>) => any; - /** - * Matches if the received string or regex matches the expected pattern. - * - * @example - * expect('hello world').toEqual(expect.stringMatching(/^hello/)); - * expect('hello world').toEqual(expect.stringMatching('hello')); - */ - stringMatching: (expected: string | RegExp) => any; - /** - * Matches if the received number is within a certain precision of the expected number. - * - * @param precision - Optional decimal precision for comparison. Default is 2. - * - * @example - * expect(10.45).toEqual(expect.closeTo(10.5, 1)); - * expect(5.11).toEqual(expect.closeTo(5.12)); // with default precision - */ - closeTo: (expected: number, precision?: number) => any; - /** - * Matches if the received value validates against a Standard Schema. - * - * @param schema - A Standard Schema V1 compatible schema object - * - * @example - * expect(user).toEqual(expect.schemaMatching(z.object({ name: z.string() }))) - * expect(['hello', 'world']).toEqual([expect.schemaMatching(z.string()), expect.schemaMatching(z.string())]) - */ - schemaMatching: (schema: unknown) => any; -} -type WithAsymmetricMatcher = T | AsymmetricMatcher; -type DeeplyAllowMatchers = T extends Array ? WithAsymmetricMatcher | DeeplyAllowMatchers[] : T extends object ? WithAsymmetricMatcher | { [K in keyof T] : DeeplyAllowMatchers } : WithAsymmetricMatcher; -interface JestAssertion extends jest.Matchers, CustomMatcher { - /** - * Used when you want to check that two objects have the same value. - * This matcher recursively checks the equality of all fields, rather than checking for object identity. - * - * @example - * expect(user).toEqual({ name: 'Alice', age: 30 }); - */ - toEqual: (expected: E) => void; - /** - * Use to test that objects have the same types as well as structure. - * - * @example - * expect(user).toStrictEqual({ name: 'Alice', age: 30 }); - */ - toStrictEqual: (expected: E) => void; - /** - * Checks that a value is what you expect. It calls `Object.is` to compare values. - * Don't use `toBe` with floating-point numbers. - * - * @example - * expect(result).toBe(42); - * expect(status).toBe(true); - */ - toBe: (expected: E) => void; - /** - * Check that a string matches a regular expression. - * - * @example - * expect(message).toMatch(/hello/); - * expect(greeting).toMatch('world'); - */ - toMatch: (expected: string | RegExp) => void; - /** - * Used to check that a JavaScript object matches a subset of the properties of an object - * - * @example - * expect(user).toMatchObject({ - * name: 'Alice', - * address: { city: 'Wonderland' } - * }); - */ - toMatchObject: (expected: E) => void; - /** - * Used when you want to check that an item is in a list. - * For testing the items in the list, this uses `===`, a strict equality check. - * - * @example - * expect(items).toContain('apple'); - * expect(numbers).toContain(5); - */ - toContain: (item: E) => void; - /** - * Used when you want to check that an item is in a list. - * For testing the items in the list, this matcher recursively checks the - * equality of all fields, rather than checking for object identity. - * - * @example - * expect(items).toContainEqual({ name: 'apple', quantity: 1 }); - */ - toContainEqual: (item: E) => void; - /** - * Use when you don't care what a value is, you just want to ensure a value - * is true in a boolean context. In JavaScript, there are six falsy values: - * `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy. - * - * @example - * expect(user.isActive).toBeTruthy(); - */ - toBeTruthy: () => void; - /** - * When you don't care what a value is, you just want to - * ensure a value is false in a boolean context. - * - * @example - * expect(user.isActive).toBeFalsy(); - */ - toBeFalsy: () => void; - /** - * For comparing floating point numbers. - * - * @example - * expect(score).toBeGreaterThan(10); - */ - toBeGreaterThan: (num: number | bigint) => void; - /** - * For comparing floating point numbers. - * - * @example - * expect(score).toBeGreaterThanOrEqual(10); - */ - toBeGreaterThanOrEqual: (num: number | bigint) => void; - /** - * For comparing floating point numbers. - * - * @example - * expect(score).toBeLessThan(10); - */ - toBeLessThan: (num: number | bigint) => void; - /** - * For comparing floating point numbers. - * - * @example - * expect(score).toBeLessThanOrEqual(10); - */ - toBeLessThanOrEqual: (num: number | bigint) => void; - /** - * Used to check that a variable is NaN. - * - * @example - * expect(value).toBeNaN(); - */ - toBeNaN: () => void; - /** - * Used to check that a variable is undefined. - * - * @example - * expect(value).toBeUndefined(); - */ - toBeUndefined: () => void; - /** - * This is the same as `.toBe(null)` but the error messages are a bit nicer. - * So use `.toBeNull()` when you want to check that something is null. - * - * @example - * expect(value).toBeNull(); - */ - toBeNull: () => void; - /** - * Used to check that a variable is nullable (null or undefined). - * - * @example - * expect(value).toBeNullable(); - */ - toBeNullable: () => void; - /** - * Ensure that a variable is not undefined. - * - * @example - * expect(value).toBeDefined(); - */ - toBeDefined: () => void; - /** - * Ensure that an object is an instance of a class. - * This matcher uses `instanceof` underneath. - * - * @example - * expect(new Date()).toBeInstanceOf(Date); - */ - toBeInstanceOf: (expected: E) => void; - /** - * Used to check that an object has a `.length` property - * and it is set to a certain numeric value. - * - * @example - * expect([1, 2, 3]).toHaveLength(3); - * expect('hello').toHaveLength(5); - */ - toHaveLength: (length: number) => void; - /** - * Use to check if a property at the specified path exists on an object. - * For checking deeply nested properties, you may use dot notation or an array containing - * the path segments for deep references. - * - * Optionally, you can provide a value to check if it matches the value present at the path - * on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks - * the equality of all fields. - * - * @example - * expect(user).toHaveProperty('address.city', 'New York'); - * expect(config).toHaveProperty(['settings', 'theme'], 'dark'); - */ - toHaveProperty: (property: string | (string | number)[], value?: E) => void; - /** - * Using exact equality with floating point numbers is a bad idea. - * Rounding means that intuitive things fail. - * The default for `numDigits` is 2. - * - * @example - * expect(price).toBeCloseTo(9.99, 2); - */ - toBeCloseTo: (number: number, numDigits?: number) => void; - /** - * Ensures that a mock function is called an exact number of times. - * - * Also under the alias `expect.toBeCalledTimes`. - * - * @example - * expect(mockFunc).toHaveBeenCalledTimes(2); - */ - toHaveBeenCalledTimes: (times: number) => void; - /** - * Ensures that a mock function is called an exact number of times. - * - * Alias for `expect.toHaveBeenCalledTimes`. - * - * @example - * expect(mockFunc).toBeCalledTimes(2); - */ - toBeCalledTimes: (times: number) => void; - /** - * Ensures that a mock function is called. - * - * Also under the alias `expect.toBeCalled`. - * - * @example - * expect(mockFunc).toHaveBeenCalled(); - */ - toHaveBeenCalled: () => void; - /** - * Ensures that a mock function is called. - * - * Alias for `expect.toHaveBeenCalled`. - * - * @example - * expect(mockFunc).toBeCalled(); - */ - toBeCalled: () => void; - /** - * Ensure that a mock function is called with specific arguments. - * - * Also under the alias `expect.toBeCalledWith`. - * - * @example - * expect(mockFunc).toHaveBeenCalledWith('arg1', 42); - */ - toHaveBeenCalledWith: (...args: E) => void; - /** - * Ensure that a mock function is called with specific arguments. - * - * Alias for `expect.toHaveBeenCalledWith`. - * - * @example - * expect(mockFunc).toBeCalledWith('arg1', 42); - */ - toBeCalledWith: (...args: E) => void; - /** - * Ensure that a mock function is called with specific arguments on an Nth call. - * - * Also under the alias `expect.nthCalledWith`. - * - * @example - * expect(mockFunc).toHaveBeenNthCalledWith(2, 'secondArg'); - */ - toHaveBeenNthCalledWith: (n: number, ...args: E) => void; - /** - * Ensure that a mock function is called with specific arguments on an Nth call. - * - * Alias for `expect.toHaveBeenNthCalledWith`. - * - * @example - * expect(mockFunc).nthCalledWith(2, 'secondArg'); - */ - nthCalledWith: (nthCall: number, ...args: E) => void; - /** - * If you have a mock function, you can use `.toHaveBeenLastCalledWith` - * to test what arguments it was last called with. - * - * Also under the alias `expect.lastCalledWith`. - * - * @example - * expect(mockFunc).toHaveBeenLastCalledWith('lastArg'); - */ - toHaveBeenLastCalledWith: (...args: E) => void; - /** - * If you have a mock function, you can use `.lastCalledWith` - * to test what arguments it was last called with. - * - * Alias for `expect.toHaveBeenLastCalledWith`. - * - * @example - * expect(mockFunc).lastCalledWith('lastArg'); - */ - lastCalledWith: (...args: E) => void; - /** - * Used to test that a function throws when it is called. - * - * Also under the alias `expect.toThrowError`. - * - * @example - * expect(() => functionWithError()).toThrow('Error message'); - * expect(() => parseJSON('invalid')).toThrow(SyntaxError); - */ - toThrow: (expected?: string | Constructable | RegExp | Error) => void; - /** - * Used to test that a function throws when it is called. - * - * Alias for `expect.toThrow`. - * - * @example - * expect(() => functionWithError()).toThrowError('Error message'); - * expect(() => parseJSON('invalid')).toThrowError(SyntaxError); - */ - toThrowError: (expected?: string | Constructable | RegExp | Error) => void; - /** - * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time - * - * Alias for `expect.toHaveReturned`. - * - * @example - * expect(mockFunc).toReturn(); - */ - toReturn: () => void; - /** - * Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time - * - * Also under the alias `expect.toReturn`. - * - * @example - * expect(mockFunc).toHaveReturned(); - */ - toHaveReturned: () => void; - /** - * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times. - * Any calls to the mock function that throw an error are not counted toward the number of times the function returned. - * - * Alias for `expect.toHaveReturnedTimes`. - * - * @example - * expect(mockFunc).toReturnTimes(3); - */ - toReturnTimes: (times: number) => void; - /** - * Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times. - * Any calls to the mock function that throw an error are not counted toward the number of times the function returned. - * - * Also under the alias `expect.toReturnTimes`. - * - * @example - * expect(mockFunc).toHaveReturnedTimes(3); - */ - toHaveReturnedTimes: (times: number) => void; - /** - * Use to ensure that a mock function returned a specific value. - * - * Alias for `expect.toHaveReturnedWith`. - * - * @example - * expect(mockFunc).toReturnWith('returnValue'); - */ - toReturnWith: (value: E) => void; - /** - * Use to ensure that a mock function returned a specific value. - * - * Also under the alias `expect.toReturnWith`. - * - * @example - * expect(mockFunc).toHaveReturnedWith('returnValue'); - */ - toHaveReturnedWith: (value: E) => void; - /** - * Use to test the specific value that a mock function last returned. - * If the last call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - * - * Also under the alias `expect.lastReturnedWith`. - * - * @example - * expect(mockFunc).toHaveLastReturnedWith('lastValue'); - */ - toHaveLastReturnedWith: (value: E) => void; - /** - * Use to test the specific value that a mock function last returned. - * If the last call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - * - * Alias for `expect.toHaveLastReturnedWith`. - * - * @example - * expect(mockFunc).lastReturnedWith('lastValue'); - */ - lastReturnedWith: (value: E) => void; - /** - * Use to test the specific value that a mock function returned for the nth call. - * If the nth call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - * - * Also under the alias `expect.nthReturnedWith`. - * - * @example - * expect(mockFunc).toHaveNthReturnedWith(2, 'nthValue'); - */ - toHaveNthReturnedWith: (nthCall: number, value: E) => void; - /** - * Use to test the specific value that a mock function returned for the nth call. - * If the nth call to the mock function threw an error, then this matcher will fail - * no matter what value you provided as the expected return value. - * - * Alias for `expect.toHaveNthReturnedWith`. - * - * @example - * expect(mockFunc).nthReturnedWith(2, 'nthValue'); - */ - nthReturnedWith: (nthCall: number, value: E) => void; -} -type VitestAssertion< - A, - T -> = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion } & ((type: string, message?: string) => Assertion); -type Promisify = { [K in keyof O] : O[K] extends (...args: infer A) => infer R ? Promisify & ((...args: A) => Promise) : O[K] }; -type PromisifyAssertion = Promisify>; -interface Assertion extends VitestAssertion, JestAssertion, Matchers { - /** - * Ensures a value is of a specific type. - * - * @example - * expect(value).toBeTypeOf('string'); - * expect(number).toBeTypeOf('number'); - */ - toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined") => void; - /** - * Asserts that a mock function was called exactly once. - * - * @example - * expect(mockFunc).toHaveBeenCalledOnce(); - */ - toHaveBeenCalledOnce: () => void; - /** - * Ensure that a mock function is called with specific arguments and called - * exactly once. - * - * @example - * expect(mockFunc).toHaveBeenCalledExactlyOnceWith('arg1', 42); - */ - toHaveBeenCalledExactlyOnceWith: (...args: E) => void; - /** - * This assertion checks if a `Mock` was called before another `Mock`. - * @param mock - A mock function created by `vi.spyOn` or `vi.fn` - * @param failIfNoFirstInvocation - Fail if the first mock was never called - * @example - * const mock1 = vi.fn() - * const mock2 = vi.fn() - * - * mock1() - * mock2() - * mock1() - * - * expect(mock1).toHaveBeenCalledBefore(mock2) - */ - toHaveBeenCalledBefore: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void; - /** - * This assertion checks if a `Mock` was called after another `Mock`. - * @param mock - A mock function created by `vi.spyOn` or `vi.fn` - * @param failIfNoFirstInvocation - Fail if the first mock was never called - * @example - * const mock1 = vi.fn() - * const mock2 = vi.fn() - * - * mock2() - * mock1() - * mock2() - * - * expect(mock1).toHaveBeenCalledAfter(mock2) - */ - toHaveBeenCalledAfter: (mock: MockInstance, failIfNoFirstInvocation?: boolean) => void; - /** - * Checks that a promise resolves successfully at least once. - * - * @example - * await expect(promise).toHaveResolved(); - */ - toHaveResolved: () => void; - /** - * Checks that a promise resolves to a specific value. - * - * @example - * await expect(promise).toHaveResolvedWith('success'); - */ - toHaveResolvedWith: (value: E) => void; - /** - * Ensures a promise resolves a specific number of times. - * - * @example - * expect(mockAsyncFunc).toHaveResolvedTimes(3); - */ - toHaveResolvedTimes: (times: number) => void; - /** - * Asserts that the last resolved value of a promise matches an expected value. - * - * @example - * await expect(mockAsyncFunc).toHaveLastResolvedWith('finalResult'); - */ - toHaveLastResolvedWith: (value: E) => void; - /** - * Ensures a specific value was returned by a promise on the nth resolution. - * - * @example - * await expect(mockAsyncFunc).toHaveNthResolvedWith(2, 'secondResult'); - */ - toHaveNthResolvedWith: (nthCall: number, value: E) => void; - /** - * Verifies that a promise resolves. - * - * @example - * await expect(someAsyncFunc).resolves.toBe(42); - */ - resolves: PromisifyAssertion; - /** - * Verifies that a promise rejects. - * - * @example - * await expect(someAsyncFunc).rejects.toThrow('error'); - */ - rejects: PromisifyAssertion; -} -declare global { - namespace jest { - interface Matchers< - R, - T = {} - > {} - } -} - -declare const customMatchers: MatchersObject; - -declare const JestChaiExpect: ChaiPlugin; - -declare const JestExtend: ChaiPlugin; - -declare function equals(a: unknown, b: unknown, customTesters?: Array, strictCheck?: boolean): boolean; -declare function isAsymmetric(obj: any): obj is AsymmetricMatcher; -declare function hasAsymmetric(obj: any, seen?: Set): boolean; -declare function isA(typeName: string, value: unknown): boolean; -declare function fnNameFor(func: Function): string; -declare function hasProperty(obj: object | null, property: string): boolean; -declare function isImmutableUnorderedKeyed(maybeKeyed: any): boolean; -declare function isImmutableUnorderedSet(maybeSet: any): boolean; -declare function iterableEquality(a: any, b: any, customTesters?: Array, aStack?: Array, bStack?: Array): boolean | undefined; -declare function subsetEquality(object: unknown, subset: unknown, customTesters?: Array): boolean | undefined; -declare function typeEquality(a: any, b: any): boolean | undefined; -declare function arrayBufferEquality(a: unknown, b: unknown): boolean | undefined; -declare function sparseArrayEquality(a: unknown, b: unknown, customTesters?: Array): boolean | undefined; -declare function generateToBeMessage(deepEqualityName: string, expected?: string, actual?: string): string; -declare function pluralize(word: string, count: number): string; -declare function getObjectKeys(object: object): Array; -declare function getObjectSubset(object: any, subset: any, customTesters: Array): { - subset: any; - stripped: number; -}; -/** -* Detects if an object is a Standard Schema V1 compatible schema -*/ -declare function isStandardSchema(obj: any): obj is StandardSchemaV1; - -declare function getState(expect: ExpectStatic): State; -declare function setState(state: Partial, expect: ExpectStatic): void; - -export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, SchemaMatching, StringContaining, StringMatching, addCustomEqualityTesters, arrayBufferEquality, customMatchers, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, isStandardSchema, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality }; -export type { Assertion, AsymmetricMatcherInterface, AsymmetricMatchersContaining, AsyncExpectationResult, ChaiPlugin, DeeplyAllowMatchers, ExpectStatic, ExpectationResult, JestAssertion, MatcherHintOptions, MatcherState, Matchers, MatchersObject, PromisifyAssertion, RawMatcherFn, SyncExpectationResult, Tester, TesterContext }; diff --git a/node_modules/@vitest/expect/dist/index.js b/node_modules/@vitest/expect/dist/index.js deleted file mode 100644 index ec7e5f9..0000000 --- a/node_modules/@vitest/expect/dist/index.js +++ /dev/null @@ -1,1875 +0,0 @@ -import { printDiffOrStringify, diff } from '@vitest/utils/diff'; -import { stringify } from '@vitest/utils/display'; -import { getType, isObject, noop, assertTypes } from '@vitest/utils/helpers'; -import c from 'tinyrainbow'; -import { isMockFunction } from '@vitest/spy'; -import { processError } from '@vitest/utils/error'; -import { use, util } from 'chai'; -import * as chai from 'chai'; -export { chai }; - -const MATCHERS_OBJECT = Symbol.for("matchers-object"); -const JEST_MATCHERS_OBJECT = Symbol.for("$$jest-matchers-object"); -const GLOBAL_EXPECT = Symbol.for("expect-global"); -const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for("asymmetric-matchers-object"); - -// selectively ported from https://github.com/jest-community/jest-extended -const customMatchers = { - toSatisfy(actual, expected, message) { - const { printReceived, printExpected, matcherHint } = this.utils; - const pass = expected(actual); - return { - pass, - message: () => pass ? `\ -${matcherHint(".not.toSatisfy", "received", "")} - -Expected value to not satisfy: -${message || printExpected(expected)} -Received: -${printReceived(actual)}` : `\ -${matcherHint(".toSatisfy", "received", "")} - -Expected value to satisfy: -${message || printExpected(expected)} - -Received: -${printReceived(actual)}` - }; - }, - toBeOneOf(actual, expected) { - const { equals, customTesters } = this; - const { printReceived, printExpected, matcherHint } = this.utils; - let pass; - if (Array.isArray(expected)) { - pass = expected.length === 0 || expected.some((item) => equals(item, actual, customTesters)); - } else if (expected instanceof Set) { - pass = expected.size === 0 || expected.has(actual) || [...expected].some((item) => equals(item, actual, customTesters)); - } else { - throw new TypeError(`You must provide an array or set to ${matcherHint(".toBeOneOf")}, not '${typeof expected}'.`); - } - return { - pass, - message: () => pass ? `\ -${matcherHint(".not.toBeOneOf", "received", "")} - -Expected value to not be one of: -${printExpected(expected)} -Received: -${printReceived(actual)}` : `\ -${matcherHint(".toBeOneOf", "received", "")} - -Expected value to be one of: -${printExpected(expected)} - -Received: -${printReceived(actual)}` - }; - } -}; - -const EXPECTED_COLOR = c.green; -const RECEIVED_COLOR = c.red; -const INVERTED_COLOR = c.inverse; -const BOLD_WEIGHT = c.bold; -const DIM_COLOR = c.dim; -function matcherHint(matcherName, received = "received", expected = "expected", options = {}) { - const { comment = "", isDirectExpectCall = false, isNot = false, promise = "", secondArgument = "", expectedColor = EXPECTED_COLOR, receivedColor = RECEIVED_COLOR, secondArgumentColor = EXPECTED_COLOR } = options; - let hint = ""; - let dimString = "expect"; - if (!isDirectExpectCall && received !== "") { - hint += DIM_COLOR(`${dimString}(`) + receivedColor(received); - dimString = ")"; - } - if (promise !== "") { - hint += DIM_COLOR(`${dimString}.`) + promise; - dimString = ""; - } - if (isNot) { - hint += `${DIM_COLOR(`${dimString}.`)}not`; - dimString = ""; - } - if (matcherName.includes(".")) { - // Old format: for backward compatibility, - // especially without promise or isNot options - dimString += matcherName; - } else { - // New format: omit period from matcherName arg - hint += DIM_COLOR(`${dimString}.`) + matcherName; - dimString = ""; - } - if (expected === "") { - dimString += "()"; - } else { - hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected); - if (secondArgument) { - hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument); - } - dimString = ")"; - } - if (comment !== "") { - dimString += ` // ${comment}`; - } - if (dimString !== "") { - hint += DIM_COLOR(dimString); - } - return hint; -} -const SPACE_SYMBOL = "·"; -// Instead of inverse highlight which now implies a change, -// replace common spaces with middle dot at the end of any line. -function replaceTrailingSpaces(text) { - return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length)); -} -function printReceived(object) { - return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object))); -} -function printExpected(value) { - return EXPECTED_COLOR(replaceTrailingSpaces(stringify(value))); -} -function getMatcherUtils() { - return { - EXPECTED_COLOR, - RECEIVED_COLOR, - INVERTED_COLOR, - BOLD_WEIGHT, - DIM_COLOR, - diff, - matcherHint, - printReceived, - printExpected, - printDiffOrStringify, - printWithType - }; -} -function printWithType(name, value, print) { - const type = getType(value); - const hasType = type !== "null" && type !== "undefined" ? `${name} has type: ${type}\n` : ""; - const hasValue = `${name} has value: ${print(value)}`; - return hasType + hasValue; -} -function addCustomEqualityTesters(newTesters) { - if (!Array.isArray(newTesters)) { - throw new TypeError(`expect.customEqualityTesters: Must be set to an array of Testers. Was given "${getType(newTesters)}"`); - } - globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters.push(...newTesters); -} -function getCustomEqualityTesters() { - return globalThis[JEST_MATCHERS_OBJECT].customEqualityTesters; -} - -// Extracted out of jasmine 2.5.2 -function equals(a, b, customTesters, strictCheck) { - customTesters = customTesters || []; - return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey); -} -const functionToString = Function.prototype.toString; -function isAsymmetric(obj) { - return !!obj && typeof obj === "object" && "asymmetricMatch" in obj && isA("Function", obj.asymmetricMatch); -} -function hasAsymmetric(obj, seen = new Set()) { - if (seen.has(obj)) { - return false; - } - seen.add(obj); - if (isAsymmetric(obj)) { - return true; - } - if (Array.isArray(obj)) { - return obj.some((i) => hasAsymmetric(i, seen)); - } - if (obj instanceof Set) { - return Array.from(obj).some((i) => hasAsymmetric(i, seen)); - } - if (isObject(obj)) { - return Object.values(obj).some((v) => hasAsymmetric(v, seen)); - } - return false; -} -function asymmetricMatch(a, b, customTesters) { - const asymmetricA = isAsymmetric(a); - const asymmetricB = isAsymmetric(b); - if (asymmetricA && asymmetricB) { - return undefined; - } - if (asymmetricA) { - return a.asymmetricMatch(b, customTesters); - } - if (asymmetricB) { - return b.asymmetricMatch(a, customTesters); - } -} -// Equality function lovingly adapted from isEqual in -// [Underscore](http://underscorejs.org) -function eq(a, b, aStack, bStack, customTesters, hasKey) { - let result = true; - const asymmetricResult = asymmetricMatch(a, b, customTesters); - if (asymmetricResult !== undefined) { - return asymmetricResult; - } - const testerContext = { equals }; - for (let i = 0; i < customTesters.length; i++) { - const customTesterResult = customTesters[i].call(testerContext, a, b, customTesters); - if (customTesterResult !== undefined) { - return customTesterResult; - } - } - if (typeof URL === "function" && a instanceof URL && b instanceof URL) { - return a.href === b.href; - } - if (Object.is(a, b)) { - return true; - } - // A strict comparison is necessary because `null == undefined`. - if (a === null || b === null) { - return a === b; - } - const className = Object.prototype.toString.call(a); - if (className !== Object.prototype.toString.call(b)) { - return false; - } - switch (className) { - case "[object Boolean]": - case "[object String]": - case "[object Number]": if (typeof a !== typeof b) { - // One is a primitive, one a `new Primitive()` - return false; - } else if (typeof a !== "object" && typeof b !== "object") { - // both are proper primitives - return Object.is(a, b); - } else { - // both are `new Primitive()`s - return Object.is(a.valueOf(), b.valueOf()); - } - case "[object Date]": { - const numA = +a; - const numB = +b; - // Coerce dates to numeric primitive values. Dates are compared by their - // millisecond representations. Note that invalid dates with millisecond representations - // of `NaN` are equivalent. - return numA === numB || Number.isNaN(numA) && Number.isNaN(numB); - } - case "[object RegExp]": return a.source === b.source && a.flags === b.flags; - case "[object Temporal.Instant]": - case "[object Temporal.ZonedDateTime]": - case "[object Temporal.PlainDateTime]": - case "[object Temporal.PlainDate]": - case "[object Temporal.PlainTime]": - case "[object Temporal.PlainYearMonth]": - case "[object Temporal.PlainMonthDay]": return a.equals(b); - case "[object Temporal.Duration]": return a.toString() === b.toString(); - } - if (typeof a !== "object" || typeof b !== "object") { - return false; - } - // Use DOM3 method isEqualNode (IE>=9) - if (isDomNode(a) && isDomNode(b)) { - return a.isEqualNode(b); - } - // Used to detect circular references. - let length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - // circular references at same depth are equal - // circular reference is not equal to non-circular one - if (aStack[length] === a) { - return bStack[length] === b; - } else if (bStack[length] === b) { - return false; - } - } - // Add the first object to the stack of traversed objects. - aStack.push(a); - bStack.push(b); - // Recursively compare objects and arrays. - // Compare array lengths to determine if a deep comparison is necessary. - if (className === "[object Array]" && a.length !== b.length) { - return false; - } - if (a instanceof Error && b instanceof Error) { - try { - return isErrorEqual(a, b, aStack, bStack, customTesters, hasKey); - } finally { - aStack.pop(); - bStack.pop(); - } - } - // Deep compare objects. - const aKeys = keys(a, hasKey); - let key; - let size = aKeys.length; - // Ensure that both objects contain the same number of properties before comparing deep equality. - if (keys(b, hasKey).length !== size) { - return false; - } - while (size--) { - key = aKeys[size]; - // Deep compare each member - result = hasKey(b, key) && eq(a[key], b[key], aStack, bStack, customTesters, hasKey); - if (!result) { - return false; - } - } - // Remove the first object from the stack of traversed objects. - aStack.pop(); - bStack.pop(); - return result; -} -function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey) { - // https://nodejs.org/docs/latest-v22.x/api/assert.html#comparison-details - // - [[Prototype]] of objects are compared using the === operator. - // - Only enumerable "own" properties are considered. - // - Error names, messages, causes, and errors are always compared, even if these are not enumerable properties. errors is also compared. - let result = Object.getPrototypeOf(a) === Object.getPrototypeOf(b) && a.name === b.name && a.message === b.message; - // check Error.cause asymmetrically - if (typeof b.cause !== "undefined") { - result && (result = eq(a.cause, b.cause, aStack, bStack, customTesters, hasKey)); - } - // AggregateError.errors - if (a instanceof AggregateError && b instanceof AggregateError) { - result && (result = eq(a.errors, b.errors, aStack, bStack, customTesters, hasKey)); - } - // spread to compare enumerable properties - result && (result = eq({ ...a }, { ...b }, aStack, bStack, customTesters, hasKey)); - return result; -} -function keys(obj, hasKey) { - const keys = []; - for (const key in obj) { - if (hasKey(obj, key)) { - keys.push(key); - } - } - return keys.concat(Object.getOwnPropertySymbols(obj).filter((symbol) => Object.getOwnPropertyDescriptor(obj, symbol).enumerable)); -} -function hasDefinedKey(obj, key) { - return hasKey(obj, key) && obj[key] !== undefined; -} -function hasKey(obj, key) { - return Object.hasOwn(obj, key); -} -function isA(typeName, value) { - return Object.prototype.toString.apply(value) === `[object ${typeName}]`; -} -function isDomNode(obj) { - return obj !== null && typeof obj === "object" && "nodeType" in obj && typeof obj.nodeType === "number" && "nodeName" in obj && typeof obj.nodeName === "string" && "isEqualNode" in obj && typeof obj.isEqualNode === "function"; -} -function fnNameFor(func) { - if (func.name) { - return func.name; - } - const matches = functionToString.call(func).match(/^(?:async)?\s*function\s*(?:\*\s*)?([\w$]+)\s*\(/); - return matches ? matches[1] : ""; -} -function getPrototype(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - if (obj.constructor.prototype === obj) { - return null; - } - return obj.constructor.prototype; -} -function hasProperty(obj, property) { - if (!obj) { - return false; - } - if (Object.hasOwn(obj, property)) { - return true; - } - return hasProperty(getPrototype(obj), property); -} -// SENTINEL constants are from https://github.com/facebook/immutable-js -const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@"; -const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@"; -const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@"; -const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@"; -const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@"; -function isImmutableUnorderedKeyed(maybeKeyed) { - return !!(maybeKeyed && maybeKeyed[IS_KEYED_SENTINEL] && !maybeKeyed[IS_ORDERED_SENTINEL]); -} -function isImmutableUnorderedSet(maybeSet) { - return !!(maybeSet && maybeSet[IS_SET_SENTINEL] && !maybeSet[IS_ORDERED_SENTINEL]); -} -function isObjectLiteral(source) { - return source != null && typeof source === "object" && !Array.isArray(source); -} -function isImmutableList(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_LIST_SENTINEL]); -} -function isImmutableOrderedKeyed(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_KEYED_SENTINEL] && source[IS_ORDERED_SENTINEL]); -} -function isImmutableOrderedSet(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_SET_SENTINEL] && source[IS_ORDERED_SENTINEL]); -} -function isImmutableRecord(source) { - return Boolean(source && isObjectLiteral(source) && source[IS_RECORD_SYMBOL]); -} -/** -* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -* -*/ -const IteratorSymbol = Symbol.iterator; -function hasIterator(object) { - return !!(object != null && object[IteratorSymbol]); -} -function iterableEquality(a, b, customTesters = [], aStack = [], bStack = []) { - if (typeof a !== "object" || typeof b !== "object" || Array.isArray(a) || Array.isArray(b) || !hasIterator(a) || !hasIterator(b)) { - return undefined; - } - if (a.constructor !== b.constructor) { - return false; - } - let length = aStack.length; - while (length--) { - // Linear search. Performance is inversely proportional to the number of - // unique nested structures. - // circular references at same depth are equal - // circular reference is not equal to non-circular one - if (aStack[length] === a) { - return bStack[length] === b; - } - } - aStack.push(a); - bStack.push(b); - const filteredCustomTesters = [...customTesters.filter((t) => t !== iterableEquality), iterableEqualityWithStack]; - function iterableEqualityWithStack(a, b) { - return iterableEquality(a, b, [...customTesters], [...aStack], [...bStack]); - } - if (a.size !== undefined) { - if (a.size !== b.size) { - return false; - } else if (isA("Set", a) || isImmutableUnorderedSet(a)) { - let allFound = true; - for (const aValue of a) { - if (!b.has(aValue)) { - let has = false; - for (const bValue of b) { - const isEqual = equals(aValue, bValue, filteredCustomTesters); - if (isEqual === true) { - has = true; - } - } - if (has === false) { - allFound = false; - break; - } - } - } - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return allFound; - } else if (isA("Map", a) || isImmutableUnorderedKeyed(a)) { - let allFound = true; - for (const aEntry of a) { - if (!b.has(aEntry[0]) || !equals(aEntry[1], b.get(aEntry[0]), filteredCustomTesters)) { - let has = false; - for (const bEntry of b) { - const matchedKey = equals(aEntry[0], bEntry[0], filteredCustomTesters); - let matchedValue = false; - if (matchedKey === true) { - matchedValue = equals(aEntry[1], bEntry[1], filteredCustomTesters); - } - if (matchedValue === true) { - has = true; - } - } - if (has === false) { - allFound = false; - break; - } - } - } - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return allFound; - } - } - const bIterator = b[IteratorSymbol](); - for (const aValue of a) { - const nextB = bIterator.next(); - if (nextB.done || !equals(aValue, nextB.value, filteredCustomTesters)) { - return false; - } - } - if (!bIterator.next().done) { - return false; - } - if (!isImmutableList(a) && !isImmutableOrderedKeyed(a) && !isImmutableOrderedSet(a) && !isImmutableRecord(a)) { - const aEntries = Object.entries(a); - const bEntries = Object.entries(b); - if (!equals(aEntries, bEntries, filteredCustomTesters)) { - return false; - } - } - // Remove the first value from the stack of traversed values. - aStack.pop(); - bStack.pop(); - return true; -} -/** -* Checks if `hasOwnProperty(object, key)` up the prototype chain, stopping at `Object.prototype`. -*/ -function hasPropertyInObject(object, key) { - const shouldTerminate = !object || typeof object !== "object" || object === Object.prototype; - if (shouldTerminate) { - return false; - } - return Object.hasOwn(object, key) || hasPropertyInObject(Object.getPrototypeOf(object), key); -} -function isObjectWithKeys(a) { - return isObject(a) && !(a instanceof Error) && !Array.isArray(a) && !(a instanceof Date); -} -function subsetEquality(object, subset, customTesters = []) { - const filteredCustomTesters = customTesters.filter((t) => t !== subsetEquality); - // subsetEquality needs to keep track of the references - // it has already visited to avoid infinite loops in case - // there are circular references in the subset passed to it. - const subsetEqualityWithContext = (seenReferences = new WeakMap()) => (object, subset) => { - if (!isObjectWithKeys(subset)) { - return undefined; - } - return Object.keys(subset).every((key) => { - if (subset[key] != null && typeof subset[key] === "object") { - if (seenReferences.has(subset[key])) { - return equals(object[key], subset[key], filteredCustomTesters); - } - seenReferences.set(subset[key], true); - } - const result = object != null && hasPropertyInObject(object, key) && equals(object[key], subset[key], [...filteredCustomTesters, subsetEqualityWithContext(seenReferences)]); - // The main goal of using seenReference is to avoid circular node on tree. - // It will only happen within a parent and its child, not a node and nodes next to it (same level) - // We should keep the reference for a parent and its child only - // Thus we should delete the reference immediately so that it doesn't interfere - // other nodes within the same level on tree. - seenReferences.delete(subset[key]); - return result; - }); - }; - return subsetEqualityWithContext()(object, subset); -} -function typeEquality(a, b) { - if (a == null || b == null || a.constructor === b.constructor) { - return undefined; - } - return false; -} -function arrayBufferEquality(a, b) { - let dataViewA = a; - let dataViewB = b; - if (!(a instanceof DataView && b instanceof DataView)) { - if (!(a instanceof ArrayBuffer) || !(b instanceof ArrayBuffer)) { - return undefined; - } - try { - dataViewA = new DataView(a); - dataViewB = new DataView(b); - } catch { - return undefined; - } - } - // Buffers are not equal when they do not have the same byte length - if (dataViewA.byteLength !== dataViewB.byteLength) { - return false; - } - // Check if every byte value is equal to each other - for (let i = 0; i < dataViewA.byteLength; i++) { - if (dataViewA.getUint8(i) !== dataViewB.getUint8(i)) { - return false; - } - } - return true; -} -function sparseArrayEquality(a, b, customTesters = []) { - if (!Array.isArray(a) || !Array.isArray(b)) { - return undefined; - } - // A sparse array [, , 1] will have keys ["2"] whereas [undefined, undefined, 1] will have keys ["0", "1", "2"] - const aKeys = Object.keys(a); - const bKeys = Object.keys(b); - const filteredCustomTesters = customTesters.filter((t) => t !== sparseArrayEquality); - return equals(a, b, filteredCustomTesters, true) && equals(aKeys, bKeys); -} -function generateToBeMessage(deepEqualityName, expected = "#{this}", actual = "#{exp}") { - const toBeMessage = `expected ${expected} to be ${actual} // Object.is equality`; - if (["toStrictEqual", "toEqual"].includes(deepEqualityName)) { - return `${toBeMessage}\n\nIf it should pass with deep equality, replace "toBe" with "${deepEqualityName}"\n\nExpected: ${expected}\nReceived: serializes to the same string\n`; - } - return toBeMessage; -} -function pluralize(word, count) { - return `${count} ${word}${count === 1 ? "" : "s"}`; -} -function getObjectKeys(object) { - return [...Object.keys(object), ...Object.getOwnPropertySymbols(object).filter((s) => { - var _Object$getOwnPropert; - return (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(object, s)) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.enumerable; - })]; -} -function getObjectSubset(object, subset, customTesters) { - let stripped = 0; - const getObjectSubsetWithContext = (seenReferences = new WeakMap()) => (object, subset) => { - if (Array.isArray(object)) { - if (Array.isArray(subset) && subset.length === object.length) { - // The map method returns correct subclass of subset. - return subset.map((sub, i) => getObjectSubsetWithContext(seenReferences)(object[i], sub)); - } - } else if (object instanceof Date) { - return object; - } else if (isObject(object) && isObject(subset)) { - if (equals(object, subset, [ - ...customTesters, - iterableEquality, - subsetEquality - ])) { - // return "expected" subset to avoid showing irrelevant toMatchObject diff - return subset; - } - const trimmed = {}; - seenReferences.set(object, trimmed); - // preserve constructor for toMatchObject diff - if (typeof object.constructor === "function" && typeof object.constructor.name === "string") { - Object.defineProperty(trimmed, "constructor", { - enumerable: false, - value: object.constructor - }); - } - for (const key of getObjectKeys(object)) { - if (hasPropertyInObject(subset, key)) { - trimmed[key] = seenReferences.has(object[key]) ? seenReferences.get(object[key]) : getObjectSubsetWithContext(seenReferences)(object[key], subset[key]); - } else { - if (!seenReferences.has(object[key])) { - stripped += 1; - if (isObject(object[key])) { - stripped += getObjectKeys(object[key]).length; - } - getObjectSubsetWithContext(seenReferences)(object[key], subset[key]); - } - } - } - if (getObjectKeys(trimmed).length > 0) { - return trimmed; - } - } - return object; - }; - return { - subset: getObjectSubsetWithContext()(object, subset), - stripped - }; -} -/** -* Detects if an object is a Standard Schema V1 compatible schema -*/ -function isStandardSchema(obj) { - return !!obj && (typeof obj === "object" || typeof obj === "function") && obj["~standard"] && typeof obj["~standard"].validate === "function"; -} - -if (!Object.hasOwn(globalThis, MATCHERS_OBJECT)) { - const globalState = new WeakMap(); - const matchers = Object.create(null); - const customEqualityTesters = []; - const asymmetricMatchers = Object.create(null); - Object.defineProperty(globalThis, MATCHERS_OBJECT, { get: () => globalState }); - Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, { - configurable: true, - get: () => ({ - state: globalState.get(globalThis[GLOBAL_EXPECT]), - matchers, - customEqualityTesters - }) - }); - Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, { get: () => asymmetricMatchers }); -} -function getState(expect) { - return globalThis[MATCHERS_OBJECT].get(expect); -} -function setState(state, expect) { - const map = globalThis[MATCHERS_OBJECT]; - const current = map.get(expect) || {}; - // so it keeps getters from `testPath` - const results = Object.defineProperties(current, { - ...Object.getOwnPropertyDescriptors(current), - ...Object.getOwnPropertyDescriptors(state) - }); - map.set(expect, results); -} - -class AsymmetricMatcher { - // should have "jest" to be compatible with its ecosystem - $$typeof = Symbol.for("jest.asymmetricMatcher"); - constructor(sample, inverse = false) { - this.sample = sample; - this.inverse = inverse; - } - getMatcherContext(expect) { - return { - ...getState(expect || globalThis[GLOBAL_EXPECT]), - equals, - isNot: this.inverse, - customTesters: getCustomEqualityTesters(), - utils: { - ...getMatcherUtils(), - diff, - stringify, - iterableEquality, - subsetEquality - } - }; - } -} -// implement custom chai/loupe inspect for better AssertionError.message formatting -// https://github.com/chaijs/loupe/blob/9b8a6deabcd50adc056a64fb705896194710c5c6/src/index.ts#L29 -// @ts-expect-error computed properties is not supported when isolatedDeclarations is enabled -// FIXME: https://github.com/microsoft/TypeScript/issues/61068 -AsymmetricMatcher.prototype[Symbol.for("chai/inspect")] = function(options) { - // minimal pretty-format with simple manual truncation - const result = stringify(this, options.depth, { min: true }); - if (result.length <= options.truncate) { - return result; - } - return `${this.toString()}{…}`; -}; -class StringContaining extends AsymmetricMatcher { - constructor(sample, inverse = false) { - if (!isA("String", sample)) { - throw new Error("Expected is not a string"); - } - super(sample, inverse); - } - asymmetricMatch(other) { - const result = isA("String", other) && other.includes(this.sample); - return this.inverse ? !result : result; - } - toString() { - return `String${this.inverse ? "Not" : ""}Containing`; - } - getExpectedType() { - return "string"; - } -} -class Anything extends AsymmetricMatcher { - asymmetricMatch(other) { - return other != null; - } - toString() { - return "Anything"; - } - toAsymmetricMatcher() { - return "Anything"; - } -} -class ObjectContaining extends AsymmetricMatcher { - constructor(sample, inverse = false) { - super(sample, inverse); - } - getPrototype(obj) { - if (Object.getPrototypeOf) { - return Object.getPrototypeOf(obj); - } - if (obj.constructor.prototype === obj) { - return null; - } - return obj.constructor.prototype; - } - hasProperty(obj, property) { - if (!obj) { - return false; - } - if (Object.hasOwn(obj, property)) { - return true; - } - return this.hasProperty(this.getPrototype(obj), property); - } - getProperties(obj) { - return [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj).filter((s) => { - var _Object$getOwnPropert; - return (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(obj, s)) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.enumerable; - })]; - } - asymmetricMatch(other, customTesters) { - if (typeof this.sample !== "object") { - throw new TypeError(`You must provide an object to ${this.toString()}, not '${typeof this.sample}'.`); - } - let result = true; - const properties = this.getProperties(this.sample); - for (const property of properties) { - var _Object$getOwnPropert2, _Object$getOwnPropert3; - if (!this.hasProperty(other, property)) { - result = false; - break; - } - const value = ((_Object$getOwnPropert2 = Object.getOwnPropertyDescriptor(this.sample, property)) === null || _Object$getOwnPropert2 === void 0 ? void 0 : _Object$getOwnPropert2.value) ?? this.sample[property]; - const otherValue = ((_Object$getOwnPropert3 = Object.getOwnPropertyDescriptor(other, property)) === null || _Object$getOwnPropert3 === void 0 ? void 0 : _Object$getOwnPropert3.value) ?? other[property]; - if (!equals(value, otherValue, customTesters)) { - result = false; - break; - } - } - return this.inverse ? !result : result; - } - toString() { - return `Object${this.inverse ? "Not" : ""}Containing`; - } - getExpectedType() { - return "object"; - } -} -class ArrayContaining extends AsymmetricMatcher { - constructor(sample, inverse = false) { - super(sample, inverse); - } - asymmetricMatch(other, customTesters) { - if (!Array.isArray(this.sample)) { - throw new TypeError(`You must provide an array to ${this.toString()}, not '${typeof this.sample}'.`); - } - const result = this.sample.length === 0 || Array.isArray(other) && this.sample.every((item) => other.some((another) => equals(item, another, customTesters))); - return this.inverse ? !result : result; - } - toString() { - return `Array${this.inverse ? "Not" : ""}Containing`; - } - getExpectedType() { - return "array"; - } -} -class Any extends AsymmetricMatcher { - constructor(sample) { - if (typeof sample === "undefined") { - throw new TypeError("any() expects to be passed a constructor function. " + "Please pass one or use anything() to match any object."); - } - super(sample); - } - fnNameFor(func) { - if (func.name) { - return func.name; - } - const functionToString = Function.prototype.toString; - const matches = functionToString.call(func).match(/^(?:async)?\s*function\s*(?:\*\s*)?([\w$]+)\s*\(/); - return matches ? matches[1] : ""; - } - asymmetricMatch(other) { - if (this.sample === String) { - return typeof other == "string" || other instanceof String; - } - if (this.sample === Number) { - return typeof other == "number" || other instanceof Number; - } - if (this.sample === Function) { - return typeof other == "function" || typeof other === "function"; - } - if (this.sample === Boolean) { - return typeof other == "boolean" || other instanceof Boolean; - } - if (this.sample === BigInt) { - return typeof other == "bigint" || other instanceof BigInt; - } - if (this.sample === Symbol) { - return typeof other == "symbol" || other instanceof Symbol; - } - if (this.sample === Object) { - return typeof other == "object"; - } - return other instanceof this.sample; - } - toString() { - return "Any"; - } - getExpectedType() { - if (this.sample === String) { - return "string"; - } - if (this.sample === Number) { - return "number"; - } - if (this.sample === Function) { - return "function"; - } - if (this.sample === Object) { - return "object"; - } - if (this.sample === Boolean) { - return "boolean"; - } - return this.fnNameFor(this.sample); - } - toAsymmetricMatcher() { - return `Any<${this.fnNameFor(this.sample)}>`; - } -} -class StringMatching extends AsymmetricMatcher { - constructor(sample, inverse = false) { - if (!isA("String", sample) && !isA("RegExp", sample)) { - throw new Error("Expected is not a String or a RegExp"); - } - super(new RegExp(sample), inverse); - } - asymmetricMatch(other) { - const result = isA("String", other) && this.sample.test(other); - return this.inverse ? !result : result; - } - toString() { - return `String${this.inverse ? "Not" : ""}Matching`; - } - getExpectedType() { - return "string"; - } -} -class CloseTo extends AsymmetricMatcher { - precision; - constructor(sample, precision = 2, inverse = false) { - if (!isA("Number", sample)) { - throw new Error("Expected is not a Number"); - } - if (!isA("Number", precision)) { - throw new Error("Precision is not a Number"); - } - super(sample); - this.inverse = inverse; - this.precision = precision; - } - asymmetricMatch(other) { - if (!isA("Number", other)) { - return false; - } - let result = false; - if (other === Number.POSITIVE_INFINITY && this.sample === Number.POSITIVE_INFINITY) { - result = true; - } else if (other === Number.NEGATIVE_INFINITY && this.sample === Number.NEGATIVE_INFINITY) { - result = true; - } else { - result = Math.abs(this.sample - other) < 10 ** -this.precision / 2; - } - return this.inverse ? !result : result; - } - toString() { - return `Number${this.inverse ? "Not" : ""}CloseTo`; - } - getExpectedType() { - return "number"; - } - toAsymmetricMatcher() { - return [ - this.toString(), - this.sample, - `(${pluralize("digit", this.precision)})` - ].join(" "); - } -} -class SchemaMatching extends AsymmetricMatcher { - result; - constructor(sample, inverse = false) { - if (!isStandardSchema(sample)) { - throw new TypeError("SchemaMatching expected to receive a Standard Schema."); - } - super(sample, inverse); - } - asymmetricMatch(other) { - const result = this.sample["~standard"].validate(other); - // Check if the result is a Promise (async validation) - if (result instanceof Promise) { - throw new TypeError("Async schema validation is not supported in asymmetric matchers."); - } - this.result = result; - const pass = !this.result.issues || this.result.issues.length === 0; - return this.inverse ? !pass : pass; - } - toString() { - return `Schema${this.inverse ? "Not" : ""}Matching`; - } - getExpectedType() { - return "object"; - } - toAsymmetricMatcher() { - var _this$result; - const { utils } = this.getMatcherContext(); - const issues = ((_this$result = this.result) === null || _this$result === void 0 ? void 0 : _this$result.issues) || []; - if (issues.length > 0) { - return `${this.toString()} ${utils.stringify(this.result, undefined, { printBasicPrototype: false })}`; - } - return this.toString(); - } -} -const JestAsymmetricMatchers = (chai, utils) => { - utils.addMethod(chai.expect, "anything", () => new Anything()); - utils.addMethod(chai.expect, "any", (expected) => new Any(expected)); - utils.addMethod(chai.expect, "stringContaining", (expected) => new StringContaining(expected)); - utils.addMethod(chai.expect, "objectContaining", (expected) => new ObjectContaining(expected)); - utils.addMethod(chai.expect, "arrayContaining", (expected) => new ArrayContaining(expected)); - utils.addMethod(chai.expect, "stringMatching", (expected) => new StringMatching(expected)); - utils.addMethod(chai.expect, "closeTo", (expected, precision) => new CloseTo(expected, precision)); - utils.addMethod(chai.expect, "schemaMatching", (expected) => new SchemaMatching(expected)); - // defineProperty does not work - chai.expect.not = { - stringContaining: (expected) => new StringContaining(expected, true), - objectContaining: (expected) => new ObjectContaining(expected, true), - arrayContaining: (expected) => new ArrayContaining(expected, true), - stringMatching: (expected) => new StringMatching(expected, true), - closeTo: (expected, precision) => new CloseTo(expected, precision, true), - schemaMatching: (expected) => new SchemaMatching(expected, true) - }; -}; - -function createAssertionMessage(util, assertion, hasArgs) { - const not = util.flag(assertion, "negate") ? "not." : ""; - const name = `${util.flag(assertion, "_name")}(${hasArgs ? "expected" : ""})`; - const promiseName = util.flag(assertion, "promise"); - const promise = promiseName ? `.${promiseName}` : ""; - return `expect(actual)${promise}.${not}${name}`; -} -function recordAsyncExpect(_test, promise, assertion, error) { - const test = _test; - // record promise for test, that resolves before test ends - if (test && promise instanceof Promise) { - // if promise is explicitly awaited, remove it from the list - promise = promise.finally(() => { - if (!test.promises) { - return; - } - const index = test.promises.indexOf(promise); - if (index !== -1) { - test.promises.splice(index, 1); - } - }); - // record promise - if (!test.promises) { - test.promises = []; - } - test.promises.push(promise); - let resolved = false; - test.onFinished ?? (test.onFinished = []); - test.onFinished.push(() => { - if (!resolved) { - var _vitest_worker__; - const processor = ((_vitest_worker__ = globalThis.__vitest_worker__) === null || _vitest_worker__ === void 0 ? void 0 : _vitest_worker__.onFilterStackTrace) || ((s) => s || ""); - const stack = processor(error.stack); - console.warn([ - `Promise returned by \`${assertion}\` was not awaited. `, - "Vitest currently auto-awaits hanging assertions at the end of the test, but this will cause the test to fail in Vitest 3. ", - "Please remember to await the assertion.\n", - stack - ].join("")); - } - }); - return { - then(onFulfilled, onRejected) { - resolved = true; - return promise.then(onFulfilled, onRejected); - }, - catch(onRejected) { - return promise.catch(onRejected); - }, - finally(onFinally) { - return promise.finally(onFinally); - }, - [Symbol.toStringTag]: "Promise" - }; - } - return promise; -} -function handleTestError(test, err) { - var _test$result; - test.result || (test.result = { state: "fail" }); - test.result.state = "fail"; - (_test$result = test.result).errors || (_test$result.errors = []); - test.result.errors.push(processError(err)); -} -function wrapAssertion(utils, name, fn) { - return function(...args) { - // private - if (name !== "withTest") { - utils.flag(this, "_name", name); - } - if (!utils.flag(this, "soft")) { - return fn.apply(this, args); - } - const test = utils.flag(this, "vitest-test"); - if (!test) { - throw new Error("expect.soft() can only be used inside a test"); - } - try { - const result = fn.apply(this, args); - if (result && typeof result === "object" && typeof result.then === "function") { - return result.then(noop, (err) => { - handleTestError(test, err); - }); - } - return result; - } catch (err) { - handleTestError(test, err); - } - }; -} - -// Jest Expect Compact -const JestChaiExpect = (chai, utils) => { - const { AssertionError } = chai; - const customTesters = getCustomEqualityTesters(); - function def(name, fn) { - const addMethod = (n) => { - const softWrapper = wrapAssertion(utils, n, fn); - utils.addMethod(chai.Assertion.prototype, n, softWrapper); - utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, n, softWrapper); - }; - if (Array.isArray(name)) { - name.forEach((n) => addMethod(n)); - } else { - addMethod(name); - } - } - [ - "throw", - "throws", - "Throw" - ].forEach((m) => { - utils.overwriteMethod(chai.Assertion.prototype, m, (_super) => { - return function(...args) { - const promise = utils.flag(this, "promise"); - const object = utils.flag(this, "object"); - const isNot = utils.flag(this, "negate"); - if (promise === "rejects") { - utils.flag(this, "object", () => { - throw object; - }); - } else if (promise === "resolves" && typeof object !== "function") { - if (!isNot) { - const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't"; - const error = { showDiff: false }; - throw new AssertionError(message, error, utils.flag(this, "ssfi")); - } else { - return; - } - } - _super.apply(this, args); - }; - }); - }); - // @ts-expect-error @internal - def("withTest", function(test) { - utils.flag(this, "vitest-test", test); - return this; - }); - def("toEqual", function(expected) { - const actual = utils.flag(this, "object"); - const equal = equals(actual, expected, [...customTesters, iterableEquality]); - return this.assert(equal, "expected #{this} to deeply equal #{exp}", "expected #{this} to not deeply equal #{exp}", expected, actual); - }); - def("toStrictEqual", function(expected) { - const obj = utils.flag(this, "object"); - const equal = equals(obj, expected, [ - ...customTesters, - iterableEquality, - typeEquality, - sparseArrayEquality, - arrayBufferEquality - ], true); - return this.assert(equal, "expected #{this} to strictly equal #{exp}", "expected #{this} to not strictly equal #{exp}", expected, obj); - }); - def("toBe", function(expected) { - const actual = this._obj; - const pass = Object.is(actual, expected); - let deepEqualityName = ""; - if (!pass) { - const toStrictEqualPass = equals(actual, expected, [ - ...customTesters, - iterableEquality, - typeEquality, - sparseArrayEquality, - arrayBufferEquality - ], true); - if (toStrictEqualPass) { - deepEqualityName = "toStrictEqual"; - } else { - const toEqualPass = equals(actual, expected, [...customTesters, iterableEquality]); - if (toEqualPass) { - deepEqualityName = "toEqual"; - } - } - } - return this.assert(pass, generateToBeMessage(deepEqualityName), "expected #{this} not to be #{exp} // Object.is equality", expected, actual); - }); - def("toMatchObject", function(expected) { - const actual = this._obj; - const pass = equals(actual, expected, [ - ...customTesters, - iterableEquality, - subsetEquality - ]); - const isNot = utils.flag(this, "negate"); - const { subset: actualSubset, stripped } = getObjectSubset(actual, expected, customTesters); - if (pass && isNot || !pass && !isNot) { - const msg = utils.getMessage(this, [ - pass, - "expected #{this} to match object #{exp}", - "expected #{this} to not match object #{exp}", - expected, - actualSubset, - false - ]); - const message = stripped === 0 ? msg : `${msg}\n(${stripped} matching ${stripped === 1 ? "property" : "properties"} omitted from actual)`; - throw new AssertionError(message, { - showDiff: true, - expected, - actual: actualSubset - }); - } - }); - def("toMatch", function(expected) { - const actual = this._obj; - if (typeof actual !== "string") { - throw new TypeError(`.toMatch() expects to receive a string, but got ${typeof actual}`); - } - return this.assert(typeof expected === "string" ? actual.includes(expected) : actual.match(expected), `expected #{this} to match #{exp}`, `expected #{this} not to match #{exp}`, expected, actual); - }); - def("toContain", function(item) { - const actual = this._obj; - if (typeof Node !== "undefined" && actual instanceof Node) { - if (!(item instanceof Node)) { - throw new TypeError(`toContain() expected a DOM node as the argument, but got ${typeof item}`); - } - return this.assert(actual.contains(item), "expected #{this} to contain element #{exp}", "expected #{this} not to contain element #{exp}", item, actual); - } - if (typeof DOMTokenList !== "undefined" && actual instanceof DOMTokenList) { - assertTypes(item, "class name", ["string"]); - const isNot = utils.flag(this, "negate"); - const expectedClassList = isNot ? actual.value.replace(item, "").trim() : `${actual.value} ${item}`; - return this.assert(actual.contains(item), `expected "${actual.value}" to contain "${item}"`, `expected "${actual.value}" not to contain "${item}"`, expectedClassList, actual.value); - } - // handle simple case on our own using `this.assert` to include diff in error message - if (typeof actual === "string" && typeof item === "string") { - return this.assert(actual.includes(item), `expected #{this} to contain #{exp}`, `expected #{this} not to contain #{exp}`, item, actual); - } - // make "actual" indexable to have compatibility with jest - if (actual != null && typeof actual !== "string") { - utils.flag(this, "object", Array.from(actual)); - } - return this.contain(item); - }); - def("toContainEqual", function(expected) { - const obj = utils.flag(this, "object"); - const index = Array.from(obj).findIndex((item) => { - return equals(item, expected, customTesters); - }); - this.assert(index !== -1, "expected #{this} to deep equally contain #{exp}", "expected #{this} to not deep equally contain #{exp}", expected); - }); - def("toBeTruthy", function() { - const obj = utils.flag(this, "object"); - this.assert(Boolean(obj), "expected #{this} to be truthy", "expected #{this} to not be truthy", true, obj); - }); - def("toBeFalsy", function() { - const obj = utils.flag(this, "object"); - this.assert(!obj, "expected #{this} to be falsy", "expected #{this} to not be falsy", false, obj); - }); - def("toBeGreaterThan", function(expected) { - const actual = this._obj; - assertTypes(actual, "actual", ["number", "bigint"]); - assertTypes(expected, "expected", ["number", "bigint"]); - return this.assert(actual > expected, `expected ${actual} to be greater than ${expected}`, `expected ${actual} to be not greater than ${expected}`, expected, actual, false); - }); - def("toBeGreaterThanOrEqual", function(expected) { - const actual = this._obj; - assertTypes(actual, "actual", ["number", "bigint"]); - assertTypes(expected, "expected", ["number", "bigint"]); - return this.assert(actual >= expected, `expected ${actual} to be greater than or equal to ${expected}`, `expected ${actual} to be not greater than or equal to ${expected}`, expected, actual, false); - }); - def("toBeLessThan", function(expected) { - const actual = this._obj; - assertTypes(actual, "actual", ["number", "bigint"]); - assertTypes(expected, "expected", ["number", "bigint"]); - return this.assert(actual < expected, `expected ${actual} to be less than ${expected}`, `expected ${actual} to be not less than ${expected}`, expected, actual, false); - }); - def("toBeLessThanOrEqual", function(expected) { - const actual = this._obj; - assertTypes(actual, "actual", ["number", "bigint"]); - assertTypes(expected, "expected", ["number", "bigint"]); - return this.assert(actual <= expected, `expected ${actual} to be less than or equal to ${expected}`, `expected ${actual} to be not less than or equal to ${expected}`, expected, actual, false); - }); - def("toBeNaN", function() { - const obj = utils.flag(this, "object"); - this.assert(Number.isNaN(obj), "expected #{this} to be NaN", "expected #{this} not to be NaN", Number.NaN, obj); - }); - def("toBeUndefined", function() { - const obj = utils.flag(this, "object"); - this.assert(undefined === obj, "expected #{this} to be undefined", "expected #{this} not to be undefined", undefined, obj); - }); - def("toBeNull", function() { - const obj = utils.flag(this, "object"); - this.assert(obj === null, "expected #{this} to be null", "expected #{this} not to be null", null, obj); - }); - def("toBeNullable", function() { - const obj = utils.flag(this, "object"); - this.assert(obj == null, "expected #{this} to be nullish", "expected #{this} not to be nullish", null, obj); - }); - def("toBeDefined", function() { - const obj = utils.flag(this, "object"); - this.assert(typeof obj !== "undefined", "expected #{this} to be defined", "expected #{this} to be undefined", obj); - }); - def("toBeTypeOf", function(expected) { - const actual = typeof this._obj; - const equal = expected === actual; - return this.assert(equal, "expected #{this} to be type of #{exp}", "expected #{this} not to be type of #{exp}", expected, actual); - }); - def("toBeInstanceOf", function(obj) { - return this.instanceOf(obj); - }); - def("toHaveLength", function(length) { - return this.have.length(length); - }); - // destructuring, because it checks `arguments` inside, and value is passing as `undefined` - def("toHaveProperty", function(...args) { - if (Array.isArray(args[0])) { - args[0] = args[0].map((key) => String(key).replace(/([.[\]])/g, "\\$1")).join("."); - } - const actual = this._obj; - const [propertyName, expected] = args; - const getValue = () => { - const hasOwn = Object.hasOwn(actual, propertyName); - if (hasOwn) { - return { - value: actual[propertyName], - exists: true - }; - } - return utils.getPathInfo(actual, propertyName); - }; - const { value, exists } = getValue(); - const pass = exists && (args.length === 1 || equals(expected, value, customTesters)); - const valueString = args.length === 1 ? "" : ` with value ${utils.objDisplay(expected)}`; - return this.assert(pass, `expected #{this} to have property "${propertyName}"${valueString}`, `expected #{this} to not have property "${propertyName}"${valueString}`, expected, exists ? value : undefined); - }); - def("toBeCloseTo", function(received, precision = 2) { - const expected = this._obj; - let pass = false; - let expectedDiff = 0; - let receivedDiff = 0; - if (received === Number.POSITIVE_INFINITY && expected === Number.POSITIVE_INFINITY) { - pass = true; - } else if (received === Number.NEGATIVE_INFINITY && expected === Number.NEGATIVE_INFINITY) { - pass = true; - } else { - expectedDiff = 10 ** -precision / 2; - receivedDiff = Math.abs(expected - received); - pass = receivedDiff < expectedDiff; - } - return this.assert(pass, `expected #{this} to be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, `expected #{this} to not be close to #{exp}, received difference is ${receivedDiff}, but expected ${expectedDiff}`, received, expected, false); - }); - function assertIsMock(assertion) { - if (!isMockFunction(assertion._obj)) { - throw new TypeError(`${utils.inspect(assertion._obj)} is not a spy or a call to a spy!`); - } - } - function getSpy(assertion) { - assertIsMock(assertion); - return assertion._obj; - } - def(["toHaveBeenCalledTimes", "toBeCalledTimes"], function(number) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const callCount = spy.mock.calls.length; - return this.assert(callCount === number, `expected "${spyName}" to be called #{exp} times, but got ${callCount} times`, `expected "${spyName}" to not be called #{exp} times`, number, callCount, false); - }); - def("toHaveBeenCalledOnce", function() { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const callCount = spy.mock.calls.length; - return this.assert(callCount === 1, `expected "${spyName}" to be called once, but got ${callCount} times`, `expected "${spyName}" to not be called once`, 1, callCount, false); - }); - def(["toHaveBeenCalled", "toBeCalled"], function() { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const callCount = spy.mock.calls.length; - const called = callCount > 0; - const isNot = utils.flag(this, "negate"); - let msg = utils.getMessage(this, [ - called, - `expected "${spyName}" to be called at least once`, - `expected "${spyName}" to not be called at all, but actually been called ${callCount} times`, - true, - called - ]); - if (called && isNot) { - msg = formatCalls(spy, msg); - } - if (called && isNot || !called && !isNot) { - throw new AssertionError(msg); - } - }); - // manually compare array elements since `jestEquals` cannot - // apply asymmetric matcher to `undefined` array element. - function equalsArgumentArray(a, b) { - return a.length === b.length && a.every((aItem, i) => equals(aItem, b[i], [...customTesters, iterableEquality])); - } - def(["toHaveBeenCalledWith", "toBeCalledWith"], function(...args) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const pass = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args)); - const isNot = utils.flag(this, "negate"); - const msg = utils.getMessage(this, [ - pass, - `expected "${spyName}" to be called with arguments: #{exp}`, - `expected "${spyName}" to not be called with arguments: #{exp}`, - args - ]); - if (pass && isNot || !pass && !isNot) { - throw new AssertionError(formatCalls(spy, msg, args)); - } - }); - def("toHaveBeenCalledExactlyOnceWith", function(...args) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const callCount = spy.mock.calls.length; - const hasCallWithArgs = spy.mock.calls.some((callArg) => equalsArgumentArray(callArg, args)); - const pass = hasCallWithArgs && callCount === 1; - const isNot = utils.flag(this, "negate"); - const msg = utils.getMessage(this, [ - pass, - `expected "${spyName}" to be called once with arguments: #{exp}`, - `expected "${spyName}" to not be called once with arguments: #{exp}`, - args - ]); - if (pass && isNot || !pass && !isNot) { - throw new AssertionError(formatCalls(spy, msg, args)); - } - }); - def(["toHaveBeenNthCalledWith", "nthCalledWith"], function(times, ...args) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const nthCall = spy.mock.calls[times - 1]; - const callCount = spy.mock.calls.length; - const isCalled = times <= callCount; - this.assert(nthCall && equalsArgumentArray(nthCall, args), `expected ${ordinalOf(times)} "${spyName}" call to have been called with #{exp}${isCalled ? `` : `, but called only ${callCount} times`}`, `expected ${ordinalOf(times)} "${spyName}" call to not have been called with #{exp}`, args, nthCall, isCalled); - }); - def(["toHaveBeenLastCalledWith", "lastCalledWith"], function(...args) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const lastCall = spy.mock.calls.at(-1); - this.assert(lastCall && equalsArgumentArray(lastCall, args), `expected last "${spyName}" call to have been called with #{exp}`, `expected last "${spyName}" call to not have been called with #{exp}`, args, lastCall); - }); - /** - * Used for `toHaveBeenCalledBefore` and `toHaveBeenCalledAfter` to determine if the expected spy was called before the result spy. - */ - function isSpyCalledBeforeAnotherSpy(beforeSpy, afterSpy, failIfNoFirstInvocation) { - const beforeInvocationCallOrder = beforeSpy.mock.invocationCallOrder; - const afterInvocationCallOrder = afterSpy.mock.invocationCallOrder; - if (beforeInvocationCallOrder.length === 0) { - return !failIfNoFirstInvocation; - } - if (afterInvocationCallOrder.length === 0) { - return false; - } - return beforeInvocationCallOrder[0] < afterInvocationCallOrder[0]; - } - def(["toHaveBeenCalledBefore"], function(resultSpy, failIfNoFirstInvocation = true) { - const expectSpy = getSpy(this); - if (!isMockFunction(resultSpy)) { - throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`); - } - this.assert(isSpyCalledBeforeAnotherSpy(expectSpy, resultSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called before "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called before "${resultSpy.getMockName()}"`, resultSpy, expectSpy); - }); - def(["toHaveBeenCalledAfter"], function(resultSpy, failIfNoFirstInvocation = true) { - const expectSpy = getSpy(this); - if (!isMockFunction(resultSpy)) { - throw new TypeError(`${utils.inspect(resultSpy)} is not a spy or a call to a spy`); - } - this.assert(isSpyCalledBeforeAnotherSpy(resultSpy, expectSpy, failIfNoFirstInvocation), `expected "${expectSpy.getMockName()}" to have been called after "${resultSpy.getMockName()}"`, `expected "${expectSpy.getMockName()}" to not have been called after "${resultSpy.getMockName()}"`, resultSpy, expectSpy); - }); - def(["toThrow", "toThrowError"], function(expected) { - if (typeof expected === "string" || typeof expected === "undefined" || expected instanceof RegExp) { - // Fixes the issue related to `chai` - return this.throws(expected === "" ? /^$/ : expected); - } - const obj = this._obj; - const promise = utils.flag(this, "promise"); - const isNot = utils.flag(this, "negate"); - let thrown = null; - if (promise === "rejects") { - thrown = obj; - } else if (promise === "resolves" && typeof obj !== "function") { - if (!isNot) { - const message = utils.flag(this, "message") || "expected promise to throw an error, but it didn't"; - const error = { showDiff: false }; - throw new AssertionError(message, error, utils.flag(this, "ssfi")); - } else { - return; - } - } else { - let isThrow = false; - try { - obj(); - } catch (err) { - isThrow = true; - thrown = err; - } - if (!isThrow && !isNot) { - const message = utils.flag(this, "message") || "expected function to throw an error, but it didn't"; - const error = { showDiff: false }; - throw new AssertionError(message, error, utils.flag(this, "ssfi")); - } - } - if (typeof expected === "function") { - const name = expected.name || expected.prototype.constructor.name; - return this.assert(thrown && thrown instanceof expected, `expected error to be instance of ${name}`, `expected error not to be instance of ${name}`, expected, thrown); - } - if (expected instanceof Error) { - const equal = equals(thrown, expected, [...customTesters, iterableEquality]); - return this.assert(equal, "expected a thrown error to be #{exp}", "expected a thrown error not to be #{exp}", expected, thrown); - } - if (typeof expected === "object" && "asymmetricMatch" in expected && typeof expected.asymmetricMatch === "function") { - const matcher = expected; - return this.assert(thrown && matcher.asymmetricMatch(thrown), "expected error to match asymmetric matcher", "expected error not to match asymmetric matcher", matcher, thrown); - } - throw new Error(`"toThrow" expects string, RegExp, function, Error instance or asymmetric matcher, got "${typeof expected}"`); - }); - [{ - name: "toHaveResolved", - condition: (spy) => spy.mock.settledResults.length > 0 && spy.mock.settledResults.some(({ type }) => type === "fulfilled"), - action: "resolved" - }, { - name: ["toHaveReturned", "toReturn"], - condition: (spy) => spy.mock.calls.length > 0 && spy.mock.results.some(({ type }) => type !== "throw"), - action: "called" - }].forEach(({ name, condition, action }) => { - def(name, function() { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const pass = condition(spy); - this.assert(pass, `expected "${spyName}" to be successfully ${action} at least once`, `expected "${spyName}" to not be successfully ${action}`, pass, !pass, false); - }); - }); - [{ - name: "toHaveResolvedTimes", - condition: (spy, times) => spy.mock.settledResults.reduce((s, { type }) => type === "fulfilled" ? ++s : s, 0) === times, - action: "resolved" - }, { - name: ["toHaveReturnedTimes", "toReturnTimes"], - condition: (spy, times) => spy.mock.results.reduce((s, { type }) => type === "throw" ? s : ++s, 0) === times, - action: "called" - }].forEach(({ name, condition, action }) => { - def(name, function(times) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const pass = condition(spy, times); - this.assert(pass, `expected "${spyName}" to be successfully ${action} ${times} times`, `expected "${spyName}" to not be successfully ${action} ${times} times`, `expected resolved times: ${times}`, `received resolved times: ${pass}`, false); - }); - }); - [{ - name: "toHaveResolvedWith", - condition: (spy, value) => spy.mock.settledResults.some(({ type, value: result }) => type === "fulfilled" && equals(value, result)), - action: "resolve" - }, { - name: ["toHaveReturnedWith", "toReturnWith"], - condition: (spy, value) => spy.mock.results.some(({ type, value: result }) => type === "return" && equals(value, result)), - action: "return" - }].forEach(({ name, condition, action }) => { - def(name, function(value) { - const spy = getSpy(this); - const pass = condition(spy, value); - const isNot = utils.flag(this, "negate"); - if (pass && isNot || !pass && !isNot) { - const spyName = spy.getMockName(); - const msg = utils.getMessage(this, [ - pass, - `expected "${spyName}" to ${action} with: #{exp} at least once`, - `expected "${spyName}" to not ${action} with: #{exp}`, - value - ]); - const results = action === "return" ? spy.mock.results : spy.mock.settledResults; - throw new AssertionError(formatReturns(spy, results, msg, value)); - } - }); - }); - [{ - name: "toHaveLastResolvedWith", - condition: (spy, value) => { - const result = spy.mock.settledResults.at(-1); - return Boolean(result && result.type === "fulfilled" && equals(result.value, value)); - }, - action: "resolve" - }, { - name: ["toHaveLastReturnedWith", "lastReturnedWith"], - condition: (spy, value) => { - const result = spy.mock.results.at(-1); - return Boolean(result && result.type === "return" && equals(result.value, value)); - }, - action: "return" - }].forEach(({ name, condition, action }) => { - def(name, function(value) { - const spy = getSpy(this); - const results = action === "return" ? spy.mock.results : spy.mock.settledResults; - const result = results.at(-1); - const spyName = spy.getMockName(); - this.assert(condition(spy, value), `expected last "${spyName}" call to ${action} #{exp}`, `expected last "${spyName}" call to not ${action} #{exp}`, value, result === null || result === void 0 ? void 0 : result.value); - }); - }); - [{ - name: "toHaveNthResolvedWith", - condition: (spy, index, value) => { - const result = spy.mock.settledResults[index - 1]; - return result && result.type === "fulfilled" && equals(result.value, value); - }, - action: "resolve" - }, { - name: ["toHaveNthReturnedWith", "nthReturnedWith"], - condition: (spy, index, value) => { - const result = spy.mock.results[index - 1]; - return result && result.type === "return" && equals(result.value, value); - }, - action: "return" - }].forEach(({ name, condition, action }) => { - def(name, function(nthCall, value) { - const spy = getSpy(this); - const spyName = spy.getMockName(); - const results = action === "return" ? spy.mock.results : spy.mock.settledResults; - const result = results[nthCall - 1]; - const ordinalCall = `${ordinalOf(nthCall)} call`; - this.assert(condition(spy, nthCall, value), `expected ${ordinalCall} "${spyName}" call to ${action} #{exp}`, `expected ${ordinalCall} "${spyName}" call to not ${action} #{exp}`, value, result === null || result === void 0 ? void 0 : result.value); - }); - }); - // @ts-expect-error @internal - def("withContext", function(context) { - for (const key in context) { - utils.flag(this, key, context[key]); - } - return this; - }); - utils.addProperty(chai.Assertion.prototype, "resolves", function __VITEST_RESOLVES__() { - const error = new Error("resolves"); - utils.flag(this, "promise", "resolves"); - utils.flag(this, "error", error); - const test = utils.flag(this, "vitest-test"); - const obj = utils.flag(this, "object"); - if (utils.flag(this, "poll")) { - throw new SyntaxError(`expect.poll() is not supported in combination with .resolves`); - } - if (typeof (obj === null || obj === void 0 ? void 0 : obj.then) !== "function") { - throw new TypeError(`You must provide a Promise to expect() when using .resolves, not '${typeof obj}'.`); - } - const proxy = new Proxy(this, { get: (target, key, receiver) => { - const result = Reflect.get(target, key, receiver); - if (typeof result !== "function") { - return result instanceof chai.Assertion ? proxy : result; - } - return (...args) => { - utils.flag(this, "_name", key); - const promise = obj.then((value) => { - utils.flag(this, "object", value); - return result.call(this, ...args); - }, (err) => { - const _error = new AssertionError(`promise rejected "${utils.inspect(err)}" instead of resolving`, { showDiff: false }); - _error.cause = err; - _error.stack = error.stack.replace(error.message, _error.message); - throw _error; - }); - return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error); - }; - } }); - return proxy; - }); - utils.addProperty(chai.Assertion.prototype, "rejects", function __VITEST_REJECTS__() { - const error = new Error("rejects"); - utils.flag(this, "promise", "rejects"); - utils.flag(this, "error", error); - const test = utils.flag(this, "vitest-test"); - const obj = utils.flag(this, "object"); - const wrapper = typeof obj === "function" ? obj() : obj; - if (utils.flag(this, "poll")) { - throw new SyntaxError(`expect.poll() is not supported in combination with .rejects`); - } - if (typeof (wrapper === null || wrapper === void 0 ? void 0 : wrapper.then) !== "function") { - throw new TypeError(`You must provide a Promise to expect() when using .rejects, not '${typeof wrapper}'.`); - } - const proxy = new Proxy(this, { get: (target, key, receiver) => { - const result = Reflect.get(target, key, receiver); - if (typeof result !== "function") { - return result instanceof chai.Assertion ? proxy : result; - } - return (...args) => { - utils.flag(this, "_name", key); - const promise = wrapper.then((value) => { - const _error = new AssertionError(`promise resolved "${utils.inspect(value)}" instead of rejecting`, { - showDiff: true, - expected: new Error("rejected promise"), - actual: value - }); - _error.stack = error.stack.replace(error.message, _error.message); - throw _error; - }, (err) => { - utils.flag(this, "object", err); - return result.call(this, ...args); - }); - return recordAsyncExpect(test, promise, createAssertionMessage(utils, this, !!args.length), error); - }; - } }); - return proxy; - }); -}; -function ordinalOf(i) { - const j = i % 10; - const k = i % 100; - if (j === 1 && k !== 11) { - return `${i}st`; - } - if (j === 2 && k !== 12) { - return `${i}nd`; - } - if (j === 3 && k !== 13) { - return `${i}rd`; - } - return `${i}th`; -} -function formatCalls(spy, msg, showActualCall) { - if (spy.mock.calls.length) { - msg += c.gray(`\n\nReceived: \n\n${spy.mock.calls.map((callArg, i) => { - let methodCall = c.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call:\n\n`); - if (showActualCall) { - methodCall += diff(showActualCall, callArg, { omitAnnotationLines: true }); - } else { - methodCall += stringify(callArg).split("\n").map((line) => ` ${line}`).join("\n"); - } - methodCall += "\n"; - return methodCall; - }).join("\n")}`); - } - msg += c.gray(`\n\nNumber of calls: ${c.bold(spy.mock.calls.length)}\n`); - return msg; -} -function formatReturns(spy, results, msg, showActualReturn) { - if (results.length) { - msg += c.gray(`\n\nReceived: \n\n${results.map((callReturn, i) => { - let methodCall = c.bold(` ${ordinalOf(i + 1)} ${spy.getMockName()} call return:\n\n`); - if (showActualReturn) { - methodCall += diff(showActualReturn, callReturn.value, { omitAnnotationLines: true }); - } else { - methodCall += stringify(callReturn).split("\n").map((line) => ` ${line}`).join("\n"); - } - methodCall += "\n"; - return methodCall; - }).join("\n")}`); - } - msg += c.gray(`\n\nNumber of calls: ${c.bold(spy.mock.calls.length)}\n`); - return msg; -} - -function getMatcherState(assertion, expect) { - const obj = assertion._obj; - const isNot = util.flag(assertion, "negate"); - const promise = util.flag(assertion, "promise") || ""; - const customMessage = util.flag(assertion, "message"); - const jestUtils = { - ...getMatcherUtils(), - diff, - stringify, - iterableEquality, - subsetEquality - }; - let task = util.flag(assertion, "vitest-test"); - const currentTestName = (task === null || task === void 0 ? void 0 : task.fullTestName) ?? ""; - if ((task === null || task === void 0 ? void 0 : task.type) !== "test") { - task = undefined; - } - const matcherState = { - ...getState(expect), - task, - currentTestName, - customTesters: getCustomEqualityTesters(), - isNot, - utils: jestUtils, - promise, - equals, - suppressedErrors: [], - soft: util.flag(assertion, "soft"), - poll: util.flag(assertion, "poll") - }; - return { - state: matcherState, - isNot, - obj, - customMessage - }; -} -class JestExtendError extends Error { - constructor(message, actual, expected) { - super(message); - this.actual = actual; - this.expected = expected; - } -} -function JestExtendPlugin(c, expect, matchers) { - return (_, utils) => { - Object.entries(matchers).forEach(([expectAssertionName, expectAssertion]) => { - function expectWrapper(...args) { - const { state, isNot, obj, customMessage } = getMatcherState(this, expect); - const result = expectAssertion.call(state, obj, ...args); - if (result && typeof result === "object" && typeof result.then === "function") { - const thenable = result; - return thenable.then(({ pass, message, actual, expected }) => { - if (pass && isNot || !pass && !isNot) { - const errorMessage = customMessage != null ? customMessage : message(); - throw new JestExtendError(errorMessage, actual, expected); - } - }); - } - const { pass, message, actual, expected } = result; - if (pass && isNot || !pass && !isNot) { - const errorMessage = customMessage != null ? customMessage : message(); - throw new JestExtendError(errorMessage, actual, expected); - } - } - const softWrapper = wrapAssertion(utils, expectAssertionName, expectWrapper); - utils.addMethod(globalThis[JEST_MATCHERS_OBJECT].matchers, expectAssertionName, softWrapper); - utils.addMethod(c.Assertion.prototype, expectAssertionName, softWrapper); - class CustomMatcher extends AsymmetricMatcher { - constructor(inverse = false, ...sample) { - super(sample, inverse); - } - asymmetricMatch(other) { - const { pass } = expectAssertion.call(this.getMatcherContext(expect), other, ...this.sample); - return this.inverse ? !pass : pass; - } - toString() { - return `${this.inverse ? "not." : ""}${expectAssertionName}`; - } - getExpectedType() { - return "any"; - } - toAsymmetricMatcher() { - return `${this.toString()}<${this.sample.map((item) => stringify(item)).join(", ")}>`; - } - } - const customMatcher = (...sample) => new CustomMatcher(false, ...sample); - Object.defineProperty(expect, expectAssertionName, { - configurable: true, - enumerable: true, - value: customMatcher, - writable: true - }); - Object.defineProperty(expect.not, expectAssertionName, { - configurable: true, - enumerable: true, - value: (...sample) => new CustomMatcher(true, ...sample), - writable: true - }); - // keep track of asymmetric matchers on global so that it can be copied over to local context's `expect`. - // note that the negated variant is automatically shared since it's assigned on the single `expect.not` object. - Object.defineProperty(globalThis[ASYMMETRIC_MATCHERS_OBJECT], expectAssertionName, { - configurable: true, - enumerable: true, - value: customMatcher, - writable: true - }); - }); - }; -} -const JestExtend = (chai, utils) => { - utils.addMethod(chai.expect, "extend", (expect, expects) => { - use(JestExtendPlugin(chai, expect, expects)); - }); -}; - -export { ASYMMETRIC_MATCHERS_OBJECT, Any, Anything, ArrayContaining, AsymmetricMatcher, GLOBAL_EXPECT, JEST_MATCHERS_OBJECT, JestAsymmetricMatchers, JestChaiExpect, JestExtend, MATCHERS_OBJECT, ObjectContaining, SchemaMatching, StringContaining, StringMatching, addCustomEqualityTesters, arrayBufferEquality, customMatchers, equals, fnNameFor, generateToBeMessage, getObjectKeys, getObjectSubset, getState, hasAsymmetric, hasProperty, isA, isAsymmetric, isImmutableUnorderedKeyed, isImmutableUnorderedSet, isStandardSchema, iterableEquality, pluralize, setState, sparseArrayEquality, subsetEquality, typeEquality }; diff --git a/node_modules/@vitest/expect/package.json b/node_modules/@vitest/expect/package.json deleted file mode 100644 index a111627..0000000 --- a/node_modules/@vitest/expect/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "@vitest/expect", - "type": "module", - "version": "4.0.16", - "description": "Jest's expect matchers as a Chai plugin", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/expect#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/expect" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "dependencies": { - "@standard-schema/spec": "^1.0.0", - "@types/chai": "^5.2.2", - "chai": "^6.2.1", - "tinyrainbow": "^3.0.3", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16" - }, - "devDependencies": { - "@vitest/runner": "4.0.16" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/mocker/LICENSE b/node_modules/@vitest/mocker/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/mocker/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/mocker/README.md b/node_modules/@vitest/mocker/README.md deleted file mode 100644 index f23202d..0000000 --- a/node_modules/@vitest/mocker/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# @vitest/mocker - -Vitest's module mocker implementation. - -[GitHub](https://github.com/vitest-dev/vitest/blob/main/packages/mocker/) | [Documentation](https://github.com/vitest-dev/vitest/blob/main/packages/mocker/EXPORTS.md) diff --git a/node_modules/@vitest/mocker/dist/auto-register.d.ts b/node_modules/@vitest/mocker/dist/auto-register.d.ts deleted file mode 100644 index 04fa25e..0000000 --- a/node_modules/@vitest/mocker/dist/auto-register.d.ts +++ /dev/null @@ -1,2 +0,0 @@ - -export { }; diff --git a/node_modules/@vitest/mocker/dist/auto-register.js b/node_modules/@vitest/mocker/dist/auto-register.js deleted file mode 100644 index 8da252b..0000000 --- a/node_modules/@vitest/mocker/dist/auto-register.js +++ /dev/null @@ -1,9 +0,0 @@ -import { M as ModuleMockerServerInterceptor } from './chunk-interceptor-native.js'; -import { registerModuleMocker } from './register.js'; -import './chunk-mocker.js'; -import './index.js'; -import './chunk-registry.js'; -import './chunk-pathe.M-eThtNZ.js'; -import '@vitest/spy'; - -registerModuleMocker(() => new ModuleMockerServerInterceptor()); diff --git a/node_modules/@vitest/mocker/dist/automock.d.ts b/node_modules/@vitest/mocker/dist/automock.d.ts deleted file mode 100644 index e453d22..0000000 --- a/node_modules/@vitest/mocker/dist/automock.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import MagicString from 'magic-string'; - -interface AutomockOptions { - /** - * @default "__vitest_mocker__" - */ - globalThisAccessor?: string; -} -declare function automockModule(code: string, mockType: "automock" | "autospy", parse: (code: string) => any, options?: AutomockOptions): MagicString; - -export { automockModule }; -export type { AutomockOptions }; diff --git a/node_modules/@vitest/mocker/dist/automock.js b/node_modules/@vitest/mocker/dist/automock.js deleted file mode 100644 index c2e2d96..0000000 --- a/node_modules/@vitest/mocker/dist/automock.js +++ /dev/null @@ -1,3 +0,0 @@ -import 'magic-string'; -export { a as automockModule } from './chunk-automock.js'; -import 'estree-walker'; diff --git a/node_modules/@vitest/mocker/dist/browser.d.ts b/node_modules/@vitest/mocker/dist/browser.d.ts deleted file mode 100644 index 7048b29..0000000 --- a/node_modules/@vitest/mocker/dist/browser.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { M as ModuleMockerInterceptor } from './mocker.d-TnKRhz7N.js'; -export { C as CompilerHintsOptions, b as ModuleMocker, a as ModuleMockerCompilerHints, d as ModuleMockerConfig, e as ModuleMockerRPC, R as ResolveIdResult, f as ResolveMockResult, c as createCompilerHints } from './mocker.d-TnKRhz7N.js'; -import { StartOptions, SetupWorker } from 'msw/browser'; -import { M as MockerRegistry, a as MockedModule } from './types.d-B8CCKmHt.js'; -import '@vitest/spy'; -import './index.d-C-sLYZi-.js'; - -interface ModuleMockerMSWInterceptorOptions { - /** - * The identifier to access the globalThis object in the worker. - * This will be injected into the script as is, so make sure it's a valid JS expression. - * @example - * ```js - * // globalThisAccessor: '__my_variable__' produces: - * globalThis[__my_variable__] - * // globalThisAccessor: 'Symbol.for('secret:mocks')' produces: - * globalThis[Symbol.for('secret:mocks')] - * // globalThisAccessor: '"__vitest_mocker__"' (notice quotes) produces: - * globalThis["__vitest_mocker__"] - * ``` - * @default `"__vitest_mocker__"` - */ - globalThisAccessor?: string; - /** - * Options passed down to `msw.setupWorker().start(options)` - */ - mswOptions?: StartOptions; - /** - * A pre-configured `msw.setupWorker` instance. - */ - mswWorker?: SetupWorker; -} -declare class ModuleMockerMSWInterceptor implements ModuleMockerInterceptor { - private readonly options; - protected readonly mocks: MockerRegistry; - private startPromise; - private worker; - constructor(options?: ModuleMockerMSWInterceptorOptions); - register(module: MockedModule): Promise; - delete(url: string): Promise; - invalidate(): Promise; - private resolveManualMock; - protected init(): Promise; -} - -declare class ModuleMockerServerInterceptor implements ModuleMockerInterceptor { - register(module: MockedModule): Promise; - delete(id: string): Promise; - invalidate(): Promise; -} - -export { ModuleMockerInterceptor, ModuleMockerMSWInterceptor, ModuleMockerServerInterceptor }; -export type { ModuleMockerMSWInterceptorOptions }; diff --git a/node_modules/@vitest/mocker/dist/browser.js b/node_modules/@vitest/mocker/dist/browser.js deleted file mode 100644 index 3e83247..0000000 --- a/node_modules/@vitest/mocker/dist/browser.js +++ /dev/null @@ -1,91 +0,0 @@ -export { M as ModuleMocker, c as createCompilerHints } from './chunk-mocker.js'; -import { M as MockerRegistry } from './chunk-registry.js'; -import { c as createManualModuleSource, a as cleanUrl } from './chunk-utils.js'; -export { M as ModuleMockerServerInterceptor } from './chunk-interceptor-native.js'; -import './index.js'; -import './chunk-pathe.M-eThtNZ.js'; - -class ModuleMockerMSWInterceptor { - mocks = new MockerRegistry(); - startPromise; - worker; - constructor(options = {}) { - this.options = options; - if (!options.globalThisAccessor) { - options.globalThisAccessor = "\"__vitest_mocker__\""; - } - } - async register(module) { - await this.init(); - this.mocks.add(module); - } - async delete(url) { - await this.init(); - this.mocks.delete(url); - } - async invalidate() { - this.mocks.clear(); - } - async resolveManualMock(mock) { - const exports$1 = Object.keys(await mock.resolve()); - const text = createManualModuleSource(mock.url, exports$1, this.options.globalThisAccessor); - return new Response(text, { headers: { "Content-Type": "application/javascript" } }); - } - async init() { - if (this.worker) { - return this.worker; - } - if (this.startPromise) { - return this.startPromise; - } - const worker = this.options.mswWorker; - this.startPromise = Promise.all([worker ? { setupWorker(handler) { - worker.use(handler); - return worker; - } } : import('msw/browser'), import('msw/core/http')]).then(([{ setupWorker }, { http }]) => { - const worker = setupWorker(http.get(/.+/, async ({ request }) => { - const path = cleanQuery(request.url.slice(location.origin.length)); - if (!this.mocks.has(path)) { - return passthrough(); - } - const mock = this.mocks.get(path); - switch (mock.type) { - case "manual": return this.resolveManualMock(mock); - case "automock": - case "autospy": return Response.redirect(injectQuery(path, `mock=${mock.type}`)); - case "redirect": return Response.redirect(mock.redirect); - default: throw new Error(`Unknown mock type: ${mock.type}`); - } - })); - return worker.start(this.options.mswOptions).then(() => worker); - }).finally(() => { - this.worker = worker; - this.startPromise = undefined; - }); - return await this.startPromise; - } -} -const trailingSeparatorRE = /[?&]$/; -const timestampRE = /\bt=\d{13}&?\b/; -const versionRE = /\bv=\w{8}&?\b/; -function cleanQuery(url) { - return url.replace(timestampRE, "").replace(versionRE, "").replace(trailingSeparatorRE, ""); -} -function passthrough() { - return new Response(null, { - status: 302, - statusText: "Passthrough", - headers: { "x-msw-intention": "passthrough" } - }); -} -const replacePercentageRE = /%/g; -function injectQuery(url, queryToInject) { - // encode percents for consistent behavior with pathToFileURL - // see #2614 for details - const resolvedUrl = new URL(url.replace(replacePercentageRE, "%25"), location.href); - const { search, hash } = resolvedUrl; - const pathname = cleanUrl(url); - return `${pathname}?${queryToInject}${search ? `&${search.slice(1)}` : ""}${hash ?? ""}`; -} - -export { ModuleMockerMSWInterceptor }; diff --git a/node_modules/@vitest/mocker/dist/chunk-automock.js b/node_modules/@vitest/mocker/dist/chunk-automock.js deleted file mode 100644 index 7558d21..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-automock.js +++ /dev/null @@ -1,345 +0,0 @@ -import MagicString from 'magic-string'; -import { walk } from 'estree-walker'; - -const isNodeInPatternWeakSet = new WeakSet(); -function setIsNodeInPattern(node) { - return isNodeInPatternWeakSet.add(node); -} -function isNodeInPattern(node) { - return isNodeInPatternWeakSet.has(node); -} -/** -* Same logic from \@vue/compiler-core & \@vue/compiler-sfc -* Except this is using acorn AST -*/ -function esmWalker(root, { onIdentifier, onImportMeta, onDynamicImport, onCallExpression }) { - const parentStack = []; - const varKindStack = []; - const scopeMap = new WeakMap(); - const identifiers = []; - const setScope = (node, name) => { - let scopeIds = scopeMap.get(node); - if (scopeIds && scopeIds.has(name)) { - return; - } - if (!scopeIds) { - scopeIds = new Set(); - scopeMap.set(node, scopeIds); - } - scopeIds.add(name); - }; - function isInScope(name, parents) { - return parents.some((node) => { - var _scopeMap$get; - return node && ((_scopeMap$get = scopeMap.get(node)) === null || _scopeMap$get === void 0 ? void 0 : _scopeMap$get.has(name)); - }); - } - function handlePattern(p, parentScope) { - if (p.type === "Identifier") { - setScope(parentScope, p.name); - } else if (p.type === "RestElement") { - handlePattern(p.argument, parentScope); - } else if (p.type === "ObjectPattern") { - p.properties.forEach((property) => { - if (property.type === "RestElement") { - setScope(parentScope, property.argument.name); - } else { - handlePattern(property.value, parentScope); - } - }); - } else if (p.type === "ArrayPattern") { - p.elements.forEach((element) => { - if (element) { - handlePattern(element, parentScope); - } - }); - } else if (p.type === "AssignmentPattern") { - handlePattern(p.left, parentScope); - } else { - setScope(parentScope, p.name); - } - } - walk(root, { - enter(node, parent) { - if (node.type === "ImportDeclaration") { - return this.skip(); - } - // track parent stack, skip for "else-if"/"else" branches as acorn nests - // the ast within "if" nodes instead of flattening them - if (parent && !(parent.type === "IfStatement" && node === parent.alternate)) { - parentStack.unshift(parent); - } - // track variable declaration kind stack used by VariableDeclarator - if (node.type === "VariableDeclaration") { - varKindStack.unshift(node.kind); - } - if (node.type === "CallExpression") { - onCallExpression === null || onCallExpression === void 0 ? void 0 : onCallExpression(node); - } - if (node.type === "MetaProperty" && node.meta.name === "import") { - onImportMeta === null || onImportMeta === void 0 ? void 0 : onImportMeta(node); - } else if (node.type === "ImportExpression") { - onDynamicImport === null || onDynamicImport === void 0 ? void 0 : onDynamicImport(node); - } - if (node.type === "Identifier") { - if (!isInScope(node.name, parentStack) && isRefIdentifier(node, parent, parentStack)) { - // record the identifier, for DFS -> BFS - identifiers.push([node, parentStack.slice(0)]); - } - } else if (isFunctionNode(node)) { - // If it is a function declaration, it could be shadowing an import - // Add its name to the scope so it won't get replaced - if (node.type === "FunctionDeclaration") { - const parentScope = findParentScope(parentStack); - if (parentScope) { - setScope(parentScope, node.id.name); - } - } - // walk function expressions and add its arguments to known identifiers - // so that we don't prefix them - node.params.forEach((p) => { - if (p.type === "ObjectPattern" || p.type === "ArrayPattern") { - handlePattern(p, node); - return; - } - walk(p.type === "AssignmentPattern" ? p.left : p, { enter(child, parent) { - // skip params default value of destructure - if ((parent === null || parent === void 0 ? void 0 : parent.type) === "AssignmentPattern" && (parent === null || parent === void 0 ? void 0 : parent.right) === child) { - return this.skip(); - } - if (child.type !== "Identifier") { - return; - } - // do not record as scope variable if is a destructuring keyword - if (isStaticPropertyKey(child, parent)) { - return; - } - // do not record if this is a default value - // assignment of a destructuring variable - if ((parent === null || parent === void 0 ? void 0 : parent.type) === "TemplateLiteral" && (parent === null || parent === void 0 ? void 0 : parent.expressions.includes(child)) || (parent === null || parent === void 0 ? void 0 : parent.type) === "CallExpression" && (parent === null || parent === void 0 ? void 0 : parent.callee) === child) { - return; - } - setScope(node, child.name); - } }); - }); - } else if (node.type === "Property" && parent.type === "ObjectPattern") { - // mark property in destructuring pattern - setIsNodeInPattern(node); - } else if (node.type === "VariableDeclarator") { - const parentFunction = findParentScope(parentStack, varKindStack[0] === "var"); - if (parentFunction) { - handlePattern(node.id, parentFunction); - } - } else if (node.type === "CatchClause" && node.param) { - handlePattern(node.param, node); - } - }, - leave(node, parent) { - // untrack parent stack from above - if (parent && !(parent.type === "IfStatement" && node === parent.alternate)) { - parentStack.shift(); - } - if (node.type === "VariableDeclaration") { - varKindStack.shift(); - } - } - }); - // emit the identifier events in BFS so the hoisted declarations - // can be captured correctly - identifiers.forEach(([node, stack]) => { - if (!isInScope(node.name, stack)) { - const parent = stack[0]; - const grandparent = stack[1]; - const hasBindingShortcut = isStaticProperty(parent) && parent.shorthand && (!isNodeInPattern(parent) || isInDestructuringAssignment(parent, parentStack)); - const classDeclaration = parent.type === "PropertyDefinition" && (grandparent === null || grandparent === void 0 ? void 0 : grandparent.type) === "ClassBody" || parent.type === "ClassDeclaration" && node === parent.superClass; - const classExpression = parent.type === "ClassExpression" && node === parent.id; - onIdentifier === null || onIdentifier === void 0 ? void 0 : onIdentifier(node, { - hasBindingShortcut, - classDeclaration, - classExpression - }, stack); - } - }); -} -function isRefIdentifier(id, parent, parentStack) { - // declaration id - if (parent.type === "CatchClause" || (parent.type === "VariableDeclarator" || parent.type === "ClassDeclaration") && parent.id === id) { - return false; - } - if (isFunctionNode(parent)) { - // function declaration/expression id - if (parent.id === id) { - return false; - } - // params list - if (parent.params.includes(id)) { - return false; - } - } - // class method name - if (parent.type === "MethodDefinition" && !parent.computed) { - return false; - } - // property key - if (isStaticPropertyKey(id, parent)) { - return false; - } - // object destructuring pattern - if (isNodeInPattern(parent) && parent.value === id) { - return false; - } - // non-assignment array destructuring pattern - if (parent.type === "ArrayPattern" && !isInDestructuringAssignment(parent, parentStack)) { - return false; - } - // member expression property - if (parent.type === "MemberExpression" && parent.property === id && !parent.computed) { - return false; - } - if (parent.type === "ExportSpecifier") { - return false; - } - // is a special keyword but parsed as identifier - if (id.name === "arguments") { - return false; - } - return true; -} -function isStaticProperty(node) { - return node && node.type === "Property" && !node.computed; -} -function isStaticPropertyKey(node, parent) { - return isStaticProperty(parent) && parent.key === node; -} -const functionNodeTypeRE = /Function(?:Expression|Declaration)$|Method$/; -function isFunctionNode(node) { - return functionNodeTypeRE.test(node.type); -} -const blockNodeTypeRE = /^BlockStatement$|^For(?:In|Of)?Statement$/; -function isBlock(node) { - return blockNodeTypeRE.test(node.type); -} -function findParentScope(parentStack, isVar = false) { - return parentStack.find(isVar ? isFunctionNode : isBlock); -} -function isInDestructuringAssignment(parent, parentStack) { - if (parent && (parent.type === "Property" || parent.type === "ArrayPattern")) { - return parentStack.some((i) => i.type === "AssignmentExpression"); - } - return false; -} -function getArbitraryModuleIdentifier(node) { - return node.type === "Identifier" ? node.name : node.raw; -} - -// TODO: better source map replacement -function automockModule(code, mockType, parse, options = {}) { - const globalThisAccessor = options.globalThisAccessor || "\"__vitest_mocker__\""; - const ast = parse(code); - const m = new MagicString(code); - const allSpecifiers = []; - let importIndex = 0; - for (const _node of ast.body) { - if (_node.type === "ExportAllDeclaration") { - throw new Error(`automocking files with \`export *\` is not supported in browser mode because it cannot be statically analysed`); - } - if (_node.type === "ExportNamedDeclaration") { - const node = _node; - const declaration = node.declaration; - function traversePattern(expression) { - // export const test = '1' - if (expression.type === "Identifier") { - allSpecifiers.push({ name: expression.name }); - } else if (expression.type === "ArrayPattern") { - expression.elements.forEach((element) => { - if (!element) { - return; - } - traversePattern(element); - }); - } else if (expression.type === "ObjectPattern") { - expression.properties.forEach((property) => { - // export const { ...rest } = {} - if (property.type === "RestElement") { - traversePattern(property); - } else if (property.type === "Property") { - traversePattern(property.value); - } else ; - }); - } else if (expression.type === "RestElement") { - traversePattern(expression.argument); - } else if (expression.type === "AssignmentPattern") { - throw new Error(`AssignmentPattern is not supported. Please open a new bug report.`); - } else if (expression.type === "MemberExpression") { - throw new Error(`MemberExpression is not supported. Please open a new bug report.`); - } else ; - } - if (declaration) { - if (declaration.type === "FunctionDeclaration") { - allSpecifiers.push({ name: declaration.id.name }); - } else if (declaration.type === "VariableDeclaration") { - declaration.declarations.forEach((declaration) => { - traversePattern(declaration.id); - }); - } else if (declaration.type === "ClassDeclaration") { - allSpecifiers.push({ name: declaration.id.name }); - } else ; - m.remove(node.start, declaration.start); - } - const specifiers = node.specifiers || []; - const source = node.source; - if (!source && specifiers.length) { - specifiers.forEach((specifier) => { - allSpecifiers.push({ - alias: getArbitraryModuleIdentifier(specifier.exported), - name: getArbitraryModuleIdentifier(specifier.local) - }); - }); - m.remove(node.start, node.end); - } else if (source && specifiers.length) { - const importNames = []; - specifiers.forEach((specifier) => { - const importedName = `__vitest_imported_${importIndex++}__`; - importNames.push([getArbitraryModuleIdentifier(specifier.local), importedName]); - allSpecifiers.push({ - name: importedName, - alias: getArbitraryModuleIdentifier(specifier.exported) - }); - }); - const importString = `import { ${importNames.map(([name, alias]) => `${name} as ${alias}`).join(", ")} } from '${source.value}'`; - m.overwrite(node.start, node.end, importString); - } - } - if (_node.type === "ExportDefaultDeclaration") { - const node = _node; - const declaration = node.declaration; - allSpecifiers.push({ - name: "__vitest_default", - alias: "default" - }); - m.overwrite(node.start, declaration.start, `const __vitest_default = `); - } - } - const moduleObject = ` -const __vitest_current_es_module__ = { - __esModule: true, - ${allSpecifiers.map(({ name }) => `["${name}"]: ${name},`).join("\n ")} -} -const __vitest_mocked_module__ = globalThis[${globalThisAccessor}].mockObject(__vitest_current_es_module__, "${mockType}") -`; - const assigning = allSpecifiers.map(({ name }, index) => { - return `const __vitest_mocked_${index}__ = __vitest_mocked_module__["${name}"]`; - }).join("\n"); - const redeclarations = allSpecifiers.map(({ name, alias }, index) => { - return ` __vitest_mocked_${index}__ as ${alias || name},`; - }).join("\n"); - const specifiersExports = ` -export { -${redeclarations} -} -`; - m.append(moduleObject + assigning + specifiersExports); - return m; -} - -export { automockModule as a, esmWalker as e }; diff --git a/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js b/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js deleted file mode 100644 index 4b472cc..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-interceptor-native.js +++ /dev/null @@ -1,15 +0,0 @@ -import { r as rpc } from './chunk-mocker.js'; - -class ModuleMockerServerInterceptor { - async register(module) { - await rpc("vitest:interceptor:register", module.toJSON()); - } - async delete(id) { - await rpc("vitest:interceptor:delete", id); - } - async invalidate() { - await rpc("vitest:interceptor:invalidate"); - } -} - -export { ModuleMockerServerInterceptor as M }; diff --git a/node_modules/@vitest/mocker/dist/chunk-mocker.js b/node_modules/@vitest/mocker/dist/chunk-mocker.js deleted file mode 100644 index d86b758..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-mocker.js +++ /dev/null @@ -1,521 +0,0 @@ -import { mockObject } from './index.js'; -import { M as MockerRegistry, R as RedirectedModule, A as AutomockedModule } from './chunk-registry.js'; -import { e as extname, j as join } from './chunk-pathe.M-eThtNZ.js'; - -/** -* Get original stacktrace without source map support the most performant way. -* - Create only 1 stack frame. -* - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms). -*/ -function createSimpleStackTrace(options) { - const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {}; - const limit = Error.stackTraceLimit; - const prepareStackTrace = Error.prepareStackTrace; - Error.stackTraceLimit = stackTraceLimit; - Error.prepareStackTrace = (e) => e.stack; - const err = new Error(message); - const stackTrace = err.stack || ""; - Error.prepareStackTrace = prepareStackTrace; - Error.stackTraceLimit = limit; - return stackTrace; -} - -const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//; -function normalizeWindowsPath(input = "") { - if (!input) { - return input; - } - return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase()); -} -const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/; -function cwd() { - if (typeof process !== "undefined" && typeof process.cwd === "function") { - return process.cwd().replace(/\\/g, "/"); - } - return "/"; -} -const resolve = function(...arguments_) { - arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument)); - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) { - const path = index >= 0 ? arguments_[index] : cwd(); - if (!path || path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isAbsolute(path); - } - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute); - if (resolvedAbsolute && !isAbsolute(resolvedPath)) { - return `/${resolvedPath}`; - } - return resolvedPath.length > 0 ? resolvedPath : "."; -}; -function normalizeString(path, allowAboveRoot) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let char = null; - for (let index = 0; index <= path.length; ++index) { - if (index < path.length) { - char = path[index]; - } else if (char === "/") { - break; - } else { - char = "/"; - } - if (char === "/") { - if (lastSlash === index - 1 || dots === 1); - else if (dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf("/"); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf("/"); - } - lastSlash = index; - dots = 0; - continue; - } else if (res.length > 0) { - res = ""; - lastSegmentLength = 0; - lastSlash = index; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - res += res.length > 0 ? "/.." : ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) { - res += `/${path.slice(lastSlash + 1, index)}`; - } else { - res = path.slice(lastSlash + 1, index); - } - lastSegmentLength = index - lastSlash - 1; - } - lastSlash = index; - dots = 0; - } else if (char === "." && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} -const isAbsolute = function(p) { - return _IS_ABSOLUTE_RE.test(p); -}; - -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m; -const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/; -function extractLocation(urlLike) { - // Fail-fast but return locations like "(native)" - if (!urlLike.includes(":")) { - return [urlLike]; - } - const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/; - const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, "")); - if (!parts) { - return [urlLike]; - } - let url = parts[1]; - if (url.startsWith("async ")) { - url = url.slice(6); - } - if (url.startsWith("http:") || url.startsWith("https:")) { - const urlObj = new URL(url); - urlObj.searchParams.delete("import"); - urlObj.searchParams.delete("browserv"); - url = urlObj.pathname + urlObj.hash + urlObj.search; - } - if (url.startsWith("/@fs/")) { - const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url); - url = url.slice(isWindows ? 5 : 4); - } - return [ - url, - parts[2] || undefined, - parts[3] || undefined - ]; -} -function parseSingleFFOrSafariStack(raw) { - let line = raw.trim(); - if (SAFARI_NATIVE_CODE_REGEXP.test(line)) { - return null; - } - if (line.includes(" > eval")) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1"); - } - // Early return for lines that don't look like Firefox/Safari stack traces - // Firefox/Safari stack traces must contain '@' and should have location info after it - if (!line.includes("@")) { - return null; - } - // Find the correct @ that separates function name from location - // For cases like '@https://@fs/path' or 'functionName@https://@fs/path' - // we need to find the first @ that precedes a valid location (containing :) - let atIndex = -1; - let locationPart = ""; - let functionName; - // Try each @ from left to right to find the one that gives us a valid location - for (let i = 0; i < line.length; i++) { - if (line[i] === "@") { - const candidateLocation = line.slice(i + 1); - // Minimum length 3 for valid location: 1 for filename + 1 for colon + 1 for line number (e.g., "a:1") - if (candidateLocation.includes(":") && candidateLocation.length >= 3) { - atIndex = i; - locationPart = candidateLocation; - functionName = i > 0 ? line.slice(0, i) : undefined; - break; - } - } - } - // Validate we found a valid location with minimum length (filename:line format) - if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) { - return null; - } - const [url, lineNumber, columnNumber] = extractLocation(locationPart); - if (!url || !lineNumber || !columnNumber) { - return null; - } - return { - file: url, - method: functionName || "", - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} -function parseSingleStack(raw) { - const line = raw.trim(); - if (!CHROME_IE_STACK_REGEXP.test(line)) { - return parseSingleFFOrSafariStack(line); - } - return parseSingleV8Stack(line); -} -// Based on https://github.com/stacktracejs/error-stack-parser -// Credit to stacktracejs -function parseSingleV8Stack(raw) { - let line = raw.trim(); - if (!CHROME_IE_STACK_REGEXP.test(line)) { - return null; - } - if (line.includes("(eval ")) { - line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""); - } - let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""); - // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)" in - // case it has spaces in it, as the string is split on \s+ later on - const location = sanitizedLine.match(/ (\(.+\)$)/); - // remove the parenthesized location from the line, if it was matched - sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine; - // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine - // because this line doesn't have function name - const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine); - let method = location && sanitizedLine || ""; - let file = url && ["eval", ""].includes(url) ? undefined : url; - if (!file || !lineNumber || !columnNumber) { - return null; - } - if (method.startsWith("async ")) { - method = method.slice(6); - } - if (file.startsWith("file://")) { - file = file.slice(7); - } - // normalize Windows path (\ -> /) - file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file); - if (method) { - method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, ""); - } - return { - method, - file, - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} - -function createCompilerHints(options) { - const globalThisAccessor = (options === null || options === void 0 ? void 0 : options.globalThisKey) || "__vitest_mocker__"; - function _mocker() { - // @ts-expect-error injected by the plugin - return typeof globalThis[globalThisAccessor] !== "undefined" ? globalThis[globalThisAccessor] : new Proxy({}, { get(_, name) { - throw new Error("Vitest mocker was not initialized in this environment. " + `vi.${String(name)}() is forbidden.`); - } }); - } - return { - hoisted(factory) { - if (typeof factory !== "function") { - throw new TypeError(`vi.hoisted() expects a function, but received a ${typeof factory}`); - } - return factory(); - }, - mock(path, factory) { - if (typeof path !== "string") { - throw new TypeError(`vi.mock() expects a string path, but received a ${typeof path}`); - } - const importer = getImporter("mock"); - _mocker().queueMock(path, importer, typeof factory === "function" ? () => factory(() => _mocker().importActual(path, importer)) : factory); - }, - unmock(path) { - if (typeof path !== "string") { - throw new TypeError(`vi.unmock() expects a string path, but received a ${typeof path}`); - } - _mocker().queueUnmock(path, getImporter("unmock")); - }, - doMock(path, factory) { - if (typeof path !== "string") { - throw new TypeError(`vi.doMock() expects a string path, but received a ${typeof path}`); - } - const importer = getImporter("doMock"); - _mocker().queueMock(path, importer, typeof factory === "function" ? () => factory(() => _mocker().importActual(path, importer)) : factory); - }, - doUnmock(path) { - if (typeof path !== "string") { - throw new TypeError(`vi.doUnmock() expects a string path, but received a ${typeof path}`); - } - _mocker().queueUnmock(path, getImporter("doUnmock")); - }, - async importActual(path) { - return _mocker().importActual(path, getImporter("importActual")); - }, - async importMock(path) { - return _mocker().importMock(path, getImporter("importMock")); - } - }; -} -function getImporter(name) { - const stackTrace = /* @__PURE__ */ createSimpleStackTrace({ stackTraceLimit: 5 }); - const stackArray = stackTrace.split("\n"); - // if there is no message in a stack trace, use the item - 1 - const importerStackIndex = stackArray.findIndex((stack) => { - return stack.includes(` at Object.${name}`) || stack.includes(`${name}@`); - }); - const stack = /* @__PURE__ */ parseSingleStack(stackArray[importerStackIndex + 1]); - return (stack === null || stack === void 0 ? void 0 : stack.file) || ""; -} - -const hot = import.meta.hot || { - on: warn, - off: warn, - send: warn -}; -function warn() { - console.warn("Vitest mocker cannot work if Vite didn't establish WS connection."); -} -function rpc(event, data) { - hot.send(event, data); - return new Promise((resolve, reject) => { - const timeout = setTimeout(() => { - reject(new Error(`Failed to resolve ${event} in time`)); - }, 5e3); - hot.on(`${event}:result`, function r(data) { - resolve(data); - clearTimeout(timeout); - hot.off(`${event}:result`, r); - }); - }); -} - -const { now } = Date; -class ModuleMocker { - registry = new MockerRegistry(); - queue = new Set(); - mockedIds = new Set(); - constructor(interceptor, rpc, createMockInstance, config) { - this.interceptor = interceptor; - this.rpc = rpc; - this.createMockInstance = createMockInstance; - this.config = config; - } - async prepare() { - if (!this.queue.size) { - return; - } - await Promise.all([...this.queue.values()]); - } - async resolveFactoryModule(id) { - const mock = this.registry.get(id); - if (!mock || mock.type !== "manual") { - throw new Error(`Mock ${id} wasn't registered. This is probably a Vitest error. Please, open a new issue with reproduction.`); - } - const result = await mock.resolve(); - return result; - } - getFactoryModule(id) { - const mock = this.registry.get(id); - if (!mock || mock.type !== "manual") { - throw new Error(`Mock ${id} wasn't registered. This is probably a Vitest error. Please, open a new issue with reproduction.`); - } - if (!mock.cache) { - throw new Error(`Mock ${id} wasn't resolved. This is probably a Vitest error. Please, open a new issue with reproduction.`); - } - return mock.cache; - } - async invalidate() { - const ids = Array.from(this.mockedIds); - if (!ids.length) { - return; - } - await this.rpc.invalidate(ids); - await this.interceptor.invalidate(); - this.registry.clear(); - } - async importActual(id, importer) { - const resolved = await this.rpc.resolveId(id, importer); - if (resolved == null) { - throw new Error(`[vitest] Cannot resolve "${id}" imported from "${importer}"`); - } - const ext = extname(resolved.id); - const url = new URL(resolved.url, location.href); - const query = `_vitest_original&ext${ext}`; - const actualUrl = `${url.pathname}${url.search ? `${url.search}&${query}` : `?${query}`}${url.hash}`; - return this.wrapDynamicImport(() => import( - /* @vite-ignore */ - actualUrl -)).then((mod) => { - if (!resolved.optimized || typeof mod.default === "undefined") { - return mod; - } - // vite injects this helper for optimized modules, so we try to follow the same behavior - const m = mod.default; - return (m === null || m === void 0 ? void 0 : m.__esModule) ? m : { - ...typeof m === "object" && !Array.isArray(m) || typeof m === "function" ? m : {}, - default: m - }; - }); - } - async importMock(rawId, importer) { - await this.prepare(); - const { resolvedId, resolvedUrl, redirectUrl } = await this.rpc.resolveMock(rawId, importer, { mock: "auto" }); - const mockUrl = this.resolveMockPath(cleanVersion(resolvedUrl)); - let mock = this.registry.get(mockUrl); - if (!mock) { - if (redirectUrl) { - const resolvedRedirect = new URL(this.resolveMockPath(cleanVersion(redirectUrl)), location.href).toString(); - mock = new RedirectedModule(rawId, resolvedId, mockUrl, resolvedRedirect); - } else { - mock = new AutomockedModule(rawId, resolvedId, mockUrl); - } - } - if (mock.type === "manual") { - return await mock.resolve(); - } - if (mock.type === "automock" || mock.type === "autospy") { - const url = new URL(`/@id/${resolvedId}`, location.href); - const query = url.search ? `${url.search}&t=${now()}` : `?t=${now()}`; - const moduleObject = await import( - /* @vite-ignore */ - `${url.pathname}${query}&mock=${mock.type}${url.hash}` -); - return this.mockObject(moduleObject, mock.type); - } - return import( - /* @vite-ignore */ - mock.redirect -); - } - mockObject(object, moduleType = "automock") { - return mockObject({ - globalConstructors: { - Object, - Function, - Array, - Map, - RegExp - }, - createMockInstance: this.createMockInstance, - type: moduleType - }, object); - } - queueMock(rawId, importer, factoryOrOptions) { - const promise = this.rpc.resolveMock(rawId, importer, { mock: typeof factoryOrOptions === "function" ? "factory" : (factoryOrOptions === null || factoryOrOptions === void 0 ? void 0 : factoryOrOptions.spy) ? "spy" : "auto" }).then(async ({ redirectUrl, resolvedId, resolvedUrl, needsInterop, mockType }) => { - const mockUrl = this.resolveMockPath(cleanVersion(resolvedUrl)); - this.mockedIds.add(resolvedId); - const factory = typeof factoryOrOptions === "function" ? async () => { - const data = await factoryOrOptions(); - // vite wraps all external modules that have "needsInterop" in a function that - // merges all exports from default into the module object - return needsInterop ? { default: data } : data; - } : undefined; - const mockRedirect = typeof redirectUrl === "string" ? new URL(this.resolveMockPath(cleanVersion(redirectUrl)), location.href).toString() : null; - let module; - if (mockType === "manual") { - module = this.registry.register("manual", rawId, resolvedId, mockUrl, factory); - } else if (mockType === "autospy") { - module = this.registry.register("autospy", rawId, resolvedId, mockUrl); - } else if (mockType === "redirect") { - module = this.registry.register("redirect", rawId, resolvedId, mockUrl, mockRedirect); - } else { - module = this.registry.register("automock", rawId, resolvedId, mockUrl); - } - await this.interceptor.register(module); - }).finally(() => { - this.queue.delete(promise); - }); - this.queue.add(promise); - } - queueUnmock(id, importer) { - const promise = this.rpc.resolveId(id, importer).then(async (resolved) => { - if (!resolved) { - return; - } - const mockUrl = this.resolveMockPath(cleanVersion(resolved.url)); - this.mockedIds.add(resolved.id); - this.registry.delete(mockUrl); - await this.interceptor.delete(mockUrl); - }).finally(() => { - this.queue.delete(promise); - }); - this.queue.add(promise); - } - // We need to await mock registration before importing the actual module - // In case there is a mocked module in the import chain - wrapDynamicImport(moduleFactory) { - if (typeof moduleFactory === "function") { - const promise = new Promise((resolve, reject) => { - this.prepare().finally(() => { - moduleFactory().then(resolve, reject); - }); - }); - return promise; - } - return moduleFactory; - } - resolveMockPath(path) { - const config = this.config; - const fsRoot = join("/@fs/", config.root); - // URL can be /file/path.js, but path is resolved to /file/path - if (path.startsWith(config.root)) { - return path.slice(config.root.length); - } - if (path.startsWith(fsRoot)) { - return path.slice(fsRoot.length); - } - return path; - } -} -const versionRegexp = /(\?|&)v=\w{8}/; -function cleanVersion(url) { - return url.replace(versionRegexp, ""); -} - -export { ModuleMocker as M, createCompilerHints as c, hot as h, rpc as r }; diff --git a/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js b/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js deleted file mode 100644 index 11a98f0..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-pathe.M-eThtNZ.js +++ /dev/null @@ -1,174 +0,0 @@ -const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//; -function normalizeWindowsPath(input = "") { - if (!input) { - return input; - } - return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase()); -} - -const _UNC_REGEX = /^[/\\]{2}/; -const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/; -const _DRIVE_LETTER_RE = /^[A-Za-z]:$/; -const _EXTNAME_RE = /.(\.[^./]+|\.)$/; -const normalize = function(path) { - if (path.length === 0) { - return "."; - } - path = normalizeWindowsPath(path); - const isUNCPath = path.match(_UNC_REGEX); - const isPathAbsolute = isAbsolute(path); - const trailingSeparator = path[path.length - 1] === "/"; - path = normalizeString(path, !isPathAbsolute); - if (path.length === 0) { - if (isPathAbsolute) { - return "/"; - } - return trailingSeparator ? "./" : "."; - } - if (trailingSeparator) { - path += "/"; - } - if (_DRIVE_LETTER_RE.test(path)) { - path += "/"; - } - if (isUNCPath) { - if (!isPathAbsolute) { - return `//./${path}`; - } - return `//${path}`; - } - return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path; -}; -const join = function(...segments) { - let path = ""; - for (const seg of segments) { - if (!seg) { - continue; - } - if (path.length > 0) { - const pathTrailing = path[path.length - 1] === "/"; - const segLeading = seg[0] === "/"; - const both = pathTrailing && segLeading; - if (both) { - path += seg.slice(1); - } else { - path += pathTrailing || segLeading ? seg : `/${seg}`; - } - } else { - path += seg; - } - } - return normalize(path); -}; -function cwd() { - if (typeof process !== "undefined" && typeof process.cwd === "function") { - return process.cwd().replace(/\\/g, "/"); - } - return "/"; -} -const resolve = function(...arguments_) { - arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument)); - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) { - const path = index >= 0 ? arguments_[index] : cwd(); - if (!path || path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isAbsolute(path); - } - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute); - if (resolvedAbsolute && !isAbsolute(resolvedPath)) { - return `/${resolvedPath}`; - } - return resolvedPath.length > 0 ? resolvedPath : "."; -}; -function normalizeString(path, allowAboveRoot) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let char = null; - for (let index = 0; index <= path.length; ++index) { - if (index < path.length) { - char = path[index]; - } else if (char === "/") { - break; - } else { - char = "/"; - } - if (char === "/") { - if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf("/"); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf("/"); - } - lastSlash = index; - dots = 0; - continue; - } else if (res.length > 0) { - res = ""; - lastSegmentLength = 0; - lastSlash = index; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - res += res.length > 0 ? "/.." : ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) { - res += `/${path.slice(lastSlash + 1, index)}`; - } else { - res = path.slice(lastSlash + 1, index); - } - lastSegmentLength = index - lastSlash - 1; - } - lastSlash = index; - dots = 0; - } else if (char === "." && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} -const isAbsolute = function(p) { - return _IS_ABSOLUTE_RE.test(p); -}; -const extname = function(p) { - if (p === "..") return ""; - const match = _EXTNAME_RE.exec(normalizeWindowsPath(p)); - return match && match[1] || ""; -}; -const dirname = function(p) { - const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1); - if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) { - segments[0] += "/"; - } - return segments.join("/") || (isAbsolute(p) ? "/" : "."); -}; -const basename = function(p, extension) { - const segments = normalizeWindowsPath(p).split("/"); - let lastSegment = ""; - for (let i = segments.length - 1; i >= 0; i--) { - const val = segments[i]; - if (val) { - lastSegment = val; - break; - } - } - return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment; -}; - -export { basename as b, dirname as d, extname as e, isAbsolute as i, join as j, resolve as r }; diff --git a/node_modules/@vitest/mocker/dist/chunk-registry.js b/node_modules/@vitest/mocker/dist/chunk-registry.js deleted file mode 100644 index fe0e803..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-registry.js +++ /dev/null @@ -1,185 +0,0 @@ -class MockerRegistry { - registryByUrl = new Map(); - registryById = new Map(); - clear() { - this.registryByUrl.clear(); - this.registryById.clear(); - } - keys() { - return this.registryByUrl.keys(); - } - add(mock) { - this.registryByUrl.set(mock.url, mock); - this.registryById.set(mock.id, mock); - } - register(typeOrEvent, raw, id, url, factoryOrRedirect) { - const type = typeof typeOrEvent === "object" ? typeOrEvent.type : typeOrEvent; - if (typeof typeOrEvent === "object") { - const event = typeOrEvent; - if (event instanceof AutomockedModule || event instanceof AutospiedModule || event instanceof ManualMockedModule || event instanceof RedirectedModule) { - throw new TypeError(`[vitest] Cannot register a mock that is already defined. ` + `Expected a JSON representation from \`MockedModule.toJSON\`, instead got "${event.type}". ` + `Use "registry.add()" to update a mock instead.`); - } - if (event.type === "automock") { - const module = AutomockedModule.fromJSON(event); - this.add(module); - return module; - } else if (event.type === "autospy") { - const module = AutospiedModule.fromJSON(event); - this.add(module); - return module; - } else if (event.type === "redirect") { - const module = RedirectedModule.fromJSON(event); - this.add(module); - return module; - } else if (event.type === "manual") { - throw new Error(`Cannot set serialized manual mock. Define a factory function manually with \`ManualMockedModule.fromJSON()\`.`); - } else { - throw new Error(`Unknown mock type: ${event.type}`); - } - } - if (typeof raw !== "string") { - throw new TypeError("[vitest] Mocks require a raw string."); - } - if (typeof url !== "string") { - throw new TypeError("[vitest] Mocks require a url string."); - } - if (typeof id !== "string") { - throw new TypeError("[vitest] Mocks require an id string."); - } - if (type === "manual") { - if (typeof factoryOrRedirect !== "function") { - throw new TypeError("[vitest] Manual mocks require a factory function."); - } - const mock = new ManualMockedModule(raw, id, url, factoryOrRedirect); - this.add(mock); - return mock; - } else if (type === "automock" || type === "autospy") { - const mock = type === "automock" ? new AutomockedModule(raw, id, url) : new AutospiedModule(raw, id, url); - this.add(mock); - return mock; - } else if (type === "redirect") { - if (typeof factoryOrRedirect !== "string") { - throw new TypeError("[vitest] Redirect mocks require a redirect string."); - } - const mock = new RedirectedModule(raw, id, url, factoryOrRedirect); - this.add(mock); - return mock; - } else { - throw new Error(`[vitest] Unknown mock type: ${type}`); - } - } - delete(id) { - this.registryByUrl.delete(id); - } - deleteById(id) { - this.registryById.delete(id); - } - get(id) { - return this.registryByUrl.get(id); - } - getById(id) { - return this.registryById.get(id); - } - has(id) { - return this.registryByUrl.has(id); - } -} -class AutomockedModule { - type = "automock"; - constructor(raw, id, url) { - this.raw = raw; - this.id = id; - this.url = url; - } - static fromJSON(data) { - return new AutospiedModule(data.raw, data.id, data.url); - } - toJSON() { - return { - type: this.type, - url: this.url, - raw: this.raw, - id: this.id - }; - } -} -class AutospiedModule { - type = "autospy"; - constructor(raw, id, url) { - this.raw = raw; - this.id = id; - this.url = url; - } - static fromJSON(data) { - return new AutospiedModule(data.raw, data.id, data.url); - } - toJSON() { - return { - type: this.type, - url: this.url, - id: this.id, - raw: this.raw - }; - } -} -class RedirectedModule { - type = "redirect"; - constructor(raw, id, url, redirect) { - this.raw = raw; - this.id = id; - this.url = url; - this.redirect = redirect; - } - static fromJSON(data) { - return new RedirectedModule(data.raw, data.id, data.url, data.redirect); - } - toJSON() { - return { - type: this.type, - url: this.url, - raw: this.raw, - id: this.id, - redirect: this.redirect - }; - } -} -class ManualMockedModule { - cache; - type = "manual"; - constructor(raw, id, url, factory) { - this.raw = raw; - this.id = id; - this.url = url; - this.factory = factory; - } - async resolve() { - if (this.cache) { - return this.cache; - } - let exports$1; - try { - exports$1 = await this.factory(); - } catch (err) { - const vitestError = new Error("[vitest] There was an error when mocking a module. " + "If you are using \"vi.mock\" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. " + "Read more: https://vitest.dev/api/vi.html#vi-mock"); - vitestError.cause = err; - throw vitestError; - } - if (exports$1 === null || typeof exports$1 !== "object" || Array.isArray(exports$1)) { - throw new TypeError(`[vitest] vi.mock("${this.raw}", factory?: () => unknown) is not returning an object. Did you mean to return an object with a "default" key?`); - } - return this.cache = exports$1; - } - static fromJSON(data, factory) { - return new ManualMockedModule(data.raw, data.id, data.url, factory); - } - toJSON() { - return { - type: this.type, - url: this.url, - id: this.id, - raw: this.raw - }; - } -} - -export { AutomockedModule as A, MockerRegistry as M, RedirectedModule as R, ManualMockedModule as a, AutospiedModule as b }; diff --git a/node_modules/@vitest/mocker/dist/chunk-utils.js b/node_modules/@vitest/mocker/dist/chunk-utils.js deleted file mode 100644 index de1b7e4..0000000 --- a/node_modules/@vitest/mocker/dist/chunk-utils.js +++ /dev/null @@ -1,16 +0,0 @@ -const postfixRE = /[?#].*$/; -function cleanUrl(url) { - return url.replace(postfixRE, ""); -} -function createManualModuleSource(moduleUrl, exports$1, globalAccessor = "\"__vitest_mocker__\"") { - const source = `const module = globalThis[${globalAccessor}].getFactoryModule("${moduleUrl}");`; - const keys = exports$1.map((name) => { - if (name === "default") { - return `export default module["default"];`; - } - return `export const ${name} = module["${name}"];`; - }).join("\n"); - return `${source}\n${keys}`; -} - -export { cleanUrl as a, createManualModuleSource as c }; diff --git a/node_modules/@vitest/mocker/dist/index.d-C-sLYZi-.d.ts b/node_modules/@vitest/mocker/dist/index.d-C-sLYZi-.d.ts deleted file mode 100644 index cad0899..0000000 --- a/node_modules/@vitest/mocker/dist/index.d-C-sLYZi-.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import './types.d-B8CCKmHt.js'; - -type Key = string | symbol; -type CreateMockInstanceProcedure = (options?: { - prototypeMembers?: (string | symbol)[]; - name?: string | symbol; - originalImplementation?: (...args: any[]) => any; - keepMembersImplementation?: boolean; -}) => any; -interface MockObjectOptions { - type: "automock" | "autospy"; - globalConstructors: GlobalConstructors; - createMockInstance: CreateMockInstanceProcedure; -} -declare function mockObject(options: MockObjectOptions, object: Record, mockExports?: Record): Record; -interface GlobalConstructors { - Object: ObjectConstructor; - Function: FunctionConstructor; - RegExp: RegExpConstructor; - Array: ArrayConstructor; - Map: MapConstructor; -} - -export { mockObject as m }; -export type { CreateMockInstanceProcedure as C, GlobalConstructors as G, MockObjectOptions as M }; diff --git a/node_modules/@vitest/mocker/dist/index.d.ts b/node_modules/@vitest/mocker/dist/index.d.ts deleted file mode 100644 index 107b5fb..0000000 --- a/node_modules/@vitest/mocker/dist/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { G as GlobalConstructors, M as MockObjectOptions, m as mockObject } from './index.d-C-sLYZi-.js'; -export { A as AutomockedModule, h as AutomockedModuleSerialized, f as AutospiedModule, i as AutospiedModuleSerialized, g as ManualMockedModule, j as ManualMockedModuleSerialized, a as MockedModule, k as MockedModuleSerialized, d as MockedModuleType, M as MockerRegistry, m as ModuleMockFactory, c as ModuleMockFactoryWithHelper, b as ModuleMockOptions, R as RedirectedModule, l as RedirectedModuleSerialized, e as ServerIdResolution, S as ServerMockResolution } from './types.d-B8CCKmHt.js'; diff --git a/node_modules/@vitest/mocker/dist/index.js b/node_modules/@vitest/mocker/dist/index.js deleted file mode 100644 index 79c5c9a..0000000 --- a/node_modules/@vitest/mocker/dist/index.js +++ /dev/null @@ -1,185 +0,0 @@ -export { A as AutomockedModule, b as AutospiedModule, a as ManualMockedModule, M as MockerRegistry, R as RedirectedModule } from './chunk-registry.js'; - -function mockObject(options, object, mockExports = {}) { - const finalizers = new Array(); - const refs = new RefTracker(); - const define = (container, key, value) => { - try { - container[key] = value; - return true; - } catch { - return false; - } - }; - const createMock = (currentValue) => { - if (!options.createMockInstance) { - throw new Error("[@vitest/mocker] `createMockInstance` is not defined. This is a Vitest error. Please open a new issue with reproduction."); - } - const createMockInstance = options.createMockInstance; - const prototypeMembers = currentValue.prototype ? collectFunctionProperties(currentValue.prototype) : []; - return createMockInstance({ - name: currentValue.name, - prototypeMembers, - originalImplementation: options.type === "autospy" ? currentValue : undefined, - keepMembersImplementation: options.type === "autospy" - }); - }; - const mockPropertiesOf = (container, newContainer) => { - const containerType = getType(container); - const isModule = containerType === "Module" || !!container.__esModule; - for (const { key: property, descriptor } of getAllMockableProperties(container, isModule, options.globalConstructors)) { - // Modules define their exports as getters. We want to process those. - if (!isModule && descriptor.get) { - try { - if (options.type === "autospy") { - Object.defineProperty(newContainer, property, descriptor); - } else { - Object.defineProperty(newContainer, property, { - configurable: descriptor.configurable, - enumerable: descriptor.enumerable, - get: () => {}, - set: descriptor.set ? () => {} : undefined - }); - } - } catch {} - continue; - } - // Skip special read-only props, we don't want to mess with those. - if (isReadonlyProp(container[property], property)) { - continue; - } - const value = container[property]; - // Special handling of references we've seen before to prevent infinite - // recursion in circular objects. - const refId = refs.getId(value); - if (refId !== undefined) { - finalizers.push(() => define(newContainer, property, refs.getMockedValue(refId))); - continue; - } - const type = getType(value); - if (Array.isArray(value)) { - if (options.type === "automock") { - define(newContainer, property, []); - } else { - const array = value.map((value) => { - if (value && typeof value === "object") { - const newObject = {}; - mockPropertiesOf(value, newObject); - return newObject; - } - if (typeof value === "function") { - return createMock(value); - } - return value; - }); - define(newContainer, property, array); - } - continue; - } - const isFunction = type.includes("Function") && typeof value === "function"; - if ((!isFunction || value._isMockFunction) && type !== "Object" && type !== "Module") { - define(newContainer, property, value); - continue; - } - // Sometimes this assignment fails for some unknown reason. If it does, - // just move along. - if (!define(newContainer, property, isFunction || options.type === "autospy" ? value : {})) { - continue; - } - if (isFunction) { - const mock = createMock(newContainer[property]); - newContainer[property] = mock; - } - refs.track(value, newContainer[property]); - mockPropertiesOf(value, newContainer[property]); - } - }; - const mockedObject = mockExports; - mockPropertiesOf(object, mockedObject); - // Plug together refs - for (const finalizer of finalizers) { - finalizer(); - } - return mockedObject; -} -class RefTracker { - idMap = new Map(); - mockedValueMap = new Map(); - getId(value) { - return this.idMap.get(value); - } - getMockedValue(id) { - return this.mockedValueMap.get(id); - } - track(originalValue, mockedValue) { - const newId = this.idMap.size; - this.idMap.set(originalValue, newId); - this.mockedValueMap.set(newId, mockedValue); - return newId; - } -} -function getType(value) { - return Object.prototype.toString.apply(value).slice(8, -1); -} -function isReadonlyProp(object, prop) { - if (prop === "arguments" || prop === "caller" || prop === "callee" || prop === "name" || prop === "length") { - const typeName = getType(object); - return typeName === "Function" || typeName === "AsyncFunction" || typeName === "GeneratorFunction" || typeName === "AsyncGeneratorFunction"; - } - if (prop === "source" || prop === "global" || prop === "ignoreCase" || prop === "multiline") { - return getType(object) === "RegExp"; - } - return false; -} -function getAllMockableProperties(obj, isModule, constructors) { - const { Map, Object, Function, RegExp, Array } = constructors; - const allProps = new Map(); - let curr = obj; - do { - // we don't need properties from these - if (curr === Object.prototype || curr === Function.prototype || curr === RegExp.prototype) { - break; - } - collectOwnProperties(curr, (key) => { - const descriptor = Object.getOwnPropertyDescriptor(curr, key); - if (descriptor) { - allProps.set(key, { - key, - descriptor - }); - } - }); - } while (curr = Object.getPrototypeOf(curr)); - // default is not specified in ownKeys, if module is interoped - if (isModule && !allProps.has("default") && "default" in obj) { - const descriptor = Object.getOwnPropertyDescriptor(obj, "default"); - if (descriptor) { - allProps.set("default", { - key: "default", - descriptor - }); - } - } - return Array.from(allProps.values()); -} -function collectOwnProperties(obj, collector) { - const collect = typeof collector === "function" ? collector : (key) => collector.add(key); - Object.getOwnPropertyNames(obj).forEach(collect); - Object.getOwnPropertySymbols(obj).forEach(collect); -} -function collectFunctionProperties(prototype) { - const properties = new Set(); - collectOwnProperties(prototype, (prop) => { - const descriptor = Object.getOwnPropertyDescriptor(prototype, prop); - if (!descriptor || descriptor.get) { - return; - } - const type = getType(descriptor.value); - if (type.includes("Function") && !isReadonlyProp(descriptor.value, prop)) { - properties.add(prop); - } - }); - return Array.from(properties); -} - -export { mockObject }; diff --git a/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts b/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts deleted file mode 100644 index db47e96..0000000 --- a/node_modules/@vitest/mocker/dist/mocker.d-TnKRhz7N.d.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { MaybeMockedDeep } from '@vitest/spy'; -import { b as ModuleMockOptions, c as ModuleMockFactoryWithHelper, a as MockedModule, M as MockerRegistry, d as MockedModuleType } from './types.d-B8CCKmHt.js'; -import { C as CreateMockInstanceProcedure } from './index.d-C-sLYZi-.js'; - -interface CompilerHintsOptions { - /** - * This is the key used to access the globalThis object in the worker. - * Unlike `globalThisAccessor` in other APIs, this is not injected into the script. - * ```ts - * // globalThisKey: '__my_variable__' produces: - * globalThis['__my_variable__'] - * // globalThisKey: '"__my_variable__"' produces: - * globalThis['"__my_variable__"'] // notice double quotes - * ``` - * @default '__vitest_mocker__' - */ - globalThisKey?: string; -} -interface ModuleMockerCompilerHints { - hoisted: (factory: () => T) => T; - mock: (path: string | Promise, factory?: ModuleMockOptions | ModuleMockFactoryWithHelper) => void; - unmock: (path: string | Promise) => void; - doMock: (path: string | Promise, factory?: ModuleMockOptions | ModuleMockFactoryWithHelper) => void; - doUnmock: (path: string | Promise) => void; - importActual: (path: string) => Promise; - importMock: (path: string) => Promise>; -} -declare function createCompilerHints(options?: CompilerHintsOptions): ModuleMockerCompilerHints; - -interface ModuleMockerInterceptor { - register: (module: MockedModule) => Promise; - delete: (url: string) => Promise; - invalidate: () => Promise; -} - -declare class ModuleMocker { - private interceptor; - private rpc; - private createMockInstance; - private config; - protected registry: MockerRegistry; - private queue; - private mockedIds; - constructor(interceptor: ModuleMockerInterceptor, rpc: ModuleMockerRPC, createMockInstance: CreateMockInstanceProcedure, config: ModuleMockerConfig); - prepare(): Promise; - resolveFactoryModule(id: string): Promise>; - getFactoryModule(id: string): any; - invalidate(): Promise; - importActual(id: string, importer: string): Promise; - importMock(rawId: string, importer: string): Promise; - mockObject(object: Record, moduleType?: "automock" | "autospy"): Record; - queueMock(rawId: string, importer: string, factoryOrOptions?: ModuleMockOptions | (() => any)): void; - queueUnmock(id: string, importer: string): void; - wrapDynamicImport(moduleFactory: () => Promise): Promise; - private resolveMockPath; -} -interface ResolveIdResult { - id: string; - url: string; - optimized: boolean; -} -interface ResolveMockResult { - mockType: MockedModuleType; - resolvedId: string; - resolvedUrl: string; - redirectUrl?: string | null; - needsInterop?: boolean; -} -interface ModuleMockerRPC { - invalidate: (ids: string[]) => Promise; - resolveId: (id: string, importer: string) => Promise; - resolveMock: (id: string, importer: string, options: { - mock: "spy" | "factory" | "auto"; - }) => Promise; -} -interface ModuleMockerConfig { - root: string; -} - -export { ModuleMocker as b, createCompilerHints as c }; -export type { CompilerHintsOptions as C, ModuleMockerInterceptor as M, ResolveIdResult as R, ModuleMockerCompilerHints as a, ModuleMockerConfig as d, ModuleMockerRPC as e, ResolveMockResult as f }; diff --git a/node_modules/@vitest/mocker/dist/node.d.ts b/node_modules/@vitest/mocker/dist/node.d.ts deleted file mode 100644 index 2f9b27c..0000000 --- a/node_modules/@vitest/mocker/dist/node.d.ts +++ /dev/null @@ -1,800 +0,0 @@ -import { AutomockOptions } from './automock.js'; -export { automockModule } from './automock.js'; -import { Plugin, Rollup, ViteDevServer } from 'vite'; -import { SourceMap } from 'magic-string'; -import { M as MockerRegistry, S as ServerMockResolution, e as ServerIdResolution } from './types.d-B8CCKmHt.js'; -export { findMockRedirect } from './redirect.js'; - -declare function createManualModuleSource(moduleUrl: string, exports: string[], globalAccessor?: string): string; - -declare function automockPlugin(options?: AutomockOptions): Plugin; - -interface DynamicImportPluginOptions { - /** - * @default `"__vitest_mocker__"` - */ - globalThisAccessor?: string; - filter?: (id: string) => boolean; -} -declare function dynamicImportPlugin(options?: DynamicImportPluginOptions): Plugin; - -// This definition file follows a somewhat unusual format. ESTree allows -// runtime type checks based on the `type` parameter. In order to explain this -// to typescript we want to use discriminated union types: -// https://github.com/Microsoft/TypeScript/pull/9163 -// -// For ESTree this is a bit tricky because the high level interfaces like -// Node or Function are pulling double duty. We want to pass common fields down -// to the interfaces that extend them (like Identifier or -// ArrowFunctionExpression), but you can't extend a type union or enforce -// common fields on them. So we've split the high level interfaces into two -// types, a base type which passes down inherited fields, and a type union of -// all types which extend the base type. Only the type union is exported, and -// the union is how other types refer to the collection of inheriting types. -// -// This makes the definitions file here somewhat more difficult to maintain, -// but it has the notable advantage of making ESTree much easier to use as -// an end user. - -interface BaseNodeWithoutComments { - // Every leaf interface that extends BaseNode must specify a type property. - // The type property should be a string literal. For example, Identifier - // has: `type: "Identifier"` - type: string; - loc?: SourceLocation | null | undefined; - range?: [number, number] | undefined; -} - -interface BaseNode extends BaseNodeWithoutComments { - leadingComments?: Comment[] | undefined; - trailingComments?: Comment[] | undefined; -} - -interface NodeMap { - AssignmentProperty: AssignmentProperty; - CatchClause: CatchClause; - Class: Class; - ClassBody: ClassBody; - Expression: Expression; - Function: Function; - Identifier: Identifier; - Literal: Literal; - MethodDefinition: MethodDefinition; - ModuleDeclaration: ModuleDeclaration; - ModuleSpecifier: ModuleSpecifier; - Pattern: Pattern; - PrivateIdentifier: PrivateIdentifier; - Program: Program; - Property: Property; - PropertyDefinition: PropertyDefinition; - SpreadElement: SpreadElement; - Statement: Statement; - Super: Super; - SwitchCase: SwitchCase; - TemplateElement: TemplateElement; - VariableDeclarator: VariableDeclarator; -} - -type Node$1 = NodeMap[keyof NodeMap]; - -interface Comment extends BaseNodeWithoutComments { - type: "Line" | "Block"; - value: string; -} - -interface SourceLocation { - source?: string | null | undefined; - start: Position; - end: Position; -} - -interface Position { - /** >= 1 */ - line: number; - /** >= 0 */ - column: number; -} - -interface Program extends BaseNode { - type: "Program"; - sourceType: "script" | "module"; - body: Array; - comments?: Comment[] | undefined; -} - -interface Directive extends BaseNode { - type: "ExpressionStatement"; - expression: Literal; - directive: string; -} - -interface BaseFunction extends BaseNode { - params: Pattern[]; - generator?: boolean | undefined; - async?: boolean | undefined; - // The body is either BlockStatement or Expression because arrow functions - // can have a body that's either. FunctionDeclarations and - // FunctionExpressions have only BlockStatement bodies. - body: BlockStatement | Expression; -} - -type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression; - -type Statement = - | ExpressionStatement - | BlockStatement - | StaticBlock - | EmptyStatement - | DebuggerStatement - | WithStatement - | ReturnStatement - | LabeledStatement - | BreakStatement - | ContinueStatement - | IfStatement - | SwitchStatement - | ThrowStatement - | TryStatement - | WhileStatement - | DoWhileStatement - | ForStatement - | ForInStatement - | ForOfStatement - | Declaration; - -interface BaseStatement extends BaseNode {} - -interface EmptyStatement extends BaseStatement { - type: "EmptyStatement"; -} - -interface BlockStatement extends BaseStatement { - type: "BlockStatement"; - body: Statement[]; - innerComments?: Comment[] | undefined; -} - -interface StaticBlock extends Omit { - type: "StaticBlock"; -} - -interface ExpressionStatement extends BaseStatement { - type: "ExpressionStatement"; - expression: Expression; -} - -interface IfStatement extends BaseStatement { - type: "IfStatement"; - test: Expression; - consequent: Statement; - alternate?: Statement | null | undefined; -} - -interface LabeledStatement extends BaseStatement { - type: "LabeledStatement"; - label: Identifier; - body: Statement; -} - -interface BreakStatement extends BaseStatement { - type: "BreakStatement"; - label?: Identifier | null | undefined; -} - -interface ContinueStatement extends BaseStatement { - type: "ContinueStatement"; - label?: Identifier | null | undefined; -} - -interface WithStatement extends BaseStatement { - type: "WithStatement"; - object: Expression; - body: Statement; -} - -interface SwitchStatement extends BaseStatement { - type: "SwitchStatement"; - discriminant: Expression; - cases: SwitchCase[]; -} - -interface ReturnStatement extends BaseStatement { - type: "ReturnStatement"; - argument?: Expression | null | undefined; -} - -interface ThrowStatement extends BaseStatement { - type: "ThrowStatement"; - argument: Expression; -} - -interface TryStatement extends BaseStatement { - type: "TryStatement"; - block: BlockStatement; - handler?: CatchClause | null | undefined; - finalizer?: BlockStatement | null | undefined; -} - -interface WhileStatement extends BaseStatement { - type: "WhileStatement"; - test: Expression; - body: Statement; -} - -interface DoWhileStatement extends BaseStatement { - type: "DoWhileStatement"; - body: Statement; - test: Expression; -} - -interface ForStatement extends BaseStatement { - type: "ForStatement"; - init?: VariableDeclaration | Expression | null | undefined; - test?: Expression | null | undefined; - update?: Expression | null | undefined; - body: Statement; -} - -interface BaseForXStatement extends BaseStatement { - left: VariableDeclaration | Pattern; - right: Expression; - body: Statement; -} - -interface ForInStatement extends BaseForXStatement { - type: "ForInStatement"; -} - -interface DebuggerStatement extends BaseStatement { - type: "DebuggerStatement"; -} - -type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration; - -interface BaseDeclaration extends BaseStatement {} - -interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration { - type: "FunctionDeclaration"; - /** It is null when a function declaration is a part of the `export default function` statement */ - id: Identifier | null; - body: BlockStatement; -} - -interface FunctionDeclaration extends MaybeNamedFunctionDeclaration { - id: Identifier; -} - -interface VariableDeclaration extends BaseDeclaration { - type: "VariableDeclaration"; - declarations: VariableDeclarator[]; - kind: "var" | "let" | "const" | "using" | "await using"; -} - -interface VariableDeclarator extends BaseNode { - type: "VariableDeclarator"; - id: Pattern; - init?: Expression | null | undefined; -} - -interface ExpressionMap { - ArrayExpression: ArrayExpression; - ArrowFunctionExpression: ArrowFunctionExpression; - AssignmentExpression: AssignmentExpression; - AwaitExpression: AwaitExpression; - BinaryExpression: BinaryExpression; - CallExpression: CallExpression; - ChainExpression: ChainExpression; - ClassExpression: ClassExpression; - ConditionalExpression: ConditionalExpression; - FunctionExpression: FunctionExpression; - Identifier: Identifier; - ImportExpression: ImportExpression; - Literal: Literal; - LogicalExpression: LogicalExpression; - MemberExpression: MemberExpression; - MetaProperty: MetaProperty; - NewExpression: NewExpression; - ObjectExpression: ObjectExpression; - SequenceExpression: SequenceExpression; - TaggedTemplateExpression: TaggedTemplateExpression; - TemplateLiteral: TemplateLiteral; - ThisExpression: ThisExpression; - UnaryExpression: UnaryExpression; - UpdateExpression: UpdateExpression; - YieldExpression: YieldExpression; -} - -type Expression = ExpressionMap[keyof ExpressionMap]; - -interface BaseExpression extends BaseNode {} - -type ChainElement = SimpleCallExpression | MemberExpression; - -interface ChainExpression extends BaseExpression { - type: "ChainExpression"; - expression: ChainElement; -} - -interface ThisExpression extends BaseExpression { - type: "ThisExpression"; -} - -interface ArrayExpression extends BaseExpression { - type: "ArrayExpression"; - elements: Array; -} - -interface ObjectExpression extends BaseExpression { - type: "ObjectExpression"; - properties: Array; -} - -interface PrivateIdentifier extends BaseNode { - type: "PrivateIdentifier"; - name: string; -} - -interface Property extends BaseNode { - type: "Property"; - key: Expression | PrivateIdentifier; - value: Expression | Pattern; // Could be an AssignmentProperty - kind: "init" | "get" | "set"; - method: boolean; - shorthand: boolean; - computed: boolean; -} - -interface PropertyDefinition extends BaseNode { - type: "PropertyDefinition"; - key: Expression | PrivateIdentifier; - value?: Expression | null | undefined; - computed: boolean; - static: boolean; -} - -interface FunctionExpression extends BaseFunction, BaseExpression { - id?: Identifier | null | undefined; - type: "FunctionExpression"; - body: BlockStatement; -} - -interface SequenceExpression extends BaseExpression { - type: "SequenceExpression"; - expressions: Expression[]; -} - -interface UnaryExpression extends BaseExpression { - type: "UnaryExpression"; - operator: UnaryOperator; - prefix: true; - argument: Expression; -} - -interface BinaryExpression extends BaseExpression { - type: "BinaryExpression"; - operator: BinaryOperator; - left: Expression | PrivateIdentifier; - right: Expression; -} - -interface AssignmentExpression extends BaseExpression { - type: "AssignmentExpression"; - operator: AssignmentOperator; - left: Pattern | MemberExpression; - right: Expression; -} - -interface UpdateExpression extends BaseExpression { - type: "UpdateExpression"; - operator: UpdateOperator; - argument: Expression; - prefix: boolean; -} - -interface LogicalExpression extends BaseExpression { - type: "LogicalExpression"; - operator: LogicalOperator; - left: Expression; - right: Expression; -} - -interface ConditionalExpression extends BaseExpression { - type: "ConditionalExpression"; - test: Expression; - alternate: Expression; - consequent: Expression; -} - -interface BaseCallExpression extends BaseExpression { - callee: Expression | Super; - arguments: Array; -} -type CallExpression = SimpleCallExpression | NewExpression; - -interface SimpleCallExpression extends BaseCallExpression { - type: "CallExpression"; - optional: boolean; -} - -interface NewExpression extends BaseCallExpression { - type: "NewExpression"; -} - -interface MemberExpression extends BaseExpression, BasePattern { - type: "MemberExpression"; - object: Expression | Super; - property: Expression | PrivateIdentifier; - computed: boolean; - optional: boolean; -} - -type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression; - -interface BasePattern extends BaseNode {} - -interface SwitchCase extends BaseNode { - type: "SwitchCase"; - test?: Expression | null | undefined; - consequent: Statement[]; -} - -interface CatchClause extends BaseNode { - type: "CatchClause"; - param: Pattern | null; - body: BlockStatement; -} - -interface Identifier extends BaseNode, BaseExpression, BasePattern { - type: "Identifier"; - name: string; -} - -type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral; - -interface SimpleLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value: string | boolean | number | null; - raw?: string | undefined; -} - -interface RegExpLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: RegExp | null | undefined; - regex: { - pattern: string; - flags: string; - }; - raw?: string | undefined; -} - -interface BigIntLiteral extends BaseNode, BaseExpression { - type: "Literal"; - value?: bigint | null | undefined; - bigint: string; - raw?: string | undefined; -} - -type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"; - -type BinaryOperator = - | "==" - | "!=" - | "===" - | "!==" - | "<" - | "<=" - | ">" - | ">=" - | "<<" - | ">>" - | ">>>" - | "+" - | "-" - | "*" - | "/" - | "%" - | "**" - | "|" - | "^" - | "&" - | "in" - | "instanceof"; - -type LogicalOperator = "||" | "&&" | "??"; - -type AssignmentOperator = - | "=" - | "+=" - | "-=" - | "*=" - | "/=" - | "%=" - | "**=" - | "<<=" - | ">>=" - | ">>>=" - | "|=" - | "^=" - | "&=" - | "||=" - | "&&=" - | "??="; - -type UpdateOperator = "++" | "--"; - -interface ForOfStatement extends BaseForXStatement { - type: "ForOfStatement"; - await: boolean; -} - -interface Super extends BaseNode { - type: "Super"; -} - -interface SpreadElement extends BaseNode { - type: "SpreadElement"; - argument: Expression; -} - -interface ArrowFunctionExpression extends BaseExpression, BaseFunction { - type: "ArrowFunctionExpression"; - expression: boolean; - body: BlockStatement | Expression; -} - -interface YieldExpression extends BaseExpression { - type: "YieldExpression"; - argument?: Expression | null | undefined; - delegate: boolean; -} - -interface TemplateLiteral extends BaseExpression { - type: "TemplateLiteral"; - quasis: TemplateElement[]; - expressions: Expression[]; -} - -interface TaggedTemplateExpression extends BaseExpression { - type: "TaggedTemplateExpression"; - tag: Expression; - quasi: TemplateLiteral; -} - -interface TemplateElement extends BaseNode { - type: "TemplateElement"; - tail: boolean; - value: { - /** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */ - cooked?: string | null | undefined; - raw: string; - }; -} - -interface AssignmentProperty extends Property { - value: Pattern; - kind: "init"; - method: boolean; // false -} - -interface ObjectPattern extends BasePattern { - type: "ObjectPattern"; - properties: Array; -} - -interface ArrayPattern extends BasePattern { - type: "ArrayPattern"; - elements: Array; -} - -interface RestElement extends BasePattern { - type: "RestElement"; - argument: Pattern; -} - -interface AssignmentPattern extends BasePattern { - type: "AssignmentPattern"; - left: Pattern; - right: Expression; -} - -type Class = ClassDeclaration | ClassExpression; -interface BaseClass extends BaseNode { - superClass?: Expression | null | undefined; - body: ClassBody; -} - -interface ClassBody extends BaseNode { - type: "ClassBody"; - body: Array; -} - -interface MethodDefinition extends BaseNode { - type: "MethodDefinition"; - key: Expression | PrivateIdentifier; - value: FunctionExpression; - kind: "constructor" | "method" | "get" | "set"; - computed: boolean; - static: boolean; -} - -interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration { - type: "ClassDeclaration"; - /** It is null when a class declaration is a part of the `export default class` statement */ - id: Identifier | null; -} - -interface ClassDeclaration extends MaybeNamedClassDeclaration { - id: Identifier; -} - -interface ClassExpression extends BaseClass, BaseExpression { - type: "ClassExpression"; - id?: Identifier | null | undefined; -} - -interface MetaProperty extends BaseExpression { - type: "MetaProperty"; - meta: Identifier; - property: Identifier; -} - -type ModuleDeclaration = - | ImportDeclaration - | ExportNamedDeclaration - | ExportDefaultDeclaration - | ExportAllDeclaration; -interface BaseModuleDeclaration extends BaseNode {} - -type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier; -interface BaseModuleSpecifier extends BaseNode { - local: Identifier; -} - -interface ImportDeclaration extends BaseModuleDeclaration { - type: "ImportDeclaration"; - specifiers: Array; - attributes: ImportAttribute[]; - source: Literal; -} - -interface ImportSpecifier extends BaseModuleSpecifier { - type: "ImportSpecifier"; - imported: Identifier | Literal; -} - -interface ImportAttribute extends BaseNode { - type: "ImportAttribute"; - key: Identifier | Literal; - value: Literal; -} - -interface ImportExpression extends BaseExpression { - type: "ImportExpression"; - source: Expression; - options?: Expression | null | undefined; -} - -interface ImportDefaultSpecifier extends BaseModuleSpecifier { - type: "ImportDefaultSpecifier"; -} - -interface ImportNamespaceSpecifier extends BaseModuleSpecifier { - type: "ImportNamespaceSpecifier"; -} - -interface ExportNamedDeclaration extends BaseModuleDeclaration { - type: "ExportNamedDeclaration"; - declaration?: Declaration | null | undefined; - specifiers: ExportSpecifier[]; - attributes: ImportAttribute[]; - source?: Literal | null | undefined; -} - -interface ExportSpecifier extends Omit { - type: "ExportSpecifier"; - local: Identifier | Literal; - exported: Identifier | Literal; -} - -interface ExportDefaultDeclaration extends BaseModuleDeclaration { - type: "ExportDefaultDeclaration"; - declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression; -} - -interface ExportAllDeclaration extends BaseModuleDeclaration { - type: "ExportAllDeclaration"; - exported: Identifier | Literal | null; - attributes: ImportAttribute[]; - source: Literal; -} - -interface AwaitExpression extends BaseExpression { - type: "AwaitExpression"; - argument: Expression; -} - -type Positioned = T & { - start: number; - end: number; -}; -type Node = Positioned; - -interface HoistMocksOptions { - /** - * List of modules that should always be imported before compiler hints. - * @default 'vitest' - */ - hoistedModule?: string; - /** - * @default ["vi", "vitest"] - */ - utilsObjectNames?: string[]; - /** - * @default ["mock", "unmock"] - */ - hoistableMockMethodNames?: string[]; - /** - * @default ["mock", "unmock", "doMock", "doUnmock"] - */ - dynamicImportMockMethodNames?: string[]; - /** - * @default ["hoisted"] - */ - hoistedMethodNames?: string[]; - regexpHoistable?: RegExp; - codeFrameGenerator?: CodeFrameGenerator; -} -interface HoistMocksPluginOptions extends Omit { - include?: string | RegExp | (string | RegExp)[]; - exclude?: string | RegExp | (string | RegExp)[]; - /** - * overrides include/exclude options - */ - filter?: (id: string) => boolean; -} -declare function hoistMocksPlugin(options?: HoistMocksPluginOptions): Plugin; -interface HoistMocksResult { - code: string; - map: SourceMap; -} -interface CodeFrameGenerator { - (node: Positioned, id: string, code: string): string; -} -declare function hoistMocks(code: string, id: string, parse: Rollup.PluginContext["parse"], options?: HoistMocksOptions): HoistMocksResult | undefined; - -interface InterceptorPluginOptions { - /** - * @default "__vitest_mocker__" - */ - globalThisAccessor?: string; - registry?: MockerRegistry; -} -declare function interceptorPlugin(options?: InterceptorPluginOptions): Plugin; - -interface MockerPluginOptions extends AutomockOptions { - hoistMocks?: HoistMocksPluginOptions; -} -declare function mockerPlugin(options?: MockerPluginOptions): Plugin[]; - -interface ServerResolverOptions { - /** - * @default ['/node_modules/'] - */ - moduleDirectories?: string[]; -} -declare class ServerMockResolver { - private server; - private options; - constructor(server: ViteDevServer, options?: ServerResolverOptions); - resolveMock(rawId: string, importer: string, options: { - mock: "spy" | "factory" | "auto"; - }): Promise; - invalidate(ids: string[]): void; - resolveId(id: string, importer?: string): Promise; - private normalizeResolveIdToUrl; - private resolveMockId; - private resolveModule; -} - -export { AutomockOptions as AutomockPluginOptions, ServerMockResolver, automockPlugin, createManualModuleSource, dynamicImportPlugin, hoistMocks, hoistMocksPlugin, interceptorPlugin, mockerPlugin }; -export type { HoistMocksPluginOptions, HoistMocksResult, InterceptorPluginOptions, ServerResolverOptions }; diff --git a/node_modules/@vitest/mocker/dist/node.js b/node_modules/@vitest/mocker/dist/node.js deleted file mode 100644 index f2ca242..0000000 --- a/node_modules/@vitest/mocker/dist/node.js +++ /dev/null @@ -1,967 +0,0 @@ -import { a as cleanUrl, c as createManualModuleSource } from './chunk-utils.js'; -import { a as automockModule, e as esmWalker } from './chunk-automock.js'; -import MagicString from 'magic-string'; -import { createFilter } from 'vite'; -import { readFile } from 'node:fs/promises'; -import { join } from 'node:path/posix'; -import { M as MockerRegistry, a as ManualMockedModule } from './chunk-registry.js'; -import { fileURLToPath } from 'node:url'; -import { existsSync, readFileSync } from 'node:fs'; -import { findMockRedirect } from './redirect.js'; -import { i as isAbsolute, j as join$1, r as resolve } from './chunk-pathe.M-eThtNZ.js'; -import 'estree-walker'; -import 'node:module'; - -function automockPlugin(options = {}) { - return { - name: "vitest:automock", - enforce: "post", - transform(code, id) { - if (id.includes("mock=automock") || id.includes("mock=autospy")) { - const mockType = id.includes("mock=automock") ? "automock" : "autospy"; - const ms = automockModule(code, mockType, this.parse, options); - return { - code: ms.toString(), - map: ms.generateMap({ - hires: "boundary", - source: cleanUrl(id) - }) - }; - } - } - }; -} - -const regexDynamicImport = /import\s*\(/; -function dynamicImportPlugin(options = {}) { - return { - name: "vitest:browser:esm-injector", - enforce: "post", - transform(source, id) { - // TODO: test is not called for static imports - if (!regexDynamicImport.test(source)) { - return; - } - if (options.filter && !options.filter(id)) { - return; - } - return injectDynamicImport(source, id, this.parse, options); - } - }; -} -function injectDynamicImport(code, id, parse, options = {}) { - const s = new MagicString(code); - let ast; - try { - ast = parse(code); - } catch (err) { - console.error(`Cannot parse ${id}:\n${err.message}`); - return; - } - // 3. convert references to import bindings & import.meta references - esmWalker(ast, { - onImportMeta() { - // s.update(node.start, node.end, viImportMetaKey) - }, - onDynamicImport(node) { - const globalThisAccessor = options.globalThisAccessor || "\"__vitest_mocker__\""; - const replaceString = `globalThis[${globalThisAccessor}].wrapDynamicImport(() => import(`; - const importSubstring = code.substring(node.start, node.end); - const hasIgnore = importSubstring.includes("/* @vite-ignore */"); - s.overwrite(node.start, node.source.start, replaceString + (hasIgnore ? "/* @vite-ignore */ " : "")); - s.overwrite(node.end - 1, node.end, "))"); - } - }); - return { - code: s.toString(), - map: s.generateMap({ - hires: "boundary", - source: id - }) - }; -} - -// AST walker module for ESTree compatible trees - - -function makeTest(test) { - if (typeof test === "string") - { return function (type) { return type === test; } } - else if (!test) - { return function () { return true; } } - else - { return test } -} - -var Found = function Found(node, state) { this.node = node; this.state = state; }; - -// Find the innermost node of a given type that contains the given -// position. Interface similar to findNodeAt. -function findNodeAround(node, pos, test, baseVisitor, state) { - test = makeTest(test); - if (!baseVisitor) { baseVisitor = base; } - try { - (function c(node, st, override) { - var type = override || node.type; - if (node.start > pos || node.end < pos) { return } - baseVisitor[type](node, st, c); - if (test(type, node)) { throw new Found(node, st) } - })(node, state); - } catch (e) { - if (e instanceof Found) { return e } - throw e - } -} - -function skipThrough(node, st, c) { c(node, st); } -function ignore(_node, _st, _c) {} - -// Node walkers. - -var base = {}; - -base.Program = base.BlockStatement = base.StaticBlock = function (node, st, c) { - for (var i = 0, list = node.body; i < list.length; i += 1) - { - var stmt = list[i]; - - c(stmt, st, "Statement"); - } -}; -base.Statement = skipThrough; -base.EmptyStatement = ignore; -base.ExpressionStatement = base.ParenthesizedExpression = base.ChainExpression = - function (node, st, c) { return c(node.expression, st, "Expression"); }; -base.IfStatement = function (node, st, c) { - c(node.test, st, "Expression"); - c(node.consequent, st, "Statement"); - if (node.alternate) { c(node.alternate, st, "Statement"); } -}; -base.LabeledStatement = function (node, st, c) { return c(node.body, st, "Statement"); }; -base.BreakStatement = base.ContinueStatement = ignore; -base.WithStatement = function (node, st, c) { - c(node.object, st, "Expression"); - c(node.body, st, "Statement"); -}; -base.SwitchStatement = function (node, st, c) { - c(node.discriminant, st, "Expression"); - for (var i = 0, list = node.cases; i < list.length; i += 1) { - var cs = list[i]; - - c(cs, st); - } -}; -base.SwitchCase = function (node, st, c) { - if (node.test) { c(node.test, st, "Expression"); } - for (var i = 0, list = node.consequent; i < list.length; i += 1) - { - var cons = list[i]; - - c(cons, st, "Statement"); - } -}; -base.ReturnStatement = base.YieldExpression = base.AwaitExpression = function (node, st, c) { - if (node.argument) { c(node.argument, st, "Expression"); } -}; -base.ThrowStatement = base.SpreadElement = - function (node, st, c) { return c(node.argument, st, "Expression"); }; -base.TryStatement = function (node, st, c) { - c(node.block, st, "Statement"); - if (node.handler) { c(node.handler, st); } - if (node.finalizer) { c(node.finalizer, st, "Statement"); } -}; -base.CatchClause = function (node, st, c) { - if (node.param) { c(node.param, st, "Pattern"); } - c(node.body, st, "Statement"); -}; -base.WhileStatement = base.DoWhileStatement = function (node, st, c) { - c(node.test, st, "Expression"); - c(node.body, st, "Statement"); -}; -base.ForStatement = function (node, st, c) { - if (node.init) { c(node.init, st, "ForInit"); } - if (node.test) { c(node.test, st, "Expression"); } - if (node.update) { c(node.update, st, "Expression"); } - c(node.body, st, "Statement"); -}; -base.ForInStatement = base.ForOfStatement = function (node, st, c) { - c(node.left, st, "ForInit"); - c(node.right, st, "Expression"); - c(node.body, st, "Statement"); -}; -base.ForInit = function (node, st, c) { - if (node.type === "VariableDeclaration") { c(node, st); } - else { c(node, st, "Expression"); } -}; -base.DebuggerStatement = ignore; - -base.FunctionDeclaration = function (node, st, c) { return c(node, st, "Function"); }; -base.VariableDeclaration = function (node, st, c) { - for (var i = 0, list = node.declarations; i < list.length; i += 1) - { - var decl = list[i]; - - c(decl, st); - } -}; -base.VariableDeclarator = function (node, st, c) { - c(node.id, st, "Pattern"); - if (node.init) { c(node.init, st, "Expression"); } -}; - -base.Function = function (node, st, c) { - if (node.id) { c(node.id, st, "Pattern"); } - for (var i = 0, list = node.params; i < list.length; i += 1) - { - var param = list[i]; - - c(param, st, "Pattern"); - } - c(node.body, st, node.expression ? "Expression" : "Statement"); -}; - -base.Pattern = function (node, st, c) { - if (node.type === "Identifier") - { c(node, st, "VariablePattern"); } - else if (node.type === "MemberExpression") - { c(node, st, "MemberPattern"); } - else - { c(node, st); } -}; -base.VariablePattern = ignore; -base.MemberPattern = skipThrough; -base.RestElement = function (node, st, c) { return c(node.argument, st, "Pattern"); }; -base.ArrayPattern = function (node, st, c) { - for (var i = 0, list = node.elements; i < list.length; i += 1) { - var elt = list[i]; - - if (elt) { c(elt, st, "Pattern"); } - } -}; -base.ObjectPattern = function (node, st, c) { - for (var i = 0, list = node.properties; i < list.length; i += 1) { - var prop = list[i]; - - if (prop.type === "Property") { - if (prop.computed) { c(prop.key, st, "Expression"); } - c(prop.value, st, "Pattern"); - } else if (prop.type === "RestElement") { - c(prop.argument, st, "Pattern"); - } - } -}; - -base.Expression = skipThrough; -base.ThisExpression = base.Super = base.MetaProperty = ignore; -base.ArrayExpression = function (node, st, c) { - for (var i = 0, list = node.elements; i < list.length; i += 1) { - var elt = list[i]; - - if (elt) { c(elt, st, "Expression"); } - } -}; -base.ObjectExpression = function (node, st, c) { - for (var i = 0, list = node.properties; i < list.length; i += 1) - { - var prop = list[i]; - - c(prop, st); - } -}; -base.FunctionExpression = base.ArrowFunctionExpression = base.FunctionDeclaration; -base.SequenceExpression = function (node, st, c) { - for (var i = 0, list = node.expressions; i < list.length; i += 1) - { - var expr = list[i]; - - c(expr, st, "Expression"); - } -}; -base.TemplateLiteral = function (node, st, c) { - for (var i = 0, list = node.quasis; i < list.length; i += 1) - { - var quasi = list[i]; - - c(quasi, st); - } - - for (var i$1 = 0, list$1 = node.expressions; i$1 < list$1.length; i$1 += 1) - { - var expr = list$1[i$1]; - - c(expr, st, "Expression"); - } -}; -base.TemplateElement = ignore; -base.UnaryExpression = base.UpdateExpression = function (node, st, c) { - c(node.argument, st, "Expression"); -}; -base.BinaryExpression = base.LogicalExpression = function (node, st, c) { - c(node.left, st, "Expression"); - c(node.right, st, "Expression"); -}; -base.AssignmentExpression = base.AssignmentPattern = function (node, st, c) { - c(node.left, st, "Pattern"); - c(node.right, st, "Expression"); -}; -base.ConditionalExpression = function (node, st, c) { - c(node.test, st, "Expression"); - c(node.consequent, st, "Expression"); - c(node.alternate, st, "Expression"); -}; -base.NewExpression = base.CallExpression = function (node, st, c) { - c(node.callee, st, "Expression"); - if (node.arguments) - { for (var i = 0, list = node.arguments; i < list.length; i += 1) - { - var arg = list[i]; - - c(arg, st, "Expression"); - } } -}; -base.MemberExpression = function (node, st, c) { - c(node.object, st, "Expression"); - if (node.computed) { c(node.property, st, "Expression"); } -}; -base.ExportNamedDeclaration = base.ExportDefaultDeclaration = function (node, st, c) { - if (node.declaration) - { c(node.declaration, st, node.type === "ExportNamedDeclaration" || node.declaration.id ? "Statement" : "Expression"); } - if (node.source) { c(node.source, st, "Expression"); } -}; -base.ExportAllDeclaration = function (node, st, c) { - if (node.exported) - { c(node.exported, st); } - c(node.source, st, "Expression"); -}; -base.ImportDeclaration = function (node, st, c) { - for (var i = 0, list = node.specifiers; i < list.length; i += 1) - { - var spec = list[i]; - - c(spec, st); - } - c(node.source, st, "Expression"); -}; -base.ImportExpression = function (node, st, c) { - c(node.source, st, "Expression"); -}; -base.ImportSpecifier = base.ImportDefaultSpecifier = base.ImportNamespaceSpecifier = base.Identifier = base.PrivateIdentifier = base.Literal = ignore; - -base.TaggedTemplateExpression = function (node, st, c) { - c(node.tag, st, "Expression"); - c(node.quasi, st, "Expression"); -}; -base.ClassDeclaration = base.ClassExpression = function (node, st, c) { return c(node, st, "Class"); }; -base.Class = function (node, st, c) { - if (node.id) { c(node.id, st, "Pattern"); } - if (node.superClass) { c(node.superClass, st, "Expression"); } - c(node.body, st); -}; -base.ClassBody = function (node, st, c) { - for (var i = 0, list = node.body; i < list.length; i += 1) - { - var elt = list[i]; - - c(elt, st); - } -}; -base.MethodDefinition = base.PropertyDefinition = base.Property = function (node, st, c) { - if (node.computed) { c(node.key, st, "Expression"); } - if (node.value) { c(node.value, st, "Expression"); } -}; - -function hoistMocksPlugin(options = {}) { - const filter = options.filter || createFilter(options.include, options.exclude); - const { hoistableMockMethodNames = ["mock", "unmock"], dynamicImportMockMethodNames = [ - "mock", - "unmock", - "doMock", - "doUnmock" - ], hoistedMethodNames = ["hoisted"], utilsObjectNames = ["vi", "vitest"] } = options; - const methods = new Set([ - ...hoistableMockMethodNames, - ...hoistedMethodNames, - ...dynamicImportMockMethodNames - ]); - const regexpHoistable = new RegExp(`\\b(?:${utilsObjectNames.join("|")})\\s*\.\\s*(?:${Array.from(methods).join("|")})\\s*\\(`); - return { - name: "vitest:mocks", - enforce: "post", - transform(code, id) { - if (!filter(id)) { - return; - } - return hoistMocks(code, id, this.parse, { - regexpHoistable, - hoistableMockMethodNames, - hoistedMethodNames, - utilsObjectNames, - dynamicImportMockMethodNames, - ...options - }); - } - }; -} -const API_NOT_FOUND_ERROR = `There are some problems in resolving the mocks API. -You may encounter this issue when importing the mocks API from another module other than 'vitest'. -To fix this issue you can either: -- import the mocks API directly from 'vitest' -- enable the 'globals' options`; -function API_NOT_FOUND_CHECK(names) { - return `\nif (${names.map((name) => `typeof globalThis["${name}"] === "undefined"`).join(" && ")}) ` + `{ throw new Error(${JSON.stringify(API_NOT_FOUND_ERROR)}) }\n`; -} -function isIdentifier(node) { - return node.type === "Identifier"; -} -function getNodeTail(code, node) { - let end = node.end; - if (code[node.end] === ";") { - end += 1; - } - if (code[node.end] === "\n") { - return end + 1; - } - if (code[node.end + 1] === "\n") { - end += 1; - } - return end; -} -const regexpHoistable = /\b(?:vi|vitest)\s*\.\s*(?:mock|unmock|hoisted|doMock|doUnmock)\s*\(/; -const hashbangRE = /^#!.*\n/; -// this is a fork of Vite SSR transform -function hoistMocks(code, id, parse, options = {}) { - var _hashbangRE$exec; - const needHoisting = (options.regexpHoistable || regexpHoistable).test(code); - if (!needHoisting) { - return; - } - const s = new MagicString(code); - let ast; - try { - ast = parse(code); - } catch (err) { - console.error(`Cannot parse ${id}:\n${err.message}.`); - return; - } - const { hoistableMockMethodNames = ["mock", "unmock"], dynamicImportMockMethodNames = [ - "mock", - "unmock", - "doMock", - "doUnmock" - ], hoistedMethodNames = ["hoisted"], utilsObjectNames = ["vi", "vitest"], hoistedModule = "vitest" } = options; - // hoist at the start of the file, after the hashbang - let hoistIndex = ((_hashbangRE$exec = hashbangRE.exec(code)) === null || _hashbangRE$exec === void 0 ? void 0 : _hashbangRE$exec[0].length) ?? 0; - let hoistedModuleImported = false; - let uid = 0; - const idToImportMap = new Map(); - const imports = []; - // this will transform import statements into dynamic ones, if there are imports - // it will keep the import as is, if we don't need to mock anything - // in browser environment it will wrap the module value with "vitest_wrap_module" function - // that returns a proxy to the module so that named exports can be mocked - function defineImport(importNode) { - const source = importNode.source.value; - // always hoist vitest import to top of the file, so - // "vi" helpers can access it - if (hoistedModule === source) { - hoistedModuleImported = true; - return; - } - const importId = `__vi_import_${uid++}__`; - imports.push({ - id: importId, - node: importNode - }); - return importId; - } - // 1. check all import statements and record id -> importName map - for (const node of ast.body) { - // import foo from 'foo' --> foo -> __import_foo__.default - // import { baz } from 'foo' --> baz -> __import_foo__.baz - // import * as ok from 'foo' --> ok -> __import_foo__ - if (node.type === "ImportDeclaration") { - const importId = defineImport(node); - if (!importId) { - continue; - } - for (const spec of node.specifiers) { - if (spec.type === "ImportSpecifier") { - if (spec.imported.type === "Identifier") { - idToImportMap.set(spec.local.name, `${importId}.${spec.imported.name}`); - } else { - idToImportMap.set(spec.local.name, `${importId}[${JSON.stringify(spec.imported.value)}]`); - } - } else if (spec.type === "ImportDefaultSpecifier") { - idToImportMap.set(spec.local.name, `${importId}.default`); - } else { - // namespace specifier - idToImportMap.set(spec.local.name, importId); - } - } - } - } - const declaredConst = new Set(); - const hoistedNodes = []; - function createSyntaxError(node, message) { - const _error = new SyntaxError(message); - Error.captureStackTrace(_error, createSyntaxError); - const serializedError = { - name: "SyntaxError", - message: _error.message, - stack: _error.stack - }; - if (options.codeFrameGenerator) { - serializedError.frame = options.codeFrameGenerator(node, id, code); - } - return serializedError; - } - function assertNotDefaultExport(node, error) { - var _findNodeAround; - const defaultExport = (_findNodeAround = findNodeAround(ast, node.start, "ExportDefaultDeclaration")) === null || _findNodeAround === void 0 ? void 0 : _findNodeAround.node; - if ((defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.declaration) === node || (defaultExport === null || defaultExport === void 0 ? void 0 : defaultExport.declaration.type) === "AwaitExpression" && defaultExport.declaration.argument === node) { - throw createSyntaxError(defaultExport, error); - } - } - function assertNotNamedExport(node, error) { - var _findNodeAround2; - const nodeExported = (_findNodeAround2 = findNodeAround(ast, node.start, "ExportNamedDeclaration")) === null || _findNodeAround2 === void 0 ? void 0 : _findNodeAround2.node; - if ((nodeExported === null || nodeExported === void 0 ? void 0 : nodeExported.declaration) === node) { - throw createSyntaxError(nodeExported, error); - } - } - function getVariableDeclaration(node) { - var _findNodeAround3, _declarationNode$decl; - const declarationNode = (_findNodeAround3 = findNodeAround(ast, node.start, "VariableDeclaration")) === null || _findNodeAround3 === void 0 ? void 0 : _findNodeAround3.node; - const init = declarationNode === null || declarationNode === void 0 || (_declarationNode$decl = declarationNode.declarations[0]) === null || _declarationNode$decl === void 0 ? void 0 : _declarationNode$decl.init; - if (init && (init === node || init.type === "AwaitExpression" && init.argument === node)) { - return declarationNode; - } - } - const usedUtilityExports = new Set(); - esmWalker(ast, { - onIdentifier(id, info, parentStack) { - const binding = idToImportMap.get(id.name); - if (!binding) { - return; - } - if (info.hasBindingShortcut) { - s.appendLeft(id.end, `: ${binding}`); - } else if (info.classDeclaration) { - if (!declaredConst.has(id.name)) { - declaredConst.add(id.name); - // locate the top-most node containing the class declaration - const topNode = parentStack[parentStack.length - 2]; - s.prependRight(topNode.start, `const ${id.name} = ${binding};\n`); - } - } else if (!info.classExpression) { - s.update(id.start, id.end, binding); - } - }, - onCallExpression(node) { - if (node.callee.type === "MemberExpression" && isIdentifier(node.callee.object) && utilsObjectNames.includes(node.callee.object.name) && isIdentifier(node.callee.property)) { - const methodName = node.callee.property.name; - usedUtilityExports.add(node.callee.object.name); - if (hoistableMockMethodNames.includes(methodName)) { - const method = `${node.callee.object.name}.${methodName}`; - assertNotDefaultExport(node, `Cannot export the result of "${method}". Remove export declaration because "${method}" doesn\'t return anything.`); - const declarationNode = getVariableDeclaration(node); - if (declarationNode) { - assertNotNamedExport(declarationNode, `Cannot export the result of "${method}". Remove export declaration because "${method}" doesn\'t return anything.`); - } - // rewrite vi.mock(import('..')) into vi.mock('..') - if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && dynamicImportMockMethodNames.includes(node.callee.property.name)) { - const moduleInfo = node.arguments[0]; - // vi.mock(import('./path')) -> vi.mock('./path') - if (moduleInfo.type === "ImportExpression") { - const source = moduleInfo.source; - s.overwrite(moduleInfo.start, moduleInfo.end, s.slice(source.start, source.end)); - } - // vi.mock(await import('./path')) -> vi.mock('./path') - if (moduleInfo.type === "AwaitExpression" && moduleInfo.argument.type === "ImportExpression") { - const source = moduleInfo.argument.source; - s.overwrite(moduleInfo.start, moduleInfo.end, s.slice(source.start, source.end)); - } - } - hoistedNodes.push(node); - } else if (dynamicImportMockMethodNames.includes(methodName)) { - const moduleInfo = node.arguments[0]; - let source = null; - if (moduleInfo.type === "ImportExpression") { - source = moduleInfo.source; - } - if (moduleInfo.type === "AwaitExpression" && moduleInfo.argument.type === "ImportExpression") { - source = moduleInfo.argument.source; - } - if (source) { - s.overwrite(moduleInfo.start, moduleInfo.end, s.slice(source.start, source.end)); - } - } - if (hoistedMethodNames.includes(methodName)) { - assertNotDefaultExport(node, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first."); - const declarationNode = getVariableDeclaration(node); - if (declarationNode) { - assertNotNamedExport(declarationNode, "Cannot export hoisted variable. You can control hoisting behavior by placing the import from this file first."); - // hoist "const variable = vi.hoisted(() => {})" - hoistedNodes.push(declarationNode); - } else { - var _findNodeAround4; - const awaitedExpression = (_findNodeAround4 = findNodeAround(ast, node.start, "AwaitExpression")) === null || _findNodeAround4 === void 0 ? void 0 : _findNodeAround4.node; - // hoist "await vi.hoisted(async () => {})" or "vi.hoisted(() => {})" - const moveNode = (awaitedExpression === null || awaitedExpression === void 0 ? void 0 : awaitedExpression.argument) === node ? awaitedExpression : node; - hoistedNodes.push(moveNode); - } - } - } - } - }); - function getNodeName(node) { - const callee = node.callee || {}; - if (callee.type === "MemberExpression" && isIdentifier(callee.property) && isIdentifier(callee.object)) { - return `${callee.object.name}.${callee.property.name}()`; - } - return "\"hoisted method\""; - } - function getNodeCall(node) { - if (node.type === "CallExpression") { - return node; - } - if (node.type === "VariableDeclaration") { - const { declarations } = node; - const init = declarations[0].init; - if (init) { - return getNodeCall(init); - } - } - if (node.type === "AwaitExpression") { - const { argument } = node; - if (argument.type === "CallExpression") { - return getNodeCall(argument); - } - } - return node; - } - function createError(outsideNode, insideNode) { - const outsideCall = getNodeCall(outsideNode); - const insideCall = getNodeCall(insideNode); - throw createSyntaxError(insideCall, `Cannot call ${getNodeName(insideCall)} inside ${getNodeName(outsideCall)}: both methods are hoisted to the top of the file and not actually called inside each other.`); - } - // validate hoistedNodes doesn't have nodes inside other nodes - for (let i = 0; i < hoistedNodes.length; i++) { - const node = hoistedNodes[i]; - for (let j = i + 1; j < hoistedNodes.length; j++) { - const otherNode = hoistedNodes[j]; - if (node.start >= otherNode.start && node.end <= otherNode.end) { - throw createError(otherNode, node); - } - if (otherNode.start >= node.start && otherNode.end <= node.end) { - throw createError(node, otherNode); - } - } - } - // hoist vi.mock/vi.hoisted - for (const node of hoistedNodes) { - const end = getNodeTail(code, node); - // don't hoist into itself if it's already at the top - if (hoistIndex === end || hoistIndex === node.start) { - hoistIndex = end; - } else { - s.move(node.start, end, hoistIndex); - } - } - // hoist actual dynamic imports last so they are inserted after all hoisted mocks - for (const { node: importNode, id: importId } of imports) { - const source = importNode.source.value; - s.update(importNode.start, importNode.end, `const ${importId} = await import(${JSON.stringify(source)});\n`); - if (importNode.start === hoistIndex) { - // no need to hoist, but update hoistIndex to keep the order - hoistIndex = importNode.end; - } else { - // There will be an error if the module is called before it is imported, - // so the module import statement is hoisted to the top - s.move(importNode.start, importNode.end, hoistIndex); - } - } - if (!hoistedModuleImported && hoistedNodes.length) { - const utilityImports = [...usedUtilityExports]; - // "vi" or "vitest" is imported from a module other than "vitest" - if (utilityImports.some((name) => idToImportMap.has(name))) { - s.prepend(API_NOT_FOUND_CHECK(utilityImports)); - } else if (utilityImports.length) { - s.prepend(`import { ${[...usedUtilityExports].join(", ")} } from ${JSON.stringify(hoistedModule)}\n`); - } - } - return { - code: s.toString(), - map: s.generateMap({ - hires: "boundary", - source: id - }) - }; -} - -function interceptorPlugin(options = {}) { - const registry = options.registry || new MockerRegistry(); - return { - name: "vitest:mocks:interceptor", - enforce: "pre", - load: { - order: "pre", - async handler(id) { - const mock = registry.getById(id); - if (!mock) { - return; - } - if (mock.type === "manual") { - const exports$1 = Object.keys(await mock.resolve()); - const accessor = options.globalThisAccessor || "\"__vitest_mocker__\""; - return createManualModuleSource(mock.url, exports$1, accessor); - } - if (mock.type === "redirect") { - return readFile(mock.redirect, "utf-8"); - } - } - }, - transform: { - order: "post", - handler(code, id) { - const mock = registry.getById(id); - if (!mock) { - return; - } - if (mock.type === "automock" || mock.type === "autospy") { - const m = automockModule(code, mock.type, this.parse, { globalThisAccessor: options.globalThisAccessor }); - return { - code: m.toString(), - map: m.generateMap({ - hires: "boundary", - source: cleanUrl(id) - }) - }; - } - } - }, - configureServer(server) { - server.ws.on("vitest:interceptor:register", (event) => { - if (event.type === "manual") { - const module = ManualMockedModule.fromJSON(event, async () => { - const keys = await getFactoryExports(event.url); - return Object.fromEntries(keys.map((key) => [key, null])); - }); - registry.add(module); - } else { - if (event.type === "redirect") { - const redirectUrl = new URL(event.redirect); - event.redirect = join(server.config.root, redirectUrl.pathname); - } - registry.register(event); - } - server.ws.send("vitest:interceptor:register:result"); - }); - server.ws.on("vitest:interceptor:delete", (id) => { - registry.delete(id); - server.ws.send("vitest:interceptor:delete:result"); - }); - server.ws.on("vitest:interceptor:invalidate", () => { - registry.clear(); - server.ws.send("vitest:interceptor:invalidate:result"); - }); - function getFactoryExports(url) { - server.ws.send("vitest:interceptor:resolve", url); - let timeout; - return new Promise((resolve, reject) => { - timeout = setTimeout(() => { - reject(new Error(`Timeout while waiting for factory exports of ${url}`)); - }, 1e4); - server.ws.on("vitest:interceptor:resolved", ({ url: resolvedUrl, keys }) => { - if (resolvedUrl === url) { - clearTimeout(timeout); - resolve(keys); - } - }); - }); - } - } - }; -} - -const VALID_ID_PREFIX = "/@id/"; -class ServerMockResolver { - constructor(server, options = {}) { - this.server = server; - this.options = options; - } - async resolveMock(rawId, importer, options) { - const { id, fsPath, external } = await this.resolveMockId(rawId, importer); - const resolvedUrl = this.normalizeResolveIdToUrl({ id }).url; - if (options.mock === "factory") { - var _manifest$fsPath; - const manifest = getViteDepsManifest(this.server.config); - const needsInterop = (manifest === null || manifest === void 0 || (_manifest$fsPath = manifest[fsPath]) === null || _manifest$fsPath === void 0 ? void 0 : _manifest$fsPath.needsInterop) ?? false; - return { - mockType: "manual", - resolvedId: id, - resolvedUrl, - needsInterop - }; - } - if (options.mock === "spy") { - return { - mockType: "autospy", - resolvedId: id, - resolvedUrl - }; - } - const redirectUrl = findMockRedirect(this.server.config.root, fsPath, external); - return { - mockType: redirectUrl === null ? "automock" : "redirect", - redirectUrl, - resolvedId: id, - resolvedUrl - }; - } - invalidate(ids) { - ids.forEach((id) => { - const moduleGraph = this.server.moduleGraph; - const module = moduleGraph.getModuleById(id); - if (module) { - module.transformResult = null; - } - }); - } - async resolveId(id, importer) { - const resolved = await this.server.pluginContainer.resolveId(id, importer, { ssr: false }); - if (!resolved) { - return null; - } - return this.normalizeResolveIdToUrl(resolved); - } - normalizeResolveIdToUrl(resolved) { - const isOptimized = resolved.id.startsWith(withTrailingSlash(this.server.config.cacheDir)); - let url; - // normalise the URL to be acceptable by the browser - // https://github.com/vitejs/vite/blob/14027b0f2a9b01c14815c38aab22baf5b29594bb/packages/vite/src/node/plugins/importAnalysis.ts#L103 - const root = this.server.config.root; - if (resolved.id.startsWith(withTrailingSlash(root))) { - url = resolved.id.slice(root.length); - } else if (resolved.id !== "/@react-refresh" && isAbsolute(resolved.id) && existsSync(cleanUrl(resolved.id))) { - url = join$1("/@fs/", resolved.id); - } else { - url = resolved.id; - } - if (url[0] !== "." && url[0] !== "/") { - url = resolved.id.startsWith(VALID_ID_PREFIX) ? resolved.id : VALID_ID_PREFIX + resolved.id.replace("\0", "__x00__"); - } - return { - id: resolved.id, - url, - optimized: isOptimized - }; - } - async resolveMockId(rawId, importer) { - if (!this.server.moduleGraph.getModuleById(importer) && !importer.startsWith(this.server.config.root)) { - importer = join$1(this.server.config.root, importer); - } - const resolved = await this.server.pluginContainer.resolveId(rawId, importer, { ssr: false }); - return this.resolveModule(rawId, resolved); - } - resolveModule(rawId, resolved) { - const id = (resolved === null || resolved === void 0 ? void 0 : resolved.id) || rawId; - const external = !isAbsolute(id) || isModuleDirectory(this.options, id) ? rawId : null; - return { - id, - fsPath: cleanUrl(id), - external - }; - } -} -function isModuleDirectory(config, path) { - const moduleDirectories = config.moduleDirectories || ["/node_modules/"]; - return moduleDirectories.some((dir) => path.includes(dir)); -} -const metadata = new WeakMap(); -function getViteDepsManifest(config) { - if (metadata.has(config)) { - return metadata.get(config); - } - const cacheDirPath = getDepsCacheDir(config); - const metadataPath = resolve(cacheDirPath, "_metadata.json"); - if (!existsSync(metadataPath)) { - return null; - } - const { optimized } = JSON.parse(readFileSync(metadataPath, "utf-8")); - const newManifest = {}; - for (const name in optimized) { - const dep = optimized[name]; - const file = resolve(cacheDirPath, dep.file); - newManifest[file] = { - hash: dep.fileHash, - needsInterop: dep.needsInterop - }; - } - metadata.set(config, newManifest); - return newManifest; -} -function getDepsCacheDir(config) { - return resolve(config.cacheDir, "deps"); -} -function withTrailingSlash(path) { - if (path.at(-1) !== "/") { - return `${path}/`; - } - return path; -} - -// this is an implementation for public usage -// vitest doesn't use this plugin directly -function mockerPlugin(options = {}) { - let server; - const registerPath = resolve(fileURLToPath(new URL("./register.js", import.meta.url))); - return [ - { - name: "vitest:mocker:ws-rpc", - config(_, { command }) { - if (command !== "serve") { - return; - } - return { - server: { preTransformRequests: false }, - optimizeDeps: { exclude: ["@vitest/mocker/register", "@vitest/mocker/browser"] } - }; - }, - configureServer(server_) { - server = server_; - const mockResolver = new ServerMockResolver(server); - server.ws.on("vitest:mocks:resolveId", async ({ id, importer }) => { - const resolved = await mockResolver.resolveId(id, importer); - server.ws.send("vitest:mocks:resolvedId:result", resolved); - }); - server.ws.on("vitest:mocks:resolveMock", async ({ id, importer, options }) => { - const resolved = await mockResolver.resolveMock(id, importer, options); - server.ws.send("vitest:mocks:resolveMock:result", resolved); - }); - server.ws.on("vitest:mocks:invalidate", async ({ ids }) => { - mockResolver.invalidate(ids); - server.ws.send("vitest:mocks:invalidate:result"); - }); - }, - async load(id) { - if (id !== registerPath) { - return; - } - if (!server) { - // mocker doesn't work during build - return "export {}"; - } - const content = await readFile(registerPath, "utf-8"); - const result = content.replace(/__VITEST_GLOBAL_THIS_ACCESSOR__/g, options.globalThisAccessor ?? "\"__vitest_mocker__\"").replace("__VITEST_MOCKER_ROOT__", JSON.stringify(server.config.root)); - return result; - } - }, - hoistMocksPlugin(options.hoistMocks), - interceptorPlugin(options), - automockPlugin(options), - dynamicImportPlugin(options) - ]; -} - -export { ServerMockResolver, automockModule, automockPlugin, createManualModuleSource, dynamicImportPlugin, findMockRedirect, hoistMocks, hoistMocksPlugin, interceptorPlugin, mockerPlugin }; diff --git a/node_modules/@vitest/mocker/dist/redirect.d.ts b/node_modules/@vitest/mocker/dist/redirect.d.ts deleted file mode 100644 index 1f8256b..0000000 --- a/node_modules/@vitest/mocker/dist/redirect.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare function findMockRedirect(root: string, mockPath: string, external: string | null): string | null; - -export { findMockRedirect }; diff --git a/node_modules/@vitest/mocker/dist/redirect.js b/node_modules/@vitest/mocker/dist/redirect.js deleted file mode 100644 index 0071819..0000000 --- a/node_modules/@vitest/mocker/dist/redirect.js +++ /dev/null @@ -1,79 +0,0 @@ -import fs from 'node:fs'; -import nodeModule from 'node:module'; -import { d as dirname, j as join, b as basename, r as resolve, e as extname } from './chunk-pathe.M-eThtNZ.js'; - -const { existsSync, readdirSync, statSync } = fs; -function findMockRedirect(root, mockPath, external) { - const path = external || mockPath; - // it's a node_module alias - // all mocks should be inside /__mocks__ - if (external || isNodeBuiltin(mockPath) || !existsSync(mockPath)) { - const mockDirname = dirname(path); - const mockFolder = join(root, "__mocks__", mockDirname); - if (!existsSync(mockFolder)) { - return null; - } - const baseOriginal = basename(path); - function findFile(mockFolder, baseOriginal) { - const files = readdirSync(mockFolder); - for (const file of files) { - const baseFile = basename(file, extname(file)); - if (baseFile === baseOriginal) { - const path = resolve(mockFolder, file); - // if the same name, return the file - if (statSync(path).isFile()) { - return path; - } else { - // find folder/index.{js,ts} - const indexFile = findFile(path, "index"); - if (indexFile) { - return indexFile; - } - } - } - } - return null; - } - return findFile(mockFolder, baseOriginal); - } - const dir = dirname(path); - const baseId = basename(path); - const fullPath = resolve(dir, "__mocks__", baseId); - return existsSync(fullPath) ? fullPath : null; -} -const builtins = new Set([ - ...nodeModule.builtinModules, - "assert/strict", - "diagnostics_channel", - "dns/promises", - "fs/promises", - "path/posix", - "path/win32", - "readline/promises", - "stream/consumers", - "stream/promises", - "stream/web", - "timers/promises", - "util/types", - "wasi" -]); -// https://nodejs.org/api/modules.html#built-in-modules-with-mandatory-node-prefix -const prefixedBuiltins = new Set([ - "node:sea", - "node:sqlite", - "node:test", - "node:test/reporters" -]); -const NODE_BUILTIN_NAMESPACE = "node:"; -function isNodeBuiltin(id) { - // Added in v18.6.0 - if (nodeModule.isBuiltin) { - return nodeModule.isBuiltin(id); - } - if (prefixedBuiltins.has(id)) { - return true; - } - return builtins.has(id.startsWith(NODE_BUILTIN_NAMESPACE) ? id.slice(NODE_BUILTIN_NAMESPACE.length) : id); -} - -export { findMockRedirect }; diff --git a/node_modules/@vitest/mocker/dist/register.d.ts b/node_modules/@vitest/mocker/dist/register.d.ts deleted file mode 100644 index 73e6207..0000000 --- a/node_modules/@vitest/mocker/dist/register.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { M as ModuleMockerInterceptor, a as ModuleMockerCompilerHints, b as ModuleMocker } from './mocker.d-TnKRhz7N.js'; -import '@vitest/spy'; -import './types.d-B8CCKmHt.js'; -import './index.d-C-sLYZi-.js'; - -declare function registerModuleMocker(interceptor: (accessor: string) => ModuleMockerInterceptor): ModuleMockerCompilerHints; -declare function registerNativeFactoryResolver(mocker: ModuleMocker): void; - -export { registerModuleMocker, registerNativeFactoryResolver }; diff --git a/node_modules/@vitest/mocker/dist/register.js b/node_modules/@vitest/mocker/dist/register.js deleted file mode 100644 index 841b687..0000000 --- a/node_modules/@vitest/mocker/dist/register.js +++ /dev/null @@ -1,41 +0,0 @@ -import { createMockInstance } from '@vitest/spy'; -import { M as ModuleMocker, r as rpc, c as createCompilerHints, h as hot } from './chunk-mocker.js'; -import './index.js'; -import './chunk-registry.js'; -import './chunk-pathe.M-eThtNZ.js'; - -function registerModuleMocker(interceptor) { - const mocker = new ModuleMocker(interceptor(__VITEST_GLOBAL_THIS_ACCESSOR__), { - resolveId(id, importer) { - return rpc("vitest:mocks:resolveId", { - id, - importer - }); - }, - resolveMock(id, importer, options) { - return rpc("vitest:mocks:resolveMock", { - id, - importer, - options - }); - }, - async invalidate(ids) { - return rpc("vitest:mocks:invalidate", { ids }); - } - }, createMockInstance, { root: __VITEST_MOCKER_ROOT__ }); - globalThis[__VITEST_GLOBAL_THIS_ACCESSOR__] = mocker; - registerNativeFactoryResolver(mocker); - return createCompilerHints({ globalThisKey: __VITEST_GLOBAL_THIS_ACCESSOR__ }); -} -function registerNativeFactoryResolver(mocker) { - hot.on("vitest:interceptor:resolve", async (url) => { - const exports$1 = await mocker.resolveFactoryModule(url); - const keys = Object.keys(exports$1); - hot.send("vitest:interceptor:resolved", { - url, - keys - }); - }); -} - -export { registerModuleMocker, registerNativeFactoryResolver }; diff --git a/node_modules/@vitest/mocker/dist/types.d-B8CCKmHt.d.ts b/node_modules/@vitest/mocker/dist/types.d-B8CCKmHt.d.ts deleted file mode 100644 index a99816f..0000000 --- a/node_modules/@vitest/mocker/dist/types.d-B8CCKmHt.d.ts +++ /dev/null @@ -1,107 +0,0 @@ -declare class MockerRegistry { - private readonly registryByUrl; - private readonly registryById; - clear(): void; - keys(): IterableIterator; - add(mock: MockedModule): void; - register(json: MockedModuleSerialized): MockedModule; - register(type: "redirect", raw: string, id: string, url: string, redirect: string): RedirectedModule; - register(type: "manual", raw: string, id: string, url: string, factory: () => any): ManualMockedModule; - register(type: "automock", raw: string, id: string, url: string): AutomockedModule; - register(type: "autospy", id: string, raw: string, url: string): AutospiedModule; - delete(id: string): void; - deleteById(id: string): void; - get(id: string): MockedModule | undefined; - getById(id: string): MockedModule | undefined; - has(id: string): boolean; -} -type MockedModule = AutomockedModule | AutospiedModule | ManualMockedModule | RedirectedModule; -type MockedModuleType = "automock" | "autospy" | "manual" | "redirect"; -type MockedModuleSerialized = AutomockedModuleSerialized | AutospiedModuleSerialized | ManualMockedModuleSerialized | RedirectedModuleSerialized; -declare class AutomockedModule { - raw: string; - id: string; - url: string; - readonly type = "automock"; - constructor(raw: string, id: string, url: string); - static fromJSON(data: AutomockedModuleSerialized): AutospiedModule; - toJSON(): AutomockedModuleSerialized; -} -interface AutomockedModuleSerialized { - type: "automock"; - url: string; - raw: string; - id: string; -} -declare class AutospiedModule { - raw: string; - id: string; - url: string; - readonly type = "autospy"; - constructor(raw: string, id: string, url: string); - static fromJSON(data: AutospiedModuleSerialized): AutospiedModule; - toJSON(): AutospiedModuleSerialized; -} -interface AutospiedModuleSerialized { - type: "autospy"; - url: string; - raw: string; - id: string; -} -declare class RedirectedModule { - raw: string; - id: string; - url: string; - redirect: string; - readonly type = "redirect"; - constructor(raw: string, id: string, url: string, redirect: string); - static fromJSON(data: RedirectedModuleSerialized): RedirectedModule; - toJSON(): RedirectedModuleSerialized; -} -interface RedirectedModuleSerialized { - type: "redirect"; - url: string; - id: string; - raw: string; - redirect: string; -} -declare class ManualMockedModule { - raw: string; - id: string; - url: string; - factory: () => any; - cache: Record | undefined; - readonly type = "manual"; - constructor(raw: string, id: string, url: string, factory: () => any); - resolve(): Promise>; - static fromJSON(data: ManualMockedModuleSerialized, factory: () => any): ManualMockedModule; - toJSON(): ManualMockedModuleSerialized; -} -interface ManualMockedModuleSerialized { - type: "manual"; - url: string; - id: string; - raw: string; -} - -type Awaitable = T | PromiseLike; -type ModuleMockFactoryWithHelper = (importOriginal: () => Promise) => Awaitable>; -type ModuleMockFactory = () => any; -interface ModuleMockOptions { - spy?: boolean; -} -interface ServerMockResolution { - mockType: "manual" | "redirect" | "automock" | "autospy"; - resolvedId: string; - resolvedUrl: string; - needsInterop?: boolean; - redirectUrl?: string | null; -} -interface ServerIdResolution { - id: string; - url: string; - optimized: boolean; -} - -export { AutomockedModule as A, MockerRegistry as M, RedirectedModule as R, AutospiedModule as f, ManualMockedModule as g }; -export type { ServerMockResolution as S, MockedModule as a, ModuleMockOptions as b, ModuleMockFactoryWithHelper as c, MockedModuleType as d, ServerIdResolution as e, AutomockedModuleSerialized as h, AutospiedModuleSerialized as i, ManualMockedModuleSerialized as j, MockedModuleSerialized as k, RedirectedModuleSerialized as l, ModuleMockFactory as m }; diff --git a/node_modules/@vitest/mocker/package.json b/node_modules/@vitest/mocker/package.json deleted file mode 100644 index 275c071..0000000 --- a/node_modules/@vitest/mocker/package.json +++ /dev/null @@ -1,86 +0,0 @@ -{ - "name": "@vitest/mocker", - "type": "module", - "version": "4.0.16", - "description": "Vitest module mocker implementation", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/mocker#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/mocker" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./node": { - "types": "./dist/node.d.ts", - "default": "./dist/node.js" - }, - "./browser": { - "types": "./dist/browser.d.ts", - "default": "./dist/browser.js" - }, - "./redirect": { - "types": "./dist/redirect.d.ts", - "default": "./dist/redirect.js" - }, - "./automock": { - "types": "./dist/automock.d.ts", - "default": "./dist/automock.js" - }, - "./register": { - "types": "./dist/register.d.ts", - "default": "./dist/register.js" - }, - "./auto-register": { - "types": "./dist/register.d.ts", - "default": "./dist/register.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "*.d.ts", - "dist" - ], - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^6.0.0 || ^7.0.0-0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } - }, - "dependencies": { - "estree-walker": "^3.0.3", - "magic-string": "^0.30.21", - "@vitest/spy": "4.0.16" - }, - "devDependencies": { - "@types/estree": "^1.0.8", - "acorn-walk": "^8.3.4", - "msw": "^2.12.3", - "pathe": "^2.0.3", - "vite": "^6.3.5", - "@vitest/spy": "4.0.16", - "@vitest/utils": "4.0.16" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/pretty-format/LICENSE b/node_modules/@vitest/pretty-format/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/pretty-format/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/pretty-format/dist/index.d.ts b/node_modules/@vitest/pretty-format/dist/index.d.ts deleted file mode 100644 index a229bcf..0000000 --- a/node_modules/@vitest/pretty-format/dist/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -interface Colors { - comment: { - close: string; - open: string; - }; - content: { - close: string; - open: string; - }; - prop: { - close: string; - open: string; - }; - tag: { - close: string; - open: string; - }; - value: { - close: string; - open: string; - }; -} -type Indent = (arg0: string) => string; -type Refs = Array; -type Print = (arg0: unknown) => string; -type Theme = Required<{ - comment?: string; - content?: string; - prop?: string; - tag?: string; - value?: string; -}>; -/** -* compare function used when sorting object keys, `null` can be used to skip over sorting. -*/ -type CompareKeys = ((a: string, b: string) => number) | null | undefined; -type RequiredOptions = Required; -interface Options extends Omit { - compareKeys: CompareKeys; - theme: Theme; -} -interface PrettyFormatOptions { - callToJSON?: boolean; - escapeRegex?: boolean; - escapeString?: boolean; - highlight?: boolean; - indent?: number; - maxDepth?: number; - maxWidth?: number; - min?: boolean; - printBasicPrototype?: boolean; - printFunctionName?: boolean; - printShadowRoot?: boolean; - compareKeys?: CompareKeys; - plugins?: Plugins; -} -type OptionsReceived = PrettyFormatOptions; -interface Config { - callToJSON: boolean; - compareKeys: CompareKeys; - colors: Colors; - escapeRegex: boolean; - escapeString: boolean; - indent: string; - maxDepth: number; - maxWidth: number; - min: boolean; - plugins: Plugins; - printBasicPrototype: boolean; - printFunctionName: boolean; - printShadowRoot: boolean; - spacingInner: string; - spacingOuter: string; -} -type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string; -type Test = (arg0: any) => boolean; -interface NewPlugin { - serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string; - test: Test; -} -interface PluginOptions { - edgeSpacing: string; - min: boolean; - spacing: string; -} -interface OldPlugin { - print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string; - test: Test; -} -type Plugin = NewPlugin | OldPlugin; -type Plugins = Array; - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -declare const DEFAULT_OPTIONS: Options; -/** -* Returns a presentation string of your `val` object -* @param val any potential JavaScript object -* @param options Custom settings -*/ -declare function format(val: unknown, options?: OptionsReceived): string; -declare const plugins: { - AsymmetricMatcher: NewPlugin; - DOMCollection: NewPlugin; - DOMElement: NewPlugin; - Immutable: NewPlugin; - ReactElement: NewPlugin; - ReactTestComponent: NewPlugin; - Error: NewPlugin; -}; - -export { DEFAULT_OPTIONS, format, plugins }; -export type { Colors, CompareKeys, Config, NewPlugin, OldPlugin, Options, OptionsReceived, Plugin, Plugins, PrettyFormatOptions, Printer, Refs, Theme }; diff --git a/node_modules/@vitest/pretty-format/dist/index.js b/node_modules/@vitest/pretty-format/dist/index.js deleted file mode 100644 index f2daec4..0000000 --- a/node_modules/@vitest/pretty-format/dist/index.js +++ /dev/null @@ -1,1018 +0,0 @@ -import styles from 'tinyrainbow'; - -function _mergeNamespaces(n, m) { - m.forEach(function (e) { - e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) { - if (k !== 'default' && !(k in n)) { - var d = Object.getOwnPropertyDescriptor(e, k); - Object.defineProperty(n, k, d.get ? d : { - enumerable: true, - get: function () { return e[k]; } - }); - } - }); - }); - return Object.freeze(n); -} - -function getKeysOfEnumerableProperties(object, compareKeys) { - const rawKeys = Object.keys(object); - const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys); - if (Object.getOwnPropertySymbols) { - for (const symbol of Object.getOwnPropertySymbols(object)) { - if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) { - keys.push(symbol); - } - } - } - return keys; -} -/** -* Return entries (for example, of a map) -* with spacing, indentation, and comma -* without surrounding punctuation (for example, braces) -*/ -function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") { - let result = ""; - let width = 0; - let current = iterator.next(); - if (!current.done) { - result += config.spacingOuter; - const indentationNext = indentation + config.indent; - while (!current.done) { - result += indentationNext; - if (width++ === config.maxWidth) { - result += "…"; - break; - } - const name = printer(current.value[0], config, indentationNext, depth, refs); - const value = printer(current.value[1], config, indentationNext, depth, refs); - result += name + separator + value; - current = iterator.next(); - if (!current.done) { - result += `,${config.spacingInner}`; - } else if (!config.min) { - result += ","; - } - } - result += config.spacingOuter + indentation; - } - return result; -} -/** -* Return values (for example, of a set) -* with spacing, indentation, and comma -* without surrounding punctuation (braces or brackets) -*/ -function printIteratorValues(iterator, config, indentation, depth, refs, printer) { - let result = ""; - let width = 0; - let current = iterator.next(); - if (!current.done) { - result += config.spacingOuter; - const indentationNext = indentation + config.indent; - while (!current.done) { - result += indentationNext; - if (width++ === config.maxWidth) { - result += "…"; - break; - } - result += printer(current.value, config, indentationNext, depth, refs); - current = iterator.next(); - if (!current.done) { - result += `,${config.spacingInner}`; - } else if (!config.min) { - result += ","; - } - } - result += config.spacingOuter + indentation; - } - return result; -} -/** -* Return items (for example, of an array) -* with spacing, indentation, and comma -* without surrounding punctuation (for example, brackets) -*/ -function printListItems(list, config, indentation, depth, refs, printer) { - let result = ""; - list = list instanceof ArrayBuffer ? new DataView(list) : list; - const isDataView = (l) => l instanceof DataView; - const length = isDataView(list) ? list.byteLength : list.length; - if (length > 0) { - result += config.spacingOuter; - const indentationNext = indentation + config.indent; - for (let i = 0; i < length; i++) { - result += indentationNext; - if (i === config.maxWidth) { - result += "…"; - break; - } - if (isDataView(list) || i in list) { - result += printer(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs); - } - if (i < length - 1) { - result += `,${config.spacingInner}`; - } else if (!config.min) { - result += ","; - } - } - result += config.spacingOuter + indentation; - } - return result; -} -/** -* Return properties of an object -* with spacing, indentation, and comma -* without surrounding punctuation (for example, braces) -*/ -function printObjectProperties(val, config, indentation, depth, refs, printer) { - let result = ""; - const keys = getKeysOfEnumerableProperties(val, config.compareKeys); - if (keys.length > 0) { - result += config.spacingOuter; - const indentationNext = indentation + config.indent; - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - const name = printer(key, config, indentationNext, depth, refs); - const value = printer(val[key], config, indentationNext, depth, refs); - result += `${indentationNext + name}: ${value}`; - if (i < keys.length - 1) { - result += `,${config.spacingInner}`; - } else if (!config.min) { - result += ","; - } - } - result += config.spacingOuter + indentation; - } - return result; -} - -const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621; -const SPACE$2 = " "; -const serialize$5 = (val, config, indentation, depth, refs, printer) => { - const stringedValue = val.toString(); - if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") { - if (++depth > config.maxDepth) { - return `[${stringedValue}]`; - } - return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer)}]`; - } - if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") { - if (++depth > config.maxDepth) { - return `[${stringedValue}]`; - } - return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer)}}`; - } - if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") { - return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs); - } - if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") { - return stringedValue + SPACE$2 + printer(val.sample, config, indentation, depth, refs); - } - if (typeof val.toAsymmetricMatcher !== "function") { - throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`); - } - return val.toAsymmetricMatcher(); -}; -const test$5 = (val) => val && val.$$typeof === asymmetricMatcher; -const plugin$5 = { - serialize: serialize$5, - test: test$5 -}; - -const SPACE$1 = " "; -const OBJECT_NAMES = new Set(["DOMStringMap", "NamedNodeMap"]); -const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/; -function testName(name) { - return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name); -} -const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name); -function isNamedNodeMap(collection) { - return collection.constructor.name === "NamedNodeMap"; -} -const serialize$4 = (collection, config, indentation, depth, refs, printer) => { - const name = collection.constructor.name; - if (++depth > config.maxDepth) { - return `[${name}]`; - } - return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => { - props[attribute.name] = attribute.value; - return props; - }, {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer)}]`); -}; -const plugin$4 = { - serialize: serialize$4, - test: test$4 -}; - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -function escapeHTML(str) { - return str.replaceAll("<", "<").replaceAll(">", ">"); -} - -// Return empty string if keys is empty. -function printProps(keys, props, config, indentation, depth, refs, printer) { - const indentationNext = indentation + config.indent; - const colors = config.colors; - return keys.map((key) => { - const value = props[key]; - let printed = printer(value, config, indentationNext, depth, refs); - if (typeof value !== "string") { - if (printed.includes("\n")) { - printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation; - } - printed = `{${printed}}`; - } - return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`; - }).join(""); -} -// Return empty string if children is empty. -function printChildren(children, config, indentation, depth, refs, printer) { - return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join(""); -} -function printShadowRoot(children, config, indentation, depth, refs, printer) { - if (config.printShadowRoot === false) { - return ""; - } - return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer)].join(""); -} -function printText(text, config) { - const contentColor = config.colors.content; - return contentColor.open + escapeHTML(text) + contentColor.close; -} -function printComment(comment, config) { - const commentColor = config.colors.comment; - return `${commentColor.open}${commentColor.close}`; -} -// Separate the functions to format props, children, and element, -// so a plugin could override a particular function, if needed. -// Too bad, so sad: the traditional (but unnecessary) space -// in a self-closing tagColor requires a second test of printedProps. -function printElement(type, printedProps, printedChildren, config, indentation) { - const tagColor = config.colors.tag; - return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}${tagColor.close}`; -} -function printElementAsLeaf(type, config) { - const tagColor = config.colors.tag; - return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`; -} - -const ELEMENT_NODE = 1; -const TEXT_NODE = 3; -const COMMENT_NODE = 8; -const FRAGMENT_NODE = 11; -const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/; -function testHasAttribute(val) { - try { - return typeof val.hasAttribute === "function" && val.hasAttribute("is"); - } catch { - return false; - } -} -function testNode(val) { - const constructorName = val.constructor.name; - const { nodeType, tagName } = val; - const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val); - return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment"; -} -const test$3 = (val) => val?.constructor?.name && testNode(val); -function nodeIsText(node) { - return node.nodeType === TEXT_NODE; -} -function nodeIsComment(node) { - return node.nodeType === COMMENT_NODE; -} -function nodeIsFragment(node) { - return node.nodeType === FRAGMENT_NODE; -} -const serialize$3 = (node, config, indentation, depth, refs, printer) => { - if (nodeIsText(node)) { - return printText(node.data, config); - } - if (nodeIsComment(node)) { - return printComment(node.data, config); - } - const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase(); - if (++depth > config.maxDepth) { - return printElementAsLeaf(type, config); - } - return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => { - props[attribute.name] = attribute.value; - return props; - }, {}), config, indentation + config.indent, depth, refs, printer), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation); -}; -const plugin$3 = { - serialize: serialize$3, - test: test$3 -}; - -// SENTINEL constants are from https://github.com/facebook/immutable-js -const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@"; -const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@"; -const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@"; -const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@"; -const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@"; -const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@"; -const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@"; -const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@"; -const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@"; -const getImmutableName = (name) => `Immutable.${name}`; -const printAsLeaf = (name) => `[${name}]`; -const SPACE = " "; -const LAZY = "…"; -function printImmutableEntries(val, config, indentation, depth, refs, printer, type) { - return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer)}}`; -} -// Record has an entries method because it is a collection in immutable v3. -// Return an iterator for Immutable Record from version v3 or v4. -function getRecordEntries(val) { - let i = 0; - return { next() { - if (i < val._keys.length) { - const key = val._keys[i++]; - return { - done: false, - value: [key, val.get(key)] - }; - } - return { - done: true, - value: undefined - }; - } }; -} -function printImmutableRecord(val, config, indentation, depth, refs, printer) { - // _name property is defined only for an Immutable Record instance - // which was constructed with a second optional descriptive name arg - const name = getImmutableName(val._name || "Record"); - return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer)}}`; -} -function printImmutableSeq(val, config, indentation, depth, refs, printer) { - const name = getImmutableName("Seq"); - if (++depth > config.maxDepth) { - return printAsLeaf(name); - } - if (val[IS_KEYED_SENTINEL]) { - return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`; - } - return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY}]`; -} -function printImmutableValues(val, config, indentation, depth, refs, printer, type) { - return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}]`; -} -const serialize$2 = (val, config, indentation, depth, refs, printer) => { - if (val[IS_MAP_SENTINEL]) { - return printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map"); - } - if (val[IS_LIST_SENTINEL]) { - return printImmutableValues(val, config, indentation, depth, refs, printer, "List"); - } - if (val[IS_SET_SENTINEL]) { - return printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set"); - } - if (val[IS_STACK_SENTINEL]) { - return printImmutableValues(val, config, indentation, depth, refs, printer, "Stack"); - } - if (val[IS_SEQ_SENTINEL]) { - return printImmutableSeq(val, config, indentation, depth, refs, printer); - } - // For compatibility with immutable v3 and v4, let record be the default. - return printImmutableRecord(val, config, indentation, depth, refs, printer); -}; -// Explicitly comparing sentinel properties to true avoids false positive -// when mock identity-obj-proxy returns the key as the value for any key. -const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true); -const plugin$2 = { - serialize: serialize$2, - test: test$2 -}; - -function getDefaultExportFromCjs(x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; -} - -var reactIs$1 = {exports: {}}; - -var reactIs_production = {}; - -/** - * @license React - * react-is.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -var hasRequiredReactIs_production; - -function requireReactIs_production () { - if (hasRequiredReactIs_production) return reactIs_production; - hasRequiredReactIs_production = 1; - var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), - REACT_PORTAL_TYPE = Symbol.for("react.portal"), - REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), - REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), - REACT_PROFILER_TYPE = Symbol.for("react.profiler"), - REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), - REACT_CONTEXT_TYPE = Symbol.for("react.context"), - REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), - REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), - REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), - REACT_MEMO_TYPE = Symbol.for("react.memo"), - REACT_LAZY_TYPE = Symbol.for("react.lazy"), - REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), - REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"); - function typeOf(object) { - if ("object" === typeof object && null !== object) { - var $$typeof = object.$$typeof; - switch ($$typeof) { - case REACT_ELEMENT_TYPE: - switch (((object = object.type), object)) { - case REACT_FRAGMENT_TYPE: - case REACT_PROFILER_TYPE: - case REACT_STRICT_MODE_TYPE: - case REACT_SUSPENSE_TYPE: - case REACT_SUSPENSE_LIST_TYPE: - case REACT_VIEW_TRANSITION_TYPE: - return object; - default: - switch (((object = object && object.$$typeof), object)) { - case REACT_CONTEXT_TYPE: - case REACT_FORWARD_REF_TYPE: - case REACT_LAZY_TYPE: - case REACT_MEMO_TYPE: - return object; - case REACT_CONSUMER_TYPE: - return object; - default: - return $$typeof; - } - } - case REACT_PORTAL_TYPE: - return $$typeof; - } - } - } - reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE; - reactIs_production.ContextProvider = REACT_CONTEXT_TYPE; - reactIs_production.Element = REACT_ELEMENT_TYPE; - reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE; - reactIs_production.Fragment = REACT_FRAGMENT_TYPE; - reactIs_production.Lazy = REACT_LAZY_TYPE; - reactIs_production.Memo = REACT_MEMO_TYPE; - reactIs_production.Portal = REACT_PORTAL_TYPE; - reactIs_production.Profiler = REACT_PROFILER_TYPE; - reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE; - reactIs_production.Suspense = REACT_SUSPENSE_TYPE; - reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE; - reactIs_production.isContextConsumer = function (object) { - return typeOf(object) === REACT_CONSUMER_TYPE; - }; - reactIs_production.isContextProvider = function (object) { - return typeOf(object) === REACT_CONTEXT_TYPE; - }; - reactIs_production.isElement = function (object) { - return ( - "object" === typeof object && - null !== object && - object.$$typeof === REACT_ELEMENT_TYPE - ); - }; - reactIs_production.isForwardRef = function (object) { - return typeOf(object) === REACT_FORWARD_REF_TYPE; - }; - reactIs_production.isFragment = function (object) { - return typeOf(object) === REACT_FRAGMENT_TYPE; - }; - reactIs_production.isLazy = function (object) { - return typeOf(object) === REACT_LAZY_TYPE; - }; - reactIs_production.isMemo = function (object) { - return typeOf(object) === REACT_MEMO_TYPE; - }; - reactIs_production.isPortal = function (object) { - return typeOf(object) === REACT_PORTAL_TYPE; - }; - reactIs_production.isProfiler = function (object) { - return typeOf(object) === REACT_PROFILER_TYPE; - }; - reactIs_production.isStrictMode = function (object) { - return typeOf(object) === REACT_STRICT_MODE_TYPE; - }; - reactIs_production.isSuspense = function (object) { - return typeOf(object) === REACT_SUSPENSE_TYPE; - }; - reactIs_production.isSuspenseList = function (object) { - return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; - }; - reactIs_production.isValidElementType = function (type) { - return "string" === typeof type || - "function" === typeof type || - type === REACT_FRAGMENT_TYPE || - type === REACT_PROFILER_TYPE || - type === REACT_STRICT_MODE_TYPE || - type === REACT_SUSPENSE_TYPE || - type === REACT_SUSPENSE_LIST_TYPE || - ("object" === typeof type && - null !== type && - (type.$$typeof === REACT_LAZY_TYPE || - type.$$typeof === REACT_MEMO_TYPE || - type.$$typeof === REACT_CONTEXT_TYPE || - type.$$typeof === REACT_CONSUMER_TYPE || - type.$$typeof === REACT_FORWARD_REF_TYPE || - type.$$typeof === REACT_CLIENT_REFERENCE || - void 0 !== type.getModuleId)) - ? true - : false; - }; - reactIs_production.typeOf = typeOf; - return reactIs_production; -} - -var hasRequiredReactIs$1; - -function requireReactIs$1 () { - if (hasRequiredReactIs$1) return reactIs$1.exports; - hasRequiredReactIs$1 = 1; - - { - reactIs$1.exports = requireReactIs_production(); - } - return reactIs$1.exports; -} - -var reactIsExports$1 = requireReactIs$1(); -var index$1 = /*@__PURE__*/getDefaultExportFromCjs(reactIsExports$1); - -var ReactIs19 = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index$1 -}, [reactIsExports$1]); - -var reactIs = {exports: {}}; - -var reactIs_production_min = {}; - -/** - * @license React - * react-is.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -var hasRequiredReactIs_production_min; - -function requireReactIs_production_min () { - if (hasRequiredReactIs_production_min) return reactIs_production_min; - hasRequiredReactIs_production_min = 1; -var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference"); - function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m; - reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return false};reactIs_production_min.isConcurrentMode=function(){return false};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p}; - reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n}; - reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?true:false};reactIs_production_min.typeOf=v; - return reactIs_production_min; -} - -var hasRequiredReactIs; - -function requireReactIs () { - if (hasRequiredReactIs) return reactIs.exports; - hasRequiredReactIs = 1; - - { - reactIs.exports = requireReactIs_production_min(); - } - return reactIs.exports; -} - -var reactIsExports = requireReactIs(); -var index = /*@__PURE__*/getDefaultExportFromCjs(reactIsExports); - -var ReactIs18 = /*#__PURE__*/_mergeNamespaces({ - __proto__: null, - default: index -}, [reactIsExports]); - -const reactIsMethods = [ - "isAsyncMode", - "isConcurrentMode", - "isContextConsumer", - "isContextProvider", - "isElement", - "isForwardRef", - "isFragment", - "isLazy", - "isMemo", - "isPortal", - "isProfiler", - "isStrictMode", - "isSuspense", - "isSuspenseList", - "isValidElementType" -]; -const ReactIs = Object.fromEntries(reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)])); -// Given element.props.children, or subtree during recursive traversal, -// return flattened array of children. -function getChildren(arg, children = []) { - if (Array.isArray(arg)) { - for (const item of arg) { - getChildren(item, children); - } - } else if (arg != null && arg !== false && arg !== "") { - children.push(arg); - } - return children; -} -function getType(element) { - const type = element.type; - if (typeof type === "string") { - return type; - } - if (typeof type === "function") { - return type.displayName || type.name || "Unknown"; - } - if (ReactIs.isFragment(element)) { - return "React.Fragment"; - } - if (ReactIs.isSuspense(element)) { - return "React.Suspense"; - } - if (typeof type === "object" && type !== null) { - if (ReactIs.isContextProvider(element)) { - return "Context.Provider"; - } - if (ReactIs.isContextConsumer(element)) { - return "Context.Consumer"; - } - if (ReactIs.isForwardRef(element)) { - if (type.displayName) { - return type.displayName; - } - const functionName = type.render.displayName || type.render.name || ""; - return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`; - } - if (ReactIs.isMemo(element)) { - const functionName = type.displayName || type.type.displayName || type.type.name || ""; - return functionName === "" ? "Memo" : `Memo(${functionName})`; - } - } - return "UNDEFINED"; -} -function getPropKeys$1(element) { - const { props } = element; - return Object.keys(props).filter((key) => key !== "children" && props[key] !== undefined).sort(); -} -const serialize$1 = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation); -const test$1 = (val) => val != null && ReactIs.isElement(val); -const plugin$1 = { - serialize: serialize$1, - test: test$1 -}; - -const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487; -function getPropKeys(object) { - const { props } = object; - return props ? Object.keys(props).filter((key) => props[key] !== undefined).sort() : []; -} -const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation); -const test = (val) => val && val.$$typeof === testSymbol; -const plugin = { - serialize, - test -}; - -const toString = Object.prototype.toString; -const toISOString = Date.prototype.toISOString; -const errorToString = Error.prototype.toString; -const regExpToString = RegExp.prototype.toString; -/** -* Explicitly comparing typeof constructor to function avoids undefined as name -* when mock identity-obj-proxy returns the key as the value for any key. -*/ -function getConstructorName(val) { - return typeof val.constructor === "function" && val.constructor.name || "Object"; -} -/** Is val is equal to global window object? Works even if it does not exist :) */ -function isWindow(val) { - return typeof window !== "undefined" && val === window; -} -// eslint-disable-next-line regexp/no-super-linear-backtracking -const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/; -const NEWLINE_REGEXP = /\n/g; -class PrettyFormatPluginError extends Error { - constructor(message, stack) { - super(message); - this.stack = stack; - this.name = this.constructor.name; - } -} -function isToStringedArrayType(toStringed) { - return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]"; -} -function printNumber(val) { - return Object.is(val, -0) ? "-0" : String(val); -} -function printBigInt(val) { - return String(`${val}n`); -} -function printFunction(val, printFunctionName) { - if (!printFunctionName) { - return "[Function]"; - } - return `[Function ${val.name || "anonymous"}]`; -} -function printSymbol(val) { - return String(val).replace(SYMBOL_REGEXP, "Symbol($1)"); -} -function printError(val) { - return `[${errorToString.call(val)}]`; -} -/** -* The first port of call for printing an object, handles most of the -* data-types in JS. -*/ -function printBasicValue(val, printFunctionName, escapeRegex, escapeString) { - if (val === true || val === false) { - return `${val}`; - } - if (val === undefined) { - return "undefined"; - } - if (val === null) { - return "null"; - } - const typeOf = typeof val; - if (typeOf === "number") { - return printNumber(val); - } - if (typeOf === "bigint") { - return printBigInt(val); - } - if (typeOf === "string") { - if (escapeString) { - return `"${val.replaceAll(/"|\\/g, "\\$&")}"`; - } - return `"${val}"`; - } - if (typeOf === "function") { - return printFunction(val, printFunctionName); - } - if (typeOf === "symbol") { - return printSymbol(val); - } - const toStringed = toString.call(val); - if (toStringed === "[object WeakMap]") { - return "WeakMap {}"; - } - if (toStringed === "[object WeakSet]") { - return "WeakSet {}"; - } - if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") { - return printFunction(val, printFunctionName); - } - if (toStringed === "[object Symbol]") { - return printSymbol(val); - } - if (toStringed === "[object Date]") { - return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val); - } - if (toStringed === "[object Error]") { - return printError(val); - } - if (toStringed === "[object RegExp]") { - if (escapeRegex) { - // https://github.com/benjamingr/RegExp.escape/blob/main/polyfill.js - return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&"); - } - return regExpToString.call(val); - } - if (val instanceof Error) { - return printError(val); - } - return null; -} -/** -* Handles more complex objects ( such as objects with circular references. -* maps and sets etc ) -*/ -function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) { - if (refs.includes(val)) { - return "[Circular]"; - } - refs = [...refs]; - refs.push(val); - const hitMaxDepth = ++depth > config.maxDepth; - const min = config.min; - if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) { - return printer(val.toJSON(), config, indentation, depth, refs, true); - } - const toStringed = toString.call(val); - if (toStringed === "[object Arguments]") { - return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`; - } - if (isToStringedArrayType(toStringed)) { - return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`; - } - if (toStringed === "[object Map]") { - return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`; - } - if (toStringed === "[object Set]") { - return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`; - } - // Avoid failure to serialize global window object in jsdom test environment. - // For example, not even relevant if window is prop of React element. - return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`; -} -const ErrorPlugin = { - test: (val) => val && val instanceof Error, - serialize(val, config, indentation, depth, refs, printer) { - if (refs.includes(val)) { - return "[Circular]"; - } - refs = [...refs, val]; - const hitMaxDepth = ++depth > config.maxDepth; - const { message, cause, ...rest } = val; - const entries = { - message, - ...typeof cause !== "undefined" ? { cause } : {}, - ...val instanceof AggregateError ? { errors: val.errors } : {}, - ...rest - }; - const name = val.name !== "Error" ? val.name : getConstructorName(val); - return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer)}}`; - } -}; -function isNewPlugin(plugin) { - return plugin.serialize != null; -} -function printPlugin(plugin, val, config, indentation, depth, refs) { - let printed; - try { - printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => { - const indentationNext = indentation + config.indent; - return indentationNext + str.replaceAll(NEWLINE_REGEXP, `\n${indentationNext}`); - }, { - edgeSpacing: config.spacingOuter, - min: config.min, - spacing: config.spacingInner - }, config.colors); - } catch (error) { - throw new PrettyFormatPluginError(error.message, error.stack); - } - if (typeof printed !== "string") { - throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`); - } - return printed; -} -function findPlugin(plugins, val) { - for (const plugin of plugins) { - try { - if (plugin.test(val)) { - return plugin; - } - } catch (error) { - throw new PrettyFormatPluginError(error.message, error.stack); - } - } - return null; -} -function printer(val, config, indentation, depth, refs, hasCalledToJSON) { - const plugin = findPlugin(config.plugins, val); - if (plugin !== null) { - return printPlugin(plugin, val, config, indentation, depth, refs); - } - const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString); - if (basicResult !== null) { - return basicResult; - } - return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON); -} -const DEFAULT_THEME = { - comment: "gray", - content: "reset", - prop: "yellow", - tag: "cyan", - value: "green" -}; -const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME); -const DEFAULT_OPTIONS = { - callToJSON: true, - compareKeys: undefined, - escapeRegex: false, - escapeString: true, - highlight: false, - indent: 2, - maxDepth: Number.POSITIVE_INFINITY, - maxWidth: Number.POSITIVE_INFINITY, - min: false, - plugins: [], - printBasicPrototype: true, - printFunctionName: true, - printShadowRoot: true, - theme: DEFAULT_THEME -}; -function validateOptions(options) { - for (const key of Object.keys(options)) { - if (!Object.hasOwn(DEFAULT_OPTIONS, key)) { - throw new Error(`pretty-format: Unknown option "${key}".`); - } - } - if (options.min && options.indent !== undefined && options.indent !== 0) { - throw new Error("pretty-format: Options \"min\" and \"indent\" cannot be used together."); - } -} -function getColorsHighlight() { - return DEFAULT_THEME_KEYS.reduce((colors, key) => { - const value = DEFAULT_THEME[key]; - const color = value && styles[value]; - if (color && typeof color.close === "string" && typeof color.open === "string") { - colors[key] = color; - } else { - throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`); - } - return colors; - }, Object.create(null)); -} -function getColorsEmpty() { - return DEFAULT_THEME_KEYS.reduce((colors, key) => { - colors[key] = { - close: "", - open: "" - }; - return colors; - }, Object.create(null)); -} -function getPrintFunctionName(options) { - return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName; -} -function getEscapeRegex(options) { - return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex; -} -function getEscapeString(options) { - return options?.escapeString ?? DEFAULT_OPTIONS.escapeString; -} -function getConfig(options) { - return { - callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON, - colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(), - compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys, - escapeRegex: getEscapeRegex(options), - escapeString: getEscapeString(options), - indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent), - maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth, - maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth, - min: options?.min ?? DEFAULT_OPTIONS.min, - plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins, - printBasicPrototype: options?.printBasicPrototype ?? true, - printFunctionName: getPrintFunctionName(options), - printShadowRoot: options?.printShadowRoot ?? true, - spacingInner: options?.min ? " " : "\n", - spacingOuter: options?.min ? "" : "\n" - }; -} -function createIndent(indent) { - return Array.from({ length: indent + 1 }).join(" "); -} -/** -* Returns a presentation string of your `val` object -* @param val any potential JavaScript object -* @param options Custom settings -*/ -function format(val, options) { - if (options) { - validateOptions(options); - if (options.plugins) { - const plugin = findPlugin(options.plugins, val); - if (plugin !== null) { - return printPlugin(plugin, val, getConfig(options), "", 0, []); - } - } - } - const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options)); - if (basicResult !== null) { - return basicResult; - } - return printComplexValue(val, getConfig(options), "", 0, []); -} -const plugins = { - AsymmetricMatcher: plugin$5, - DOMCollection: plugin$4, - DOMElement: plugin$3, - Immutable: plugin$2, - ReactElement: plugin$1, - ReactTestComponent: plugin, - Error: ErrorPlugin -}; - -export { DEFAULT_OPTIONS, format, plugins }; diff --git a/node_modules/@vitest/pretty-format/package.json b/node_modules/@vitest/pretty-format/package.json deleted file mode 100644 index 3319f6b..0000000 --- a/node_modules/@vitest/pretty-format/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@vitest/pretty-format", - "type": "module", - "version": "4.0.16", - "description": "Fork of pretty-format with support for ESM", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/utils#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/pretty-format" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "*.d.ts", - "dist" - ], - "dependencies": { - "tinyrainbow": "^3.0.3" - }, - "devDependencies": { - "@types/react-is": "^19.2.0", - "react-is": "^19.2.0", - "react-is-18": "npm:react-is@18.3.1" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/runner/LICENSE b/node_modules/@vitest/runner/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/runner/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/runner/README.md b/node_modules/@vitest/runner/README.md deleted file mode 100644 index 2796b6a..0000000 --- a/node_modules/@vitest/runner/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# @vitest/runner - -Vitest mechanism to collect and run tasks. - -[GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/advanced/runner) diff --git a/node_modules/@vitest/runner/dist/chunk-tasks.js b/node_modules/@vitest/runner/dist/chunk-tasks.js deleted file mode 100644 index 44c232e..0000000 --- a/node_modules/@vitest/runner/dist/chunk-tasks.js +++ /dev/null @@ -1,337 +0,0 @@ -import { processError } from '@vitest/utils/error'; -import { parseSingleStack } from '@vitest/utils/source-map'; -import { relative } from 'pathe'; -import { toArray } from '@vitest/utils/helpers'; - -function createChainable(keys, fn) { - function create(context) { - const chain = function(...args) { - return fn.apply(context, args); - }; - Object.assign(chain, fn); - chain.withContext = () => chain.bind(context); - chain.setContext = (key, value) => { - context[key] = value; - }; - chain.mergeContext = (ctx) => { - Object.assign(context, ctx); - }; - for (const key of keys) { - Object.defineProperty(chain, key, { get() { - return create({ - ...context, - [key]: true - }); - } }); - } - return chain; - } - const chain = create({}); - chain.fn = fn; - return chain; -} - -/** -* If any tasks been marked as `only`, mark all other tasks as `skip`. -*/ -function interpretTaskModes(file, namePattern, testLocations, onlyMode, parentIsOnly, allowOnly) { - const matchedLocations = []; - const traverseSuite = (suite, parentIsOnly, parentMatchedWithLocation) => { - const suiteIsOnly = parentIsOnly || suite.mode === "only"; - suite.tasks.forEach((t) => { - // Check if either the parent suite or the task itself are marked as included - const includeTask = suiteIsOnly || t.mode === "only"; - if (onlyMode) { - if (t.type === "suite" && (includeTask || someTasksAreOnly(t))) { - // Don't skip this suite - if (t.mode === "only") { - checkAllowOnly(t, allowOnly); - t.mode = "run"; - } - } else if (t.mode === "run" && !includeTask) { - t.mode = "skip"; - } else if (t.mode === "only") { - checkAllowOnly(t, allowOnly); - t.mode = "run"; - } - } - let hasLocationMatch = parentMatchedWithLocation; - // Match test location against provided locations, only run if present - // in `testLocations`. Note: if `includeTaskLocations` is not enabled, - // all test will be skipped. - if (testLocations !== undefined && testLocations.length !== 0) { - if (t.location && (testLocations === null || testLocations === void 0 ? void 0 : testLocations.includes(t.location.line))) { - t.mode = "run"; - matchedLocations.push(t.location.line); - hasLocationMatch = true; - } else if (parentMatchedWithLocation) { - t.mode = "run"; - } else if (t.type === "test") { - t.mode = "skip"; - } - } - if (t.type === "test") { - if (namePattern && !getTaskFullName(t).match(namePattern)) { - t.mode = "skip"; - } - } else if (t.type === "suite") { - if (t.mode === "skip") { - skipAllTasks(t); - } else if (t.mode === "todo") { - todoAllTasks(t); - } else { - traverseSuite(t, includeTask, hasLocationMatch); - } - } - }); - // if all subtasks are skipped, mark as skip - if (suite.mode === "run" || suite.mode === "queued") { - if (suite.tasks.length && suite.tasks.every((i) => i.mode !== "run" && i.mode !== "queued")) { - suite.mode = "skip"; - } - } - }; - traverseSuite(file, parentIsOnly, false); - const nonMatching = testLocations === null || testLocations === void 0 ? void 0 : testLocations.filter((loc) => !matchedLocations.includes(loc)); - if (nonMatching && nonMatching.length !== 0) { - const message = nonMatching.length === 1 ? `line ${nonMatching[0]}` : `lines ${nonMatching.join(", ")}`; - if (file.result === undefined) { - file.result = { - state: "fail", - errors: [] - }; - } - if (file.result.errors === undefined) { - file.result.errors = []; - } - file.result.errors.push(processError(new Error(`No test found in ${file.name} in ${message}`))); - } -} -function getTaskFullName(task) { - return `${task.suite ? `${getTaskFullName(task.suite)} ` : ""}${task.name}`; -} -function someTasksAreOnly(suite) { - return suite.tasks.some((t) => t.mode === "only" || t.type === "suite" && someTasksAreOnly(t)); -} -function skipAllTasks(suite) { - suite.tasks.forEach((t) => { - if (t.mode === "run" || t.mode === "queued") { - t.mode = "skip"; - if (t.type === "suite") { - skipAllTasks(t); - } - } - }); -} -function todoAllTasks(suite) { - suite.tasks.forEach((t) => { - if (t.mode === "run" || t.mode === "queued") { - t.mode = "todo"; - if (t.type === "suite") { - todoAllTasks(t); - } - } - }); -} -function checkAllowOnly(task, allowOnly) { - if (allowOnly) { - return; - } - const error = processError(new Error("[Vitest] Unexpected .only modifier. Remove it or pass --allowOnly argument to bypass this error")); - task.result = { - state: "fail", - errors: [error] - }; -} -/* @__NO_SIDE_EFFECTS__ */ -function generateHash(str) { - let hash = 0; - if (str.length === 0) { - return `${hash}`; - } - for (let i = 0; i < str.length; i++) { - const char = str.charCodeAt(i); - hash = (hash << 5) - hash + char; - hash = hash & hash; - } - return `${hash}`; -} -function calculateSuiteHash(parent) { - parent.tasks.forEach((t, idx) => { - t.id = `${parent.id}_${idx}`; - if (t.type === "suite") { - calculateSuiteHash(t); - } - }); -} -function createFileTask(filepath, root, projectName, pool, viteEnvironment) { - const path = relative(root, filepath); - const file = { - id: generateFileHash(path, projectName), - name: path, - fullName: path, - type: "suite", - mode: "queued", - filepath, - tasks: [], - meta: Object.create(null), - projectName, - file: undefined, - pool, - viteEnvironment - }; - file.file = file; - return file; -} -/** -* Generate a unique ID for a file based on its path and project name -* @param file File relative to the root of the project to keep ID the same between different machines -* @param projectName The name of the test project -*/ -/* @__NO_SIDE_EFFECTS__ */ -function generateFileHash(file, projectName) { - return /* @__PURE__ */ generateHash(`${file}${projectName || ""}`); -} -function findTestFileStackTrace(testFilePath, error) { - // first line is the error message - const lines = error.split("\n").slice(1); - for (const line of lines) { - const stack = parseSingleStack(line); - if (stack && stack.file === testFilePath) { - return stack; - } - } -} - -/** -* Return a function for running multiple async operations with limited concurrency. -*/ -function limitConcurrency(concurrency = Infinity) { - // The number of currently active + pending tasks. - let count = 0; - // The head and tail of the pending task queue, built using a singly linked list. - // Both head and tail are initially undefined, signifying an empty queue. - // They both become undefined again whenever there are no pending tasks. - let head; - let tail; - // A bookkeeping function executed whenever a task has been run to completion. - const finish = () => { - count--; - // Check if there are further pending tasks in the queue. - if (head) { - // Allow the next pending task to run and pop it from the queue. - head[0](); - head = head[1]; - // The head may now be undefined if there are no further pending tasks. - // In that case, set tail to undefined as well. - tail = head && tail; - } - }; - return (func, ...args) => { - // Create a promise chain that: - // 1. Waits for its turn in the task queue (if necessary). - // 2. Runs the task. - // 3. Allows the next pending task (if any) to run. - return new Promise((resolve) => { - if (count++ < concurrency) { - // No need to queue if fewer than maxConcurrency tasks are running. - resolve(); - } else if (tail) { - // There are pending tasks, so append to the queue. - tail = tail[1] = [resolve]; - } else { - // No other pending tasks, initialize the queue with a new tail and head. - head = tail = [resolve]; - } - }).then(() => { - // Running func here ensures that even a non-thenable result or an - // immediately thrown error gets wrapped into a Promise. - return func(...args); - }).finally(finish); - }; -} - -/** -* Partition in tasks groups by consecutive concurrent -*/ -function partitionSuiteChildren(suite) { - let tasksGroup = []; - const tasksGroups = []; - for (const c of suite.tasks) { - if (tasksGroup.length === 0 || c.concurrent === tasksGroup[0].concurrent) { - tasksGroup.push(c); - } else { - tasksGroups.push(tasksGroup); - tasksGroup = [c]; - } - } - if (tasksGroup.length > 0) { - tasksGroups.push(tasksGroup); - } - return tasksGroups; -} - -function isTestCase(s) { - return s.type === "test"; -} -function getTests(suite) { - const tests = []; - const arraySuites = toArray(suite); - for (const s of arraySuites) { - if (isTestCase(s)) { - tests.push(s); - } else { - for (const task of s.tasks) { - if (isTestCase(task)) { - tests.push(task); - } else { - const taskTests = getTests(task); - for (const test of taskTests) { - tests.push(test); - } - } - } - } - } - return tests; -} -function getTasks(tasks = []) { - return toArray(tasks).flatMap((s) => isTestCase(s) ? [s] : [s, ...getTasks(s.tasks)]); -} -function getSuites(suite) { - return toArray(suite).flatMap((s) => s.type === "suite" ? [s, ...getSuites(s.tasks)] : []); -} -function hasTests(suite) { - return toArray(suite).some((s) => s.tasks.some((c) => isTestCase(c) || hasTests(c))); -} -function hasFailed(suite) { - return toArray(suite).some((s) => { - var _s$result; - return ((_s$result = s.result) === null || _s$result === void 0 ? void 0 : _s$result.state) === "fail" || s.type === "suite" && hasFailed(s.tasks); - }); -} -function getNames(task) { - const names = [task.name]; - let current = task; - while (current === null || current === void 0 ? void 0 : current.suite) { - current = current.suite; - if (current === null || current === void 0 ? void 0 : current.name) { - names.unshift(current.name); - } - } - if (current !== task.file) { - names.unshift(task.file.name); - } - return names; -} -function getFullName(task, separator = " > ") { - return getNames(task).join(separator); -} -function getTestName(task, separator = " > ") { - return getNames(task).slice(1).join(separator); -} -function createTaskName(names, separator = " > ") { - return names.filter((name) => name !== undefined).join(separator); -} - -export { calculateSuiteHash as a, createFileTask as b, createChainable as c, generateHash as d, createTaskName as e, findTestFileStackTrace as f, generateFileHash as g, getFullName as h, interpretTaskModes as i, getNames as j, getSuites as k, limitConcurrency as l, getTasks as m, getTestName as n, getTests as o, partitionSuiteChildren as p, hasFailed as q, hasTests as r, someTasksAreOnly as s, isTestCase as t }; diff --git a/node_modules/@vitest/runner/dist/index.d.ts b/node_modules/@vitest/runner/dist/index.d.ts deleted file mode 100644 index 2cc20e4..0000000 --- a/node_modules/@vitest/runner/dist/index.d.ts +++ /dev/null @@ -1,180 +0,0 @@ -import { b as TestArtifact, a as Test, S as Suite, d as SuiteHooks, F as File, e as TaskUpdateEvent, T as Task, f as TestAPI, g as SuiteAPI, h as SuiteCollector } from './tasks.d-BUa1HjoW.js'; -export { A as AfterAllListener, n as AfterEachListener, B as BeforeAllListener, p as BeforeEachListener, q as Fixture, r as FixtureFn, s as FixtureOptions, t as Fixtures, I as ImportDuration, u as InferFixturesTypes, O as OnTestFailedHandler, v as OnTestFinishedHandler, R as RunMode, w as RuntimeContext, x as SequenceHooks, y as SequenceSetupFiles, z as SuiteFactory, D as TaskBase, E as TaskCustomOptions, G as TaskEventPack, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, M as TaskResultPack, N as TaskState, P as TestAnnotation, Q as TestAnnotationArtifact, U as TestAnnotationLocation, V as TestArtifactBase, W as TestArtifactLocation, X as TestArtifactRegistry, Y as TestAttachment, Z as TestContext, _ as TestFunction, $ as TestOptions, a0 as Use, a1 as VisualRegressionArtifact, i as afterAll, j as afterEach, k as beforeAll, l as beforeEach, o as onTestFailed, m as onTestFinished } from './tasks.d-BUa1HjoW.js'; -import { Awaitable } from '@vitest/utils'; -import { FileSpecification, VitestRunner } from './types.js'; -export { CancelReason, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource } from './types.js'; -import '@vitest/utils/diff'; - -/** -* @experimental -* @advanced -* -* Records a custom test artifact during test execution. -* -* This function allows you to attach structured data, files, or metadata to a test. -* -* Vitest automatically injects the source location where the artifact was created and manages any attachments you include. -* -* @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests -* @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase} -* -* @returns A promise that resolves to the recorded artifact with location injected -* -* @throws {Error} If called after the test has finished running -* @throws {Error} If the test runner doesn't support artifacts -* -* @example -* ```ts -* // In a custom assertion -* async function toHaveValidSchema(this: MatcherState, actual: unknown) { -* const validation = validateSchema(actual) -* -* await recordArtifact(this.task, { -* type: 'my-plugin:schema-validation', -* passed: validation.valid, -* errors: validation.errors, -* }) -* -* return { pass: validation.valid, message: () => '...' } -* } -* ``` -*/ -declare function recordArtifact(task: Test, artifact: Artifact): Promise; - -declare function setFn(key: Test, fn: () => Awaitable): void; -declare function getFn(key: Task): () => Awaitable; -declare function setHooks(key: Suite, hooks: SuiteHooks): void; -declare function getHooks(key: Suite): SuiteHooks; - -declare function updateTask(event: TaskUpdateEvent, task: Task, runner: VitestRunner): void; -declare function startTests(specs: string[] | FileSpecification[], runner: VitestRunner): Promise; -declare function publicCollect(specs: string[] | FileSpecification[], runner: VitestRunner): Promise; - -/** -* Creates a suite of tests, allowing for grouping and hierarchical organization of tests. -* Suites can contain both tests and other suites, enabling complex test structures. -* -* @param {string} name - The name of the suite, used for identification and reporting. -* @param {Function} fn - A function that defines the tests and suites within this suite. -* @example -* ```ts -* // Define a suite with two tests -* suite('Math operations', () => { -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* -* test('should subtract two numbers', () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* }); -* ``` -* @example -* ```ts -* // Define nested suites -* suite('String operations', () => { -* suite('Trimming', () => { -* test('should trim whitespace from start and end', () => { -* expect(' hello '.trim()).toBe('hello'); -* }); -* }); -* -* suite('Concatenation', () => { -* test('should concatenate two strings', () => { -* expect('hello' + ' ' + 'world').toBe('hello world'); -* }); -* }); -* }); -* ``` -*/ -declare const suite: SuiteAPI; -/** -* Defines a test case with a given name and test function. The test function can optionally be configured with test options. -* -* @param {string | Function} name - The name of the test or a function that will be used as a test name. -* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. -* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. -* @throws {Error} If called inside another test function. -* @example -* ```ts -* // Define a simple test -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* ``` -* @example -* ```ts -* // Define a test with options -* test('should subtract two numbers', { retry: 3 }, () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* ``` -*/ -declare const test: TestAPI; -/** -* Creates a suite of tests, allowing for grouping and hierarchical organization of tests. -* Suites can contain both tests and other suites, enabling complex test structures. -* -* @param {string} name - The name of the suite, used for identification and reporting. -* @param {Function} fn - A function that defines the tests and suites within this suite. -* @example -* ```ts -* // Define a suite with two tests -* describe('Math operations', () => { -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* -* test('should subtract two numbers', () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* }); -* ``` -* @example -* ```ts -* // Define nested suites -* describe('String operations', () => { -* describe('Trimming', () => { -* test('should trim whitespace from start and end', () => { -* expect(' hello '.trim()).toBe('hello'); -* }); -* }); -* -* describe('Concatenation', () => { -* test('should concatenate two strings', () => { -* expect('hello' + ' ' + 'world').toBe('hello world'); -* }); -* }); -* }); -* ``` -*/ -declare const describe: SuiteAPI; -/** -* Defines a test case with a given name and test function. The test function can optionally be configured with test options. -* -* @param {string | Function} name - The name of the test or a function that will be used as a test name. -* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. -* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. -* @throws {Error} If called inside another test function. -* @example -* ```ts -* // Define a simple test -* it('adds two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* ``` -* @example -* ```ts -* // Define a test with options -* it('subtracts two numbers', { retry: 3 }, () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* ``` -*/ -declare const it: TestAPI; -declare function getCurrentSuite(): SuiteCollector; -declare function createTaskCollector(fn: (...args: any[]) => any, context?: Record): TestAPI; - -declare function getCurrentTest(): T; - -export { File, FileSpecification, Suite, SuiteAPI, SuiteCollector, SuiteHooks, Task, TaskUpdateEvent, Test, TestAPI, TestArtifact, VitestRunner, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, recordArtifact, setFn, setHooks, startTests, suite, test, updateTask }; diff --git a/node_modules/@vitest/runner/dist/index.js b/node_modules/@vitest/runner/dist/index.js deleted file mode 100644 index 9912f23..0000000 --- a/node_modules/@vitest/runner/dist/index.js +++ /dev/null @@ -1,2114 +0,0 @@ -import { processError } from '@vitest/utils/error'; -import { isObject, createDefer, assertTypes, toArray, isNegativeNaN, objectAttr, shuffle } from '@vitest/utils/helpers'; -import { getSafeTimers } from '@vitest/utils/timers'; -import { format, formatRegExp, objDisplay } from '@vitest/utils/display'; -import { c as createChainable, e as createTaskName, f as findTestFileStackTrace, b as createFileTask, a as calculateSuiteHash, s as someTasksAreOnly, i as interpretTaskModes, l as limitConcurrency, p as partitionSuiteChildren, r as hasTests, q as hasFailed } from './chunk-tasks.js'; -import '@vitest/utils/source-map'; -import 'pathe'; - -class PendingError extends Error { - code = "VITEST_PENDING"; - taskId; - constructor(message, task, note) { - super(message); - this.message = message; - this.note = note; - this.taskId = task.id; - } -} -class TestRunAbortError extends Error { - name = "TestRunAbortError"; - reason; - constructor(message, reason) { - super(message); - this.reason = reason; - } -} - -// use WeakMap here to make the Test and Suite object serializable -const fnMap = new WeakMap(); -const testFixtureMap = new WeakMap(); -const hooksMap = new WeakMap(); -function setFn(key, fn) { - fnMap.set(key, fn); -} -function getFn(key) { - return fnMap.get(key); -} -function setTestFixture(key, fixture) { - testFixtureMap.set(key, fixture); -} -function getTestFixture(key) { - return testFixtureMap.get(key); -} -function setHooks(key, hooks) { - hooksMap.set(key, hooks); -} -function getHooks(key) { - return hooksMap.get(key); -} - -function mergeScopedFixtures(testFixtures, scopedFixtures) { - const scopedFixturesMap = scopedFixtures.reduce((map, fixture) => { - map[fixture.prop] = fixture; - return map; - }, {}); - const newFixtures = {}; - testFixtures.forEach((fixture) => { - const useFixture = scopedFixturesMap[fixture.prop] || { ...fixture }; - newFixtures[useFixture.prop] = useFixture; - }); - for (const fixtureKep in newFixtures) { - var _fixture$deps; - const fixture = newFixtures[fixtureKep]; - // if the fixture was define before the scope, then its dep - // will reference the original fixture instead of the scope - fixture.deps = (_fixture$deps = fixture.deps) === null || _fixture$deps === void 0 ? void 0 : _fixture$deps.map((dep) => newFixtures[dep.prop]); - } - return Object.values(newFixtures); -} -function mergeContextFixtures(fixtures, context, runner) { - const fixtureOptionKeys = [ - "auto", - "injected", - "scope" - ]; - const fixtureArray = Object.entries(fixtures).map(([prop, value]) => { - const fixtureItem = { value }; - if (Array.isArray(value) && value.length >= 2 && isObject(value[1]) && Object.keys(value[1]).some((key) => fixtureOptionKeys.includes(key))) { - var _runner$injectValue; - // fixture with options - Object.assign(fixtureItem, value[1]); - const userValue = value[0]; - fixtureItem.value = fixtureItem.injected ? ((_runner$injectValue = runner.injectValue) === null || _runner$injectValue === void 0 ? void 0 : _runner$injectValue.call(runner, prop)) ?? userValue : userValue; - } - fixtureItem.scope = fixtureItem.scope || "test"; - if (fixtureItem.scope === "worker" && !runner.getWorkerContext) { - fixtureItem.scope = "file"; - } - fixtureItem.prop = prop; - fixtureItem.isFn = typeof fixtureItem.value === "function"; - return fixtureItem; - }); - if (Array.isArray(context.fixtures)) { - context.fixtures = context.fixtures.concat(fixtureArray); - } else { - context.fixtures = fixtureArray; - } - // Update dependencies of fixture functions - fixtureArray.forEach((fixture) => { - if (fixture.isFn) { - const usedProps = getUsedProps(fixture.value); - if (usedProps.length) { - fixture.deps = context.fixtures.filter(({ prop }) => prop !== fixture.prop && usedProps.includes(prop)); - } - // test can access anything, so we ignore it - if (fixture.scope !== "test") { - var _fixture$deps2; - (_fixture$deps2 = fixture.deps) === null || _fixture$deps2 === void 0 ? void 0 : _fixture$deps2.forEach((dep) => { - if (!dep.isFn) { - // non fn fixtures are always resolved and available to anyone - return; - } - // worker scope can only import from worker scope - if (fixture.scope === "worker" && dep.scope === "worker") { - return; - } - // file scope an import from file and worker scopes - if (fixture.scope === "file" && dep.scope !== "test") { - return; - } - throw new SyntaxError(`cannot use the ${dep.scope} fixture "${dep.prop}" inside the ${fixture.scope} fixture "${fixture.prop}"`); - }); - } - } - }); - return context; -} -const fixtureValueMaps = new Map(); -const cleanupFnArrayMap = new Map(); -async function callFixtureCleanup(context) { - const cleanupFnArray = cleanupFnArrayMap.get(context) ?? []; - for (const cleanup of cleanupFnArray.reverse()) { - await cleanup(); - } - cleanupFnArrayMap.delete(context); -} -function withFixtures(runner, fn, testContext) { - return (hookContext) => { - const context = hookContext || testContext; - if (!context) { - return fn({}); - } - const fixtures = getTestFixture(context); - if (!(fixtures === null || fixtures === void 0 ? void 0 : fixtures.length)) { - return fn(context); - } - const usedProps = getUsedProps(fn); - const hasAutoFixture = fixtures.some(({ auto }) => auto); - if (!usedProps.length && !hasAutoFixture) { - return fn(context); - } - if (!fixtureValueMaps.get(context)) { - fixtureValueMaps.set(context, new Map()); - } - const fixtureValueMap = fixtureValueMaps.get(context); - if (!cleanupFnArrayMap.has(context)) { - cleanupFnArrayMap.set(context, []); - } - const cleanupFnArray = cleanupFnArrayMap.get(context); - const usedFixtures = fixtures.filter(({ prop, auto }) => auto || usedProps.includes(prop)); - const pendingFixtures = resolveDeps(usedFixtures); - if (!pendingFixtures.length) { - return fn(context); - } - async function resolveFixtures() { - for (const fixture of pendingFixtures) { - // fixture could be already initialized during "before" hook - if (fixtureValueMap.has(fixture)) { - continue; - } - const resolvedValue = await resolveFixtureValue(runner, fixture, context, cleanupFnArray); - context[fixture.prop] = resolvedValue; - fixtureValueMap.set(fixture, resolvedValue); - if (fixture.scope === "test") { - cleanupFnArray.unshift(() => { - fixtureValueMap.delete(fixture); - }); - } - } - } - return resolveFixtures().then(() => fn(context)); - }; -} -const globalFixturePromise = new WeakMap(); -function resolveFixtureValue(runner, fixture, context, cleanupFnArray) { - var _runner$getWorkerCont; - const fileContext = getFileContext(context.task.file); - const workerContext = (_runner$getWorkerCont = runner.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner); - if (!fixture.isFn) { - var _fixture$prop; - fileContext[_fixture$prop = fixture.prop] ?? (fileContext[_fixture$prop] = fixture.value); - if (workerContext) { - var _fixture$prop2; - workerContext[_fixture$prop2 = fixture.prop] ?? (workerContext[_fixture$prop2] = fixture.value); - } - return fixture.value; - } - if (fixture.scope === "test") { - return resolveFixtureFunction(fixture.value, context, cleanupFnArray); - } - // in case the test runs in parallel - if (globalFixturePromise.has(fixture)) { - return globalFixturePromise.get(fixture); - } - let fixtureContext; - if (fixture.scope === "worker") { - if (!workerContext) { - throw new TypeError("[@vitest/runner] The worker context is not available in the current test runner. Please, provide the `getWorkerContext` method when initiating the runner."); - } - fixtureContext = workerContext; - } else { - fixtureContext = fileContext; - } - if (fixture.prop in fixtureContext) { - return fixtureContext[fixture.prop]; - } - if (!cleanupFnArrayMap.has(fixtureContext)) { - cleanupFnArrayMap.set(fixtureContext, []); - } - const cleanupFnFileArray = cleanupFnArrayMap.get(fixtureContext); - const promise = resolveFixtureFunction(fixture.value, fixtureContext, cleanupFnFileArray).then((value) => { - fixtureContext[fixture.prop] = value; - globalFixturePromise.delete(fixture); - return value; - }); - globalFixturePromise.set(fixture, promise); - return promise; -} -async function resolveFixtureFunction(fixtureFn, context, cleanupFnArray) { - // wait for `use` call to extract fixture value - const useFnArgPromise = createDefer(); - let isUseFnArgResolved = false; - const fixtureReturn = fixtureFn(context, async (useFnArg) => { - // extract `use` argument - isUseFnArgResolved = true; - useFnArgPromise.resolve(useFnArg); - // suspend fixture teardown by holding off `useReturnPromise` resolution until cleanup - const useReturnPromise = createDefer(); - cleanupFnArray.push(async () => { - // start teardown by resolving `use` Promise - useReturnPromise.resolve(); - // wait for finishing teardown - await fixtureReturn; - }); - await useReturnPromise; - }).catch((e) => { - // treat fixture setup error as test failure - if (!isUseFnArgResolved) { - useFnArgPromise.reject(e); - return; - } - // otherwise re-throw to avoid silencing error during cleanup - throw e; - }); - return useFnArgPromise; -} -function resolveDeps(fixtures, depSet = new Set(), pendingFixtures = []) { - fixtures.forEach((fixture) => { - if (pendingFixtures.includes(fixture)) { - return; - } - if (!fixture.isFn || !fixture.deps) { - pendingFixtures.push(fixture); - return; - } - if (depSet.has(fixture)) { - throw new Error(`Circular fixture dependency detected: ${fixture.prop} <- ${[...depSet].reverse().map((d) => d.prop).join(" <- ")}`); - } - depSet.add(fixture); - resolveDeps(fixture.deps, depSet, pendingFixtures); - pendingFixtures.push(fixture); - depSet.clear(); - }); - return pendingFixtures; -} -function getUsedProps(fn) { - let fnString = filterOutComments(fn.toString()); - // match lowered async function and strip it off - // example code on esbuild-try https://esbuild.github.io/try/#YgAwLjI0LjAALS1zdXBwb3J0ZWQ6YXN5bmMtYXdhaXQ9ZmFsc2UAZQBlbnRyeS50cwBjb25zdCBvID0gewogIGYxOiBhc3luYyAoKSA9PiB7fSwKICBmMjogYXN5bmMgKGEpID0+IHt9LAogIGYzOiBhc3luYyAoYSwgYikgPT4ge30sCiAgZjQ6IGFzeW5jIGZ1bmN0aW9uKGEpIHt9LAogIGY1OiBhc3luYyBmdW5jdGlvbiBmZihhKSB7fSwKICBhc3luYyBmNihhKSB7fSwKCiAgZzE6IGFzeW5jICgpID0+IHt9LAogIGcyOiBhc3luYyAoeyBhIH0pID0+IHt9LAogIGczOiBhc3luYyAoeyBhIH0sIGIpID0+IHt9LAogIGc0OiBhc3luYyBmdW5jdGlvbiAoeyBhIH0pIHt9LAogIGc1OiBhc3luYyBmdW5jdGlvbiBnZyh7IGEgfSkge30sCiAgYXN5bmMgZzYoeyBhIH0pIHt9LAoKICBoMTogYXN5bmMgKCkgPT4ge30sCiAgLy8gY29tbWVudCBiZXR3ZWVuCiAgaDI6IGFzeW5jIChhKSA9PiB7fSwKfQ - // __async(this, null, function* - // __async(this, arguments, function* - // __async(this, [_0, _1], function* - if (/__async\((?:this|null), (?:null|arguments|\[[_0-9, ]*\]), function\*/.test(fnString)) { - fnString = fnString.split(/__async\((?:this|null),/)[1]; - } - const match = fnString.match(/[^(]*\(([^)]*)/); - if (!match) { - return []; - } - const args = splitByComma(match[1]); - if (!args.length) { - return []; - } - let first = args[0]; - if ("__VITEST_FIXTURE_INDEX__" in fn) { - first = args[fn.__VITEST_FIXTURE_INDEX__]; - if (!first) { - return []; - } - } - if (!(first[0] === "{" && first.endsWith("}"))) { - throw new Error(`The first argument inside a fixture must use object destructuring pattern, e.g. ({ test } => {}). Instead, received "${first}".`); - } - const _first = first.slice(1, -1).replace(/\s/g, ""); - const props = splitByComma(_first).map((prop) => { - return prop.replace(/:.*|=.*/g, ""); - }); - const last = props.at(-1); - if (last && last.startsWith("...")) { - throw new Error(`Rest parameters are not supported in fixtures, received "${last}".`); - } - return props; -} -function filterOutComments(s) { - const result = []; - let commentState = "none"; - for (let i = 0; i < s.length; ++i) { - if (commentState === "singleline") { - if (s[i] === "\n") { - commentState = "none"; - } - } else if (commentState === "multiline") { - if (s[i - 1] === "*" && s[i] === "/") { - commentState = "none"; - } - } else if (commentState === "none") { - if (s[i] === "/" && s[i + 1] === "/") { - commentState = "singleline"; - } else if (s[i] === "/" && s[i + 1] === "*") { - commentState = "multiline"; - i += 2; - } else { - result.push(s[i]); - } - } - } - return result.join(""); -} -function splitByComma(s) { - const result = []; - const stack = []; - let start = 0; - for (let i = 0; i < s.length; i++) { - if (s[i] === "{" || s[i] === "[") { - stack.push(s[i] === "{" ? "}" : "]"); - } else if (s[i] === stack.at(-1)) { - stack.pop(); - } else if (!stack.length && s[i] === ",") { - const token = s.substring(start, i).trim(); - if (token) { - result.push(token); - } - start = i + 1; - } - } - const lastToken = s.substring(start).trim(); - if (lastToken) { - result.push(lastToken); - } - return result; -} - -let _test; -function setCurrentTest(test) { - _test = test; -} -function getCurrentTest() { - return _test; -} -const tests = []; -function addRunningTest(test) { - tests.push(test); - return () => { - tests.splice(tests.indexOf(test)); - }; -} -function getRunningTests() { - return tests; -} - -function getDefaultHookTimeout() { - return getRunner().config.hookTimeout; -} -const CLEANUP_TIMEOUT_KEY = Symbol.for("VITEST_CLEANUP_TIMEOUT"); -const CLEANUP_STACK_TRACE_KEY = Symbol.for("VITEST_CLEANUP_STACK_TRACE"); -function getBeforeHookCleanupCallback(hook, result, context) { - if (typeof result === "function") { - const timeout = CLEANUP_TIMEOUT_KEY in hook && typeof hook[CLEANUP_TIMEOUT_KEY] === "number" ? hook[CLEANUP_TIMEOUT_KEY] : getDefaultHookTimeout(); - const stackTraceError = CLEANUP_STACK_TRACE_KEY in hook && hook[CLEANUP_STACK_TRACE_KEY] instanceof Error ? hook[CLEANUP_STACK_TRACE_KEY] : undefined; - return withTimeout(result, timeout, true, stackTraceError, (_, error) => { - if (context) { - abortContextSignal(context, error); - } - }); - } -} -/** -* Registers a callback function to be executed once before all tests within the current suite. -* This hook is useful for scenarios where you need to perform setup operations that are common to all tests in a suite, such as initializing a database connection or setting up a test environment. -* -* **Note:** The `beforeAll` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed before all tests. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using beforeAll to set up a database connection -* beforeAll(async () => { -* await database.connect(); -* }); -* ``` -*/ -function beforeAll(fn, timeout = getDefaultHookTimeout()) { - assertTypes(fn, "\"beforeAll\" callback", ["function"]); - const stackTraceError = new Error("STACK_TRACE_ERROR"); - return getCurrentSuite().on("beforeAll", Object.assign(withTimeout(fn, timeout, true, stackTraceError), { - [CLEANUP_TIMEOUT_KEY]: timeout, - [CLEANUP_STACK_TRACE_KEY]: stackTraceError - })); -} -/** -* Registers a callback function to be executed once after all tests within the current suite have completed. -* This hook is useful for scenarios where you need to perform cleanup operations after all tests in a suite have run, such as closing database connections or cleaning up temporary files. -* -* **Note:** The `afterAll` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed after all tests. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using afterAll to close a database connection -* afterAll(async () => { -* await database.disconnect(); -* }); -* ``` -*/ -function afterAll(fn, timeout) { - assertTypes(fn, "\"afterAll\" callback", ["function"]); - return getCurrentSuite().on("afterAll", withTimeout(fn, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"))); -} -/** -* Registers a callback function to be executed before each test within the current suite. -* This hook is useful for scenarios where you need to reset or reinitialize the test environment before each test runs, such as resetting database states, clearing caches, or reinitializing variables. -* -* **Note:** The `beforeEach` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using beforeEach to reset a database state -* beforeEach(async () => { -* await database.reset(); -* }); -* ``` -*/ -function beforeEach(fn, timeout = getDefaultHookTimeout()) { - assertTypes(fn, "\"beforeEach\" callback", ["function"]); - const stackTraceError = new Error("STACK_TRACE_ERROR"); - const runner = getRunner(); - return getCurrentSuite().on("beforeEach", Object.assign(withTimeout(withFixtures(runner, fn), timeout ?? getDefaultHookTimeout(), true, stackTraceError, abortIfTimeout), { - [CLEANUP_TIMEOUT_KEY]: timeout, - [CLEANUP_STACK_TRACE_KEY]: stackTraceError - })); -} -/** -* Registers a callback function to be executed after each test within the current suite has completed. -* This hook is useful for scenarios where you need to clean up or reset the test environment after each test runs, such as deleting temporary files, clearing test-specific database entries, or resetting mocked functions. -* -* **Note:** The `afterEach` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using afterEach to delete temporary files created during a test -* afterEach(async () => { -* await fileSystem.deleteTempFiles(); -* }); -* ``` -*/ -function afterEach(fn, timeout) { - assertTypes(fn, "\"afterEach\" callback", ["function"]); - const runner = getRunner(); - return getCurrentSuite().on("afterEach", withTimeout(withFixtures(runner, fn), timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout)); -} -/** -* Registers a callback function to be executed when a test fails within the current suite. -* This function allows for custom actions to be performed in response to test failures, such as logging, cleanup, or additional diagnostics. -* -* **Note:** The `onTestFailed` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed upon a test failure. The function receives the test result (including errors). -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @throws {Error} Throws an error if the function is not called within a test. -* @returns {void} -* @example -* ```ts -* // Example of using onTestFailed to log failure details -* onTestFailed(({ errors }) => { -* console.log(`Test failed: ${test.name}`, errors); -* }); -* ``` -*/ -const onTestFailed = createTestHook("onTestFailed", (test, handler, timeout) => { - test.onFailed || (test.onFailed = []); - test.onFailed.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout)); -}); -/** -* Registers a callback function to be executed when the current test finishes, regardless of the outcome (pass or fail). -* This function is ideal for performing actions that should occur after every test execution, such as cleanup, logging, or resetting shared resources. -* -* This hook is useful if you have access to a resource in the test itself and you want to clean it up after the test finishes. It is a more compact way to clean up resources than using the combination of `beforeEach` and `afterEach`. -* -* **Note:** The `onTestFinished` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* **Note:** The `onTestFinished` hook is not called if the test is canceled with a dynamic `ctx.skip()` call. -* -* @param {Function} fn - The callback function to be executed after a test finishes. The function can receive parameters providing details about the completed test, including its success or failure status. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @throws {Error} Throws an error if the function is not called within a test. -* @returns {void} -* @example -* ```ts -* // Example of using onTestFinished for cleanup -* const db = await connectToDatabase(); -* onTestFinished(async () => { -* await db.disconnect(); -* }); -* ``` -*/ -const onTestFinished = createTestHook("onTestFinished", (test, handler, timeout) => { - test.onFinished || (test.onFinished = []); - test.onFinished.push(withTimeout(handler, timeout ?? getDefaultHookTimeout(), true, new Error("STACK_TRACE_ERROR"), abortIfTimeout)); -}); -function createTestHook(name, handler) { - return (fn, timeout) => { - assertTypes(fn, `"${name}" callback`, ["function"]); - const current = getCurrentTest(); - if (!current) { - throw new Error(`Hook ${name}() can only be called inside a test`); - } - return handler(current, fn, timeout); - }; -} - -/** -* Creates a suite of tests, allowing for grouping and hierarchical organization of tests. -* Suites can contain both tests and other suites, enabling complex test structures. -* -* @param {string} name - The name of the suite, used for identification and reporting. -* @param {Function} fn - A function that defines the tests and suites within this suite. -* @example -* ```ts -* // Define a suite with two tests -* suite('Math operations', () => { -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* -* test('should subtract two numbers', () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* }); -* ``` -* @example -* ```ts -* // Define nested suites -* suite('String operations', () => { -* suite('Trimming', () => { -* test('should trim whitespace from start and end', () => { -* expect(' hello '.trim()).toBe('hello'); -* }); -* }); -* -* suite('Concatenation', () => { -* test('should concatenate two strings', () => { -* expect('hello' + ' ' + 'world').toBe('hello world'); -* }); -* }); -* }); -* ``` -*/ -const suite = createSuite(); -/** -* Defines a test case with a given name and test function. The test function can optionally be configured with test options. -* -* @param {string | Function} name - The name of the test or a function that will be used as a test name. -* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. -* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. -* @throws {Error} If called inside another test function. -* @example -* ```ts -* // Define a simple test -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* ``` -* @example -* ```ts -* // Define a test with options -* test('should subtract two numbers', { retry: 3 }, () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* ``` -*/ -const test = createTest(function(name, optionsOrFn, optionsOrTest) { - if (getCurrentTest()) { - throw new Error("Calling the test function inside another test function is not allowed. Please put it inside \"describe\" or \"suite\" so it can be properly collected."); - } - getCurrentSuite().test.fn.call(this, formatName(name), optionsOrFn, optionsOrTest); -}); -/** -* Creates a suite of tests, allowing for grouping and hierarchical organization of tests. -* Suites can contain both tests and other suites, enabling complex test structures. -* -* @param {string} name - The name of the suite, used for identification and reporting. -* @param {Function} fn - A function that defines the tests and suites within this suite. -* @example -* ```ts -* // Define a suite with two tests -* describe('Math operations', () => { -* test('should add two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* -* test('should subtract two numbers', () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* }); -* ``` -* @example -* ```ts -* // Define nested suites -* describe('String operations', () => { -* describe('Trimming', () => { -* test('should trim whitespace from start and end', () => { -* expect(' hello '.trim()).toBe('hello'); -* }); -* }); -* -* describe('Concatenation', () => { -* test('should concatenate two strings', () => { -* expect('hello' + ' ' + 'world').toBe('hello world'); -* }); -* }); -* }); -* ``` -*/ -const describe = suite; -/** -* Defines a test case with a given name and test function. The test function can optionally be configured with test options. -* -* @param {string | Function} name - The name of the test or a function that will be used as a test name. -* @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided. -* @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters. -* @throws {Error} If called inside another test function. -* @example -* ```ts -* // Define a simple test -* it('adds two numbers', () => { -* expect(add(1, 2)).toBe(3); -* }); -* ``` -* @example -* ```ts -* // Define a test with options -* it('subtracts two numbers', { retry: 3 }, () => { -* expect(subtract(5, 2)).toBe(3); -* }); -* ``` -*/ -const it = test; -let runner; -let defaultSuite; -let currentTestFilepath; -function assert(condition, message) { - if (!condition) { - throw new Error(`Vitest failed to find ${message}. This is a bug in Vitest. Please, open an issue with reproduction.`); - } -} -function getDefaultSuite() { - assert(defaultSuite, "the default suite"); - return defaultSuite; -} -function getRunner() { - assert(runner, "the runner"); - return runner; -} -function createDefaultSuite(runner) { - const config = runner.config.sequence; - const collector = suite("", { concurrent: config.concurrent }, () => {}); - // no parent suite for top-level tests - delete collector.suite; - return collector; -} -function clearCollectorContext(file, currentRunner) { - if (!defaultSuite) { - defaultSuite = createDefaultSuite(currentRunner); - } - defaultSuite.file = file; - runner = currentRunner; - currentTestFilepath = file.filepath; - collectorContext.tasks.length = 0; - defaultSuite.clear(); - collectorContext.currentSuite = defaultSuite; -} -function getCurrentSuite() { - const currentSuite = collectorContext.currentSuite || defaultSuite; - assert(currentSuite, "the current suite"); - return currentSuite; -} -function createSuiteHooks() { - return { - beforeAll: [], - afterAll: [], - beforeEach: [], - afterEach: [] - }; -} -function parseArguments(optionsOrFn, timeoutOrTest) { - if (timeoutOrTest != null && typeof timeoutOrTest === "object") { - throw new TypeError(`Signature "test(name, fn, { ... })" was deprecated in Vitest 3 and removed in Vitest 4. Please, provide options as a second argument instead.`); - } - let options = {}; - let fn; - // it('', () => {}, 1000) - if (typeof timeoutOrTest === "number") { - options = { timeout: timeoutOrTest }; - } else if (typeof optionsOrFn === "object") { - options = optionsOrFn; - } - if (typeof optionsOrFn === "function") { - if (typeof timeoutOrTest === "function") { - throw new TypeError("Cannot use two functions as arguments. Please use the second argument for options."); - } - fn = optionsOrFn; - } else if (typeof timeoutOrTest === "function") { - fn = timeoutOrTest; - } - return { - options, - handler: fn - }; -} -// implementations -function createSuiteCollector(name, factory = () => {}, mode, each, suiteOptions, parentCollectorFixtures) { - const tasks = []; - let suite; - initSuite(true); - const task = function(name = "", options = {}) { - var _collectorContext$cur, _collectorContext$cur2, _collectorContext$cur3; - const timeout = (options === null || options === void 0 ? void 0 : options.timeout) ?? runner.config.testTimeout; - const currentSuite = (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.suite; - const task = { - id: "", - name, - fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur2 = collectorContext.currentSuite) === null || _collectorContext$cur2 === void 0 || (_collectorContext$cur2 = _collectorContext$cur2.file) === null || _collectorContext$cur2 === void 0 ? void 0 : _collectorContext$cur2.fullName), name]), - fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name]), - suite: currentSuite, - each: options.each, - fails: options.fails, - context: undefined, - type: "test", - file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur3 = collectorContext.currentSuite) === null || _collectorContext$cur3 === void 0 ? void 0 : _collectorContext$cur3.file), - timeout, - retry: options.retry ?? runner.config.retry, - repeats: options.repeats, - mode: options.only ? "only" : options.skip ? "skip" : options.todo ? "todo" : "run", - meta: options.meta ?? Object.create(null), - annotations: [], - artifacts: [] - }; - const handler = options.handler; - if (task.mode === "run" && !handler) { - task.mode = "todo"; - } - if (options.concurrent || !options.sequential && runner.config.sequence.concurrent) { - task.concurrent = true; - } - task.shuffle = suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle; - const context = createTestContext(task, runner); - // create test context - Object.defineProperty(task, "context", { - value: context, - enumerable: false - }); - setTestFixture(context, options.fixtures); - // custom can be called from any place, let's assume the limit is 15 stacks - const limit = Error.stackTraceLimit; - Error.stackTraceLimit = 15; - const stackTraceError = new Error("STACK_TRACE_ERROR"); - Error.stackTraceLimit = limit; - if (handler) { - setFn(task, withTimeout(withAwaitAsyncAssertions(withFixtures(runner, handler, context), task), timeout, false, stackTraceError, (_, error) => abortIfTimeout([context], error))); - } - if (runner.config.includeTaskLocation) { - const error = stackTraceError.stack; - const stack = findTestFileStackTrace(currentTestFilepath, error); - if (stack) { - task.location = { - line: stack.line, - column: stack.column - }; - } - } - tasks.push(task); - return task; - }; - const test = createTest(function(name, optionsOrFn, timeoutOrTest) { - let { options, handler } = parseArguments(optionsOrFn, timeoutOrTest); - // inherit repeats, retry, timeout from suite - if (typeof suiteOptions === "object") { - options = Object.assign({}, suiteOptions, options); - } - // inherit concurrent / sequential from suite - options.concurrent = this.concurrent || !this.sequential && (options === null || options === void 0 ? void 0 : options.concurrent); - options.sequential = this.sequential || !this.concurrent && (options === null || options === void 0 ? void 0 : options.sequential); - const test = task(formatName(name), { - ...this, - ...options, - handler - }); - test.type = "test"; - }); - let collectorFixtures = parentCollectorFixtures; - const collector = { - type: "collector", - name, - mode, - suite, - options: suiteOptions, - test, - tasks, - collect, - task, - clear, - on: addHook, - fixtures() { - return collectorFixtures; - }, - scoped(fixtures) { - const parsed = mergeContextFixtures(fixtures, { fixtures: collectorFixtures }, runner); - if (parsed.fixtures) { - collectorFixtures = parsed.fixtures; - } - } - }; - function addHook(name, ...fn) { - getHooks(suite)[name].push(...fn); - } - function initSuite(includeLocation) { - var _collectorContext$cur4, _collectorContext$cur5, _collectorContext$cur6; - if (typeof suiteOptions === "number") { - suiteOptions = { timeout: suiteOptions }; - } - const currentSuite = (_collectorContext$cur4 = collectorContext.currentSuite) === null || _collectorContext$cur4 === void 0 ? void 0 : _collectorContext$cur4.suite; - suite = { - id: "", - type: "suite", - name, - fullName: createTaskName([(currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullName) ?? ((_collectorContext$cur5 = collectorContext.currentSuite) === null || _collectorContext$cur5 === void 0 || (_collectorContext$cur5 = _collectorContext$cur5.file) === null || _collectorContext$cur5 === void 0 ? void 0 : _collectorContext$cur5.fullName), name]), - fullTestName: createTaskName([currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fullTestName, name]), - suite: currentSuite, - mode, - each, - file: (currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.file) ?? ((_collectorContext$cur6 = collectorContext.currentSuite) === null || _collectorContext$cur6 === void 0 ? void 0 : _collectorContext$cur6.file), - shuffle: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.shuffle, - tasks: [], - meta: Object.create(null), - concurrent: suiteOptions === null || suiteOptions === void 0 ? void 0 : suiteOptions.concurrent - }; - if (runner && includeLocation && runner.config.includeTaskLocation) { - const limit = Error.stackTraceLimit; - Error.stackTraceLimit = 15; - const error = new Error("stacktrace").stack; - Error.stackTraceLimit = limit; - const stack = findTestFileStackTrace(currentTestFilepath, error); - if (stack) { - suite.location = { - line: stack.line, - column: stack.column - }; - } - } - setHooks(suite, createSuiteHooks()); - } - function clear() { - tasks.length = 0; - initSuite(false); - } - async function collect(file) { - if (!file) { - throw new TypeError("File is required to collect tasks."); - } - if (factory) { - await runWithSuite(collector, () => factory(test)); - } - const allChildren = []; - for (const i of tasks) { - allChildren.push(i.type === "collector" ? await i.collect(file) : i); - } - suite.tasks = allChildren; - return suite; - } - collectTask(collector); - return collector; -} -function withAwaitAsyncAssertions(fn, task) { - return (async (...args) => { - const fnResult = await fn(...args); - // some async expect will be added to this array, in case user forget to await them - if (task.promises) { - const result = await Promise.allSettled(task.promises); - const errors = result.map((r) => r.status === "rejected" ? r.reason : undefined).filter(Boolean); - if (errors.length) { - throw errors; - } - } - return fnResult; - }); -} -function createSuite() { - function suiteFn(name, factoryOrOptions, optionsOrFactory) { - var _currentSuite$options; - if (getCurrentTest()) { - throw new Error("Calling the suite function inside test function is not allowed. It can be only called at the top level or inside another suite function."); - } - let mode = this.only ? "only" : this.skip ? "skip" : this.todo ? "todo" : "run"; - const currentSuite = collectorContext.currentSuite || defaultSuite; - let { options, handler: factory } = parseArguments(factoryOrOptions, optionsOrFactory); - if (mode === "run" && !factory) { - mode = "todo"; - } - const isConcurrentSpecified = options.concurrent || this.concurrent || options.sequential === false; - const isSequentialSpecified = options.sequential || this.sequential || options.concurrent === false; - // inherit options from current suite - options = { - ...currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.options, - ...options, - shuffle: this.shuffle ?? options.shuffle ?? (currentSuite === null || currentSuite === void 0 || (_currentSuite$options = currentSuite.options) === null || _currentSuite$options === void 0 ? void 0 : _currentSuite$options.shuffle) ?? (runner === null || runner === void 0 ? void 0 : runner.config.sequence.shuffle) - }; - // inherit concurrent / sequential from suite - const isConcurrent = isConcurrentSpecified || options.concurrent && !isSequentialSpecified; - const isSequential = isSequentialSpecified || options.sequential && !isConcurrentSpecified; - options.concurrent = isConcurrent && !isSequential; - options.sequential = isSequential && !isConcurrent; - return createSuiteCollector(formatName(name), factory, mode, this.each, options, currentSuite === null || currentSuite === void 0 ? void 0 : currentSuite.fixtures()); - } - suiteFn.each = function(cases, ...args) { - const suite = this.withContext(); - this.setContext("each", true); - if (Array.isArray(cases) && args.length) { - cases = formatTemplateString(cases, args); - } - return (name, optionsOrFn, fnOrOptions) => { - const _name = formatName(name); - const arrayOnlyCases = cases.every(Array.isArray); - const { options, handler } = parseArguments(optionsOrFn, fnOrOptions); - const fnFirst = typeof optionsOrFn === "function"; - cases.forEach((i, idx) => { - const items = Array.isArray(i) ? i : [i]; - if (fnFirst) { - if (arrayOnlyCases) { - suite(formatTitle(_name, items, idx), handler ? () => handler(...items) : undefined, options.timeout); - } else { - suite(formatTitle(_name, items, idx), handler ? () => handler(i) : undefined, options.timeout); - } - } else { - if (arrayOnlyCases) { - suite(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : undefined); - } else { - suite(formatTitle(_name, items, idx), options, handler ? () => handler(i) : undefined); - } - } - }); - this.setContext("each", undefined); - }; - }; - suiteFn.for = function(cases, ...args) { - if (Array.isArray(cases) && args.length) { - cases = formatTemplateString(cases, args); - } - return (name, optionsOrFn, fnOrOptions) => { - const name_ = formatName(name); - const { options, handler } = parseArguments(optionsOrFn, fnOrOptions); - cases.forEach((item, idx) => { - suite(formatTitle(name_, toArray(item), idx), options, handler ? () => handler(item) : undefined); - }); - }; - }; - suiteFn.skipIf = (condition) => condition ? suite.skip : suite; - suiteFn.runIf = (condition) => condition ? suite : suite.skip; - return createChainable([ - "concurrent", - "sequential", - "shuffle", - "skip", - "only", - "todo" - ], suiteFn); -} -function createTaskCollector(fn, context) { - const taskFn = fn; - taskFn.each = function(cases, ...args) { - const test = this.withContext(); - this.setContext("each", true); - if (Array.isArray(cases) && args.length) { - cases = formatTemplateString(cases, args); - } - return (name, optionsOrFn, fnOrOptions) => { - const _name = formatName(name); - const arrayOnlyCases = cases.every(Array.isArray); - const { options, handler } = parseArguments(optionsOrFn, fnOrOptions); - const fnFirst = typeof optionsOrFn === "function"; - cases.forEach((i, idx) => { - const items = Array.isArray(i) ? i : [i]; - if (fnFirst) { - if (arrayOnlyCases) { - test(formatTitle(_name, items, idx), handler ? () => handler(...items) : undefined, options.timeout); - } else { - test(formatTitle(_name, items, idx), handler ? () => handler(i) : undefined, options.timeout); - } - } else { - if (arrayOnlyCases) { - test(formatTitle(_name, items, idx), options, handler ? () => handler(...items) : undefined); - } else { - test(formatTitle(_name, items, idx), options, handler ? () => handler(i) : undefined); - } - } - }); - this.setContext("each", undefined); - }; - }; - taskFn.for = function(cases, ...args) { - const test = this.withContext(); - if (Array.isArray(cases) && args.length) { - cases = formatTemplateString(cases, args); - } - return (name, optionsOrFn, fnOrOptions) => { - const _name = formatName(name); - const { options, handler } = parseArguments(optionsOrFn, fnOrOptions); - cases.forEach((item, idx) => { - // monkey-patch handler to allow parsing fixture - const handlerWrapper = handler ? (ctx) => handler(item, ctx) : undefined; - if (handlerWrapper) { - handlerWrapper.__VITEST_FIXTURE_INDEX__ = 1; - handlerWrapper.toString = () => handler.toString(); - } - test(formatTitle(_name, toArray(item), idx), options, handlerWrapper); - }); - }; - }; - taskFn.skipIf = function(condition) { - return condition ? this.skip : this; - }; - taskFn.runIf = function(condition) { - return condition ? this : this.skip; - }; - taskFn.scoped = function(fixtures) { - const collector = getCurrentSuite(); - collector.scoped(fixtures); - }; - taskFn.extend = function(fixtures) { - const _context = mergeContextFixtures(fixtures, context || {}, runner); - const originalWrapper = fn; - return createTest(function(name, optionsOrFn, optionsOrTest) { - const collector = getCurrentSuite(); - const scopedFixtures = collector.fixtures(); - const context = { ...this }; - if (scopedFixtures) { - context.fixtures = mergeScopedFixtures(context.fixtures || [], scopedFixtures); - } - originalWrapper.call(context, formatName(name), optionsOrFn, optionsOrTest); - }, _context); - }; - taskFn.beforeEach = beforeEach; - taskFn.afterEach = afterEach; - taskFn.beforeAll = beforeAll; - taskFn.afterAll = afterAll; - const _test = createChainable([ - "concurrent", - "sequential", - "skip", - "only", - "todo", - "fails" - ], taskFn); - if (context) { - _test.mergeContext(context); - } - return _test; -} -function createTest(fn, context) { - return createTaskCollector(fn, context); -} -function formatName(name) { - return typeof name === "string" ? name : typeof name === "function" ? name.name || "" : String(name); -} -function formatTitle(template, items, idx) { - if (template.includes("%#") || template.includes("%$")) { - // '%#' match index of the test case - template = template.replace(/%%/g, "__vitest_escaped_%__").replace(/%#/g, `${idx}`).replace(/%\$/g, `${idx + 1}`).replace(/__vitest_escaped_%__/g, "%%"); - } - const count = template.split("%").length - 1; - if (template.includes("%f")) { - const placeholders = template.match(/%f/g) || []; - placeholders.forEach((_, i) => { - if (isNegativeNaN(items[i]) || Object.is(items[i], -0)) { - // Replace the i-th occurrence of '%f' with '-%f' - let occurrence = 0; - template = template.replace(/%f/g, (match) => { - occurrence++; - return occurrence === i + 1 ? "-%f" : match; - }); - } - }); - } - const isObjectItem = isObject(items[0]); - function formatAttribute(s) { - return s.replace(/\$([$\w.]+)/g, (_, key) => { - var _runner$config; - const isArrayKey = /^\d+$/.test(key); - if (!isObjectItem && !isArrayKey) { - return `$${key}`; - } - const arrayElement = isArrayKey ? objectAttr(items, key) : undefined; - const value = isObjectItem ? objectAttr(items[0], key, arrayElement) : arrayElement; - return objDisplay(value, { truncate: runner === null || runner === void 0 || (_runner$config = runner.config) === null || _runner$config === void 0 || (_runner$config = _runner$config.chaiConfig) === null || _runner$config === void 0 ? void 0 : _runner$config.truncateThreshold }); - }); - } - let output = ""; - let i = 0; - handleRegexMatch( - template, - formatRegExp, - // format "%" - (match) => { - if (i < count) { - output += format(match[0], items[i++]); - } else { - output += match[0]; - } - }, - // format "$" - (nonMatch) => { - output += formatAttribute(nonMatch); - } - ); - return output; -} -// based on https://github.com/unocss/unocss/blob/2e74b31625bbe3b9c8351570749aa2d3f799d919/packages/autocomplete/src/parse.ts#L11 -function handleRegexMatch(input, regex, onMatch, onNonMatch) { - let lastIndex = 0; - for (const m of input.matchAll(regex)) { - if (lastIndex < m.index) { - onNonMatch(input.slice(lastIndex, m.index)); - } - onMatch(m); - lastIndex = m.index + m[0].length; - } - if (lastIndex < input.length) { - onNonMatch(input.slice(lastIndex)); - } -} -function formatTemplateString(cases, args) { - const header = cases.join("").trim().replace(/ /g, "").split("\n").map((i) => i.split("|"))[0]; - const res = []; - for (let i = 0; i < Math.floor(args.length / header.length); i++) { - const oneCase = {}; - for (let j = 0; j < header.length; j++) { - oneCase[header[j]] = args[i * header.length + j]; - } - res.push(oneCase); - } - return res; -} - -const now$2 = Date.now; -const collectorContext = { - tasks: [], - currentSuite: null -}; -function collectTask(task) { - var _collectorContext$cur; - (_collectorContext$cur = collectorContext.currentSuite) === null || _collectorContext$cur === void 0 ? void 0 : _collectorContext$cur.tasks.push(task); -} -async function runWithSuite(suite, fn) { - const prev = collectorContext.currentSuite; - collectorContext.currentSuite = suite; - await fn(); - collectorContext.currentSuite = prev; -} -function withTimeout(fn, timeout, isHook = false, stackTraceError, onTimeout) { - if (timeout <= 0 || timeout === Number.POSITIVE_INFINITY) { - return fn; - } - const { setTimeout, clearTimeout } = getSafeTimers(); - // this function name is used to filter error in test/cli/test/fails.test.ts - return (function runWithTimeout(...args) { - const startTime = now$2(); - const runner = getRunner(); - runner._currentTaskStartTime = startTime; - runner._currentTaskTimeout = timeout; - return new Promise((resolve_, reject_) => { - var _timer$unref; - const timer = setTimeout(() => { - clearTimeout(timer); - rejectTimeoutError(); - }, timeout); - // `unref` might not exist in browser - (_timer$unref = timer.unref) === null || _timer$unref === void 0 ? void 0 : _timer$unref.call(timer); - function rejectTimeoutError() { - const error = makeTimeoutError(isHook, timeout, stackTraceError); - onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(args, error); - reject_(error); - } - function resolve(result) { - runner._currentTaskStartTime = undefined; - runner._currentTaskTimeout = undefined; - clearTimeout(timer); - // if test/hook took too long in microtask, setTimeout won't be triggered, - // but we still need to fail the test, see - // https://github.com/vitest-dev/vitest/issues/2920 - if (now$2() - startTime >= timeout) { - rejectTimeoutError(); - return; - } - resolve_(result); - } - function reject(error) { - runner._currentTaskStartTime = undefined; - runner._currentTaskTimeout = undefined; - clearTimeout(timer); - reject_(error); - } - // sync test/hook will be caught by try/catch - try { - const result = fn(...args); - // the result is a thenable, we don't wrap this in Promise.resolve - // to avoid creating new promises - if (typeof result === "object" && result != null && typeof result.then === "function") { - result.then(resolve, reject); - } else { - resolve(result); - } - } - // user sync test/hook throws an error -catch (error) { - reject(error); - } - }); - }); -} -const abortControllers = new WeakMap(); -function abortIfTimeout([context], error) { - if (context) { - abortContextSignal(context, error); - } -} -function abortContextSignal(context, error) { - const abortController = abortControllers.get(context); - abortController === null || abortController === void 0 ? void 0 : abortController.abort(error); -} -function createTestContext(test, runner) { - var _runner$extendTaskCon; - const context = function() { - throw new Error("done() callback is deprecated, use promise instead"); - }; - let abortController = abortControllers.get(context); - if (!abortController) { - abortController = new AbortController(); - abortControllers.set(context, abortController); - } - context.signal = abortController.signal; - context.task = test; - context.skip = (condition, note) => { - if (condition === false) { - // do nothing - return undefined; - } - test.result ?? (test.result = { state: "skip" }); - test.result.pending = true; - throw new PendingError("test is skipped; abort execution", test, typeof condition === "string" ? condition : note); - }; - context.annotate = ((message, type, attachment) => { - if (test.result && test.result.state !== "run") { - throw new Error(`Cannot annotate tests outside of the test run. The test "${test.name}" finished running with the "${test.result.state}" state already.`); - } - const annotation = { - message, - type: typeof type === "object" || type === undefined ? "notice" : type - }; - const annotationAttachment = typeof type === "object" ? type : attachment; - if (annotationAttachment) { - annotation.attachment = annotationAttachment; - manageArtifactAttachment(annotation.attachment); - } - return recordAsyncOperation(test, recordArtifact(test, { - type: "internal:annotation", - annotation - }).then(async ({ annotation }) => { - if (!runner.onTestAnnotate) { - throw new Error(`Test runner doesn't support test annotations.`); - } - await finishSendTasksUpdate(runner); - const resolvedAnnotation = await runner.onTestAnnotate(test, annotation); - test.annotations.push(resolvedAnnotation); - return resolvedAnnotation; - })); - }); - context.onTestFailed = (handler, timeout) => { - test.onFailed || (test.onFailed = []); - test.onFailed.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error))); - }; - context.onTestFinished = (handler, timeout) => { - test.onFinished || (test.onFinished = []); - test.onFinished.push(withTimeout(handler, timeout ?? runner.config.hookTimeout, true, new Error("STACK_TRACE_ERROR"), (_, error) => abortController.abort(error))); - }; - return ((_runner$extendTaskCon = runner.extendTaskContext) === null || _runner$extendTaskCon === void 0 ? void 0 : _runner$extendTaskCon.call(runner, context)) || context; -} -function makeTimeoutError(isHook, timeout, stackTraceError) { - const message = `${isHook ? "Hook" : "Test"} timed out in ${timeout}ms.\nIf this is a long-running ${isHook ? "hook" : "test"}, pass a timeout value as the last argument or configure it globally with "${isHook ? "hookTimeout" : "testTimeout"}".`; - const error = new Error(message); - if (stackTraceError === null || stackTraceError === void 0 ? void 0 : stackTraceError.stack) { - error.stack = stackTraceError.stack.replace(error.message, stackTraceError.message); - } - return error; -} -const fileContexts = new WeakMap(); -function getFileContext(file) { - const context = fileContexts.get(file); - if (!context) { - throw new Error(`Cannot find file context for ${file.name}`); - } - return context; -} -function setFileContext(file, context) { - fileContexts.set(file, context); -} - -async function runSetupFiles(config, files, runner) { - if (config.sequence.setupFiles === "parallel") { - await Promise.all(files.map(async (fsPath) => { - await runner.importFile(fsPath, "setup"); - })); - } else { - for (const fsPath of files) { - await runner.importFile(fsPath, "setup"); - } - } -} - -const now$1 = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now; -async function collectTests(specs, runner) { - const files = []; - const config = runner.config; - const $ = runner.trace; - for (const spec of specs) { - const filepath = typeof spec === "string" ? spec : spec.filepath; - await $("collect_spec", { "code.file.path": filepath }, async () => { - var _runner$onCollectStar; - const testLocations = typeof spec === "string" ? undefined : spec.testLocations; - const file = createFileTask(filepath, config.root, config.name, runner.pool, runner.viteEnvironment); - setFileContext(file, Object.create(null)); - file.shuffle = config.sequence.shuffle; - (_runner$onCollectStar = runner.onCollectStart) === null || _runner$onCollectStar === void 0 ? void 0 : _runner$onCollectStar.call(runner, file); - clearCollectorContext(file, runner); - try { - var _runner$getImportDura; - const setupFiles = toArray(config.setupFiles); - if (setupFiles.length) { - const setupStart = now$1(); - await runSetupFiles(config, setupFiles, runner); - const setupEnd = now$1(); - file.setupDuration = setupEnd - setupStart; - } else { - file.setupDuration = 0; - } - const collectStart = now$1(); - await runner.importFile(filepath, "collect"); - const durations = (_runner$getImportDura = runner.getImportDurations) === null || _runner$getImportDura === void 0 ? void 0 : _runner$getImportDura.call(runner); - if (durations) { - file.importDurations = durations; - } - const defaultTasks = await getDefaultSuite().collect(file); - const fileHooks = createSuiteHooks(); - mergeHooks(fileHooks, getHooks(defaultTasks)); - for (const c of [...defaultTasks.tasks, ...collectorContext.tasks]) { - if (c.type === "test" || c.type === "suite") { - file.tasks.push(c); - } else if (c.type === "collector") { - const suite = await c.collect(file); - if (suite.name || suite.tasks.length) { - mergeHooks(fileHooks, getHooks(suite)); - file.tasks.push(suite); - } - } else { - // check that types are exhausted - c; - } - } - setHooks(file, fileHooks); - file.collectDuration = now$1() - collectStart; - } catch (e) { - var _runner$getImportDura2; - const error = processError(e); - file.result = { - state: "fail", - errors: [error] - }; - const durations = (_runner$getImportDura2 = runner.getImportDurations) === null || _runner$getImportDura2 === void 0 ? void 0 : _runner$getImportDura2.call(runner); - if (durations) { - file.importDurations = durations; - } - } - calculateSuiteHash(file); - const hasOnlyTasks = someTasksAreOnly(file); - interpretTaskModes(file, config.testNamePattern, testLocations, hasOnlyTasks, false, config.allowOnly); - if (file.mode === "queued") { - file.mode = "run"; - } - files.push(file); - }); - } - return files; -} -function mergeHooks(baseHooks, hooks) { - for (const _key in hooks) { - const key = _key; - baseHooks[key].push(...hooks[key]); - } - return baseHooks; -} - -const now = globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now; -const unixNow = Date.now; -const { clearTimeout, setTimeout } = getSafeTimers(); -function updateSuiteHookState(task, name, state, runner) { - if (!task.result) { - task.result = { state: "run" }; - } - if (!task.result.hooks) { - task.result.hooks = {}; - } - const suiteHooks = task.result.hooks; - if (suiteHooks) { - suiteHooks[name] = state; - let event = state === "run" ? "before-hook-start" : "before-hook-end"; - if (name === "afterAll" || name === "afterEach") { - event = state === "run" ? "after-hook-start" : "after-hook-end"; - } - updateTask(event, task, runner); - } -} -function getSuiteHooks(suite, name, sequence) { - const hooks = getHooks(suite)[name]; - if (sequence === "stack" && (name === "afterAll" || name === "afterEach")) { - return hooks.slice().reverse(); - } - return hooks; -} -async function callTestHooks(runner, test, hooks, sequence) { - if (sequence === "stack") { - hooks = hooks.slice().reverse(); - } - if (!hooks.length) { - return; - } - const context = test.context; - const onTestFailed = test.context.onTestFailed; - const onTestFinished = test.context.onTestFinished; - context.onTestFailed = () => { - throw new Error(`Cannot call "onTestFailed" inside a test hook.`); - }; - context.onTestFinished = () => { - throw new Error(`Cannot call "onTestFinished" inside a test hook.`); - }; - if (sequence === "parallel") { - try { - await Promise.all(hooks.map((fn) => fn(test.context))); - } catch (e) { - failTask(test.result, e, runner.config.diffOptions); - } - } else { - for (const fn of hooks) { - try { - await fn(test.context); - } catch (e) { - failTask(test.result, e, runner.config.diffOptions); - } - } - } - context.onTestFailed = onTestFailed; - context.onTestFinished = onTestFinished; -} -async function callSuiteHook(suite, currentTask, name, runner, args) { - const sequence = runner.config.sequence.hooks; - const callbacks = []; - // stop at file level - const parentSuite = "filepath" in suite ? null : suite.suite || suite.file; - if (name === "beforeEach" && parentSuite) { - callbacks.push(...await callSuiteHook(parentSuite, currentTask, name, runner, args)); - } - const hooks = getSuiteHooks(suite, name, sequence); - if (hooks.length > 0) { - updateSuiteHookState(currentTask, name, "run", runner); - } - async function runHook(hook) { - return getBeforeHookCleanupCallback(hook, await hook(...args), name === "beforeEach" ? args[0] : undefined); - } - if (sequence === "parallel") { - callbacks.push(...await Promise.all(hooks.map((hook) => runHook(hook)))); - } else { - for (const hook of hooks) { - callbacks.push(await runHook(hook)); - } - } - if (hooks.length > 0) { - updateSuiteHookState(currentTask, name, "pass", runner); - } - if (name === "afterEach" && parentSuite) { - callbacks.push(...await callSuiteHook(parentSuite, currentTask, name, runner, args)); - } - return callbacks; -} -const packs = new Map(); -const eventsPacks = []; -const pendingTasksUpdates = []; -function sendTasksUpdate(runner) { - if (packs.size) { - var _runner$onTaskUpdate; - const taskPacks = Array.from(packs).map(([id, task]) => { - return [ - id, - task[0], - task[1] - ]; - }); - const p = (_runner$onTaskUpdate = runner.onTaskUpdate) === null || _runner$onTaskUpdate === void 0 ? void 0 : _runner$onTaskUpdate.call(runner, taskPacks, eventsPacks); - if (p) { - pendingTasksUpdates.push(p); - // remove successful promise to not grow array indefnitely, - // but keep rejections so finishSendTasksUpdate can handle them - p.then(() => pendingTasksUpdates.splice(pendingTasksUpdates.indexOf(p), 1), () => {}); - } - eventsPacks.length = 0; - packs.clear(); - } -} -async function finishSendTasksUpdate(runner) { - sendTasksUpdate(runner); - await Promise.all(pendingTasksUpdates); -} -function throttle(fn, ms) { - let last = 0; - let pendingCall; - return function call(...args) { - const now = unixNow(); - if (now - last > ms) { - last = now; - clearTimeout(pendingCall); - pendingCall = undefined; - return fn.apply(this, args); - } - // Make sure fn is still called even if there are no further calls - pendingCall ?? (pendingCall = setTimeout(() => call.bind(this)(...args), ms)); - }; -} -// throttle based on summary reporter's DURATION_UPDATE_INTERVAL_MS -const sendTasksUpdateThrottled = throttle(sendTasksUpdate, 100); -function updateTask(event, task, runner) { - eventsPacks.push([ - task.id, - event, - undefined - ]); - packs.set(task.id, [task.result, task.meta]); - sendTasksUpdateThrottled(runner); -} -async function callCleanupHooks(runner, cleanups) { - const sequence = runner.config.sequence.hooks; - if (sequence === "stack") { - cleanups = cleanups.slice().reverse(); - } - if (sequence === "parallel") { - await Promise.all(cleanups.map(async (fn) => { - if (typeof fn !== "function") { - return; - } - await fn(); - })); - } else { - for (const fn of cleanups) { - if (typeof fn !== "function") { - continue; - } - await fn(); - } - } -} -async function runTest(test, runner) { - var _runner$onBeforeRunTa, _test$result, _runner$onAfterRunTas; - await ((_runner$onBeforeRunTa = runner.onBeforeRunTask) === null || _runner$onBeforeRunTa === void 0 ? void 0 : _runner$onBeforeRunTa.call(runner, test)); - if (test.mode !== "run" && test.mode !== "queued") { - updateTask("test-prepare", test, runner); - updateTask("test-finished", test, runner); - return; - } - if (((_test$result = test.result) === null || _test$result === void 0 ? void 0 : _test$result.state) === "fail") { - // should not be possible to get here, I think this is just copy pasted from suite - // TODO: maybe someone fails tests in `beforeAll` hooks? - // https://github.com/vitest-dev/vitest/pull/7069 - updateTask("test-failed-early", test, runner); - return; - } - const start = now(); - test.result = { - state: "run", - startTime: unixNow(), - retryCount: 0 - }; - updateTask("test-prepare", test, runner); - const cleanupRunningTest = addRunningTest(test); - setCurrentTest(test); - const suite = test.suite || test.file; - const $ = runner.trace; - const repeats = test.repeats ?? 0; - for (let repeatCount = 0; repeatCount <= repeats; repeatCount++) { - const retry = test.retry ?? 0; - for (let retryCount = 0; retryCount <= retry; retryCount++) { - var _test$onFinished, _test$onFailed, _runner$onAfterRetryT, _test$result2, _test$result3; - let beforeEachCleanups = []; - try { - var _runner$onBeforeTryTa, _runner$onAfterTryTas; - await ((_runner$onBeforeTryTa = runner.onBeforeTryTask) === null || _runner$onBeforeTryTa === void 0 ? void 0 : _runner$onBeforeTryTa.call(runner, test, { - retry: retryCount, - repeats: repeatCount - })); - test.result.repeatCount = repeatCount; - beforeEachCleanups = await $("test.beforeEach", () => callSuiteHook(suite, test, "beforeEach", runner, [test.context, suite])); - if (runner.runTask) { - await $("test.callback", () => runner.runTask(test)); - } else { - const fn = getFn(test); - if (!fn) { - throw new Error("Test function is not found. Did you add it using `setFn`?"); - } - await $("test.callback", () => fn()); - } - await ((_runner$onAfterTryTas = runner.onAfterTryTask) === null || _runner$onAfterTryTas === void 0 ? void 0 : _runner$onAfterTryTas.call(runner, test, { - retry: retryCount, - repeats: repeatCount - })); - if (test.result.state !== "fail") { - if (!test.repeats) { - test.result.state = "pass"; - } else if (test.repeats && retry === retryCount) { - test.result.state = "pass"; - } - } - } catch (e) { - failTask(test.result, e, runner.config.diffOptions); - } - try { - var _runner$onTaskFinishe; - await ((_runner$onTaskFinishe = runner.onTaskFinished) === null || _runner$onTaskFinishe === void 0 ? void 0 : _runner$onTaskFinishe.call(runner, test)); - } catch (e) { - failTask(test.result, e, runner.config.diffOptions); - } - try { - await $("test.afterEach", () => callSuiteHook(suite, test, "afterEach", runner, [test.context, suite])); - if (beforeEachCleanups.length) { - await $("test.cleanup", () => callCleanupHooks(runner, beforeEachCleanups)); - } - await callFixtureCleanup(test.context); - } catch (e) { - failTask(test.result, e, runner.config.diffOptions); - } - if ((_test$onFinished = test.onFinished) === null || _test$onFinished === void 0 ? void 0 : _test$onFinished.length) { - await $("test.onFinished", () => callTestHooks(runner, test, test.onFinished, "stack")); - } - if (test.result.state === "fail" && ((_test$onFailed = test.onFailed) === null || _test$onFailed === void 0 ? void 0 : _test$onFailed.length)) { - await $("test.onFailed", () => callTestHooks(runner, test, test.onFailed, runner.config.sequence.hooks)); - } - test.onFailed = undefined; - test.onFinished = undefined; - await ((_runner$onAfterRetryT = runner.onAfterRetryTask) === null || _runner$onAfterRetryT === void 0 ? void 0 : _runner$onAfterRetryT.call(runner, test, { - retry: retryCount, - repeats: repeatCount - })); - // skipped with new PendingError - if (((_test$result2 = test.result) === null || _test$result2 === void 0 ? void 0 : _test$result2.pending) || ((_test$result3 = test.result) === null || _test$result3 === void 0 ? void 0 : _test$result3.state) === "skip") { - var _test$result4; - test.mode = "skip"; - test.result = { - state: "skip", - note: (_test$result4 = test.result) === null || _test$result4 === void 0 ? void 0 : _test$result4.note, - pending: true, - duration: now() - start - }; - updateTask("test-finished", test, runner); - setCurrentTest(undefined); - cleanupRunningTest(); - return; - } - if (test.result.state === "pass") { - break; - } - if (retryCount < retry) { - // reset state when retry test - test.result.state = "run"; - test.result.retryCount = (test.result.retryCount ?? 0) + 1; - } - // update retry info - updateTask("test-retried", test, runner); - } - } - // if test is marked to be failed, flip the result - if (test.fails) { - if (test.result.state === "pass") { - const error = processError(new Error("Expect test to fail")); - test.result.state = "fail"; - test.result.errors = [error]; - } else { - test.result.state = "pass"; - test.result.errors = undefined; - } - } - cleanupRunningTest(); - setCurrentTest(undefined); - test.result.duration = now() - start; - await ((_runner$onAfterRunTas = runner.onAfterRunTask) === null || _runner$onAfterRunTas === void 0 ? void 0 : _runner$onAfterRunTas.call(runner, test)); - updateTask("test-finished", test, runner); -} -function failTask(result, err, diffOptions) { - if (err instanceof PendingError) { - result.state = "skip"; - result.note = err.note; - result.pending = true; - return; - } - result.state = "fail"; - const errors = Array.isArray(err) ? err : [err]; - for (const e of errors) { - const error = processError(e, diffOptions); - result.errors ?? (result.errors = []); - result.errors.push(error); - } -} -function markTasksAsSkipped(suite, runner) { - suite.tasks.forEach((t) => { - t.mode = "skip"; - t.result = { - ...t.result, - state: "skip" - }; - updateTask("test-finished", t, runner); - if (t.type === "suite") { - markTasksAsSkipped(t, runner); - } - }); -} -async function runSuite(suite, runner) { - var _runner$onBeforeRunSu, _suite$result; - await ((_runner$onBeforeRunSu = runner.onBeforeRunSuite) === null || _runner$onBeforeRunSu === void 0 ? void 0 : _runner$onBeforeRunSu.call(runner, suite)); - if (((_suite$result = suite.result) === null || _suite$result === void 0 ? void 0 : _suite$result.state) === "fail") { - markTasksAsSkipped(suite, runner); - // failed during collection - updateTask("suite-failed-early", suite, runner); - return; - } - const start = now(); - const mode = suite.mode; - suite.result = { - state: mode === "skip" || mode === "todo" ? mode : "run", - startTime: unixNow() - }; - const $ = runner.trace; - updateTask("suite-prepare", suite, runner); - let beforeAllCleanups = []; - if (suite.mode === "skip") { - suite.result.state = "skip"; - updateTask("suite-finished", suite, runner); - } else if (suite.mode === "todo") { - suite.result.state = "todo"; - updateTask("suite-finished", suite, runner); - } else { - var _runner$onAfterRunSui; - try { - try { - beforeAllCleanups = await $("suite.beforeAll", () => callSuiteHook(suite, suite, "beforeAll", runner, [suite])); - } catch (e) { - markTasksAsSkipped(suite, runner); - throw e; - } - if (runner.runSuite) { - await runner.runSuite(suite); - } else { - for (let tasksGroup of partitionSuiteChildren(suite)) { - if (tasksGroup[0].concurrent === true) { - await Promise.all(tasksGroup.map((c) => runSuiteChild(c, runner))); - } else { - const { sequence } = runner.config; - if (suite.shuffle) { - // run describe block independently from tests - const suites = tasksGroup.filter((group) => group.type === "suite"); - const tests = tasksGroup.filter((group) => group.type === "test"); - const groups = shuffle([suites, tests], sequence.seed); - tasksGroup = groups.flatMap((group) => shuffle(group, sequence.seed)); - } - for (const c of tasksGroup) { - await runSuiteChild(c, runner); - } - } - } - } - } catch (e) { - failTask(suite.result, e, runner.config.diffOptions); - } - try { - await $("suite.afterAll", () => callSuiteHook(suite, suite, "afterAll", runner, [suite])); - if (beforeAllCleanups.length) { - await $("suite.cleanup", () => callCleanupHooks(runner, beforeAllCleanups)); - } - if (suite.file === suite) { - const context = getFileContext(suite); - await callFixtureCleanup(context); - } - } catch (e) { - failTask(suite.result, e, runner.config.diffOptions); - } - if (suite.mode === "run" || suite.mode === "queued") { - if (!runner.config.passWithNoTests && !hasTests(suite)) { - var _suite$result$errors; - suite.result.state = "fail"; - if (!((_suite$result$errors = suite.result.errors) === null || _suite$result$errors === void 0 ? void 0 : _suite$result$errors.length)) { - const error = processError(new Error(`No test found in suite ${suite.name}`)); - suite.result.errors = [error]; - } - } else if (hasFailed(suite)) { - suite.result.state = "fail"; - } else { - suite.result.state = "pass"; - } - } - suite.result.duration = now() - start; - await ((_runner$onAfterRunSui = runner.onAfterRunSuite) === null || _runner$onAfterRunSui === void 0 ? void 0 : _runner$onAfterRunSui.call(runner, suite)); - updateTask("suite-finished", suite, runner); - } -} -let limitMaxConcurrency; -async function runSuiteChild(c, runner) { - const $ = runner.trace; - if (c.type === "test") { - return limitMaxConcurrency(() => { - var _c$location, _c$location2; - return $("run.test", { - "vitest.test.id": c.id, - "vitest.test.name": c.name, - "vitest.test.mode": c.mode, - "vitest.test.timeout": c.timeout, - "code.file.path": c.file.filepath, - "code.line.number": (_c$location = c.location) === null || _c$location === void 0 ? void 0 : _c$location.line, - "code.column.number": (_c$location2 = c.location) === null || _c$location2 === void 0 ? void 0 : _c$location2.column - }, () => runTest(c, runner)); - }); - } else if (c.type === "suite") { - var _c$location3, _c$location4; - return $("run.suite", { - "vitest.suite.id": c.id, - "vitest.suite.name": c.name, - "vitest.suite.mode": c.mode, - "code.file.path": c.file.filepath, - "code.line.number": (_c$location3 = c.location) === null || _c$location3 === void 0 ? void 0 : _c$location3.line, - "code.column.number": (_c$location4 = c.location) === null || _c$location4 === void 0 ? void 0 : _c$location4.column - }, () => runSuite(c, runner)); - } -} -async function runFiles(files, runner) { - limitMaxConcurrency ?? (limitMaxConcurrency = limitConcurrency(runner.config.maxConcurrency)); - for (const file of files) { - if (!file.tasks.length && !runner.config.passWithNoTests) { - var _file$result; - if (!((_file$result = file.result) === null || _file$result === void 0 || (_file$result = _file$result.errors) === null || _file$result === void 0 ? void 0 : _file$result.length)) { - const error = processError(new Error(`No test suite found in file ${file.filepath}`)); - file.result = { - state: "fail", - errors: [error] - }; - } - } - await runner.trace("run.spec", { - "code.file.path": file.filepath, - "vitest.suite.tasks.length": file.tasks.length - }, () => runSuite(file, runner)); - } -} -const workerRunners = new WeakSet(); -function defaultTrace(_, attributes, cb) { - if (typeof attributes === "function") { - return attributes(); - } - return cb(); -} -async function startTests(specs, runner) { - var _runner$cancel; - runner.trace ?? (runner.trace = defaultTrace); - const cancel = (_runner$cancel = runner.cancel) === null || _runner$cancel === void 0 ? void 0 : _runner$cancel.bind(runner); - // Ideally, we need to have an event listener for this, but only have a runner here. - // Adding another onCancel felt wrong (maybe it needs to be refactored) - runner.cancel = (reason) => { - // We intentionally create only one error since there is only one test run that can be cancelled - const error = new TestRunAbortError("The test run was aborted by the user.", reason); - getRunningTests().forEach((test) => abortContextSignal(test.context, error)); - return cancel === null || cancel === void 0 ? void 0 : cancel(reason); - }; - if (!workerRunners.has(runner)) { - var _runner$onCleanupWork; - (_runner$onCleanupWork = runner.onCleanupWorkerContext) === null || _runner$onCleanupWork === void 0 ? void 0 : _runner$onCleanupWork.call(runner, async () => { - var _runner$getWorkerCont; - const context = (_runner$getWorkerCont = runner.getWorkerContext) === null || _runner$getWorkerCont === void 0 ? void 0 : _runner$getWorkerCont.call(runner); - if (context) { - await callFixtureCleanup(context); - } - }); - workerRunners.add(runner); - } - try { - var _runner$onBeforeColle, _runner$onCollected, _runner$onBeforeRunFi, _runner$onAfterRunFil; - const paths = specs.map((f) => typeof f === "string" ? f : f.filepath); - await ((_runner$onBeforeColle = runner.onBeforeCollect) === null || _runner$onBeforeColle === void 0 ? void 0 : _runner$onBeforeColle.call(runner, paths)); - const files = await collectTests(specs, runner); - await ((_runner$onCollected = runner.onCollected) === null || _runner$onCollected === void 0 ? void 0 : _runner$onCollected.call(runner, files)); - await ((_runner$onBeforeRunFi = runner.onBeforeRunFiles) === null || _runner$onBeforeRunFi === void 0 ? void 0 : _runner$onBeforeRunFi.call(runner, files)); - await runFiles(files, runner); - await ((_runner$onAfterRunFil = runner.onAfterRunFiles) === null || _runner$onAfterRunFil === void 0 ? void 0 : _runner$onAfterRunFil.call(runner, files)); - await finishSendTasksUpdate(runner); - return files; - } finally { - runner.cancel = cancel; - } -} -async function publicCollect(specs, runner) { - var _runner$onBeforeColle2, _runner$onCollected2; - runner.trace ?? (runner.trace = defaultTrace); - const paths = specs.map((f) => typeof f === "string" ? f : f.filepath); - await ((_runner$onBeforeColle2 = runner.onBeforeCollect) === null || _runner$onBeforeColle2 === void 0 ? void 0 : _runner$onBeforeColle2.call(runner, paths)); - const files = await collectTests(specs, runner); - await ((_runner$onCollected2 = runner.onCollected) === null || _runner$onCollected2 === void 0 ? void 0 : _runner$onCollected2.call(runner, files)); - return files; -} - -/** -* @experimental -* @advanced -* -* Records a custom test artifact during test execution. -* -* This function allows you to attach structured data, files, or metadata to a test. -* -* Vitest automatically injects the source location where the artifact was created and manages any attachments you include. -* -* @param task - The test task context, typically accessed via `this.task` in custom matchers or `context.task` in tests -* @param artifact - The artifact to record. Must extend {@linkcode TestArtifactBase} -* -* @returns A promise that resolves to the recorded artifact with location injected -* -* @throws {Error} If called after the test has finished running -* @throws {Error} If the test runner doesn't support artifacts -* -* @example -* ```ts -* // In a custom assertion -* async function toHaveValidSchema(this: MatcherState, actual: unknown) { -* const validation = validateSchema(actual) -* -* await recordArtifact(this.task, { -* type: 'my-plugin:schema-validation', -* passed: validation.valid, -* errors: validation.errors, -* }) -* -* return { pass: validation.valid, message: () => '...' } -* } -* ``` -*/ -async function recordArtifact(task, artifact) { - const runner = getRunner(); - if (task.result && task.result.state !== "run") { - throw new Error(`Cannot record a test artifact outside of the test run. The test "${task.name}" finished running with the "${task.result.state}" state already.`); - } - const stack = findTestFileStackTrace(task.file.filepath, new Error("STACK_TRACE").stack); - if (stack) { - artifact.location = { - file: stack.file, - line: stack.line, - column: stack.column - }; - if (artifact.type === "internal:annotation") { - artifact.annotation.location = artifact.location; - } - } - if (Array.isArray(artifact.attachments)) { - for (const attachment of artifact.attachments) { - manageArtifactAttachment(attachment); - } - } - // annotations won't resolve as artifacts for backwards compatibility until next major - if (artifact.type === "internal:annotation") { - return artifact; - } - if (!runner.onTestArtifactRecord) { - throw new Error(`Test runner doesn't support test artifacts.`); - } - await finishSendTasksUpdate(runner); - const resolvedArtifact = await runner.onTestArtifactRecord(task, artifact); - task.artifacts.push(resolvedArtifact); - return resolvedArtifact; -} -const table = []; -for (let i = 65; i < 91; i++) { - table.push(String.fromCharCode(i)); -} -for (let i = 97; i < 123; i++) { - table.push(String.fromCharCode(i)); -} -for (let i = 0; i < 10; i++) { - table.push(i.toString(10)); -} -table.push("+", "/"); -function encodeUint8Array(bytes) { - let base64 = ""; - const len = bytes.byteLength; - for (let i = 0; i < len; i += 3) { - if (len === i + 1) { - const a = (bytes[i] & 252) >> 2; - const b = (bytes[i] & 3) << 4; - base64 += table[a]; - base64 += table[b]; - base64 += "=="; - } else if (len === i + 2) { - const a = (bytes[i] & 252) >> 2; - const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4; - const c = (bytes[i + 1] & 15) << 2; - base64 += table[a]; - base64 += table[b]; - base64 += table[c]; - base64 += "="; - } else { - const a = (bytes[i] & 252) >> 2; - const b = (bytes[i] & 3) << 4 | (bytes[i + 1] & 240) >> 4; - const c = (bytes[i + 1] & 15) << 2 | (bytes[i + 2] & 192) >> 6; - const d = bytes[i + 2] & 63; - base64 += table[a]; - base64 += table[b]; - base64 += table[c]; - base64 += table[d]; - } - } - return base64; -} -/** -* Records an async operation associated with a test task. -* -* This function tracks promises that should be awaited before a test completes. -* The promise is automatically removed from the test's promise list once it settles. -*/ -function recordAsyncOperation(test, promise) { - // if promise is explicitly awaited, remove it from the list - promise = promise.finally(() => { - if (!test.promises) { - return; - } - const index = test.promises.indexOf(promise); - if (index !== -1) { - test.promises.splice(index, 1); - } - }); - // record promise - if (!test.promises) { - test.promises = []; - } - test.promises.push(promise); - return promise; -} -/** -* Validates and prepares a test attachment for serialization. -* -* This function ensures attachments have either `body` or `path` set (but not both), and converts `Uint8Array` bodies to base64-encoded strings for easier serialization. -* -* @param attachment - The attachment to validate and prepare -* -* @throws {TypeError} If neither `body` nor `path` is provided -* @throws {TypeError} If both `body` and `path` are provided -*/ -function manageArtifactAttachment(attachment) { - if (attachment.body == null && !attachment.path) { - throw new TypeError(`Test attachment requires "body" or "path" to be set. Both are missing.`); - } - if (attachment.body && attachment.path) { - throw new TypeError(`Test attachment requires only one of "body" or "path" to be set. Both are specified.`); - } - // convert to a string so it's easier to serialise - if (attachment.body instanceof Uint8Array) { - attachment.body = encodeUint8Array(attachment.body); - } -} - -export { afterAll, afterEach, beforeAll, beforeEach, publicCollect as collectTests, createTaskCollector, describe, getCurrentSuite, getCurrentTest, getFn, getHooks, it, onTestFailed, onTestFinished, recordArtifact, setFn, setHooks, startTests, suite, test, updateTask }; diff --git a/node_modules/@vitest/runner/dist/tasks.d-BUa1HjoW.d.ts b/node_modules/@vitest/runner/dist/tasks.d-BUa1HjoW.d.ts deleted file mode 100644 index 86aa34c..0000000 --- a/node_modules/@vitest/runner/dist/tasks.d-BUa1HjoW.d.ts +++ /dev/null @@ -1,836 +0,0 @@ -import { TestError, Awaitable } from '@vitest/utils'; - -interface FixtureItem extends FixtureOptions { - prop: string; - value: any; - scope: "test" | "file" | "worker"; - /** - * Indicates whether the fixture is a function - */ - isFn: boolean; - /** - * The dependencies(fixtures) of current fixture function. - */ - deps?: FixtureItem[]; -} - -/** -* Registers a callback function to be executed once before all tests within the current suite. -* This hook is useful for scenarios where you need to perform setup operations that are common to all tests in a suite, such as initializing a database connection or setting up a test environment. -* -* **Note:** The `beforeAll` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed before all tests. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using beforeAll to set up a database connection -* beforeAll(async () => { -* await database.connect(); -* }); -* ``` -*/ -declare function beforeAll(fn: BeforeAllListener, timeout?: number): void; -/** -* Registers a callback function to be executed once after all tests within the current suite have completed. -* This hook is useful for scenarios where you need to perform cleanup operations after all tests in a suite have run, such as closing database connections or cleaning up temporary files. -* -* **Note:** The `afterAll` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed after all tests. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using afterAll to close a database connection -* afterAll(async () => { -* await database.disconnect(); -* }); -* ``` -*/ -declare function afterAll(fn: AfterAllListener, timeout?: number): void; -/** -* Registers a callback function to be executed before each test within the current suite. -* This hook is useful for scenarios where you need to reset or reinitialize the test environment before each test runs, such as resetting database states, clearing caches, or reinitializing variables. -* -* **Note:** The `beforeEach` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using beforeEach to reset a database state -* beforeEach(async () => { -* await database.reset(); -* }); -* ``` -*/ -declare function beforeEach(fn: BeforeEachListener, timeout?: number): void; -/** -* Registers a callback function to be executed after each test within the current suite has completed. -* This hook is useful for scenarios where you need to clean up or reset the test environment after each test runs, such as deleting temporary files, clearing test-specific database entries, or resetting mocked functions. -* -* **Note:** The `afterEach` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @returns {void} -* @example -* ```ts -* // Example of using afterEach to delete temporary files created during a test -* afterEach(async () => { -* await fileSystem.deleteTempFiles(); -* }); -* ``` -*/ -declare function afterEach(fn: AfterEachListener, timeout?: number): void; -/** -* Registers a callback function to be executed when a test fails within the current suite. -* This function allows for custom actions to be performed in response to test failures, such as logging, cleanup, or additional diagnostics. -* -* **Note:** The `onTestFailed` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* @param {Function} fn - The callback function to be executed upon a test failure. The function receives the test result (including errors). -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @throws {Error} Throws an error if the function is not called within a test. -* @returns {void} -* @example -* ```ts -* // Example of using onTestFailed to log failure details -* onTestFailed(({ errors }) => { -* console.log(`Test failed: ${test.name}`, errors); -* }); -* ``` -*/ -declare const onTestFailed: TaskHook; -/** -* Registers a callback function to be executed when the current test finishes, regardless of the outcome (pass or fail). -* This function is ideal for performing actions that should occur after every test execution, such as cleanup, logging, or resetting shared resources. -* -* This hook is useful if you have access to a resource in the test itself and you want to clean it up after the test finishes. It is a more compact way to clean up resources than using the combination of `beforeEach` and `afterEach`. -* -* **Note:** The `onTestFinished` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file. -* -* **Note:** The `onTestFinished` hook is not called if the test is canceled with a dynamic `ctx.skip()` call. -* -* @param {Function} fn - The callback function to be executed after a test finishes. The function can receive parameters providing details about the completed test, including its success or failure status. -* @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used. -* @throws {Error} Throws an error if the function is not called within a test. -* @returns {void} -* @example -* ```ts -* // Example of using onTestFinished for cleanup -* const db = await connectToDatabase(); -* onTestFinished(async () => { -* await db.disconnect(); -* }); -* ``` -*/ -declare const onTestFinished: TaskHook; - -type ChainableFunction< - T extends string, - F extends (...args: any) => any, - C = object -> = F & { [x in T] : ChainableFunction } & { - fn: (this: Record, ...args: Parameters) => ReturnType; -} & C; -declare function createChainable< - T extends string, - Args extends any[], - R = any ->(keys: T[], fn: (this: Record, ...args: Args) => R): ChainableFunction R>; - -type RunMode = "run" | "skip" | "only" | "todo" | "queued"; -type TaskState = RunMode | "pass" | "fail"; -interface TaskBase { - /** - * Unique task identifier. Based on the file id and the position of the task. - * The id of the file task is based on the file path relative to root and project name. - * It will not change between runs. - * @example `1201091390`, `1201091390_0`, `1201091390_0_1` - */ - id: string; - /** - * Task name provided by the user. If no name was provided, it will be an empty string. - */ - name: string; - /** - * Full name including the file path, any parent suites, and this task's name. - * - * Uses ` > ` as the separator between levels. - * - * @example - * // file - * 'test/task-names.test.ts' - * @example - * // suite - * 'test/task-names.test.ts > meal planning' - * 'test/task-names.test.ts > meal planning > grocery lists' - * @example - * // test - * 'test/task-names.test.ts > meal planning > grocery lists > calculates ingredients' - */ - fullName: string; - /** - * Full name excluding the file path, including any parent suites and this task's name. `undefined` for file tasks. - * - * Uses ` > ` as the separator between levels. - * - * @example - * // file - * undefined - * @example - * // suite - * 'meal planning' - * 'meal planning > grocery lists' - * @example - * // test - * 'meal planning > grocery lists > calculates ingredients' - */ - fullTestName?: string; - /** - * Task mode. - * - **skip**: task is skipped - * - **only**: only this task and other tasks with `only` mode will run - * - **todo**: task is marked as a todo, alias for `skip` - * - **run**: task will run or already ran - * - **queued**: task will start running next. It can only exist on the File - */ - mode: RunMode; - /** - * Custom metadata for the task. JSON reporter will save this data. - */ - meta: TaskMeta; - /** - * Whether the task was produced with `.each()` method. - */ - each?: boolean; - /** - * Whether the task should run concurrently with other tasks. - */ - concurrent?: boolean; - /** - * Whether the tasks of the suite run in a random order. - */ - shuffle?: boolean; - /** - * Suite that this task is part of. File task or the global suite will have no parent. - */ - suite?: Suite; - /** - * Result of the task. Suite and file tasks will only have the result if there - * was an error during collection or inside `afterAll`/`beforeAll`. - */ - result?: TaskResult; - /** - * The amount of times the task should be retried if it fails. - * @default 0 - */ - retry?: number; - /** - * The amount of times the task should be repeated after the successful run. - * If the task fails, it will not be retried unless `retry` is specified. - * @default 0 - */ - repeats?: number; - /** - * Location of the task in the file. This field is populated only if - * `includeTaskLocation` option is set. It is generated by calling `new Error` - * and parsing the stack trace, so the location might differ depending on the runtime. - */ - location?: { - line: number; - column: number; - }; - /** - * If the test was collected by parsing the file AST, and the name - * is not a static string, this property will be set to `true`. - * @experimental - */ - dynamic?: boolean; -} -interface TaskPopulated extends TaskBase { - /** - * File task. It's the root task of the file. - */ - file: File; - /** - * Whether the task should succeed if it fails. If the task fails, it will be marked as passed. - */ - fails?: boolean; - /** - * Store promises (from async expects) to wait for them before finishing the test - */ - promises?: Promise[]; -} -/** -* Custom metadata that can be used in reporters. -*/ -interface TaskMeta {} -/** -* The result of calling a task. -*/ -interface TaskResult { - /** - * State of the task. Inherits the `task.mode` during collection. - * When the task has finished, it will be changed to `pass` or `fail`. - * - **pass**: task ran successfully - * - **fail**: task failed - */ - state: TaskState; - /** - * Errors that occurred during the task execution. It is possible to have several errors - * if `expect.soft()` failed multiple times or `retry` was triggered. - */ - errors?: TestError[]; - /** - * How long in milliseconds the task took to run. - */ - duration?: number; - /** - * Time in milliseconds when the task started running. - */ - startTime?: number; - /** - * Heap size in bytes after the task finished. - * Only available if `logHeapUsage` option is set and `process.memoryUsage` is defined. - */ - heap?: number; - /** - * State of related to this task hooks. Useful during reporting. - */ - hooks?: Partial>; - /** - * The amount of times the task was retried. The task is retried only if it - * failed and `retry` option is set. - */ - retryCount?: number; - /** - * The amount of times the task was repeated. The task is repeated only if - * `repeats` option is set. This number also contains `retryCount`. - */ - repeatCount?: number; -} -/** The time spent importing & executing a non-externalized file. */ -interface ImportDuration { - /** The time spent importing & executing the file itself, not counting all non-externalized imports that the file does. */ - selfTime: number; - /** The time spent importing & executing the file and all its imports. */ - totalTime: number; - /** Will be set to `true`, if the module was externalized. In this case totalTime and selfTime are identical. */ - external?: boolean; - /** Which module imported this module first. All subsequent imports are cached. */ - importer?: string; -} -/** -* The tuple representing a single task update. -* Usually reported after the task finishes. -*/ -type TaskResultPack = [id: string, result: TaskResult | undefined, meta: TaskMeta]; -interface TaskEventData { - annotation?: TestAnnotation | undefined; - artifact?: TestArtifact | undefined; -} -type TaskEventPack = [id: string, event: TaskUpdateEvent, data: TaskEventData | undefined]; -type TaskUpdateEvent = "test-failed-early" | "suite-failed-early" | "test-prepare" | "test-finished" | "test-retried" | "suite-prepare" | "suite-finished" | "before-hook-start" | "before-hook-end" | "after-hook-start" | "after-hook-end" | "test-annotation" | "test-artifact"; -interface Suite extends TaskBase { - type: "suite"; - /** - * File task. It's the root task of the file. - */ - file: File; - /** - * An array of tasks that are part of the suite. - */ - tasks: Task[]; -} -interface File extends Suite { - /** - * The name of the pool that the file belongs to. - * @default 'forks' - */ - pool?: string; - /** - * The environment that processes the file on the server. - */ - viteEnvironment?: string; - /** - * The path to the file in UNIX format. - */ - filepath: string; - /** - * The name of the workspace project the file belongs to. - */ - projectName: string | undefined; - /** - * The time it took to collect all tests in the file. - * This time also includes importing all the file dependencies. - */ - collectDuration?: number; - /** - * The time it took to import the setup file. - */ - setupDuration?: number; - /** The time spent importing every non-externalized dependency that Vitest has processed. */ - importDurations?: Record; -} -interface Test extends TaskPopulated { - type: "test"; - /** - * Test context that will be passed to the test function. - */ - context: TestContext & ExtraContext; - /** - * The test timeout in milliseconds. - */ - timeout: number; - /** - * An array of custom annotations. - */ - annotations: TestAnnotation[]; - /** - * An array of artifacts produced by the test. - * - * @experimental - */ - artifacts: TestArtifact[]; - fullTestName: string; -} -type Task = Test | Suite | File; -type TestFunction = (context: TestContext & ExtraContext) => Awaitable | void; -type ExtractEachCallbackArgs> = { - 1: [T[0]]; - 2: [T[0], T[1]]; - 3: [T[0], T[1], T[2]]; - 4: [T[0], T[1], T[2], T[3]]; - 5: [T[0], T[1], T[2], T[3], T[4]]; - 6: [T[0], T[1], T[2], T[3], T[4], T[5]]; - 7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6]]; - 8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7]]; - 9: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8]]; - 10: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8], T[9]]; - fallback: Array ? U : any>; -}[T extends Readonly<[any]> ? 1 : T extends Readonly<[any, any]> ? 2 : T extends Readonly<[any, any, any]> ? 3 : T extends Readonly<[any, any, any, any]> ? 4 : T extends Readonly<[any, any, any, any, any]> ? 5 : T extends Readonly<[any, any, any, any, any, any]> ? 6 : T extends Readonly<[any, any, any, any, any, any, any]> ? 7 : T extends Readonly<[any, any, any, any, any, any, any, any]> ? 8 : T extends Readonly<[any, any, any, any, any, any, any, any, any]> ? 9 : T extends Readonly<[any, any, any, any, any, any, any, any, any, any]> ? 10 : "fallback"]; -interface EachFunctionReturn { - (name: string | Function, fn: (...args: T) => Awaitable, options?: number): void; - (name: string | Function, options: TestCollectorOptions, fn: (...args: T) => Awaitable): void; -} -interface TestEachFunction { - (cases: ReadonlyArray): EachFunctionReturn; - >(cases: ReadonlyArray): EachFunctionReturn>; - (cases: ReadonlyArray): EachFunctionReturn; - (...args: [TemplateStringsArray, ...any]): EachFunctionReturn; -} -interface TestForFunctionReturn< - Arg, - Context -> { - (name: string | Function, fn: (arg: Arg, context: Context) => Awaitable): void; - (name: string | Function, options: TestCollectorOptions, fn: (args: Arg, context: Context) => Awaitable): void; -} -interface TestForFunction { - (cases: ReadonlyArray): TestForFunctionReturn; - (strings: TemplateStringsArray, ...values: any[]): TestForFunctionReturn; -} -interface SuiteForFunction { - (cases: ReadonlyArray): EachFunctionReturn<[T]>; - (...args: [TemplateStringsArray, ...any]): EachFunctionReturn; -} -interface TestCollectorCallable { - (name: string | Function, fn?: TestFunction, options?: number): void; - (name: string | Function, options?: TestCollectorOptions, fn?: TestFunction): void; -} -type ChainableTestAPI = ChainableFunction<"concurrent" | "sequential" | "only" | "skip" | "todo" | "fails", TestCollectorCallable, { - each: TestEachFunction; - for: TestForFunction; -}>; -type TestCollectorOptions = Omit; -interface TestOptions { - /** - * Test timeout. - */ - timeout?: number; - /** - * Times to retry the test if fails. Useful for making flaky tests more stable. - * When retries is up, the last test error will be thrown. - * - * @default 0 - */ - retry?: number; - /** - * How many times the test will run again. - * Only inner tests will repeat if set on `describe()`, nested `describe()` will inherit parent's repeat by default. - * - * @default 0 - */ - repeats?: number; - /** - * Whether suites and tests run concurrently. - * Tests inherit `concurrent` from `describe()` and nested `describe()` will inherit from parent's `concurrent`. - */ - concurrent?: boolean; - /** - * Whether tests run sequentially. - * Tests inherit `sequential` from `describe()` and nested `describe()` will inherit from parent's `sequential`. - */ - sequential?: boolean; - /** - * Whether the tasks of the suite run in a random order. - */ - shuffle?: boolean; - /** - * Whether the test should be skipped. - */ - skip?: boolean; - /** - * Should this test be the only one running in a suite. - */ - only?: boolean; - /** - * Whether the test should be skipped and marked as a todo. - */ - todo?: boolean; - /** - * Whether the test is expected to fail. If it does, the test will pass, otherwise it will fail. - */ - fails?: boolean; -} -interface ExtendedAPI { - skipIf: (condition: any) => ChainableTestAPI; - runIf: (condition: any) => ChainableTestAPI; -} -interface Hooks { - beforeAll: typeof beforeAll; - afterAll: typeof afterAll; - beforeEach: typeof beforeEach; - afterEach: typeof afterEach; -} -type TestAPI = ChainableTestAPI & ExtendedAPI & Hooks & { - extend: = object>(fixtures: Fixtures) => TestAPI<{ [K in keyof T | keyof ExtraContext] : K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never }>; - scoped: (fixtures: Fixtures>) => void; -}; -interface FixtureOptions { - /** - * Whether to automatically set up current fixture, even though it's not being used in tests. - * @default false - */ - auto?: boolean; - /** - * Indicated if the injected value from the config should be preferred over the fixture value - */ - injected?: boolean; - /** - * When should the fixture be set up. - * - **test**: fixture will be set up before every test - * - **worker**: fixture will be set up once per worker - * - **file**: fixture will be set up once per file - * - * **Warning:** The `vmThreads` and `vmForks` pools initiate worker fixtures once per test file. - * @default 'test' - */ - scope?: "test" | "worker" | "file"; -} -type Use = (value: T) => Promise; -type FixtureFn< - T, - K extends keyof T, - ExtraContext -> = (context: Omit & ExtraContext, use: Use) => Promise; -type Fixture< - T, - K extends keyof T, - ExtraContext = object -> = ((...args: any) => any) extends T[K] ? T[K] extends any ? FixtureFn>> : never : T[K] | (T[K] extends any ? FixtureFn>> : never); -type Fixtures< - T extends Record, - ExtraContext = object -> = { [K in keyof T] : Fixture | [Fixture, FixtureOptions?] }; -type InferFixturesTypes = T extends TestAPI ? C : T; -interface SuiteCollectorCallable { - (name: string | Function, fn?: SuiteFactory, options?: number): SuiteCollector; - (name: string | Function, options: TestOptions, fn?: SuiteFactory): SuiteCollector; -} -type ChainableSuiteAPI = ChainableFunction<"concurrent" | "sequential" | "only" | "skip" | "todo" | "shuffle", SuiteCollectorCallable, { - each: TestEachFunction; - for: SuiteForFunction; -}>; -type SuiteAPI = ChainableSuiteAPI & { - skipIf: (condition: any) => ChainableSuiteAPI; - runIf: (condition: any) => ChainableSuiteAPI; -}; -interface BeforeAllListener { - (suite: Readonly): Awaitable; -} -interface AfterAllListener { - (suite: Readonly): Awaitable; -} -interface BeforeEachListener { - (context: TestContext & ExtraContext, suite: Readonly): Awaitable; -} -interface AfterEachListener { - (context: TestContext & ExtraContext, suite: Readonly): Awaitable; -} -interface SuiteHooks { - beforeAll: BeforeAllListener[]; - afterAll: AfterAllListener[]; - beforeEach: BeforeEachListener[]; - afterEach: AfterEachListener[]; -} -interface TaskCustomOptions extends TestOptions { - /** - * Whether the task was produced with `.each()` method. - */ - each?: boolean; - /** - * Custom metadata for the task that will be assigned to `task.meta`. - */ - meta?: Record; - /** - * Task fixtures. - */ - fixtures?: FixtureItem[]; - /** - * Function that will be called when the task is executed. - * If nothing is provided, the runner will try to get the function using `getFn(task)`. - * If the runner cannot find the function, the task will be marked as failed. - */ - handler?: (context: TestContext) => Awaitable; -} -interface SuiteCollector { - readonly name: string; - readonly mode: RunMode; - options?: TestOptions; - type: "collector"; - test: TestAPI; - tasks: (Suite | Test | SuiteCollector)[]; - scoped: (fixtures: Fixtures) => void; - fixtures: () => FixtureItem[] | undefined; - file?: File; - suite?: Suite; - task: (name: string, options?: TaskCustomOptions) => Test; - collect: (file: File) => Promise; - clear: () => void; - on: >(name: T, ...fn: SuiteHooks[T]) => void; -} -type SuiteFactory = (test: TestAPI) => Awaitable; -interface RuntimeContext { - tasks: (SuiteCollector | Test)[]; - currentSuite: SuiteCollector | null; -} -/** -* User's custom test context. -*/ -interface TestContext { - /** - * Metadata of the current test - */ - readonly task: Readonly; - /** - * An [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that will be aborted if the test times out or - * the test run was cancelled. - * @see {@link https://vitest.dev/guide/test-context#signal} - */ - readonly signal: AbortSignal; - /** - * Register a callback to run when this specific test fails. - * Useful when tests run concurrently. - * @see {@link https://vitest.dev/guide/test-context#ontestfailed} - */ - readonly onTestFailed: (fn: OnTestFailedHandler, timeout?: number) => void; - /** - * Register a callback to run when this specific test finishes. - * Useful when tests run concurrently. - * @see {@link https://vitest.dev/guide/test-context#ontestfinished} - */ - readonly onTestFinished: (fn: OnTestFinishedHandler, timeout?: number) => void; - /** - * Mark tests as skipped. All execution after this call will be skipped. - * This function throws an error, so make sure you are not catching it accidentally. - * @see {@link https://vitest.dev/guide/test-context#skip} - */ - readonly skip: { - (note?: string): never; - (condition: boolean, note?: string): void; - }; - /** - * Add a test annotation that will be displayed by your reporter. - * @see {@link https://vitest.dev/guide/test-context#annotate} - */ - readonly annotate: { - (message: string, type?: string, attachment?: TestAttachment): Promise; - (message: string, attachment?: TestAttachment): Promise; - }; -} -type OnTestFailedHandler = (context: TestContext) => Awaitable; -type OnTestFinishedHandler = (context: TestContext) => Awaitable; -interface TaskHook { - (fn: HookListener, timeout?: number): void; -} -type SequenceHooks = "stack" | "list" | "parallel"; -type SequenceSetupFiles = "list" | "parallel"; -/** -* Represents a file or data attachment associated with a test artifact. -* -* Attachments can be either file-based (via `path`) or inline content (via `body`). -* The `contentType` helps consumers understand how to interpret the attachment data. -*/ -interface TestAttachment { - /** MIME type of the attachment (e.g., 'image/png', 'text/plain') */ - contentType?: string; - /** File system path to the attachment */ - path?: string; - /** Inline attachment content as a string or raw binary data */ - body?: string | Uint8Array; -} -/** -* Source code location information for a test artifact. -* -* Indicates where in the source code the artifact originated from. -*/ -interface TestArtifactLocation { - /** Line number in the source file (1-indexed) */ - line: number; - /** Column number in the line (1-indexed) */ - column: number; - /** Path to the source file */ - file: string; -} -/** -* @experimental -* -* Base interface for all test artifacts. -* -* Extend this interface when creating custom test artifacts. Vitest automatically manages the `attachments` array and injects the `location` property to indicate where the artifact was created in your test code. -*/ -interface TestArtifactBase { - /** File or data attachments associated with this artifact */ - attachments?: TestAttachment[]; - /** Source location where this artifact was created */ - location?: TestArtifactLocation; -} -/** -* @deprecated Use {@linkcode TestArtifactLocation} instead. -* -* Kept for backwards compatibility. -*/ -type TestAnnotationLocation = TestArtifactLocation; -interface TestAnnotation { - message: string; - type: string; - location?: TestArtifactLocation; - attachment?: TestAttachment; -} -/** -* @experimental -* -* Artifact type for test annotations. -*/ -interface TestAnnotationArtifact extends TestArtifactBase { - type: "internal:annotation"; - annotation: TestAnnotation; -} -type VisualRegressionArtifactAttachment = TestAttachment & ({ - name: "reference" | "actual"; - width: number; - height: number; -} | { - name: "diff"; -}); -/** -* @experimental -* -* Artifact type for visual regressions. -*/ -interface VisualRegressionArtifact extends TestArtifactBase { - type: "internal:toMatchScreenshot"; - kind: "visual-regression"; - message: string; - attachments: VisualRegressionArtifactAttachment[]; -} -/** -* @experimental -* @advanced -* -* Registry for custom test artifact types. -* -* Augment this interface to register custom artifact types that your tests can produce. -* -* Each custom artifact should extend {@linkcode TestArtifactBase} and include a unique `type` discriminator property. -* -* @remarks -* - Use a `Symbol` as the **registry key** to guarantee uniqueness -* - The `type` property should follow the pattern `'package-name:artifact-name'`, `'internal:'` is a reserved prefix -* - Use `attachments` to include files or data; extend {@linkcode TestAttachment} for custom metadata -* - `location` property is automatically injected to indicate where the artifact was created -* -* @example -* ```ts -* // Define custom attachment type for generated PDF -* interface PDFAttachment extends TestAttachment { -* contentType: 'application/pdf' -* body: Uint8Array -* pageCount: number -* fileSize: number -* } -* -* interface PDFGenerationArtifact extends TestArtifactBase { -* type: 'my-plugin:pdf-generation' -* templateName: string -* isValid: boolean -* attachments: [PDFAttachment] -* } -* -* // Use a symbol to guarantee key uniqueness -* const pdfKey = Symbol('pdf-generation') -* -* declare module 'vitest' { -* interface TestArtifactRegistry { -* [pdfKey]: PDFGenerationArtifact -* } -* } -* -* // Custom assertion for PDF generation -* async function toGenerateValidPDF( -* this: MatcherState, -* actual: PDFTemplate, -* data: Record -* ): AsyncExpectationResult { -* const pdfBuffer = await actual.render(data) -* const validation = await validatePDF(pdfBuffer) -* -* await recordArtifact(this.task, { -* type: 'my-plugin:pdf-generation', -* templateName: actual.name, -* isValid: validation.success, -* attachments: [{ -* contentType: 'application/pdf', -* body: pdfBuffer, -* pageCount: validation.pageCount, -* fileSize: pdfBuffer.byteLength -* }] -* }) -* -* return { -* pass: validation.success, -* message: () => validation.success -* ? `Generated valid PDF with ${validation.pageCount} pages` -* : `Invalid PDF: ${validation.error}` -* } -* } -* ``` -*/ -interface TestArtifactRegistry {} -/** -* @experimental -* -* Union type of all test artifacts, including built-in and custom registered artifacts. -* -* This type automatically includes all artifacts registered via {@link TestArtifactRegistry}. -*/ -type TestArtifact = TestAnnotationArtifact | VisualRegressionArtifact | TestArtifactRegistry[keyof TestArtifactRegistry]; - -export { createChainable as c, afterAll as i, afterEach as j, beforeAll as k, beforeEach as l, onTestFinished as m, onTestFailed as o }; -export type { TestOptions as $, AfterAllListener as A, BeforeAllListener as B, ChainableFunction as C, TaskBase as D, TaskCustomOptions as E, File as F, TaskEventPack as G, TaskHook as H, ImportDuration as I, TaskMeta as J, TaskPopulated as K, TaskResult as L, TaskResultPack as M, TaskState as N, OnTestFailedHandler as O, TestAnnotation as P, TestAnnotationArtifact as Q, RunMode as R, Suite as S, Task as T, TestAnnotationLocation as U, TestArtifactBase as V, TestArtifactLocation as W, TestArtifactRegistry as X, TestAttachment as Y, TestContext as Z, TestFunction as _, Test as a, Use as a0, VisualRegressionArtifact as a1, TestArtifact as b, SuiteHooks as d, TaskUpdateEvent as e, TestAPI as f, SuiteAPI as g, SuiteCollector as h, AfterEachListener as n, BeforeEachListener as p, Fixture as q, FixtureFn as r, FixtureOptions as s, Fixtures as t, InferFixturesTypes as u, OnTestFinishedHandler as v, RuntimeContext as w, SequenceHooks as x, SequenceSetupFiles as y, SuiteFactory as z }; diff --git a/node_modules/@vitest/runner/dist/types.d.ts b/node_modules/@vitest/runner/dist/types.d.ts deleted file mode 100644 index ad636c3..0000000 --- a/node_modules/@vitest/runner/dist/types.d.ts +++ /dev/null @@ -1,183 +0,0 @@ -import { DiffOptions } from '@vitest/utils/diff'; -import { F as File, a as Test, S as Suite, M as TaskResultPack, G as TaskEventPack, P as TestAnnotation, b as TestArtifact, Z as TestContext, I as ImportDuration, x as SequenceHooks, y as SequenceSetupFiles } from './tasks.d-BUa1HjoW.js'; -export { A as AfterAllListener, n as AfterEachListener, B as BeforeAllListener, p as BeforeEachListener, q as Fixture, r as FixtureFn, s as FixtureOptions, t as Fixtures, u as InferFixturesTypes, O as OnTestFailedHandler, v as OnTestFinishedHandler, R as RunMode, w as RuntimeContext, g as SuiteAPI, h as SuiteCollector, z as SuiteFactory, d as SuiteHooks, T as Task, D as TaskBase, E as TaskCustomOptions, H as TaskHook, J as TaskMeta, K as TaskPopulated, L as TaskResult, N as TaskState, e as TaskUpdateEvent, f as TestAPI, Q as TestAnnotationArtifact, U as TestAnnotationLocation, V as TestArtifactBase, W as TestArtifactLocation, X as TestArtifactRegistry, Y as TestAttachment, _ as TestFunction, $ as TestOptions, a0 as Use, a1 as VisualRegressionArtifact } from './tasks.d-BUa1HjoW.js'; -import '@vitest/utils'; - -/** -* This is a subset of Vitest config that's required for the runner to work. -*/ -interface VitestRunnerConfig { - root: string; - setupFiles: string[]; - name?: string; - passWithNoTests: boolean; - testNamePattern?: RegExp; - allowOnly?: boolean; - sequence: { - shuffle?: boolean; - concurrent?: boolean; - seed: number; - hooks: SequenceHooks; - setupFiles: SequenceSetupFiles; - }; - chaiConfig?: { - truncateThreshold?: number; - }; - maxConcurrency: number; - testTimeout: number; - hookTimeout: number; - retry: number; - includeTaskLocation?: boolean; - diffOptions?: DiffOptions; -} -/** -* Possible options to run a single file in a test. -*/ -interface FileSpecification { - filepath: string; - testLocations: number[] | undefined; -} -type VitestRunnerImportSource = "collect" | "setup"; -interface VitestRunnerConstructor { - new (config: VitestRunnerConfig): VitestRunner; -} -type CancelReason = "keyboard-input" | "test-failure" | (string & Record); -interface VitestRunner { - /** - * First thing that's getting called before actually collecting and running tests. - */ - onBeforeCollect?: (paths: string[]) => unknown; - /** - * Called after the file task was created but not collected yet. - */ - onCollectStart?: (file: File) => unknown; - /** - * Called after collecting tests and before "onBeforeRun". - */ - onCollected?: (files: File[]) => unknown; - /** - * Called when test runner should cancel next test runs. - * Runner should listen for this method and mark tests and suites as skipped in - * "onBeforeRunSuite" and "onBeforeRunTask" when called. - */ - cancel?: (reason: CancelReason) => unknown; - /** - * Called before running a single test. Doesn't have "result" yet. - */ - onBeforeRunTask?: (test: Test) => unknown; - /** - * Called before actually running the test function. Already has "result" with "state" and "startTime". - */ - onBeforeTryTask?: (test: Test, options: { - retry: number; - repeats: number; - }) => unknown; - /** - * When the task has finished running, but before cleanup hooks are called - */ - onTaskFinished?: (test: Test) => unknown; - /** - * Called after result and state are set. - */ - onAfterRunTask?: (test: Test) => unknown; - /** - * Called right after running the test function. Doesn't have new state yet. Will not be called, if the test function throws. - */ - onAfterTryTask?: (test: Test, options: { - retry: number; - repeats: number; - }) => unknown; - /** - * Called after the retry resolution happend. Unlike `onAfterTryTask`, the test now has a new state. - * All `after` hooks were also called by this point. - */ - onAfterRetryTask?: (test: Test, options: { - retry: number; - repeats: number; - }) => unknown; - /** - * Called before running a single suite. Doesn't have "result" yet. - */ - onBeforeRunSuite?: (suite: Suite) => unknown; - /** - * Called after running a single suite. Has state and result. - */ - onAfterRunSuite?: (suite: Suite) => unknown; - /** - * If defined, will be called instead of usual Vitest suite partition and handling. - * "before" and "after" hooks will not be ignored. - */ - runSuite?: (suite: Suite) => Promise; - /** - * If defined, will be called instead of usual Vitest handling. Useful, if you have your custom test function. - * "before" and "after" hooks will not be ignored. - */ - runTask?: (test: Test) => Promise; - /** - * Called, when a task is updated. The same as "onTaskUpdate" in a reporter, but this is running in the same thread as tests. - */ - onTaskUpdate?: (task: TaskResultPack[], events: TaskEventPack[]) => Promise; - /** - * Called when annotation is added via the `context.annotate` method. - */ - onTestAnnotate?: (test: Test, annotation: TestAnnotation) => Promise; - /** - * @experimental - * - * Called when artifacts are recorded on tests via the `recordArtifact` utility. - */ - onTestArtifactRecord?: (test: Test, artifact: Artifact) => Promise; - /** - * Called before running all tests in collected paths. - */ - onBeforeRunFiles?: (files: File[]) => unknown; - /** - * Called right after running all tests in collected paths. - */ - onAfterRunFiles?: (files: File[]) => unknown; - /** - * Called when new context for a test is defined. Useful if you want to add custom properties to the context. - * If you only want to define custom context, consider using "beforeAll" in "setupFiles" instead. - * - * @see https://vitest.dev/advanced/runner#your-task-function - */ - extendTaskContext?: (context: TestContext) => TestContext; - /** - * Called when test and setup files are imported. Can be called in two situations: when collecting tests and when importing setup files. - */ - importFile: (filepath: string, source: VitestRunnerImportSource) => unknown; - /** - * Function that is called when the runner attempts to get the value when `test.extend` is used with `{ injected: true }` - */ - injectValue?: (key: string) => unknown; - /** - * Gets the time spent importing each individual non-externalized file that Vitest collected. - */ - getImportDurations?: () => Record; - /** - * Publicly available configuration. - */ - config: VitestRunnerConfig; - /** - * The name of the current pool. Can affect how stack trace is inferred on the server side. - */ - pool?: string; - /** - * The current Vite environment that processes the files on the server. - */ - viteEnvironment?: string; - /** - * Return the worker context for fixtures specified with `scope: 'worker'` - */ - getWorkerContext?: () => Record; - onCleanupWorkerContext?: (cleanup: () => unknown) => void; - trace?(name: string, cb: () => T): T; - trace?(name: string, attributes: Record, cb: () => T): T; - /** @private */ - _currentTaskStartTime?: number; - /** @private */ - _currentTaskTimeout?: number; -} - -export { File, ImportDuration, SequenceHooks, SequenceSetupFiles, Suite, TaskEventPack, TaskResultPack, Test, TestAnnotation, TestArtifact, TestContext }; -export type { CancelReason, FileSpecification, VitestRunner, VitestRunnerConfig, VitestRunnerConstructor, VitestRunnerImportSource }; diff --git a/node_modules/@vitest/runner/dist/types.js b/node_modules/@vitest/runner/dist/types.js deleted file mode 100644 index 8b13789..0000000 --- a/node_modules/@vitest/runner/dist/types.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/@vitest/runner/dist/utils.d.ts b/node_modules/@vitest/runner/dist/utils.d.ts deleted file mode 100644 index b96f618..0000000 --- a/node_modules/@vitest/runner/dist/utils.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { S as Suite, F as File, T as Task, a as Test } from './tasks.d-BUa1HjoW.js'; -export { C as ChainableFunction, c as createChainable } from './tasks.d-BUa1HjoW.js'; -import { ParsedStack, Arrayable } from '@vitest/utils'; - -/** -* If any tasks been marked as `only`, mark all other tasks as `skip`. -*/ -declare function interpretTaskModes(file: Suite, namePattern?: string | RegExp, testLocations?: number[] | undefined, onlyMode?: boolean, parentIsOnly?: boolean, allowOnly?: boolean): void; -declare function someTasksAreOnly(suite: Suite): boolean; -declare function generateHash(str: string): string; -declare function calculateSuiteHash(parent: Suite): void; -declare function createFileTask(filepath: string, root: string, projectName: string | undefined, pool?: string, viteEnvironment?: string): File; -/** -* Generate a unique ID for a file based on its path and project name -* @param file File relative to the root of the project to keep ID the same between different machines -* @param projectName The name of the test project -*/ -declare function generateFileHash(file: string, projectName: string | undefined): string; -declare function findTestFileStackTrace(testFilePath: string, error: string): ParsedStack | undefined; - -/** -* Return a function for running multiple async operations with limited concurrency. -*/ -declare function limitConcurrency(concurrency?: number): < - Args extends unknown[], - T ->(func: (...args: Args) => PromiseLike | T, ...args: Args) => Promise; - -/** -* Partition in tasks groups by consecutive concurrent -*/ -declare function partitionSuiteChildren(suite: Suite): Task[][]; - -declare function isTestCase(s: Task): s is Test; -declare function getTests(suite: Arrayable): Test[]; -declare function getTasks(tasks?: Arrayable): Task[]; -declare function getSuites(suite: Arrayable): Suite[]; -declare function hasTests(suite: Arrayable): boolean; -declare function hasFailed(suite: Arrayable): boolean; -declare function getNames(task: Task): string[]; -declare function getFullName(task: Task, separator?: string): string; -declare function getTestName(task: Task, separator?: string): string; -declare function createTaskName(names: readonly (string | undefined)[], separator?: string): string; - -export { calculateSuiteHash, createFileTask, createTaskName, findTestFileStackTrace, generateFileHash, generateHash, getFullName, getNames, getSuites, getTasks, getTestName, getTests, hasFailed, hasTests, interpretTaskModes, isTestCase, limitConcurrency, partitionSuiteChildren, someTasksAreOnly }; diff --git a/node_modules/@vitest/runner/dist/utils.js b/node_modules/@vitest/runner/dist/utils.js deleted file mode 100644 index 24362a4..0000000 --- a/node_modules/@vitest/runner/dist/utils.js +++ /dev/null @@ -1,5 +0,0 @@ -export { a as calculateSuiteHash, c as createChainable, b as createFileTask, e as createTaskName, f as findTestFileStackTrace, g as generateFileHash, d as generateHash, h as getFullName, j as getNames, k as getSuites, m as getTasks, n as getTestName, o as getTests, q as hasFailed, r as hasTests, i as interpretTaskModes, t as isTestCase, l as limitConcurrency, p as partitionSuiteChildren, s as someTasksAreOnly } from './chunk-tasks.js'; -import '@vitest/utils/error'; -import '@vitest/utils/source-map'; -import 'pathe'; -import '@vitest/utils/helpers'; diff --git a/node_modules/@vitest/runner/package.json b/node_modules/@vitest/runner/package.json deleted file mode 100644 index 0733f60..0000000 --- a/node_modules/@vitest/runner/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@vitest/runner", - "type": "module", - "version": "4.0.16", - "description": "Vitest test runner", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/runner#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/runner" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": true, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./utils": { - "types": "./dist/utils.d.ts", - "default": "./dist/utils.js" - }, - "./types": { - "types": "./dist/types.d.ts", - "default": "./dist/types.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "*.d.ts", - "dist" - ], - "dependencies": { - "pathe": "^2.0.3", - "@vitest/utils": "4.0.16" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/runner/types.d.ts b/node_modules/@vitest/runner/types.d.ts deleted file mode 100644 index 26a1254..0000000 --- a/node_modules/@vitest/runner/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/types.js' diff --git a/node_modules/@vitest/runner/utils.d.ts b/node_modules/@vitest/runner/utils.d.ts deleted file mode 100644 index e3f344e..0000000 --- a/node_modules/@vitest/runner/utils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/utils.js' diff --git a/node_modules/@vitest/snapshot/LICENSE b/node_modules/@vitest/snapshot/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/snapshot/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/snapshot/README.md b/node_modules/@vitest/snapshot/README.md deleted file mode 100644 index edf0817..0000000 --- a/node_modules/@vitest/snapshot/README.md +++ /dev/null @@ -1,84 +0,0 @@ -# @vitest/snapshot - -Lightweight implementation of Jest's snapshots. - -## Usage - -```js -import { SnapshotClient } from '@vitest/snapshot' -import { NodeSnapshotEnvironment } from '@vitest/snapshot/environment' -import { SnapshotManager } from '@vitest/snapshot/manager' - -const client = new SnapshotClient({ - // you need to provide your own equality check implementation if you use it - // this function is called when `.toMatchSnapshot({ property: 1 })` is called - isEqual: (received, expected) => - equals(received, expected, [iterableEquality, subsetEquality]), -}) - -// class that implements snapshot saving and reading -// by default uses fs module, but you can provide your own implementation depending on the environment -const environment = new NodeSnapshotEnvironment() - -// you need to implement this yourselves, -// this depends on your runner -function getCurrentFilepath() { - return '/file.spec.js' -} -function getCurrentTestName() { - return 'test1' -} - -// example for inline snapshots, nothing is required to support regular snapshots, -// just call `assert` with `isInline: false` -function wrapper(received) { - function __INLINE_SNAPSHOT__(inlineSnapshot, message) { - client.assert({ - received, - message, - isInline: true, - inlineSnapshot, - filepath: getCurrentFilepath(), - name: getCurrentTestName(), - }) - } - return { - // the name is hard-coded, it should be inside another function, so Vitest can find the actual test file where it was called (parses call stack trace + 2) - // you can override this behaviour in SnapshotState's `_inferInlineSnapshotStack` method by providing your own SnapshotState to SnapshotClient constructor - toMatchInlineSnapshot: (...args) => __INLINE_SNAPSHOT__(...args), - } -} - -const options = { - updateSnapshot: 'new', - snapshotEnvironment: environment, -} - -await client.startCurrentRun( - getCurrentFilepath(), - getCurrentTestName(), - options -) - -// this will save snapshot to a file which is returned by "snapshotEnvironment.resolvePath" -client.assert({ - received: 'some text', - isInline: false, -}) - -// uses "pretty-format", so it requires quotes -// also naming is hard-coded when parsing test files -wrapper('text 1').toMatchInlineSnapshot() -wrapper('text 2').toMatchInlineSnapshot('"text 2"') - -const result = await client.finishCurrentRun() // this saves files and returns SnapshotResult - -// you can use manager to manage several clients -const manager = new SnapshotManager(options) -manager.add(result) - -// do something -// and then read the summary - -console.log(manager.summary) -``` diff --git a/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts b/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts deleted file mode 100644 index 435ae4f..0000000 --- a/node_modules/@vitest/snapshot/dist/environment.d-DHdQ1Csl.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -interface ParsedStack { - method: string; - file: string; - line: number; - column: number; -} - -interface SnapshotEnvironment { - getVersion: () => string; - getHeader: () => string; - resolvePath: (filepath: string) => Promise; - resolveRawPath: (testPath: string, rawPath: string) => Promise; - saveSnapshotFile: (filepath: string, snapshot: string) => Promise; - readSnapshotFile: (filepath: string) => Promise; - removeSnapshotFile: (filepath: string) => Promise; - processStackTrace?: (stack: ParsedStack) => ParsedStack; -} -interface SnapshotEnvironmentOptions { - snapshotsDirName?: string; -} - -export type { ParsedStack as P, SnapshotEnvironment as S, SnapshotEnvironmentOptions as a }; diff --git a/node_modules/@vitest/snapshot/dist/environment.d.ts b/node_modules/@vitest/snapshot/dist/environment.d.ts deleted file mode 100644 index efa86bc..0000000 --- a/node_modules/@vitest/snapshot/dist/environment.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { S as SnapshotEnvironment, a as SnapshotEnvironmentOptions } from './environment.d-DHdQ1Csl.js'; - -declare class NodeSnapshotEnvironment implements SnapshotEnvironment { - private options; - constructor(options?: SnapshotEnvironmentOptions); - getVersion(): string; - getHeader(): string; - resolveRawPath(testPath: string, rawPath: string): Promise; - resolvePath(filepath: string): Promise; - prepareDirectory(dirPath: string): Promise; - saveSnapshotFile(filepath: string, snapshot: string): Promise; - readSnapshotFile(filepath: string): Promise; - removeSnapshotFile(filepath: string): Promise; -} - -export { NodeSnapshotEnvironment, SnapshotEnvironment }; diff --git a/node_modules/@vitest/snapshot/dist/environment.js b/node_modules/@vitest/snapshot/dist/environment.js deleted file mode 100644 index 079b478..0000000 --- a/node_modules/@vitest/snapshot/dist/environment.js +++ /dev/null @@ -1,40 +0,0 @@ -import { promises, existsSync } from 'node:fs'; -import { resolve, isAbsolute, dirname, join, basename } from 'pathe'; - -class NodeSnapshotEnvironment { - constructor(options = {}) { - this.options = options; - } - getVersion() { - return "1"; - } - getHeader() { - return `// Snapshot v${this.getVersion()}`; - } - async resolveRawPath(testPath, rawPath) { - return isAbsolute(rawPath) ? rawPath : resolve(dirname(testPath), rawPath); - } - async resolvePath(filepath) { - return join(join(dirname(filepath), this.options.snapshotsDirName ?? "__snapshots__"), `${basename(filepath)}.snap`); - } - async prepareDirectory(dirPath) { - await promises.mkdir(dirPath, { recursive: true }); - } - async saveSnapshotFile(filepath, snapshot) { - await promises.mkdir(dirname(filepath), { recursive: true }); - await promises.writeFile(filepath, snapshot, "utf-8"); - } - async readSnapshotFile(filepath) { - if (!existsSync(filepath)) { - return null; - } - return promises.readFile(filepath, "utf-8"); - } - async removeSnapshotFile(filepath) { - if (existsSync(filepath)) { - await promises.unlink(filepath); - } - } -} - -export { NodeSnapshotEnvironment }; diff --git a/node_modules/@vitest/snapshot/dist/index.d.ts b/node_modules/@vitest/snapshot/dist/index.d.ts deleted file mode 100644 index 260d8ed..0000000 --- a/node_modules/@vitest/snapshot/dist/index.d.ts +++ /dev/null @@ -1,130 +0,0 @@ -import { S as SnapshotStateOptions, a as SnapshotMatchOptions, b as SnapshotResult, R as RawSnapshotInfo } from './rawSnapshot.d-lFsMJFUd.js'; -export { c as SnapshotData, d as SnapshotSerializer, e as SnapshotSummary, f as SnapshotUpdateState, U as UncheckedSnapshot } from './rawSnapshot.d-lFsMJFUd.js'; -import { S as SnapshotEnvironment, P as ParsedStack } from './environment.d-DHdQ1Csl.js'; -import { Plugin, Plugins } from '@vitest/pretty-format'; - -/** -* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -declare class DefaultMap< - K, - V -> extends Map { - private defaultFn; - constructor(defaultFn: (key: K) => V, entries?: Iterable); - get(key: K): V; -} -declare class CounterMap extends DefaultMap { - constructor(); - _total: number | undefined; - valueOf(): number; - increment(key: K): void; - total(): number; -} - -interface SnapshotReturnOptions { - actual: string; - count: number; - expected?: string; - key: string; - pass: boolean; -} -interface SaveStatus { - deleted: boolean; - saved: boolean; -} -declare class SnapshotState { - testFilePath: string; - snapshotPath: string; - private _counters; - private _dirty; - private _updateSnapshot; - private _snapshotData; - private _initialData; - private _inlineSnapshots; - private _inlineSnapshotStacks; - private _testIdToKeys; - private _rawSnapshots; - private _uncheckedKeys; - private _snapshotFormat; - private _environment; - private _fileExists; - expand: boolean; - private _added; - private _matched; - private _unmatched; - private _updated; - get added(): CounterMap; - set added(value: number); - get matched(): CounterMap; - set matched(value: number); - get unmatched(): CounterMap; - set unmatched(value: number); - get updated(): CounterMap; - set updated(value: number); - private constructor(); - static create(testFilePath: string, options: SnapshotStateOptions): Promise; - get environment(): SnapshotEnvironment; - markSnapshotsAsCheckedForTest(testName: string): void; - clearTest(testId: string): void; - protected _inferInlineSnapshotStack(stacks: ParsedStack[]): ParsedStack | null; - private _addSnapshot; - save(): Promise; - getUncheckedCount(): number; - getUncheckedKeys(): Array; - removeUncheckedKeys(): void; - match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot }: SnapshotMatchOptions): SnapshotReturnOptions; - pack(): Promise; -} - -interface AssertOptions { - received: unknown; - filepath: string; - name: string; - /** - * Not required but needed for `SnapshotClient.clearTest` to implement test-retry behavior. - * @default name - */ - testId?: string; - message?: string; - isInline?: boolean; - properties?: object; - inlineSnapshot?: string; - error?: Error; - errorMessage?: string; - rawSnapshot?: RawSnapshotInfo; -} -interface SnapshotClientOptions { - isEqual?: (received: unknown, expected: unknown) => boolean; -} -declare class SnapshotClient { - private options; - snapshotStateMap: Map; - constructor(options?: SnapshotClientOptions); - setup(filepath: string, options: SnapshotStateOptions): Promise; - finish(filepath: string): Promise; - skipTest(filepath: string, testName: string): void; - clearTest(filepath: string, testId: string): void; - getSnapshotState(filepath: string): SnapshotState; - assert(options: AssertOptions): void; - assertRaw(options: AssertOptions): Promise; - clear(): void; -} - -declare function stripSnapshotIndentation(inlineSnapshot: string): string; - -/** -* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -declare function addSerializer(plugin: Plugin): void; -declare function getSerializers(): Plugins; - -export { SnapshotClient, SnapshotEnvironment, SnapshotMatchOptions, SnapshotResult, SnapshotState, SnapshotStateOptions, addSerializer, getSerializers, stripSnapshotIndentation }; diff --git a/node_modules/@vitest/snapshot/dist/index.js b/node_modules/@vitest/snapshot/dist/index.js deleted file mode 100644 index 40d564e..0000000 --- a/node_modules/@vitest/snapshot/dist/index.js +++ /dev/null @@ -1,1437 +0,0 @@ -import { resolve } from 'pathe'; -import { plugins, format } from '@vitest/pretty-format'; - -// src/vlq.ts -var comma = ",".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} - -// src/trace-mapping.ts - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; - -// src/binary-search.ts -var found = false; -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + (high - low >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - low = lastIndex === -1 ? 0 : lastIndex; - } else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return state.lastIndex = binarySearch(haystack, needle, low, high); -} - -// src/trace-mapping.ts -var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; -var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; -var LEAST_UPPER_BOUND = -1; -var GREATEST_LOWER_BOUND = 1; -function cast(map) { - return map; -} -function decodedMappings(map) { - var _a; - return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded)); -} -function originalPositionFor(map, needle) { - let { line, column, bias } = needle; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - if (line >= decoded.length) return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - bias || GREATEST_LOWER_BOUND - ); - if (index === -1) return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping( - resolvedSources[segment[SOURCES_INDEX]], - segment[SOURCE_LINE] + 1, - segment[SOURCE_COLUMN], - segment.length === 5 ? names[segment[NAMES_INDEX]] : null - ); -} -function OMapping(source, line, column, name) { - return { source, line, column, name }; -} -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } else if (bias === LEAST_UPPER_BOUND) index++; - if (index === -1 || index === segments.length) return -1; - return index; -} - -function notNullish(v) { - return v != null; -} -function isPrimitive(value) { - return value === null || typeof value !== "function" && typeof value !== "object"; -} -function isObject(item) { - return item != null && typeof item === "object" && !Array.isArray(item); -} -/** -* If code starts with a function call, will return its last index, respecting arguments. -* This will return 25 - last ending character of toMatch ")" -* Also works with callbacks -* ``` -* toMatch({ test: '123' }); -* toBeAliased('123') -* ``` -*/ -function getCallLastIndex(code) { - let charIndex = -1; - let inString = null; - let startedBracers = 0; - let endedBracers = 0; - let beforeChar = null; - while (charIndex <= code.length) { - beforeChar = code[charIndex]; - charIndex++; - const char = code[charIndex]; - const isCharString = char === "\"" || char === "'" || char === "`"; - if (isCharString && beforeChar !== "\\") { - if (inString === char) { - inString = null; - } else if (!inString) { - inString = char; - } - } - if (!inString) { - if (char === "(") { - startedBracers++; - } - if (char === ")") { - endedBracers++; - } - } - if (startedBracers && endedBracers && startedBracers === endedBracers) { - return charIndex; - } - } - return null; -} - -const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m; -const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/; -const stackIgnorePatterns = [ - "node:internal", - /\/packages\/\w+\/dist\//, - /\/@vitest\/\w+\/dist\//, - "/vitest/dist/", - "/vitest/src/", - "/node_modules/chai/", - "/node_modules/tinyspy/", - "/vite/dist/node/module-runner", - "/rolldown-vite/dist/node/module-runner", - "/deps/chunk-", - "/deps/@vitest", - "/deps/loupe", - "/deps/chai", - "/browser-playwright/dist/locators.js", - "/browser-webdriverio/dist/locators.js", - "/browser-preview/dist/locators.js", - /node:\w+/, - /__vitest_test__/, - /__vitest_browser__/, - /\/deps\/vitest_/ -]; -function extractLocation(urlLike) { - // Fail-fast but return locations like "(native)" - if (!urlLike.includes(":")) { - return [urlLike]; - } - const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/; - const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, "")); - if (!parts) { - return [urlLike]; - } - let url = parts[1]; - if (url.startsWith("async ")) { - url = url.slice(6); - } - if (url.startsWith("http:") || url.startsWith("https:")) { - const urlObj = new URL(url); - urlObj.searchParams.delete("import"); - urlObj.searchParams.delete("browserv"); - url = urlObj.pathname + urlObj.hash + urlObj.search; - } - if (url.startsWith("/@fs/")) { - const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url); - url = url.slice(isWindows ? 5 : 4); - } - return [ - url, - parts[2] || undefined, - parts[3] || undefined - ]; -} -function parseSingleFFOrSafariStack(raw) { - let line = raw.trim(); - if (SAFARI_NATIVE_CODE_REGEXP.test(line)) { - return null; - } - if (line.includes(" > eval")) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1"); - } - // Early return for lines that don't look like Firefox/Safari stack traces - // Firefox/Safari stack traces must contain '@' and should have location info after it - if (!line.includes("@")) { - return null; - } - // Find the correct @ that separates function name from location - // For cases like '@https://@fs/path' or 'functionName@https://@fs/path' - // we need to find the first @ that precedes a valid location (containing :) - let atIndex = -1; - let locationPart = ""; - let functionName; - // Try each @ from left to right to find the one that gives us a valid location - for (let i = 0; i < line.length; i++) { - if (line[i] === "@") { - const candidateLocation = line.slice(i + 1); - // Minimum length 3 for valid location: 1 for filename + 1 for colon + 1 for line number (e.g., "a:1") - if (candidateLocation.includes(":") && candidateLocation.length >= 3) { - atIndex = i; - locationPart = candidateLocation; - functionName = i > 0 ? line.slice(0, i) : undefined; - break; - } - } - } - // Validate we found a valid location with minimum length (filename:line format) - if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) { - return null; - } - const [url, lineNumber, columnNumber] = extractLocation(locationPart); - if (!url || !lineNumber || !columnNumber) { - return null; - } - return { - file: url, - method: functionName || "", - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} -// Based on https://github.com/stacktracejs/error-stack-parser -// Credit to stacktracejs -function parseSingleV8Stack(raw) { - let line = raw.trim(); - if (!CHROME_IE_STACK_REGEXP.test(line)) { - return null; - } - if (line.includes("(eval ")) { - line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""); - } - let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""); - // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)" in - // case it has spaces in it, as the string is split on \s+ later on - const location = sanitizedLine.match(/ (\(.+\)$)/); - // remove the parenthesized location from the line, if it was matched - sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine; - // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine - // because this line doesn't have function name - const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine); - let method = location && sanitizedLine || ""; - let file = url && ["eval", ""].includes(url) ? undefined : url; - if (!file || !lineNumber || !columnNumber) { - return null; - } - if (method.startsWith("async ")) { - method = method.slice(6); - } - if (file.startsWith("file://")) { - file = file.slice(7); - } - // normalize Windows path (\ -> /) - file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file); - if (method) { - method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, ""); - } - return { - method, - file, - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} -function parseStacktrace(stack, options = {}) { - const { ignoreStackEntries = stackIgnorePatterns } = options; - const stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack); - return stacks.map((stack) => { - var _options$getSourceMap; - if (options.getUrlId) { - stack.file = options.getUrlId(stack.file); - } - const map = (_options$getSourceMap = options.getSourceMap) === null || _options$getSourceMap === void 0 ? void 0 : _options$getSourceMap.call(options, stack.file); - if (!map || typeof map !== "object" || !map.version) { - return shouldFilter(ignoreStackEntries, stack.file) ? null : stack; - } - const traceMap = new DecodedMap(map, stack.file); - const position = getOriginalPosition(traceMap, stack); - if (!position) { - return stack; - } - const { line, column, source, name } = position; - let file = source || stack.file; - if (file.match(/\/\w:\//)) { - file = file.slice(1); - } - if (shouldFilter(ignoreStackEntries, file)) { - return null; - } - if (line != null && column != null) { - return { - line, - column, - file, - method: name || stack.method - }; - } - return stack; - }).filter((s) => s != null); -} -function shouldFilter(ignoreStackEntries, file) { - return ignoreStackEntries.some((p) => file.match(p)); -} -function parseFFOrSafariStackTrace(stack) { - return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish); -} -function parseV8Stacktrace(stack) { - return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish); -} -function parseErrorStacktrace(e, options = {}) { - if (!e || isPrimitive(e)) { - return []; - } - if ("stacks" in e && e.stacks) { - return e.stacks; - } - const stackStr = e.stack || ""; - // if "stack" property was overwritten at runtime to be something else, - // ignore the value because we don't know how to process it - let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : []; - if (!stackFrames.length) { - const e_ = e; - if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) { - stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options); - } - if (e_.sourceURL != null && e_.line != null && e_._column != null) { - stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options); - } - } - if (options.frameFilter) { - stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false); - } - e.stacks = stackFrames; - return stackFrames; -} -class DecodedMap { - _encoded; - _decoded; - _decodedMemo; - url; - version; - names = []; - resolvedSources; - constructor(map, from) { - this.map = map; - const { mappings, names, sources } = map; - this.version = map.version; - this.names = names || []; - this._encoded = mappings || ""; - this._decodedMemo = memoizedState(); - this.url = from; - this.resolvedSources = (sources || []).map((s) => resolve(s || "", from)); - } -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1 - }; -} -function getOriginalPosition(map, needle) { - const result = originalPositionFor(map, needle); - if (result.column == null) { - return null; - } - return result; -} - -const lineSplitRE = /\r?\n/; -function positionToOffset(source, lineNumber, columnNumber) { - const lines = source.split(lineSplitRE); - const nl = /\r\n/.test(source) ? 2 : 1; - let start = 0; - if (lineNumber > lines.length) { - return source.length; - } - for (let i = 0; i < lineNumber - 1; i++) { - start += lines[i].length + nl; - } - return start + columnNumber; -} -function offsetToLineNumber(source, offset) { - if (offset > source.length) { - throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`); - } - const lines = source.split(lineSplitRE); - const nl = /\r\n/.test(source) ? 2 : 1; - let counted = 0; - let line = 0; - for (; line < lines.length; line++) { - const lineLength = lines[line].length + nl; - if (counted + lineLength >= offset) { - break; - } - counted += lineLength; - } - return line + 1; -} - -async function saveInlineSnapshots(environment, snapshots) { - const MagicString = (await import('magic-string')).default; - const files = new Set(snapshots.map((i) => i.file)); - await Promise.all(Array.from(files).map(async (file) => { - const snaps = snapshots.filter((i) => i.file === file); - const code = await environment.readSnapshotFile(file); - const s = new MagicString(code); - for (const snap of snaps) { - const index = positionToOffset(code, snap.line, snap.column); - replaceInlineSnap(code, s, index, snap.snapshot); - } - const transformed = s.toString(); - if (transformed !== code) { - await environment.saveSnapshotFile(file, transformed); - } - })); -} -const startObjectRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*\{/; -function replaceObjectSnap(code, s, index, newSnap) { - let _code = code.slice(index); - const startMatch = startObjectRegex.exec(_code); - if (!startMatch) { - return false; - } - _code = _code.slice(startMatch.index); - let callEnd = getCallLastIndex(_code); - if (callEnd === null) { - return false; - } - callEnd += index + startMatch.index; - const shapeStart = index + startMatch.index + startMatch[0].length; - const shapeEnd = getObjectShapeEndIndex(code, shapeStart); - const snap = `, ${prepareSnapString(newSnap, code, index)}`; - if (shapeEnd === callEnd) { - // toMatchInlineSnapshot({ foo: expect.any(String) }) - s.appendLeft(callEnd, snap); - } else { - // toMatchInlineSnapshot({ foo: expect.any(String) }, ``) - s.overwrite(shapeEnd, callEnd, snap); - } - return true; -} -function getObjectShapeEndIndex(code, index) { - let startBraces = 1; - let endBraces = 0; - while (startBraces !== endBraces && index < code.length) { - const s = code[index++]; - if (s === "{") { - startBraces++; - } else if (s === "}") { - endBraces++; - } - } - return index; -} -function prepareSnapString(snap, source, index) { - const lineNumber = offsetToLineNumber(source, index); - const line = source.split(lineSplitRE)[lineNumber - 1]; - const indent = line.match(/^\s*/)[0] || ""; - const indentNext = indent.includes(" ") ? `${indent}\t` : `${indent} `; - const lines = snap.trim().replace(/\\/g, "\\\\").split(/\n/g); - const isOneline = lines.length <= 1; - const quote = "`"; - if (isOneline) { - return `${quote}${lines.join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")}${quote}`; - } - return `${quote}\n${lines.map((i) => i ? indentNext + i : "").join("\n").replace(/`/g, "\\`").replace(/\$\{/g, "\\${")}\n${indent}${quote}`; -} -const toMatchInlineName = "toMatchInlineSnapshot"; -const toThrowErrorMatchingInlineName = "toThrowErrorMatchingInlineSnapshot"; -// on webkit, the line number is at the end of the method, not at the start -function getCodeStartingAtIndex(code, index) { - const indexInline = index - toMatchInlineName.length; - if (code.slice(indexInline, index) === toMatchInlineName) { - return { - code: code.slice(indexInline), - index: indexInline - }; - } - const indexThrowInline = index - toThrowErrorMatchingInlineName.length; - if (code.slice(index - indexThrowInline, index) === toThrowErrorMatchingInlineName) { - return { - code: code.slice(index - indexThrowInline), - index: index - indexThrowInline - }; - } - return { - code: code.slice(index), - index - }; -} -const startRegex = /(?:toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot)\s*\(\s*(?:\/\*[\s\S]*\*\/\s*|\/\/.*(?:[\n\r\u2028\u2029]\s*|[\t\v\f \xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF]))*[\w$]*(['"`)])/; -function replaceInlineSnap(code, s, currentIndex, newSnap) { - const { code: codeStartingAtIndex, index } = getCodeStartingAtIndex(code, currentIndex); - const startMatch = startRegex.exec(codeStartingAtIndex); - const firstKeywordMatch = /toMatchInlineSnapshot|toThrowErrorMatchingInlineSnapshot/.exec(codeStartingAtIndex); - if (!startMatch || startMatch.index !== (firstKeywordMatch === null || firstKeywordMatch === void 0 ? void 0 : firstKeywordMatch.index)) { - return replaceObjectSnap(code, s, index, newSnap); - } - const quote = startMatch[1]; - const startIndex = index + startMatch.index + startMatch[0].length; - const snapString = prepareSnapString(newSnap, code, index); - if (quote === ")") { - s.appendRight(startIndex - 1, snapString); - return true; - } - const quoteEndRE = new RegExp(`(?:^|[^\\\\])${quote}`); - const endMatch = quoteEndRE.exec(code.slice(startIndex)); - if (!endMatch) { - return false; - } - const endIndex = startIndex + endMatch.index + endMatch[0].length; - s.overwrite(startIndex - 1, endIndex, snapString); - return true; -} -const INDENTATION_REGEX = /^([^\S\n]*)\S/m; -function stripSnapshotIndentation(inlineSnapshot) { - var _lines$at; - // Find indentation if exists. - const match = inlineSnapshot.match(INDENTATION_REGEX); - if (!match || !match[1]) { - // No indentation. - return inlineSnapshot; - } - const indentation = match[1]; - const lines = inlineSnapshot.split(/\n/g); - if (lines.length <= 2) { - // Must be at least 3 lines. - return inlineSnapshot; - } - if (lines[0].trim() !== "" || ((_lines$at = lines.at(-1)) === null || _lines$at === void 0 ? void 0 : _lines$at.trim()) !== "") { - // If not blank first and last lines, abort. - return inlineSnapshot; - } - for (let i = 1; i < lines.length - 1; i++) { - if (lines[i] !== "") { - if (lines[i].indexOf(indentation) !== 0) { - // All lines except first and last should either be blank or have the same - // indent as the first line (or more). If this isn't the case we don't - // want to touch the snapshot at all. - return inlineSnapshot; - } - lines[i] = lines[i].substring(indentation.length); - } - } - // Last line is a special case because it won't have the same indent as others - // but may still have been given some indent to line up. - lines[lines.length - 1] = ""; - // Return inline snapshot, now at indent 0. - inlineSnapshot = lines.join("\n"); - return inlineSnapshot; -} - -async function saveRawSnapshots(environment, snapshots) { - await Promise.all(snapshots.map(async (snap) => { - if (!snap.readonly) { - await environment.saveSnapshotFile(snap.file, snap.snapshot); - } - })); -} - -function getDefaultExportFromCjs(x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; -} - -var naturalCompare$1 = {exports: {}}; - -var hasRequiredNaturalCompare; - -function requireNaturalCompare () { - if (hasRequiredNaturalCompare) return naturalCompare$1.exports; - hasRequiredNaturalCompare = 1; - /* - * @version 1.4.0 - * @date 2015-10-26 - * @stability 3 - Stable - * @author Lauri Rooden (https://github.com/litejs/natural-compare-lite) - * @license MIT License - */ - - - var naturalCompare = function(a, b) { - var i, codeA - , codeB = 1 - , posA = 0 - , posB = 0 - , alphabet = String.alphabet; - - function getCode(str, pos, code) { - if (code) { - for (i = pos; code = getCode(str, i), code < 76 && code > 65;) ++i; - return +str.slice(pos - 1, i) - } - code = alphabet && alphabet.indexOf(str.charAt(pos)); - return code > -1 ? code + 76 : ((code = str.charCodeAt(pos) || 0), code < 45 || code > 127) ? code - : code < 46 ? 65 // - - : code < 48 ? code - 1 - : code < 58 ? code + 18 // 0-9 - : code < 65 ? code - 11 - : code < 91 ? code + 11 // A-Z - : code < 97 ? code - 37 - : code < 123 ? code + 5 // a-z - : code - 63 - } - - - if ((a+="") != (b+="")) for (;codeB;) { - codeA = getCode(a, posA++); - codeB = getCode(b, posB++); - - if (codeA < 76 && codeB < 76 && codeA > 66 && codeB > 66) { - codeA = getCode(a, posA, posA); - codeB = getCode(b, posB, posA = i); - posB = i; - } - - if (codeA != codeB) return (codeA < codeB) ? -1 : 1 - } - return 0 - }; - - try { - naturalCompare$1.exports = naturalCompare; - } catch (e) { - String.naturalCompare = naturalCompare; - } - return naturalCompare$1.exports; -} - -var naturalCompareExports = requireNaturalCompare(); -var naturalCompare = /*@__PURE__*/getDefaultExportFromCjs(naturalCompareExports); - -const serialize$1 = (val, config, indentation, depth, refs, printer) => { - // Serialize a non-default name, even if config.printFunctionName is false. - const name = val.getMockName(); - const nameString = name === "vi.fn()" ? "" : ` ${name}`; - let callsString = ""; - if (val.mock.calls.length !== 0) { - const indentationNext = indentation + config.indent; - callsString = ` {${config.spacingOuter}${indentationNext}"calls": ${printer(val.mock.calls, config, indentationNext, depth, refs)}${config.min ? ", " : ","}${config.spacingOuter}${indentationNext}"results": ${printer(val.mock.results, config, indentationNext, depth, refs)}${config.min ? "" : ","}${config.spacingOuter}${indentation}}`; - } - return `[MockFunction${nameString}]${callsString}`; -}; -const test = (val) => val && !!val._isMockFunction; -const plugin = { - serialize: serialize$1, - test -}; - -const { DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent, AsymmetricMatcher } = plugins; -let PLUGINS = [ - ReactTestComponent, - ReactElement, - DOMElement, - DOMCollection, - Immutable, - AsymmetricMatcher, - plugin -]; -function addSerializer(plugin) { - PLUGINS = [plugin].concat(PLUGINS); -} -function getSerializers() { - return PLUGINS; -} - -// TODO: rewrite and clean up -function testNameToKey(testName, count) { - return `${testName} ${count}`; -} -function keyToTestName(key) { - if (!/ \d+$/.test(key)) { - throw new Error("Snapshot keys must end with a number."); - } - return key.replace(/ \d+$/, ""); -} -function getSnapshotData(content, options) { - const update = options.updateSnapshot; - const data = Object.create(null); - let snapshotContents = ""; - let dirty = false; - if (content != null) { - try { - snapshotContents = content; - // eslint-disable-next-line no-new-func - const populate = new Function("exports", snapshotContents); - populate(data); - } catch {} - } - // const validationResult = validateSnapshotVersion(snapshotContents) - const isInvalid = snapshotContents; - // if (update === 'none' && isInvalid) - // throw validationResult - if ((update === "all" || update === "new") && isInvalid) { - dirty = true; - } - return { - data, - dirty - }; -} -// Add extra line breaks at beginning and end of multiline snapshot -// to make the content easier to read. -function addExtraLineBreaks(string) { - return string.includes("\n") ? `\n${string}\n` : string; -} -// Remove extra line breaks at beginning and end of multiline snapshot. -// Instead of trim, which can remove additional newlines or spaces -// at beginning or end of the content from a custom serializer. -function removeExtraLineBreaks(string) { - return string.length > 2 && string[0] === "\n" && string.endsWith("\n") ? string.slice(1, -1) : string; -} -// export const removeLinesBeforeExternalMatcherTrap = (stack: string): string => { -// const lines = stack.split('\n') -// for (let i = 0; i < lines.length; i += 1) { -// // It's a function name specified in `packages/expect/src/index.ts` -// // for external custom matchers. -// if (lines[i].includes('__EXTERNAL_MATCHER_TRAP__')) -// return lines.slice(i + 1).join('\n') -// } -// return stack -// } -const escapeRegex = true; -const printFunctionName = false; -function serialize(val, indent = 2, formatOverrides = {}) { - return normalizeNewlines(format(val, { - escapeRegex, - indent, - plugins: getSerializers(), - printFunctionName, - ...formatOverrides - })); -} -function escapeBacktickString(str) { - return str.replace(/`|\\|\$\{/g, "\\$&"); -} -function printBacktickString(str) { - return `\`${escapeBacktickString(str)}\``; -} -function normalizeNewlines(string) { - return string.replace(/\r\n|\r/g, "\n"); -} -async function saveSnapshotFile(environment, snapshotData, snapshotPath) { - const snapshots = Object.keys(snapshotData).sort(naturalCompare).map((key) => `exports[${printBacktickString(key)}] = ${printBacktickString(normalizeNewlines(snapshotData[key]))};`); - const content = `${environment.getHeader()}\n\n${snapshots.join("\n\n")}\n`; - const oldContent = await environment.readSnapshotFile(snapshotPath); - const skipWriting = oldContent != null && oldContent === content; - if (skipWriting) { - return; - } - await environment.saveSnapshotFile(snapshotPath, content); -} -function deepMergeArray(target = [], source = []) { - const mergedOutput = Array.from(target); - source.forEach((sourceElement, index) => { - const targetElement = mergedOutput[index]; - if (Array.isArray(target[index])) { - mergedOutput[index] = deepMergeArray(target[index], sourceElement); - } else if (isObject(targetElement)) { - mergedOutput[index] = deepMergeSnapshot(target[index], sourceElement); - } else { - // Source does not exist in target or target is primitive and cannot be deep merged - mergedOutput[index] = sourceElement; - } - }); - return mergedOutput; -} -/** -* Deep merge, but considers asymmetric matchers. Unlike base util's deep merge, -* will merge any object-like instance. -* Compatible with Jest's snapshot matcher. Should not be used outside of snapshot. -* -* @example -* ```ts -* toMatchSnapshot({ -* name: expect.stringContaining('text') -* }) -* ``` -*/ -function deepMergeSnapshot(target, source) { - if (isObject(target) && isObject(source)) { - const mergedOutput = { ...target }; - Object.keys(source).forEach((key) => { - if (isObject(source[key]) && !source[key].$$typeof) { - if (!(key in target)) { - Object.assign(mergedOutput, { [key]: source[key] }); - } else { - mergedOutput[key] = deepMergeSnapshot(target[key], source[key]); - } - } else if (Array.isArray(source[key])) { - mergedOutput[key] = deepMergeArray(target[key], source[key]); - } else { - Object.assign(mergedOutput, { [key]: source[key] }); - } - }); - return mergedOutput; - } else if (Array.isArray(target) && Array.isArray(source)) { - return deepMergeArray(target, source); - } - return target; -} -class DefaultMap extends Map { - constructor(defaultFn, entries) { - super(entries); - this.defaultFn = defaultFn; - } - get(key) { - if (!this.has(key)) { - this.set(key, this.defaultFn(key)); - } - return super.get(key); - } -} -class CounterMap extends DefaultMap { - constructor() { - super(() => 0); - } - // compat for jest-image-snapshot https://github.com/vitest-dev/vitest/issues/7322 - // `valueOf` and `Snapshot.added` setter allows - // snapshotState.added = snapshotState.added + 1 - // to function as - // snapshotState.added.total_ = snapshotState.added.total() + 1 - _total; - valueOf() { - return this._total = this.total(); - } - increment(key) { - if (typeof this._total !== "undefined") { - this._total++; - } - this.set(key, this.get(key) + 1); - } - total() { - if (typeof this._total !== "undefined") { - return this._total; - } - let total = 0; - for (const x of this.values()) { - total += x; - } - return total; - } -} - -function isSameStackPosition(x, y) { - return x.file === y.file && x.column === y.column && x.line === y.line; -} -class SnapshotState { - _counters = new CounterMap(); - _dirty; - _updateSnapshot; - _snapshotData; - _initialData; - _inlineSnapshots; - _inlineSnapshotStacks; - _testIdToKeys = new DefaultMap(() => []); - _rawSnapshots; - _uncheckedKeys; - _snapshotFormat; - _environment; - _fileExists; - expand; - // getter/setter for jest-image-snapshot compat - // https://github.com/vitest-dev/vitest/issues/7322 - _added = new CounterMap(); - _matched = new CounterMap(); - _unmatched = new CounterMap(); - _updated = new CounterMap(); - get added() { - return this._added; - } - set added(value) { - this._added._total = value; - } - get matched() { - return this._matched; - } - set matched(value) { - this._matched._total = value; - } - get unmatched() { - return this._unmatched; - } - set unmatched(value) { - this._unmatched._total = value; - } - get updated() { - return this._updated; - } - set updated(value) { - this._updated._total = value; - } - constructor(testFilePath, snapshotPath, snapshotContent, options) { - this.testFilePath = testFilePath; - this.snapshotPath = snapshotPath; - const { data, dirty } = getSnapshotData(snapshotContent, options); - this._fileExists = snapshotContent != null; - this._initialData = { ...data }; - this._snapshotData = { ...data }; - this._dirty = dirty; - this._inlineSnapshots = []; - this._inlineSnapshotStacks = []; - this._rawSnapshots = []; - this._uncheckedKeys = new Set(Object.keys(this._snapshotData)); - this.expand = options.expand || false; - this._updateSnapshot = options.updateSnapshot; - this._snapshotFormat = { - printBasicPrototype: false, - escapeString: false, - ...options.snapshotFormat - }; - this._environment = options.snapshotEnvironment; - } - static async create(testFilePath, options) { - const snapshotPath = await options.snapshotEnvironment.resolvePath(testFilePath); - const content = await options.snapshotEnvironment.readSnapshotFile(snapshotPath); - return new SnapshotState(testFilePath, snapshotPath, content, options); - } - get environment() { - return this._environment; - } - markSnapshotsAsCheckedForTest(testName) { - this._uncheckedKeys.forEach((uncheckedKey) => { - // skip snapshots with following keys - // testName n - // testName > xxx n (this is for toMatchSnapshot("xxx") API) - if (/ \d+$| > /.test(uncheckedKey.slice(testName.length))) { - this._uncheckedKeys.delete(uncheckedKey); - } - }); - } - clearTest(testId) { - // clear inline - this._inlineSnapshots = this._inlineSnapshots.filter((s) => s.testId !== testId); - this._inlineSnapshotStacks = this._inlineSnapshotStacks.filter((s) => s.testId !== testId); - // clear file - for (const key of this._testIdToKeys.get(testId)) { - const name = keyToTestName(key); - const count = this._counters.get(name); - if (count > 0) { - if (key in this._snapshotData || key in this._initialData) { - this._snapshotData[key] = this._initialData[key]; - } - this._counters.set(name, count - 1); - } - } - this._testIdToKeys.delete(testId); - // clear stats - this.added.delete(testId); - this.updated.delete(testId); - this.matched.delete(testId); - this.unmatched.delete(testId); - } - _inferInlineSnapshotStack(stacks) { - // if called inside resolves/rejects, stacktrace is different - const promiseIndex = stacks.findIndex((i) => i.method.match(/__VITEST_(RESOLVES|REJECTS)__/)); - if (promiseIndex !== -1) { - return stacks[promiseIndex + 3]; - } - // inline snapshot function is called __INLINE_SNAPSHOT__ - // in integrations/snapshot/chai.ts - const stackIndex = stacks.findIndex((i) => i.method.includes("__INLINE_SNAPSHOT__")); - return stackIndex !== -1 ? stacks[stackIndex + 2] : null; - } - _addSnapshot(key, receivedSerialized, options) { - this._dirty = true; - if (options.stack) { - this._inlineSnapshots.push({ - snapshot: receivedSerialized, - testId: options.testId, - ...options.stack - }); - } else if (options.rawSnapshot) { - this._rawSnapshots.push({ - ...options.rawSnapshot, - snapshot: receivedSerialized - }); - } else { - this._snapshotData[key] = receivedSerialized; - } - } - async save() { - const hasExternalSnapshots = Object.keys(this._snapshotData).length; - const hasInlineSnapshots = this._inlineSnapshots.length; - const hasRawSnapshots = this._rawSnapshots.length; - const isEmpty = !hasExternalSnapshots && !hasInlineSnapshots && !hasRawSnapshots; - const status = { - deleted: false, - saved: false - }; - if ((this._dirty || this._uncheckedKeys.size) && !isEmpty) { - if (hasExternalSnapshots) { - await saveSnapshotFile(this._environment, this._snapshotData, this.snapshotPath); - this._fileExists = true; - } - if (hasInlineSnapshots) { - await saveInlineSnapshots(this._environment, this._inlineSnapshots); - } - if (hasRawSnapshots) { - await saveRawSnapshots(this._environment, this._rawSnapshots); - } - status.saved = true; - } else if (!hasExternalSnapshots && this._fileExists) { - if (this._updateSnapshot === "all") { - await this._environment.removeSnapshotFile(this.snapshotPath); - this._fileExists = false; - } - status.deleted = true; - } - return status; - } - getUncheckedCount() { - return this._uncheckedKeys.size || 0; - } - getUncheckedKeys() { - return Array.from(this._uncheckedKeys); - } - removeUncheckedKeys() { - if (this._updateSnapshot === "all" && this._uncheckedKeys.size) { - this._dirty = true; - this._uncheckedKeys.forEach((key) => delete this._snapshotData[key]); - this._uncheckedKeys.clear(); - } - } - match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot }) { - // this also increments counter for inline snapshots. maybe we shouldn't? - this._counters.increment(testName); - const count = this._counters.get(testName); - if (!key) { - key = testNameToKey(testName, count); - } - this._testIdToKeys.get(testId).push(key); - // Do not mark the snapshot as "checked" if the snapshot is inline and - // there's an external snapshot. This way the external snapshot can be - // removed with `--updateSnapshot`. - if (!(isInline && this._snapshotData[key] !== undefined)) { - this._uncheckedKeys.delete(key); - } - let receivedSerialized = rawSnapshot && typeof received === "string" ? received : serialize(received, undefined, this._snapshotFormat); - if (!rawSnapshot) { - receivedSerialized = addExtraLineBreaks(receivedSerialized); - } - if (rawSnapshot) { - // normalize EOL when snapshot contains CRLF but received is LF - if (rawSnapshot.content && rawSnapshot.content.match(/\r\n/) && !receivedSerialized.match(/\r\n/)) { - rawSnapshot.content = normalizeNewlines(rawSnapshot.content); - } - } - const expected = isInline ? inlineSnapshot : rawSnapshot ? rawSnapshot.content : this._snapshotData[key]; - const expectedTrimmed = rawSnapshot ? expected : expected === null || expected === void 0 ? void 0 : expected.trim(); - const pass = expectedTrimmed === (rawSnapshot ? receivedSerialized : receivedSerialized.trim()); - const hasSnapshot = expected !== undefined; - const snapshotIsPersisted = isInline || this._fileExists || rawSnapshot && rawSnapshot.content != null; - if (pass && !isInline && !rawSnapshot) { - // Executing a snapshot file as JavaScript and writing the strings back - // when other snapshots have changed loses the proper escaping for some - // characters. Since we check every snapshot in every test, use the newly - // generated formatted string. - // Note that this is only relevant when a snapshot is added and the dirty - // flag is set. - this._snapshotData[key] = receivedSerialized; - } - // find call site of toMatchInlineSnapshot - let stack; - if (isInline) { - var _this$environment$pro, _this$environment; - const stacks = parseErrorStacktrace(error || new Error("snapshot"), { ignoreStackEntries: [] }); - const _stack = this._inferInlineSnapshotStack(stacks); - if (!_stack) { - throw new Error(`@vitest/snapshot: Couldn't infer stack frame for inline snapshot.\n${JSON.stringify(stacks)}`); - } - stack = ((_this$environment$pro = (_this$environment = this.environment).processStackTrace) === null || _this$environment$pro === void 0 ? void 0 : _this$environment$pro.call(_this$environment, _stack)) || _stack; - // removing 1 column, because source map points to the wrong - // location for js files, but `column-1` points to the same in both js/ts - // https://github.com/vitejs/vite/issues/8657 - stack.column--; - // reject multiple inline snapshots at the same location if snapshot is different - const snapshotsWithSameStack = this._inlineSnapshotStacks.filter((s) => isSameStackPosition(s, stack)); - if (snapshotsWithSameStack.length > 0) { - // ensure only one snapshot will be written at the same location - this._inlineSnapshots = this._inlineSnapshots.filter((s) => !isSameStackPosition(s, stack)); - const differentSnapshot = snapshotsWithSameStack.find((s) => s.snapshot !== receivedSerialized); - if (differentSnapshot) { - throw Object.assign(new Error("toMatchInlineSnapshot with different snapshots cannot be called at the same location"), { - actual: receivedSerialized, - expected: differentSnapshot.snapshot - }); - } - } - this._inlineSnapshotStacks.push({ - ...stack, - testId, - snapshot: receivedSerialized - }); - } - // These are the conditions on when to write snapshots: - // * There's no snapshot file in a non-CI environment. - // * There is a snapshot file and we decided to update the snapshot. - // * There is a snapshot file, but it doesn't have this snapshot. - // These are the conditions on when not to write snapshots: - // * The update flag is set to 'none'. - // * There's no snapshot file or a file without this snapshot on a CI environment. - if (hasSnapshot && this._updateSnapshot === "all" || (!hasSnapshot || !snapshotIsPersisted) && (this._updateSnapshot === "new" || this._updateSnapshot === "all")) { - if (this._updateSnapshot === "all") { - if (!pass) { - if (hasSnapshot) { - this.updated.increment(testId); - } else { - this.added.increment(testId); - } - this._addSnapshot(key, receivedSerialized, { - stack, - testId, - rawSnapshot - }); - } else { - this.matched.increment(testId); - } - } else { - this._addSnapshot(key, receivedSerialized, { - stack, - testId, - rawSnapshot - }); - this.added.increment(testId); - } - return { - actual: "", - count, - expected: "", - key, - pass: true - }; - } else { - if (!pass) { - this.unmatched.increment(testId); - return { - actual: rawSnapshot ? receivedSerialized : removeExtraLineBreaks(receivedSerialized), - count, - expected: expectedTrimmed !== undefined ? rawSnapshot ? expectedTrimmed : removeExtraLineBreaks(expectedTrimmed) : undefined, - key, - pass: false - }; - } else { - this.matched.increment(testId); - return { - actual: "", - count, - expected: "", - key, - pass: true - }; - } - } - } - async pack() { - const snapshot = { - filepath: this.testFilePath, - added: 0, - fileDeleted: false, - matched: 0, - unchecked: 0, - uncheckedKeys: [], - unmatched: 0, - updated: 0 - }; - const uncheckedCount = this.getUncheckedCount(); - const uncheckedKeys = this.getUncheckedKeys(); - if (uncheckedCount) { - this.removeUncheckedKeys(); - } - const status = await this.save(); - snapshot.fileDeleted = status.deleted; - snapshot.added = this.added.total(); - snapshot.matched = this.matched.total(); - snapshot.unmatched = this.unmatched.total(); - snapshot.updated = this.updated.total(); - snapshot.unchecked = !status.deleted ? uncheckedCount : 0; - snapshot.uncheckedKeys = Array.from(uncheckedKeys); - return snapshot; - } -} - -function createMismatchError(message, expand, actual, expected) { - const error = new Error(message); - Object.defineProperty(error, "actual", { - value: actual, - enumerable: true, - configurable: true, - writable: true - }); - Object.defineProperty(error, "expected", { - value: expected, - enumerable: true, - configurable: true, - writable: true - }); - Object.defineProperty(error, "diffOptions", { value: { expand } }); - return error; -} -class SnapshotClient { - snapshotStateMap = new Map(); - constructor(options = {}) { - this.options = options; - } - async setup(filepath, options) { - if (this.snapshotStateMap.has(filepath)) { - return; - } - this.snapshotStateMap.set(filepath, await SnapshotState.create(filepath, options)); - } - async finish(filepath) { - const state = this.getSnapshotState(filepath); - const result = await state.pack(); - this.snapshotStateMap.delete(filepath); - return result; - } - skipTest(filepath, testName) { - const state = this.getSnapshotState(filepath); - state.markSnapshotsAsCheckedForTest(testName); - } - clearTest(filepath, testId) { - const state = this.getSnapshotState(filepath); - state.clearTest(testId); - } - getSnapshotState(filepath) { - const state = this.snapshotStateMap.get(filepath); - if (!state) { - throw new Error(`The snapshot state for '${filepath}' is not found. Did you call 'SnapshotClient.setup()'?`); - } - return state; - } - assert(options) { - const { filepath, name, testId = name, message, isInline = false, properties, inlineSnapshot, error, errorMessage, rawSnapshot } = options; - let { received } = options; - if (!filepath) { - throw new Error("Snapshot cannot be used outside of test"); - } - const snapshotState = this.getSnapshotState(filepath); - if (typeof properties === "object") { - if (typeof received !== "object" || !received) { - throw new Error("Received value must be an object when the matcher has properties"); - } - try { - var _this$options$isEqual, _this$options; - const pass = ((_this$options$isEqual = (_this$options = this.options).isEqual) === null || _this$options$isEqual === void 0 ? void 0 : _this$options$isEqual.call(_this$options, received, properties)) ?? false; - // const pass = equals(received, properties, [iterableEquality, subsetEquality]) - if (!pass) { - throw createMismatchError("Snapshot properties mismatched", snapshotState.expand, received, properties); - } else { - received = deepMergeSnapshot(received, properties); - } - } catch (err) { - err.message = errorMessage || "Snapshot mismatched"; - throw err; - } - } - const testName = [name, ...message ? [message] : []].join(" > "); - const { actual, expected, key, pass } = snapshotState.match({ - testId, - testName, - received, - isInline, - error, - inlineSnapshot, - rawSnapshot - }); - if (!pass) { - throw createMismatchError(`Snapshot \`${key || "unknown"}\` mismatched`, snapshotState.expand, rawSnapshot ? actual : actual === null || actual === void 0 ? void 0 : actual.trim(), rawSnapshot ? expected : expected === null || expected === void 0 ? void 0 : expected.trim()); - } - } - async assertRaw(options) { - if (!options.rawSnapshot) { - throw new Error("Raw snapshot is required"); - } - const { filepath, rawSnapshot } = options; - if (rawSnapshot.content == null) { - if (!filepath) { - throw new Error("Snapshot cannot be used outside of test"); - } - const snapshotState = this.getSnapshotState(filepath); - // save the filepath, so it don't lose even if the await make it out-of-context - options.filepath || (options.filepath = filepath); - // resolve and read the raw snapshot file - rawSnapshot.file = await snapshotState.environment.resolveRawPath(filepath, rawSnapshot.file); - rawSnapshot.content = await snapshotState.environment.readSnapshotFile(rawSnapshot.file) ?? undefined; - } - return this.assert(options); - } - clear() { - this.snapshotStateMap.clear(); - } -} - -export { SnapshotClient, SnapshotState, addSerializer, getSerializers, stripSnapshotIndentation }; diff --git a/node_modules/@vitest/snapshot/dist/manager.d.ts b/node_modules/@vitest/snapshot/dist/manager.d.ts deleted file mode 100644 index a782935..0000000 --- a/node_modules/@vitest/snapshot/dist/manager.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { S as SnapshotStateOptions, e as SnapshotSummary, b as SnapshotResult } from './rawSnapshot.d-lFsMJFUd.js'; -import '@vitest/pretty-format'; -import './environment.d-DHdQ1Csl.js'; - -declare class SnapshotManager { - options: Omit; - summary: SnapshotSummary; - extension: string; - constructor(options: Omit); - clear(): void; - add(result: SnapshotResult): void; - resolvePath(testPath: string, context?: T): string; - resolveRawPath(testPath: string, rawPath: string): string; -} -declare function emptySummary(options: Omit): SnapshotSummary; -declare function addSnapshotResult(summary: SnapshotSummary, result: SnapshotResult): void; - -export { SnapshotManager, addSnapshotResult, emptySummary }; diff --git a/node_modules/@vitest/snapshot/dist/manager.js b/node_modules/@vitest/snapshot/dist/manager.js deleted file mode 100644 index 90a36a3..0000000 --- a/node_modules/@vitest/snapshot/dist/manager.js +++ /dev/null @@ -1,73 +0,0 @@ -import { join, dirname, basename, resolve, isAbsolute } from 'pathe'; - -class SnapshotManager { - summary; - extension = ".snap"; - constructor(options) { - this.options = options; - this.clear(); - } - clear() { - this.summary = emptySummary(this.options); - } - add(result) { - addSnapshotResult(this.summary, result); - } - resolvePath(testPath, context) { - const resolver = this.options.resolveSnapshotPath || (() => { - return join(join(dirname(testPath), "__snapshots__"), `${basename(testPath)}${this.extension}`); - }); - const path = resolver(testPath, this.extension, context); - return path; - } - resolveRawPath(testPath, rawPath) { - return isAbsolute(rawPath) ? rawPath : resolve(dirname(testPath), rawPath); - } -} -function emptySummary(options) { - const summary = { - added: 0, - failure: false, - filesAdded: 0, - filesRemoved: 0, - filesRemovedList: [], - filesUnmatched: 0, - filesUpdated: 0, - matched: 0, - total: 0, - unchecked: 0, - uncheckedKeysByFile: [], - unmatched: 0, - updated: 0, - didUpdate: options.updateSnapshot === "all" - }; - return summary; -} -function addSnapshotResult(summary, result) { - if (result.added) { - summary.filesAdded++; - } - if (result.fileDeleted) { - summary.filesRemoved++; - } - if (result.unmatched) { - summary.filesUnmatched++; - } - if (result.updated) { - summary.filesUpdated++; - } - summary.added += result.added; - summary.matched += result.matched; - summary.unchecked += result.unchecked; - if (result.uncheckedKeys && result.uncheckedKeys.length > 0) { - summary.uncheckedKeysByFile.push({ - filePath: result.filepath, - keys: result.uncheckedKeys - }); - } - summary.unmatched += result.unmatched; - summary.updated += result.updated; - summary.total += result.added + result.matched + result.unmatched + result.updated; -} - -export { SnapshotManager, addSnapshotResult, emptySummary }; diff --git a/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts b/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts deleted file mode 100644 index 96fa2dd..0000000 --- a/node_modules/@vitest/snapshot/dist/rawSnapshot.d-lFsMJFUd.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { OptionsReceived, Plugin } from '@vitest/pretty-format'; -import { S as SnapshotEnvironment } from './environment.d-DHdQ1Csl.js'; - -type SnapshotData = Record; -type SnapshotUpdateState = "all" | "new" | "none"; -type SnapshotSerializer = Plugin; -interface SnapshotStateOptions { - updateSnapshot: SnapshotUpdateState; - snapshotEnvironment: SnapshotEnvironment; - expand?: boolean; - snapshotFormat?: OptionsReceived; - resolveSnapshotPath?: (path: string, extension: string, context?: any) => string; -} -interface SnapshotMatchOptions { - testId: string; - testName: string; - received: unknown; - key?: string; - inlineSnapshot?: string; - isInline: boolean; - error?: Error; - rawSnapshot?: RawSnapshotInfo; -} -interface SnapshotResult { - filepath: string; - added: number; - fileDeleted: boolean; - matched: number; - unchecked: number; - uncheckedKeys: Array; - unmatched: number; - updated: number; -} -interface UncheckedSnapshot { - filePath: string; - keys: Array; -} -interface SnapshotSummary { - added: number; - didUpdate: boolean; - failure: boolean; - filesAdded: number; - filesRemoved: number; - filesRemovedList: Array; - filesUnmatched: number; - filesUpdated: number; - matched: number; - total: number; - unchecked: number; - uncheckedKeysByFile: Array; - unmatched: number; - updated: number; -} - -interface RawSnapshotInfo { - file: string; - readonly?: boolean; - content?: string; -} - -export type { RawSnapshotInfo as R, SnapshotStateOptions as S, UncheckedSnapshot as U, SnapshotMatchOptions as a, SnapshotResult as b, SnapshotData as c, SnapshotSerializer as d, SnapshotSummary as e, SnapshotUpdateState as f }; diff --git a/node_modules/@vitest/snapshot/environment.d.ts b/node_modules/@vitest/snapshot/environment.d.ts deleted file mode 100644 index 855f0d1..0000000 --- a/node_modules/@vitest/snapshot/environment.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/environment.js' diff --git a/node_modules/@vitest/snapshot/manager.d.ts b/node_modules/@vitest/snapshot/manager.d.ts deleted file mode 100644 index f3e8077..0000000 --- a/node_modules/@vitest/snapshot/manager.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/manager.js' diff --git a/node_modules/@vitest/snapshot/package.json b/node_modules/@vitest/snapshot/package.json deleted file mode 100644 index 9f19024..0000000 --- a/node_modules/@vitest/snapshot/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@vitest/snapshot", - "type": "module", - "version": "4.0.16", - "description": "Vitest snapshot manager", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/snapshot#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/snapshot" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./environment": { - "types": "./dist/environment.d.ts", - "default": "./dist/environment.js" - }, - "./manager": { - "types": "./dist/manager.d.ts", - "default": "./dist/manager.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "*.d.ts", - "dist" - ], - "dependencies": { - "magic-string": "^0.30.21", - "pathe": "^2.0.3", - "@vitest/pretty-format": "4.0.16" - }, - "devDependencies": { - "@types/natural-compare": "^1.4.3", - "natural-compare": "^1.4.0", - "@vitest/utils": "4.0.16" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/spy/LICENSE b/node_modules/@vitest/spy/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/spy/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/spy/README.md b/node_modules/@vitest/spy/README.md deleted file mode 100644 index 5d23c87..0000000 --- a/node_modules/@vitest/spy/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# @vitest/spy - -Lightweight Jest compatible spy implementation. diff --git a/node_modules/@vitest/spy/dist/index.d.ts b/node_modules/@vitest/spy/dist/index.d.ts deleted file mode 100644 index 408aeca..0000000 --- a/node_modules/@vitest/spy/dist/index.d.ts +++ /dev/null @@ -1,384 +0,0 @@ -interface MockResultReturn { - type: "return"; - /** - * The value that was returned from the function. If function returned a Promise, then this will be a resolved value. - */ - value: T; -} -interface MockResultIncomplete { - type: "incomplete"; - value: undefined; -} -interface MockResultThrow { - type: "throw"; - /** - * An error that was thrown during function execution. - */ - value: any; -} -interface MockSettledResultIncomplete { - type: "incomplete"; - value: undefined; -} -interface MockSettledResultFulfilled { - type: "fulfilled"; - value: T; -} -interface MockSettledResultRejected { - type: "rejected"; - value: any; -} -type MockResult = MockResultReturn | MockResultThrow | MockResultIncomplete; -type MockSettledResult = MockSettledResultFulfilled | MockSettledResultRejected | MockSettledResultIncomplete; -type MockParameters = T extends Constructable ? ConstructorParameters : T extends Procedure ? Parameters : never; -type MockReturnType = T extends Constructable ? void : T extends Procedure ? ReturnType : never; -type MockProcedureContext = T extends Constructable ? InstanceType : ThisParameterType; -interface MockContext { - /** - * This is an array containing all arguments for each call. One item of the array is the arguments of that call. - * - * @see https://vitest.dev/api/mock#mock-calls - * @example - * const fn = vi.fn() - * - * fn('arg1', 'arg2') - * fn('arg3') - * - * fn.mock.calls === [ - * ['arg1', 'arg2'], // first call - * ['arg3'], // second call - * ] - */ - calls: MockParameters[]; - /** - * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value. - * @see https://vitest.dev/api/mock#mock-instances - */ - instances: MockProcedureContext[]; - /** - * An array of `this` values that were used during each call to the mock function. - * @see https://vitest.dev/api/mock#mock-contexts - */ - contexts: MockProcedureContext[]; - /** - * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks. - * - * @see https://vitest.dev/api/mock#mock-invocationcallorder - * @example - * const fn1 = vi.fn() - * const fn2 = vi.fn() - * - * fn1() - * fn2() - * fn1() - * - * fn1.mock.invocationCallOrder === [1, 3] - * fn2.mock.invocationCallOrder === [2] - */ - invocationCallOrder: number[]; - /** - * This is an array containing all values that were `returned` from the function. - * - * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected. - * - * @see https://vitest.dev/api/mock#mock-results - * @example - * const fn = vi.fn() - * .mockReturnValueOnce('result') - * .mockImplementationOnce(() => { throw new Error('thrown error') }) - * - * const result = fn() - * - * try { - * fn() - * } - * catch {} - * - * fn.mock.results === [ - * { - * type: 'return', - * value: 'result', - * }, - * { - * type: 'throw', - * value: Error, - * }, - * ] - */ - results: MockResult>[]; - /** - * An array containing all values that were `resolved` or `rejected` from the function. - * - * This array will be empty if the function was never resolved or rejected. - * - * @see https://vitest.dev/api/mock#mock-settledresults - * @example - * const fn = vi.fn().mockResolvedValueOnce('result') - * - * const result = fn() - * - * fn.mock.settledResults === [ - * { - * type: 'incomplete', - * value: undefined, - * } - * ] - * fn.mock.results === [ - * { - * type: 'return', - * value: Promise<'result'>, - * }, - * ] - * - * await result - * - * fn.mock.settledResults === [ - * { - * type: 'fulfilled', - * value: 'result', - * }, - * ] - */ - settledResults: MockSettledResult>>[]; - /** - * This contains the arguments of the last call. If spy wasn't called, will return `undefined`. - * @see https://vitest.dev/api/mock#mock-lastcall - */ - lastCall: MockParameters | undefined; -} -type Procedure = (...args: any[]) => any; -type NormalizedProcedure = T extends Constructable ? ({ - new (...args: ConstructorParameters): InstanceType; -}) | ({ - (this: InstanceType, ...args: ConstructorParameters): void; -}) : T extends Procedure ? (...args: Parameters) => ReturnType : never; -type Methods = keyof { [K in keyof T as T[K] extends Procedure ? K : never] : T[K] }; -type Properties = { [K in keyof T] : T[K] extends Procedure ? never : K }[keyof T] & (string | symbol); -type Classes = { [K in keyof T] : T[K] extends new (...args: any[]) => any ? K : never }[keyof T] & (string | symbol); -interface MockInstance extends Disposable { - /** - * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`. - * @see https://vitest.dev/api/mock#getmockname - */ - getMockName(): string; - /** - * Sets the internal mock name. This is useful for identifying the mock when an assertion fails. - * @see https://vitest.dev/api/mock#mockname - */ - mockName(name: string): this; - /** - * Current context of the mock. It stores information about all invocation calls, instances, and results. - */ - mock: MockContext; - /** - * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions. - * - * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration. - * @see https://vitest.dev/api/mock#mockclear - */ - mockClear(): this; - /** - * Does what `mockClear` does and resets inner implementation to the original function. This also resets all "once" implementations. - * - * Note that resetting a mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. - * Resetting a mock from `vi.fn(impl)` will set implementation to `impl`. It is useful for completely resetting a mock to its default state. - * - * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration. - * @see https://vitest.dev/api/mock#mockreset - */ - mockReset(): this; - /** - * Does what `mockReset` does and restores original descriptors of spied-on objects. - * @see https://vitest.dev/api/mock#mockrestore - */ - mockRestore(): void; - /** - * Returns current permanent mock implementation if there is one. - * - * If mock was created with `vi.fn`, it will consider passed down method as a mock implementation. - * - * If mock was created with `vi.spyOn`, it will return `undefined` unless a custom implementation was provided. - */ - getMockImplementation(): NormalizedProcedure | undefined; - /** - * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. - * @see https://vitest.dev/api/mock#mockimplementation - * @example - * const increment = vi.fn().mockImplementation(count => count + 1); - * expect(increment(3)).toBe(4); - */ - mockImplementation(fn: NormalizedProcedure): this; - /** - * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls. - * - * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called. - * @see https://vitest.dev/api/mock#mockimplementationonce - * @example - * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1); - * expect(fn(3)).toBe(4); - * expect(fn(3)).toBe(3); - */ - mockImplementationOnce(fn: NormalizedProcedure): this; - /** - * Overrides the original mock implementation temporarily while the callback is being executed. - * - * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce). - * @see https://vitest.dev/api/mock#withimplementation - * @example - * const myMockFn = vi.fn(() => 'original') - * - * myMockFn.withImplementation(() => 'temp', () => { - * myMockFn() // 'temp' - * }) - * - * myMockFn() // 'original' - */ - withImplementation(fn: NormalizedProcedure, cb: () => Promise): Promise; - withImplementation(fn: NormalizedProcedure, cb: () => unknown): this; - /** - * Use this if you need to return the `this` context from the method without invoking the actual implementation. - * @see https://vitest.dev/api/mock#mockreturnthis - */ - mockReturnThis(): this; - /** - * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function. - * @see https://vitest.dev/api/mock#mockreturnvalue - * @example - * const mock = vi.fn() - * mock.mockReturnValue(42) - * mock() // 42 - * mock.mockReturnValue(43) - * mock() // 43 - */ - mockReturnValue(value: MockReturnType): this; - /** - * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function. - * - * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called. - * @example - * const myMockFn = vi - * .fn() - * .mockReturnValue('default') - * .mockReturnValueOnce('first call') - * .mockReturnValueOnce('second call') - * - * // 'first call', 'second call', 'default' - * console.log(myMockFn(), myMockFn(), myMockFn()) - */ - mockReturnValueOnce(value: MockReturnType): this; - /** - * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function. - * @example - * const asyncMock = vi.fn().mockResolvedValue(42) - * asyncMock() // Promise<42> - */ - mockResolvedValue(value: Awaited>): this; - /** - * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value. - * @example - * const myMockFn = vi - * .fn() - * .mockResolvedValue('default') - * .mockResolvedValueOnce('first call') - * .mockResolvedValueOnce('second call') - * - * // Promise<'first call'>, Promise<'second call'>, Promise<'default'> - * console.log(myMockFn(), myMockFn(), myMockFn()) - */ - mockResolvedValueOnce(value: Awaited>): this; - /** - * Accepts an error that will be rejected when async function is called. - * @example - * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error')) - * await asyncMock() // throws Error<'Async error'> - */ - mockRejectedValue(error: unknown): this; - /** - * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value. - * @example - * const asyncMock = vi - * .fn() - * .mockResolvedValueOnce('first call') - * .mockRejectedValueOnce(new Error('Async error')) - * - * await asyncMock() // first call - * await asyncMock() // throws Error<'Async error'> - */ - mockRejectedValueOnce(error: unknown): this; -} -type Mock = MockInstance & (T extends Constructable ? (T extends Procedure ? { - new (...args: ConstructorParameters): InstanceType; - (...args: Parameters): ReturnType; -} : { - new (...args: ConstructorParameters): InstanceType; -}) : { - new (...args: MockParameters): MockReturnType; - (...args: MockParameters): MockReturnType; -}) & { [P in keyof T] : T[P] }; -type PartialMaybePromise = T extends Promise> ? Promise>> : Partial; -type PartialResultFunction = T extends Constructable ? ({ - new (...args: ConstructorParameters): InstanceType; -}) | ({ - (this: InstanceType, ...args: ConstructorParameters): void; -}) : T extends Procedure ? (...args: Parameters) => PartialMaybePromise> : T; -type PartialMock = Mock> : T>>; -type MaybeMockedConstructor = T extends Constructable ? Mock : T; -type MockedFunction = Mock & { [K in keyof T] : T[K] }; -type PartiallyMockedFunction = PartialMock & { [K in keyof T] : T[K] }; -type MockedFunctionDeep = Mock & MockedObjectDeep; -type PartiallyMockedFunctionDeep = PartialMock & MockedObjectDeep; -type MockedObject = MaybeMockedConstructor & { [K in Methods] : T[K] extends Procedure ? MockedFunction : T[K] } & { [K in Properties] : T[K] }; -type MockedObjectDeep = MaybeMockedConstructor & { [K in Methods] : T[K] extends Procedure ? MockedFunctionDeep : T[K] } & { [K in Properties] : MaybeMockedDeep }; -type MaybeMockedDeep = T extends Procedure | Constructable ? MockedFunctionDeep : T extends object ? MockedObjectDeep : T; -type MaybePartiallyMockedDeep = T extends Procedure | Constructable ? PartiallyMockedFunctionDeep : T extends object ? MockedObjectDeep : T; -type MaybeMocked = T extends Procedure | Constructable ? MockedFunction : T extends object ? MockedObject : T; -type MaybePartiallyMocked = T extends Procedure | Constructable ? PartiallyMockedFunction : T extends object ? MockedObject : T; -interface Constructable { - new (...args: any[]): any; -} -type MockedClass = MockInstance & { - prototype: T extends { - prototype: any; - } ? Mocked : never; -} & T; -type Mocked = { [P in keyof T] : T[P] extends Procedure ? MockInstance : T[P] extends Constructable ? MockedClass : T[P] } & T; -interface MockConfig { - mockImplementation: Procedure | Constructable | undefined; - mockOriginal: Procedure | Constructable | undefined; - mockName: string; - onceMockImplementations: Array; -} -interface MockInstanceOption { - originalImplementation?: Procedure | Constructable; - mockImplementation?: Procedure | Constructable; - resetToMockImplementation?: boolean; - restore?: () => void; - prototypeMembers?: (string | symbol)[]; - keepMembersImplementation?: boolean; - prototypeState?: MockContext; - prototypeConfig?: MockConfig; - resetToMockName?: boolean; - name?: string | symbol; -} - -declare function isMockFunction(fn: any): fn is Mock; -declare function createMockInstance(options?: MockInstanceOption): Mock; -declare function fn(originalImplementation?: T): Mock; -declare function spyOn< - T extends object, - S extends Properties> ->(object: T, key: S, accessor: "get"): Mock<() => T[S]>; -declare function spyOn< - T extends object, - G extends Properties> ->(object: T, key: G, accessor: "set"): Mock<(arg: T[G]) => void>; -declare function spyOn< - T extends object, - M extends Classes> | Methods> ->(object: T, key: M): Required[M] extends Constructable | Procedure ? Mock[M]> : never; -declare function restoreAllMocks(): void; -declare function clearAllMocks(): void; -declare function resetAllMocks(): void; - -export { clearAllMocks, createMockInstance, fn, isMockFunction, resetAllMocks, restoreAllMocks, spyOn }; -export type { Constructable, MaybeMocked, MaybeMockedConstructor, MaybeMockedDeep, MaybePartiallyMocked, MaybePartiallyMockedDeep, Mock, MockContext, MockInstance, MockInstanceOption, MockParameters, MockProcedureContext, MockResult, MockResultIncomplete, MockResultReturn, MockResultThrow, MockReturnType, MockSettledResult, MockSettledResultFulfilled, MockSettledResultIncomplete, MockSettledResultRejected, Mocked, MockedClass, MockedFunction, MockedFunctionDeep, MockedObject, MockedObjectDeep, PartialMock, PartiallyMockedFunction, PartiallyMockedFunctionDeep, Procedure }; diff --git a/node_modules/@vitest/spy/dist/index.js b/node_modules/@vitest/spy/dist/index.js deleted file mode 100644 index 96f9784..0000000 --- a/node_modules/@vitest/spy/dist/index.js +++ /dev/null @@ -1,433 +0,0 @@ -function isMockFunction(fn) { - return typeof fn === "function" && "_isMockFunction" in fn && fn._isMockFunction === true; -} -const MOCK_RESTORE = new Set(); -// Jest keeps the state in a separate WeakMap which is good for memory, -// but it makes the state slower to access and return different values -// if you stored it before calling `mockClear` where it will be recreated -const REGISTERED_MOCKS = new Set(); -const MOCK_CONFIGS = new WeakMap(); -function createMockInstance(options = {}) { - var _ref; - const { originalImplementation, restore, mockImplementation, resetToMockImplementation, resetToMockName } = options; - if (restore) { - MOCK_RESTORE.add(restore); - } - const config = getDefaultConfig(originalImplementation); - const state = getDefaultState(); - const mock = createMock({ - config, - state, - ...options - }); - const mockLength = ((_ref = mockImplementation || originalImplementation) === null || _ref === void 0 ? void 0 : _ref.length) ?? 0; - Object.defineProperty(mock, "length", { - writable: true, - enumerable: false, - value: mockLength, - configurable: true - }); - // inherit the default name so it appears in snapshots and logs - // this is used by `vi.spyOn()` for better debugging. - // when `vi.fn()` is called, we just use the default string - if (resetToMockName) { - config.mockName = mock.name || "vi.fn()"; - } - MOCK_CONFIGS.set(mock, config); - REGISTERED_MOCKS.add(mock); - mock._isMockFunction = true; - mock.getMockImplementation = () => { - // Jest only returns `config.mockImplementation` here, - // but we think it makes sense to return what the next function will be called - return config.onceMockImplementations[0] || config.mockImplementation; - }; - Object.defineProperty(mock, "mock", { - configurable: false, - enumerable: true, - writable: false, - value: state - }); - mock.mockImplementation = function mockImplementation(implementation) { - config.mockImplementation = implementation; - return mock; - }; - mock.mockImplementationOnce = function mockImplementationOnce(implementation) { - config.onceMockImplementations.push(implementation); - return mock; - }; - mock.withImplementation = function withImplementation(implementation, callback) { - const previousImplementation = config.mockImplementation; - const previousOnceImplementations = config.onceMockImplementations; - const reset = () => { - config.mockImplementation = previousImplementation; - config.onceMockImplementations = previousOnceImplementations; - }; - config.mockImplementation = implementation; - config.onceMockImplementations = []; - const returnValue = callback(); - if (typeof returnValue === "object" && typeof (returnValue === null || returnValue === void 0 ? void 0 : returnValue.then) === "function") { - return returnValue.then(() => { - reset(); - return mock; - }); - } else { - reset(); - } - return mock; - }; - mock.mockReturnThis = function mockReturnThis() { - return mock.mockImplementation(function() { - return this; - }); - }; - mock.mockReturnValue = function mockReturnValue(value) { - return mock.mockImplementation(() => value); - }; - mock.mockReturnValueOnce = function mockReturnValueOnce(value) { - return mock.mockImplementationOnce(() => value); - }; - mock.mockResolvedValue = function mockResolvedValue(value) { - return mock.mockImplementation(() => Promise.resolve(value)); - }; - mock.mockResolvedValueOnce = function mockResolvedValueOnce(value) { - return mock.mockImplementationOnce(() => Promise.resolve(value)); - }; - mock.mockRejectedValue = function mockRejectedValue(value) { - return mock.mockImplementation(() => Promise.reject(value)); - }; - mock.mockRejectedValueOnce = function mockRejectedValueOnce(value) { - return mock.mockImplementationOnce(() => Promise.reject(value)); - }; - mock.mockClear = function mockClear() { - state.calls = []; - state.contexts = []; - state.instances = []; - state.invocationCallOrder = []; - state.results = []; - state.settledResults = []; - return mock; - }; - mock.mockReset = function mockReset() { - mock.mockClear(); - config.mockImplementation = resetToMockImplementation ? mockImplementation : undefined; - config.mockName = resetToMockName ? mock.name || "vi.fn()" : "vi.fn()"; - config.onceMockImplementations = []; - return mock; - }; - mock.mockRestore = function mockRestore() { - mock.mockReset(); - return restore === null || restore === void 0 ? void 0 : restore(); - }; - mock.mockName = function mockName(name) { - if (typeof name === "string") { - config.mockName = name; - } - return mock; - }; - mock.getMockName = function getMockName() { - return config.mockName || "vi.fn()"; - }; - if (Symbol.dispose) { - mock[Symbol.dispose] = () => mock.mockRestore(); - } - if (mockImplementation) { - mock.mockImplementation(mockImplementation); - } - return mock; -} -function fn(originalImplementation) { - // if the function is already a mock, just return the same function, - // simillarly to how vi.spyOn() works - if (originalImplementation != null && isMockFunction(originalImplementation)) { - return originalImplementation; - } - return createMockInstance({ - mockImplementation: originalImplementation, - resetToMockImplementation: true - }); -} -function spyOn(object, key, accessor) { - assert(object != null, "The vi.spyOn() function could not find an object to spy upon. The first argument must be defined."); - assert(typeof object === "object" || typeof object === "function", "Vitest cannot spy on a primitive value."); - const [originalDescriptorObject, originalDescriptor] = getDescriptor(object, key) || []; - assert(originalDescriptor || key in object, `The property "${String(key)}" is not defined on the ${typeof object}.`); - let accessType = accessor || "value"; - let ssr = false; - // vite ssr support - actual function is stored inside a getter - if (accessType === "value" && originalDescriptor && originalDescriptor.value == null && originalDescriptor.get) { - accessType = "get"; - ssr = true; - } - let original; - if (originalDescriptor) { - original = originalDescriptor[accessType]; - } else if (accessType !== "value") { - original = () => object[key]; - } else { - original = object[key]; - } - const originalImplementation = ssr && original ? original() : original; - const originalType = typeof originalImplementation; - assert( - // allow only functions - originalType === "function" || accessType !== "value" && original == null, - `vi.spyOn() can only spy on a function. Received ${originalType}.` - ); - if (isMockFunction(originalImplementation)) { - return originalImplementation; - } - const reassign = (cb) => { - const { value, ...desc } = originalDescriptor || { - configurable: true, - writable: true - }; - if (accessType !== "value") { - delete desc.writable; - } - desc[accessType] = cb; - Object.defineProperty(object, key, desc); - }; - const restore = () => { - // if method is defined on the prototype, we can just remove it from - // the current object instead of redefining a copy of it - if (originalDescriptorObject !== object) { - Reflect.deleteProperty(object, key); - } else if (originalDescriptor && !original) { - Object.defineProperty(object, key, originalDescriptor); - } else { - reassign(original); - } - }; - const mock = createMockInstance({ - restore, - originalImplementation, - resetToMockName: true - }); - try { - reassign(ssr ? () => mock : mock); - } catch (error) { - if (error instanceof TypeError && Symbol.toStringTag && object[Symbol.toStringTag] === "Module" && (error.message.includes("Cannot redefine property") || error.message.includes("Cannot replace module namespace") || error.message.includes("can't redefine non-configurable property"))) { - throw new TypeError(`Cannot spy on export "${String(key)}". Module namespace is not configurable in ESM. See: https://vitest.dev/guide/browser/#limitations`, { cause: error }); - } - throw error; - } - return mock; -} -function getDescriptor(obj, method) { - const objDescriptor = Object.getOwnPropertyDescriptor(obj, method); - if (objDescriptor) { - return [obj, objDescriptor]; - } - let currentProto = Object.getPrototypeOf(obj); - while (currentProto !== null) { - const descriptor = Object.getOwnPropertyDescriptor(currentProto, method); - if (descriptor) { - return [currentProto, descriptor]; - } - currentProto = Object.getPrototypeOf(currentProto); - } -} -function assert(condition, message) { - if (!condition) { - throw new Error(message); - } -} -let invocationCallCounter = 1; -function createMock({ state, config, name: mockName, prototypeState, prototypeConfig, keepMembersImplementation, mockImplementation, prototypeMembers = [] }) { - const original = config.mockOriginal; - const pseudoOriginal = mockImplementation; - const name = mockName || (original === null || original === void 0 ? void 0 : original.name) || "Mock"; - const namedObject = { [name]: (function(...args) { - registerCalls(args, state, prototypeState); - registerInvocationOrder(invocationCallCounter++, state, prototypeState); - const result = { - type: "incomplete", - value: undefined - }; - const settledResult = { - type: "incomplete", - value: undefined - }; - registerResult(result, state, prototypeState); - registerSettledResult(settledResult, state, prototypeState); - const context = new.target ? undefined : this; - const [instanceIndex, instancePrototypeIndex] = registerInstance(context, state, prototypeState); - const [contextIndex, contextPrototypeIndex] = registerContext(context, state, prototypeState); - const implementation = config.onceMockImplementations.shift() || config.mockImplementation || (prototypeConfig === null || prototypeConfig === void 0 ? void 0 : prototypeConfig.onceMockImplementations.shift()) || (prototypeConfig === null || prototypeConfig === void 0 ? void 0 : prototypeConfig.mockImplementation) || original || function() {}; - let returnValue; - let thrownValue; - let didThrow = false; - try { - if (new.target) { - returnValue = Reflect.construct(implementation, args, new.target); - // jest calls this before the implementation, but we have to resolve this _after_ - // because we cannot do it before the `Reflect.construct` called the custom implementation. - // fortunetly, the constructor is always an empty functon because `prototypeMethods` - // are only used by the automocker, so this doesn't matter - for (const prop of prototypeMembers) { - const prototypeMock = returnValue[prop]; - // the method was overidden because of inheritence, ignore it - // eslint-disable-next-line ts/no-use-before-define - if (prototypeMock !== mock.prototype[prop]) { - continue; - } - const isMock = isMockFunction(prototypeMock); - const prototypeState = isMock ? prototypeMock.mock : undefined; - const prototypeConfig = isMock ? MOCK_CONFIGS.get(prototypeMock) : undefined; - returnValue[prop] = createMockInstance({ - originalImplementation: keepMembersImplementation ? prototypeConfig === null || prototypeConfig === void 0 ? void 0 : prototypeConfig.mockOriginal : undefined, - prototypeState, - prototypeConfig, - keepMembersImplementation - }); - } - } else { - returnValue = implementation.apply(this, args); - } - } catch (error) { - thrownValue = error; - didThrow = true; - if (error instanceof TypeError && error.message.includes("is not a constructor")) { - console.warn(`[vitest] The ${namedObject[name].getMockName()} mock did not use 'function' or 'class' in its implementation, see https://vitest.dev/api/vi#vi-spyon for examples.`); - } - throw error; - } finally { - if (didThrow) { - result.type = "throw"; - result.value = thrownValue; - settledResult.type = "rejected"; - settledResult.value = thrownValue; - } else { - result.type = "return"; - result.value = returnValue; - if (new.target) { - state.contexts[contextIndex - 1] = returnValue; - state.instances[instanceIndex - 1] = returnValue; - if (contextPrototypeIndex != null && prototypeState) { - prototypeState.contexts[contextPrototypeIndex - 1] = returnValue; - } - if (instancePrototypeIndex != null && prototypeState) { - prototypeState.instances[instancePrototypeIndex - 1] = returnValue; - } - } - if (returnValue instanceof Promise) { - returnValue.then((settledValue) => { - settledResult.type = "fulfilled"; - settledResult.value = settledValue; - }, (rejectedValue) => { - settledResult.type = "rejected"; - settledResult.value = rejectedValue; - }); - } else { - settledResult.type = "fulfilled"; - settledResult.value = returnValue; - } - } - } - return returnValue; - }) }; - const mock = namedObject[name]; - const copyPropertiesFrom = original || pseudoOriginal; - if (copyPropertiesFrom) { - copyOriginalStaticProperties(mock, copyPropertiesFrom); - } - return mock; -} -function registerCalls(args, state, prototypeState) { - state.calls.push(args); - prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.calls.push(args); -} -function registerInvocationOrder(order, state, prototypeState) { - state.invocationCallOrder.push(order); - prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.invocationCallOrder.push(order); -} -function registerResult(result, state, prototypeState) { - state.results.push(result); - prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.results.push(result); -} -function registerSettledResult(result, state, prototypeState) { - state.settledResults.push(result); - prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.settledResults.push(result); -} -function registerInstance(instance, state, prototypeState) { - const instanceIndex = state.instances.push(instance); - const instancePrototypeIndex = prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.instances.push(instance); - return [instanceIndex, instancePrototypeIndex]; -} -function registerContext(context, state, prototypeState) { - const contextIndex = state.contexts.push(context); - const contextPrototypeIndex = prototypeState === null || prototypeState === void 0 ? void 0 : prototypeState.contexts.push(context); - return [contextIndex, contextPrototypeIndex]; -} -function copyOriginalStaticProperties(mock, original) { - const { properties, descriptors } = getAllProperties(original); - for (const key of properties) { - const descriptor = descriptors[key]; - const mockDescriptor = getDescriptor(mock, key); - if (mockDescriptor) { - continue; - } - Object.defineProperty(mock, key, descriptor); - } -} -const ignoreProperties = new Set([ - "length", - "name", - "prototype", - Symbol.for("nodejs.util.promisify.custom") -]); -function getAllProperties(original) { - const properties = new Set(); - const descriptors = {}; - while (original && original !== Object.prototype && original !== Function.prototype) { - const ownProperties = [...Object.getOwnPropertyNames(original), ...Object.getOwnPropertySymbols(original)]; - for (const prop of ownProperties) { - if (descriptors[prop] || ignoreProperties.has(prop)) { - continue; - } - properties.add(prop); - descriptors[prop] = Object.getOwnPropertyDescriptor(original, prop); - } - original = Object.getPrototypeOf(original); - } - return { - properties, - descriptors - }; -} -function getDefaultConfig(original) { - return { - mockImplementation: undefined, - mockOriginal: original, - mockName: "vi.fn()", - onceMockImplementations: [] - }; -} -function getDefaultState() { - const state = { - calls: [], - contexts: [], - instances: [], - invocationCallOrder: [], - settledResults: [], - results: [], - get lastCall() { - return state.calls.at(-1); - } - }; - return state; -} -function restoreAllMocks() { - for (const restore of MOCK_RESTORE) { - restore(); - } - MOCK_RESTORE.clear(); -} -function clearAllMocks() { - REGISTERED_MOCKS.forEach((mock) => mock.mockClear()); -} -function resetAllMocks() { - REGISTERED_MOCKS.forEach((mock) => mock.mockReset()); -} - -export { clearAllMocks, createMockInstance, fn, isMockFunction, resetAllMocks, restoreAllMocks, spyOn }; diff --git a/node_modules/@vitest/spy/package.json b/node_modules/@vitest/spy/package.json deleted file mode 100644 index 9029aa4..0000000 --- a/node_modules/@vitest/spy/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "@vitest/spy", - "type": "module", - "version": "4.0.16", - "description": "Lightweight Jest compatible spy implementation", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/spy#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/spy" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "files": [ - "dist" - ], - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/@vitest/utils/LICENSE b/node_modules/@vitest/utils/LICENSE deleted file mode 100644 index 0e5771d..0000000 --- a/node_modules/@vitest/utils/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2021-Present VoidZero Inc. and Vitest contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/@vitest/utils/diff.d.ts b/node_modules/@vitest/utils/diff.d.ts deleted file mode 100644 index 0a66b86..0000000 --- a/node_modules/@vitest/utils/diff.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/diff.js' diff --git a/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js b/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js deleted file mode 100644 index c9366dd..0000000 --- a/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +++ /dev/null @@ -1,5 +0,0 @@ -function getDefaultExportFromCjs(x) { - return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x; -} - -export { getDefaultExportFromCjs as g }; diff --git a/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js b/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js deleted file mode 100644 index 74d0dab..0000000 --- a/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.js +++ /dev/null @@ -1,156 +0,0 @@ -const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//; -function normalizeWindowsPath(input = "") { - if (!input) { - return input; - } - return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase()); -} - -const _UNC_REGEX = /^[/\\]{2}/; -const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/; -const _DRIVE_LETTER_RE = /^[A-Za-z]:$/; -const normalize = function(path) { - if (path.length === 0) { - return "."; - } - path = normalizeWindowsPath(path); - const isUNCPath = path.match(_UNC_REGEX); - const isPathAbsolute = isAbsolute(path); - const trailingSeparator = path[path.length - 1] === "/"; - path = normalizeString(path, !isPathAbsolute); - if (path.length === 0) { - if (isPathAbsolute) { - return "/"; - } - return trailingSeparator ? "./" : "."; - } - if (trailingSeparator) { - path += "/"; - } - if (_DRIVE_LETTER_RE.test(path)) { - path += "/"; - } - if (isUNCPath) { - if (!isPathAbsolute) { - return `//./${path}`; - } - return `//${path}`; - } - return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path; -}; -const join = function(...segments) { - let path = ""; - for (const seg of segments) { - if (!seg) { - continue; - } - if (path.length > 0) { - const pathTrailing = path[path.length - 1] === "/"; - const segLeading = seg[0] === "/"; - const both = pathTrailing && segLeading; - if (both) { - path += seg.slice(1); - } else { - path += pathTrailing || segLeading ? seg : `/${seg}`; - } - } else { - path += seg; - } - } - return normalize(path); -}; -function cwd() { - if (typeof process !== "undefined" && typeof process.cwd === "function") { - return process.cwd().replace(/\\/g, "/"); - } - return "/"; -} -const resolve = function(...arguments_) { - arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument)); - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) { - const path = index >= 0 ? arguments_[index] : cwd(); - if (!path || path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isAbsolute(path); - } - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute); - if (resolvedAbsolute && !isAbsolute(resolvedPath)) { - return `/${resolvedPath}`; - } - return resolvedPath.length > 0 ? resolvedPath : "."; -}; -function normalizeString(path, allowAboveRoot) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let char = null; - for (let index = 0; index <= path.length; ++index) { - if (index < path.length) { - char = path[index]; - } else if (char === "/") { - break; - } else { - char = "/"; - } - if (char === "/") { - if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf("/"); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf("/"); - } - lastSlash = index; - dots = 0; - continue; - } else if (res.length > 0) { - res = ""; - lastSegmentLength = 0; - lastSlash = index; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - res += res.length > 0 ? "/.." : ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) { - res += `/${path.slice(lastSlash + 1, index)}`; - } else { - res = path.slice(lastSlash + 1, index); - } - lastSegmentLength = index - lastSlash - 1; - } - lastSlash = index; - dots = 0; - } else if (char === "." && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} -const isAbsolute = function(p) { - return _IS_ABSOLUTE_RE.test(p); -}; -const dirname = function(p) { - const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1); - if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) { - segments[0] += "/"; - } - return segments.join("/") || (isAbsolute(p) ? "/" : "."); -}; - -export { dirname as d, join as j, resolve as r }; diff --git a/node_modules/@vitest/utils/dist/constants.d.ts b/node_modules/@vitest/utils/dist/constants.d.ts deleted file mode 100644 index bd5ad65..0000000 --- a/node_modules/@vitest/utils/dist/constants.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -declare const KNOWN_ASSET_TYPES: string[]; -declare const KNOWN_ASSET_RE: RegExp; -declare const CSS_LANGS_RE: RegExp; -/** -* Prefix for resolved Ids that are not valid browser import specifiers -*/ -declare const VALID_ID_PREFIX = "/@id/"; -/** -* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the -* module ID with `\0`, a convention from the rollup ecosystem. -* This prevents other plugins from trying to process the id (like node resolution), -* and core features like sourcemaps can use this info to differentiate between -* virtual modules and regular files. -* `\0` is not a permitted char in import URLs so we have to replace them during -* import analysis. The id will be decoded back before entering the plugins pipeline. -* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual -* modules in the browser end up encoded as `/@id/__x00__{id}` -*/ -declare const NULL_BYTE_PLACEHOLDER = "__x00__"; - -export { CSS_LANGS_RE, KNOWN_ASSET_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX }; diff --git a/node_modules/@vitest/utils/dist/constants.js b/node_modules/@vitest/utils/dist/constants.js deleted file mode 100644 index 385045b..0000000 --- a/node_modules/@vitest/utils/dist/constants.js +++ /dev/null @@ -1,49 +0,0 @@ -// TODO: this is all copy pasted from Vite - can they expose a module that exports only constants? -const KNOWN_ASSET_TYPES = [ - "apng", - "bmp", - "png", - "jpe?g", - "jfif", - "pjpeg", - "pjp", - "gif", - "svg", - "ico", - "webp", - "avif", - "mp4", - "webm", - "ogg", - "mp3", - "wav", - "flac", - "aac", - "woff2?", - "eot", - "ttf", - "otf", - "webmanifest", - "pdf", - "txt" -]; -const KNOWN_ASSET_RE = new RegExp(`\\.(${KNOWN_ASSET_TYPES.join("|")})$`); -const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/; -/** -* Prefix for resolved Ids that are not valid browser import specifiers -*/ -const VALID_ID_PREFIX = `/@id/`; -/** -* Plugins that use 'virtual modules' (e.g. for helper functions), prefix the -* module ID with `\0`, a convention from the rollup ecosystem. -* This prevents other plugins from trying to process the id (like node resolution), -* and core features like sourcemaps can use this info to differentiate between -* virtual modules and regular files. -* `\0` is not a permitted char in import URLs so we have to replace them during -* import analysis. The id will be decoded back before entering the plugins pipeline. -* These encoded virtual ids are also prefixed by the VALID_ID_PREFIX, so virtual -* modules in the browser end up encoded as `/@id/__x00__{id}` -*/ -const NULL_BYTE_PLACEHOLDER = `__x00__`; - -export { CSS_LANGS_RE, KNOWN_ASSET_RE, KNOWN_ASSET_TYPES, NULL_BYTE_PLACEHOLDER, VALID_ID_PREFIX }; diff --git a/node_modules/@vitest/utils/dist/diff.d.ts b/node_modules/@vitest/utils/dist/diff.d.ts deleted file mode 100644 index 603569d..0000000 --- a/node_modules/@vitest/utils/dist/diff.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { D as DiffOptions } from './types.d-BCElaP-c.js'; -export { a as DiffOptionsColor, S as SerializedDiffOptions } from './types.d-BCElaP-c.js'; -import '@vitest/pretty-format'; - -/** -* Diff Match and Patch -* Copyright 2018 The diff-match-patch Authors. -* https://github.com/google/diff-match-patch -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/** -* @fileoverview Computes the difference between two texts to create a patch. -* Applies the patch onto another text, allowing for errors. -* @author fraser@google.com (Neil Fraser) -*/ -/** -* CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file: -* -* 1. Delete anything not needed to use diff_cleanupSemantic method -* 2. Convert from prototype properties to var declarations -* 3. Convert Diff to class from constructor and prototype -* 4. Add type annotations for arguments and return values -* 5. Add exports -*/ -/** -* The data structure representing a diff is an array of tuples: -* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] -* which means: delete 'Hello', add 'Goodbye' and keep ' world.' -*/ -declare const DIFF_DELETE = -1; -declare const DIFF_INSERT = 1; -declare const DIFF_EQUAL = 0; -/** -* Class representing one diff tuple. -* Attempts to look like a two-element array (which is what this used to be). -* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. -* @param {string} text Text to be deleted, inserted, or retained. -* @constructor -*/ -declare class Diff { - 0: number; - 1: string; - constructor(op: number, text: string); -} - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -declare function diffLinesUnified(aLines: Array, bLines: Array, options?: DiffOptions): string; -declare function diffLinesUnified2(aLinesDisplay: Array, bLinesDisplay: Array, aLinesCompare: Array, bLinesCompare: Array, options?: DiffOptions): string; -declare function diffLinesRaw(aLines: Array, bLines: Array, options?: DiffOptions): [Array, boolean]; - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -declare function diffStringsUnified(a: string, b: string, options?: DiffOptions): string; -declare function diffStringsRaw(a: string, b: string, cleanup: boolean, options?: DiffOptions): [Array, boolean]; - -/** -* @param a Expected value -* @param b Received value -* @param options Diff options -* @returns {string | null} a string diff -*/ -declare function diff(a: any, b: any, options?: DiffOptions): string | undefined; -declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions): string | undefined; -declare function replaceAsymmetricMatcher(actual: any, expected: any, actualReplaced?: WeakSet, expectedReplaced?: WeakSet): { - replacedActual: any; - replacedExpected: any; -}; -type PrintLabel = (string: string) => string; -declare function getLabelPrinter(...strings: Array): PrintLabel; - -export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, DiffOptions, diff, diffLinesRaw, diffLinesUnified, diffLinesUnified2, diffStringsRaw, diffStringsUnified, getLabelPrinter, printDiffOrStringify, replaceAsymmetricMatcher }; diff --git a/node_modules/@vitest/utils/dist/diff.js b/node_modules/@vitest/utils/dist/diff.js deleted file mode 100644 index 2386857..0000000 --- a/node_modules/@vitest/utils/dist/diff.js +++ /dev/null @@ -1,2187 +0,0 @@ -import { plugins, format } from '@vitest/pretty-format'; -import c from 'tinyrainbow'; -import { stringify } from './display.js'; -import { deepClone, getOwnProperties, getType as getType$1 } from './helpers.js'; -import { g as getDefaultExportFromCjs } from './chunk-_commonjsHelpers.js'; -import './constants.js'; - -/** -* Diff Match and Patch -* Copyright 2018 The diff-match-patch Authors. -* https://github.com/google/diff-match-patch -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ -/** -* @fileoverview Computes the difference between two texts to create a patch. -* Applies the patch onto another text, allowing for errors. -* @author fraser@google.com (Neil Fraser) -*/ -/** -* CHANGES by pedrottimark to diff_match_patch_uncompressed.ts file: -* -* 1. Delete anything not needed to use diff_cleanupSemantic method -* 2. Convert from prototype properties to var declarations -* 3. Convert Diff to class from constructor and prototype -* 4. Add type annotations for arguments and return values -* 5. Add exports -*/ -/** -* The data structure representing a diff is an array of tuples: -* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] -* which means: delete 'Hello', add 'Goodbye' and keep ' world.' -*/ -const DIFF_DELETE = -1; -const DIFF_INSERT = 1; -const DIFF_EQUAL = 0; -/** -* Class representing one diff tuple. -* Attempts to look like a two-element array (which is what this used to be). -* @param {number} op Operation, one of: DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL. -* @param {string} text Text to be deleted, inserted, or retained. -* @constructor -*/ -class Diff { - 0; - 1; - constructor(op, text) { - this[0] = op; - this[1] = text; - } -} -/** -* Determine the common prefix of two strings. -* @param {string} text1 First string. -* @param {string} text2 Second string. -* @return {number} The number of characters common to the start of each -* string. -*/ -function diff_commonPrefix(text1, text2) { - // Quick check for common null cases. - if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) { - return 0; - } - // Binary search. - // Performance analysis: https://neil.fraser.name/news/2007/10/09/ - let pointermin = 0; - let pointermax = Math.min(text1.length, text2.length); - let pointermid = pointermax; - let pointerstart = 0; - while (pointermin < pointermid) { - if (text1.substring(pointerstart, pointermid) === text2.substring(pointerstart, pointermid)) { - pointermin = pointermid; - pointerstart = pointermin; - } else { - pointermax = pointermid; - } - pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); - } - return pointermid; -} -/** -* Determine the common suffix of two strings. -* @param {string} text1 First string. -* @param {string} text2 Second string. -* @return {number} The number of characters common to the end of each string. -*/ -function diff_commonSuffix(text1, text2) { - // Quick check for common null cases. - if (!text1 || !text2 || text1.charAt(text1.length - 1) !== text2.charAt(text2.length - 1)) { - return 0; - } - // Binary search. - // Performance analysis: https://neil.fraser.name/news/2007/10/09/ - let pointermin = 0; - let pointermax = Math.min(text1.length, text2.length); - let pointermid = pointermax; - let pointerend = 0; - while (pointermin < pointermid) { - if (text1.substring(text1.length - pointermid, text1.length - pointerend) === text2.substring(text2.length - pointermid, text2.length - pointerend)) { - pointermin = pointermid; - pointerend = pointermin; - } else { - pointermax = pointermid; - } - pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); - } - return pointermid; -} -/** -* Determine if the suffix of one string is the prefix of another. -* @param {string} text1 First string. -* @param {string} text2 Second string. -* @return {number} The number of characters common to the end of the first -* string and the start of the second string. -* @private -*/ -function diff_commonOverlap_(text1, text2) { - // Cache the text lengths to prevent multiple calls. - const text1_length = text1.length; - const text2_length = text2.length; - // Eliminate the null case. - if (text1_length === 0 || text2_length === 0) { - return 0; - } - // Truncate the longer string. - if (text1_length > text2_length) { - text1 = text1.substring(text1_length - text2_length); - } else if (text1_length < text2_length) { - text2 = text2.substring(0, text1_length); - } - const text_length = Math.min(text1_length, text2_length); - // Quick check for the worst case. - if (text1 === text2) { - return text_length; - } - // Start by looking for a single character match - // and increase length until no match is found. - // Performance analysis: https://neil.fraser.name/news/2010/11/04/ - let best = 0; - let length = 1; - while (true) { - const pattern = text1.substring(text_length - length); - const found = text2.indexOf(pattern); - if (found === -1) { - return best; - } - length += found; - if (found === 0 || text1.substring(text_length - length) === text2.substring(0, length)) { - best = length; - length++; - } - } -} -/** -* Reduce the number of edits by eliminating semantically trivial equalities. -* @param {!Array.} diffs Array of diff tuples. -*/ -function diff_cleanupSemantic(diffs) { - let changes = false; - const equalities = []; - let equalitiesLength = 0; - /** @type {?string} */ - let lastEquality = null; - // Always equal to diffs[equalities[equalitiesLength - 1]][1] - let pointer = 0; - // Number of characters that changed prior to the equality. - let length_insertions1 = 0; - let length_deletions1 = 0; - // Number of characters that changed after the equality. - let length_insertions2 = 0; - let length_deletions2 = 0; - while (pointer < diffs.length) { - if (diffs[pointer][0] === DIFF_EQUAL) { - // Equality found. - equalities[equalitiesLength++] = pointer; - length_insertions1 = length_insertions2; - length_deletions1 = length_deletions2; - length_insertions2 = 0; - length_deletions2 = 0; - lastEquality = diffs[pointer][1]; - } else { - // An insertion or deletion. - if (diffs[pointer][0] === DIFF_INSERT) { - length_insertions2 += diffs[pointer][1].length; - } else { - length_deletions2 += diffs[pointer][1].length; - } - // Eliminate an equality that is smaller or equal to the edits on both - // sides of it. - if (lastEquality && lastEquality.length <= Math.max(length_insertions1, length_deletions1) && lastEquality.length <= Math.max(length_insertions2, length_deletions2)) { - // Duplicate record. - diffs.splice(equalities[equalitiesLength - 1], 0, new Diff(DIFF_DELETE, lastEquality)); - // Change second copy to insert. - diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; - // Throw away the equality we just deleted. - equalitiesLength--; - // Throw away the previous equality (it needs to be reevaluated). - equalitiesLength--; - pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; - length_insertions1 = 0; - length_deletions1 = 0; - length_insertions2 = 0; - length_deletions2 = 0; - lastEquality = null; - changes = true; - } - } - pointer++; - } - // Normalize the diff. - if (changes) { - diff_cleanupMerge(diffs); - } - diff_cleanupSemanticLossless(diffs); - // Find any overlaps between deletions and insertions. - // e.g: abcxxxxxxdef - // -> abcxxxdef - // e.g: xxxabcdefxxx - // -> defxxxabc - // Only extract an overlap if it is as big as the edit ahead or behind it. - pointer = 1; - while (pointer < diffs.length) { - if (diffs[pointer - 1][0] === DIFF_DELETE && diffs[pointer][0] === DIFF_INSERT) { - const deletion = diffs[pointer - 1][1]; - const insertion = diffs[pointer][1]; - const overlap_length1 = diff_commonOverlap_(deletion, insertion); - const overlap_length2 = diff_commonOverlap_(insertion, deletion); - if (overlap_length1 >= overlap_length2) { - if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) { - // Overlap found. Insert an equality and trim the surrounding edits. - diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, insertion.substring(0, overlap_length1))); - diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1); - diffs[pointer + 1][1] = insertion.substring(overlap_length1); - pointer++; - } - } else { - if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) { - // Reverse overlap found. - // Insert an equality and swap and trim the surrounding edits. - diffs.splice(pointer, 0, new Diff(DIFF_EQUAL, deletion.substring(0, overlap_length2))); - diffs[pointer - 1][0] = DIFF_INSERT; - diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2); - diffs[pointer + 1][0] = DIFF_DELETE; - diffs[pointer + 1][1] = deletion.substring(overlap_length2); - pointer++; - } - } - pointer++; - } - pointer++; - } -} -// Define some regex patterns for matching boundaries. -const nonAlphaNumericRegex_ = /[^a-z0-9]/i; -const whitespaceRegex_ = /\s/; -const linebreakRegex_ = /[\r\n]/; -const blanklineEndRegex_ = /\n\r?\n$/; -const blanklineStartRegex_ = /^\r?\n\r?\n/; -/** -* Look for single edits surrounded on both sides by equalities -* which can be shifted sideways to align the edit to a word boundary. -* e.g: The cat came. -> The cat came. -* @param {!Array.} diffs Array of diff tuples. -*/ -function diff_cleanupSemanticLossless(diffs) { - let pointer = 1; - // Intentionally ignore the first and last element (don't need checking). - while (pointer < diffs.length - 1) { - if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) { - // This is a single edit surrounded by equalities. - let equality1 = diffs[pointer - 1][1]; - let edit = diffs[pointer][1]; - let equality2 = diffs[pointer + 1][1]; - // First, shift the edit as far left as possible. - const commonOffset = diff_commonSuffix(equality1, edit); - if (commonOffset) { - const commonString = edit.substring(edit.length - commonOffset); - equality1 = equality1.substring(0, equality1.length - commonOffset); - edit = commonString + edit.substring(0, edit.length - commonOffset); - equality2 = commonString + equality2; - } - // Second, step character by character right, looking for the best fit. - let bestEquality1 = equality1; - let bestEdit = edit; - let bestEquality2 = equality2; - let bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); - while (edit.charAt(0) === equality2.charAt(0)) { - equality1 += edit.charAt(0); - edit = edit.substring(1) + equality2.charAt(0); - equality2 = equality2.substring(1); - const score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); - // The >= encourages trailing rather than leading whitespace on edits. - if (score >= bestScore) { - bestScore = score; - bestEquality1 = equality1; - bestEdit = edit; - bestEquality2 = equality2; - } - } - if (diffs[pointer - 1][1] !== bestEquality1) { - // We have an improvement, save it back to the diff. - if (bestEquality1) { - diffs[pointer - 1][1] = bestEquality1; - } else { - diffs.splice(pointer - 1, 1); - pointer--; - } - diffs[pointer][1] = bestEdit; - if (bestEquality2) { - diffs[pointer + 1][1] = bestEquality2; - } else { - diffs.splice(pointer + 1, 1); - pointer--; - } - } - } - pointer++; - } -} -/** -* Reorder and merge like edit sections. Merge equalities. -* Any edit section can move as long as it doesn't cross an equality. -* @param {!Array.} diffs Array of diff tuples. -*/ -function diff_cleanupMerge(diffs) { - var _diffs$at; - // Add a dummy entry at the end. - diffs.push(new Diff(DIFF_EQUAL, "")); - let pointer = 0; - let count_delete = 0; - let count_insert = 0; - let text_delete = ""; - let text_insert = ""; - let commonlength; - while (pointer < diffs.length) { - switch (diffs[pointer][0]) { - case DIFF_INSERT: - count_insert++; - text_insert += diffs[pointer][1]; - pointer++; - break; - case DIFF_DELETE: - count_delete++; - text_delete += diffs[pointer][1]; - pointer++; - break; - case DIFF_EQUAL: - // Upon reaching an equality, check for prior redundancies. - if (count_delete + count_insert > 1) { - if (count_delete !== 0 && count_insert !== 0) { - // Factor out any common prefixes. - commonlength = diff_commonPrefix(text_insert, text_delete); - if (commonlength !== 0) { - if (pointer - count_delete - count_insert > 0 && diffs[pointer - count_delete - count_insert - 1][0] === DIFF_EQUAL) { - diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength); - } else { - diffs.splice(0, 0, new Diff(DIFF_EQUAL, text_insert.substring(0, commonlength))); - pointer++; - } - text_insert = text_insert.substring(commonlength); - text_delete = text_delete.substring(commonlength); - } - // Factor out any common suffixes. - commonlength = diff_commonSuffix(text_insert, text_delete); - if (commonlength !== 0) { - diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1]; - text_insert = text_insert.substring(0, text_insert.length - commonlength); - text_delete = text_delete.substring(0, text_delete.length - commonlength); - } - } - // Delete the offending records and add the merged ones. - pointer -= count_delete + count_insert; - diffs.splice(pointer, count_delete + count_insert); - if (text_delete.length) { - diffs.splice(pointer, 0, new Diff(DIFF_DELETE, text_delete)); - pointer++; - } - if (text_insert.length) { - diffs.splice(pointer, 0, new Diff(DIFF_INSERT, text_insert)); - pointer++; - } - pointer++; - } else if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) { - // Merge this equality with the previous one. - diffs[pointer - 1][1] += diffs[pointer][1]; - diffs.splice(pointer, 1); - } else { - pointer++; - } - count_insert = 0; - count_delete = 0; - text_delete = ""; - text_insert = ""; - break; - } - } - if (((_diffs$at = diffs.at(-1)) === null || _diffs$at === void 0 ? void 0 : _diffs$at[1]) === "") { - diffs.pop(); - } - // Second pass: look for single edits surrounded on both sides by equalities - // which can be shifted sideways to eliminate an equality. - // e.g: ABAC -> ABAC - let changes = false; - pointer = 1; - // Intentionally ignore the first and last element (don't need checking). - while (pointer < diffs.length - 1) { - if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) { - // This is a single edit surrounded by equalities. - if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) { - // Shift the edit over the previous equality. - diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); - diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; - diffs.splice(pointer - 1, 1); - changes = true; - } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) === diffs[pointer + 1][1]) { - // Shift the edit over the next equality. - diffs[pointer - 1][1] += diffs[pointer + 1][1]; - diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; - diffs.splice(pointer + 1, 1); - changes = true; - } - } - pointer++; - } - // If shifts were made, the diff needs reordering and another shift sweep. - if (changes) { - diff_cleanupMerge(diffs); - } -} -/** -* Given two strings, compute a score representing whether the internal -* boundary falls on logical boundaries. -* Scores range from 6 (best) to 0 (worst). -* Closure, but does not reference any external variables. -* @param {string} one First string. -* @param {string} two Second string. -* @return {number} The score. -* @private -*/ -function diff_cleanupSemanticScore_(one, two) { - if (!one || !two) { - // Edges are the best. - return 6; - } - // Each port of this function behaves slightly differently due to - // subtle differences in each language's definition of things like - // 'whitespace'. Since this function's purpose is largely cosmetic, - // the choice has been made to use each language's native features - // rather than force total conformity. - const char1 = one.charAt(one.length - 1); - const char2 = two.charAt(0); - const nonAlphaNumeric1 = char1.match(nonAlphaNumericRegex_); - const nonAlphaNumeric2 = char2.match(nonAlphaNumericRegex_); - const whitespace1 = nonAlphaNumeric1 && char1.match(whitespaceRegex_); - const whitespace2 = nonAlphaNumeric2 && char2.match(whitespaceRegex_); - const lineBreak1 = whitespace1 && char1.match(linebreakRegex_); - const lineBreak2 = whitespace2 && char2.match(linebreakRegex_); - const blankLine1 = lineBreak1 && one.match(blanklineEndRegex_); - const blankLine2 = lineBreak2 && two.match(blanklineStartRegex_); - if (blankLine1 || blankLine2) { - // Five points for blank lines. - return 5; - } else if (lineBreak1 || lineBreak2) { - // Four points for line breaks. - return 4; - } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) { - // Three points for end of sentences. - return 3; - } else if (whitespace1 || whitespace2) { - // Two points for whitespace. - return 2; - } else if (nonAlphaNumeric1 || nonAlphaNumeric2) { - // One point for non-alphanumeric. - return 1; - } - return 0; -} - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ -const NO_DIFF_MESSAGE = "Compared values have no visual difference."; -const SIMILAR_MESSAGE = "Compared values serialize to the same structure.\n" + "Printing internal object structure without calling `toJSON` instead."; - -var build = {}; - -var hasRequiredBuild; - -function requireBuild () { - if (hasRequiredBuild) return build; - hasRequiredBuild = 1; - - Object.defineProperty(build, '__esModule', { - value: true - }); - build.default = diffSequence; - /** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - */ - - // This diff-sequences package implements the linear space variation in - // An O(ND) Difference Algorithm and Its Variations by Eugene W. Myers - - // Relationship in notation between Myers paper and this package: - // A is a - // N is aLength, aEnd - aStart, and so on - // x is aIndex, aFirst, aLast, and so on - // B is b - // M is bLength, bEnd - bStart, and so on - // y is bIndex, bFirst, bLast, and so on - // Δ = N - M is negative of baDeltaLength = bLength - aLength - // D is d - // k is kF - // k + Δ is kF = kR - baDeltaLength - // V is aIndexesF or aIndexesR (see comment below about Indexes type) - // index intervals [1, N] and [1, M] are [0, aLength) and [0, bLength) - // starting point in forward direction (0, 0) is (-1, -1) - // starting point in reverse direction (N + 1, M + 1) is (aLength, bLength) - - // The “edit graph” for sequences a and b corresponds to items: - // in a on the horizontal axis - // in b on the vertical axis - // - // Given a-coordinate of a point in a diagonal, you can compute b-coordinate. - // - // Forward diagonals kF: - // zero diagonal intersects top left corner - // positive diagonals intersect top edge - // negative diagonals insersect left edge - // - // Reverse diagonals kR: - // zero diagonal intersects bottom right corner - // positive diagonals intersect right edge - // negative diagonals intersect bottom edge - - // The graph contains a directed acyclic graph of edges: - // horizontal: delete an item from a - // vertical: insert an item from b - // diagonal: common item in a and b - // - // The algorithm solves dual problems in the graph analogy: - // Find longest common subsequence: path with maximum number of diagonal edges - // Find shortest edit script: path with minimum number of non-diagonal edges - - // Input callback function compares items at indexes in the sequences. - - // Output callback function receives the number of adjacent items - // and starting indexes of each common subsequence. - // Either original functions or wrapped to swap indexes if graph is transposed. - // Indexes in sequence a of last point of forward or reverse paths in graph. - // Myers algorithm indexes by diagonal k which for negative is bad deopt in V8. - // This package indexes by iF and iR which are greater than or equal to zero. - // and also updates the index arrays in place to cut memory in half. - // kF = 2 * iF - d - // kR = d - 2 * iR - // Division of index intervals in sequences a and b at the middle change. - // Invariant: intervals do not have common items at the start or end. - const pkg = 'diff-sequences'; // for error messages - const NOT_YET_SET = 0; // small int instead of undefined to avoid deopt in V8 - - // Return the number of common items that follow in forward direction. - // The length of what Myers paper calls a “snake” in a forward path. - const countCommonItemsF = (aIndex, aEnd, bIndex, bEnd, isCommon) => { - let nCommon = 0; - while (aIndex < aEnd && bIndex < bEnd && isCommon(aIndex, bIndex)) { - aIndex += 1; - bIndex += 1; - nCommon += 1; - } - return nCommon; - }; - - // Return the number of common items that precede in reverse direction. - // The length of what Myers paper calls a “snake” in a reverse path. - const countCommonItemsR = (aStart, aIndex, bStart, bIndex, isCommon) => { - let nCommon = 0; - while (aStart <= aIndex && bStart <= bIndex && isCommon(aIndex, bIndex)) { - aIndex -= 1; - bIndex -= 1; - nCommon += 1; - } - return nCommon; - }; - - // A simple function to extend forward paths from (d - 1) to d changes - // when forward and reverse paths cannot yet overlap. - const extendPathsF = ( - d, - aEnd, - bEnd, - bF, - isCommon, - aIndexesF, - iMaxF // return the value because optimization might decrease it - ) => { - // Unroll the first iteration. - let iF = 0; - let kF = -d; // kF = 2 * iF - d - let aFirst = aIndexesF[iF]; // in first iteration always insert - let aIndexPrev1 = aFirst; // prev value of [iF - 1] in next iteration - aIndexesF[iF] += countCommonItemsF( - aFirst + 1, - aEnd, - bF + aFirst - kF + 1, - bEnd, - isCommon - ); - - // Optimization: skip diagonals in which paths cannot ever overlap. - const nF = d < iMaxF ? d : iMaxF; - - // The diagonals kF are odd when d is odd and even when d is even. - for (iF += 1, kF += 2; iF <= nF; iF += 1, kF += 2) { - // To get first point of path segment, move one change in forward direction - // from last point of previous path segment in an adjacent diagonal. - // In last possible iteration when iF === d and kF === d always delete. - if (iF !== d && aIndexPrev1 < aIndexesF[iF]) { - aFirst = aIndexesF[iF]; // vertical to insert from b - } else { - aFirst = aIndexPrev1 + 1; // horizontal to delete from a - - if (aEnd <= aFirst) { - // Optimization: delete moved past right of graph. - return iF - 1; - } - } - - // To get last point of path segment, move along diagonal of common items. - aIndexPrev1 = aIndexesF[iF]; - aIndexesF[iF] = - aFirst + - countCommonItemsF(aFirst + 1, aEnd, bF + aFirst - kF + 1, bEnd, isCommon); - } - return iMaxF; - }; - - // A simple function to extend reverse paths from (d - 1) to d changes - // when reverse and forward paths cannot yet overlap. - const extendPathsR = ( - d, - aStart, - bStart, - bR, - isCommon, - aIndexesR, - iMaxR // return the value because optimization might decrease it - ) => { - // Unroll the first iteration. - let iR = 0; - let kR = d; // kR = d - 2 * iR - let aFirst = aIndexesR[iR]; // in first iteration always insert - let aIndexPrev1 = aFirst; // prev value of [iR - 1] in next iteration - aIndexesR[iR] -= countCommonItemsR( - aStart, - aFirst - 1, - bStart, - bR + aFirst - kR - 1, - isCommon - ); - - // Optimization: skip diagonals in which paths cannot ever overlap. - const nR = d < iMaxR ? d : iMaxR; - - // The diagonals kR are odd when d is odd and even when d is even. - for (iR += 1, kR -= 2; iR <= nR; iR += 1, kR -= 2) { - // To get first point of path segment, move one change in reverse direction - // from last point of previous path segment in an adjacent diagonal. - // In last possible iteration when iR === d and kR === -d always delete. - if (iR !== d && aIndexesR[iR] < aIndexPrev1) { - aFirst = aIndexesR[iR]; // vertical to insert from b - } else { - aFirst = aIndexPrev1 - 1; // horizontal to delete from a - - if (aFirst < aStart) { - // Optimization: delete moved past left of graph. - return iR - 1; - } - } - - // To get last point of path segment, move along diagonal of common items. - aIndexPrev1 = aIndexesR[iR]; - aIndexesR[iR] = - aFirst - - countCommonItemsR( - aStart, - aFirst - 1, - bStart, - bR + aFirst - kR - 1, - isCommon - ); - } - return iMaxR; - }; - - // A complete function to extend forward paths from (d - 1) to d changes. - // Return true if a path overlaps reverse path of (d - 1) changes in its diagonal. - const extendOverlappablePathsF = ( - d, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - iMaxF, - aIndexesR, - iMaxR, - division // update prop values if return true - ) => { - const bF = bStart - aStart; // bIndex = bF + aIndex - kF - const aLength = aEnd - aStart; - const bLength = bEnd - bStart; - const baDeltaLength = bLength - aLength; // kF = kR - baDeltaLength - - // Range of diagonals in which forward and reverse paths might overlap. - const kMinOverlapF = -baDeltaLength - (d - 1); // -(d - 1) <= kR - const kMaxOverlapF = -baDeltaLength + (d - 1); // kR <= (d - 1) - - let aIndexPrev1 = NOT_YET_SET; // prev value of [iF - 1] in next iteration - - // Optimization: skip diagonals in which paths cannot ever overlap. - const nF = d < iMaxF ? d : iMaxF; - - // The diagonals kF = 2 * iF - d are odd when d is odd and even when d is even. - for (let iF = 0, kF = -d; iF <= nF; iF += 1, kF += 2) { - // To get first point of path segment, move one change in forward direction - // from last point of previous path segment in an adjacent diagonal. - // In first iteration when iF === 0 and kF === -d always insert. - // In last possible iteration when iF === d and kF === d always delete. - const insert = iF === 0 || (iF !== d && aIndexPrev1 < aIndexesF[iF]); - const aLastPrev = insert ? aIndexesF[iF] : aIndexPrev1; - const aFirst = insert - ? aLastPrev // vertical to insert from b - : aLastPrev + 1; // horizontal to delete from a - - // To get last point of path segment, move along diagonal of common items. - const bFirst = bF + aFirst - kF; - const nCommonF = countCommonItemsF( - aFirst + 1, - aEnd, - bFirst + 1, - bEnd, - isCommon - ); - const aLast = aFirst + nCommonF; - aIndexPrev1 = aIndexesF[iF]; - aIndexesF[iF] = aLast; - if (kMinOverlapF <= kF && kF <= kMaxOverlapF) { - // Solve for iR of reverse path with (d - 1) changes in diagonal kF: - // kR = kF + baDeltaLength - // kR = (d - 1) - 2 * iR - const iR = (d - 1 - (kF + baDeltaLength)) / 2; - - // If this forward path overlaps the reverse path in this diagonal, - // then this is the middle change of the index intervals. - if (iR <= iMaxR && aIndexesR[iR] - 1 <= aLast) { - // Unlike the Myers algorithm which finds only the middle “snake” - // this package can find two common subsequences per division. - // Last point of previous path segment is on an adjacent diagonal. - const bLastPrev = bF + aLastPrev - (insert ? kF + 1 : kF - 1); - - // Because of invariant that intervals preceding the middle change - // cannot have common items at the end, - // move in reverse direction along a diagonal of common items. - const nCommonR = countCommonItemsR( - aStart, - aLastPrev, - bStart, - bLastPrev, - isCommon - ); - const aIndexPrevFirst = aLastPrev - nCommonR; - const bIndexPrevFirst = bLastPrev - nCommonR; - const aEndPreceding = aIndexPrevFirst + 1; - const bEndPreceding = bIndexPrevFirst + 1; - division.nChangePreceding = d - 1; - if (d - 1 === aEndPreceding + bEndPreceding - aStart - bStart) { - // Optimization: number of preceding changes in forward direction - // is equal to number of items in preceding interval, - // therefore it cannot contain any common items. - division.aEndPreceding = aStart; - division.bEndPreceding = bStart; - } else { - division.aEndPreceding = aEndPreceding; - division.bEndPreceding = bEndPreceding; - } - division.nCommonPreceding = nCommonR; - if (nCommonR !== 0) { - division.aCommonPreceding = aEndPreceding; - division.bCommonPreceding = bEndPreceding; - } - division.nCommonFollowing = nCommonF; - if (nCommonF !== 0) { - division.aCommonFollowing = aFirst + 1; - division.bCommonFollowing = bFirst + 1; - } - const aStartFollowing = aLast + 1; - const bStartFollowing = bFirst + nCommonF + 1; - division.nChangeFollowing = d - 1; - if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { - // Optimization: number of changes in reverse direction - // is equal to number of items in following interval, - // therefore it cannot contain any common items. - division.aStartFollowing = aEnd; - division.bStartFollowing = bEnd; - } else { - division.aStartFollowing = aStartFollowing; - division.bStartFollowing = bStartFollowing; - } - return true; - } - } - } - return false; - }; - - // A complete function to extend reverse paths from (d - 1) to d changes. - // Return true if a path overlaps forward path of d changes in its diagonal. - const extendOverlappablePathsR = ( - d, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - iMaxF, - aIndexesR, - iMaxR, - division // update prop values if return true - ) => { - const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR - const aLength = aEnd - aStart; - const bLength = bEnd - bStart; - const baDeltaLength = bLength - aLength; // kR = kF + baDeltaLength - - // Range of diagonals in which forward and reverse paths might overlap. - const kMinOverlapR = baDeltaLength - d; // -d <= kF - const kMaxOverlapR = baDeltaLength + d; // kF <= d - - let aIndexPrev1 = NOT_YET_SET; // prev value of [iR - 1] in next iteration - - // Optimization: skip diagonals in which paths cannot ever overlap. - const nR = d < iMaxR ? d : iMaxR; - - // The diagonals kR = d - 2 * iR are odd when d is odd and even when d is even. - for (let iR = 0, kR = d; iR <= nR; iR += 1, kR -= 2) { - // To get first point of path segment, move one change in reverse direction - // from last point of previous path segment in an adjacent diagonal. - // In first iteration when iR === 0 and kR === d always insert. - // In last possible iteration when iR === d and kR === -d always delete. - const insert = iR === 0 || (iR !== d && aIndexesR[iR] < aIndexPrev1); - const aLastPrev = insert ? aIndexesR[iR] : aIndexPrev1; - const aFirst = insert - ? aLastPrev // vertical to insert from b - : aLastPrev - 1; // horizontal to delete from a - - // To get last point of path segment, move along diagonal of common items. - const bFirst = bR + aFirst - kR; - const nCommonR = countCommonItemsR( - aStart, - aFirst - 1, - bStart, - bFirst - 1, - isCommon - ); - const aLast = aFirst - nCommonR; - aIndexPrev1 = aIndexesR[iR]; - aIndexesR[iR] = aLast; - if (kMinOverlapR <= kR && kR <= kMaxOverlapR) { - // Solve for iF of forward path with d changes in diagonal kR: - // kF = kR - baDeltaLength - // kF = 2 * iF - d - const iF = (d + (kR - baDeltaLength)) / 2; - - // If this reverse path overlaps the forward path in this diagonal, - // then this is a middle change of the index intervals. - if (iF <= iMaxF && aLast - 1 <= aIndexesF[iF]) { - const bLast = bFirst - nCommonR; - division.nChangePreceding = d; - if (d === aLast + bLast - aStart - bStart) { - // Optimization: number of changes in reverse direction - // is equal to number of items in preceding interval, - // therefore it cannot contain any common items. - division.aEndPreceding = aStart; - division.bEndPreceding = bStart; - } else { - division.aEndPreceding = aLast; - division.bEndPreceding = bLast; - } - division.nCommonPreceding = nCommonR; - if (nCommonR !== 0) { - // The last point of reverse path segment is start of common subsequence. - division.aCommonPreceding = aLast; - division.bCommonPreceding = bLast; - } - division.nChangeFollowing = d - 1; - if (d === 1) { - // There is no previous path segment. - division.nCommonFollowing = 0; - division.aStartFollowing = aEnd; - division.bStartFollowing = bEnd; - } else { - // Unlike the Myers algorithm which finds only the middle “snake” - // this package can find two common subsequences per division. - // Last point of previous path segment is on an adjacent diagonal. - const bLastPrev = bR + aLastPrev - (insert ? kR - 1 : kR + 1); - - // Because of invariant that intervals following the middle change - // cannot have common items at the start, - // move in forward direction along a diagonal of common items. - const nCommonF = countCommonItemsF( - aLastPrev, - aEnd, - bLastPrev, - bEnd, - isCommon - ); - division.nCommonFollowing = nCommonF; - if (nCommonF !== 0) { - // The last point of reverse path segment is start of common subsequence. - division.aCommonFollowing = aLastPrev; - division.bCommonFollowing = bLastPrev; - } - const aStartFollowing = aLastPrev + nCommonF; // aFirstPrev - const bStartFollowing = bLastPrev + nCommonF; // bFirstPrev - - if (d - 1 === aEnd + bEnd - aStartFollowing - bStartFollowing) { - // Optimization: number of changes in forward direction - // is equal to number of items in following interval, - // therefore it cannot contain any common items. - division.aStartFollowing = aEnd; - division.bStartFollowing = bEnd; - } else { - division.aStartFollowing = aStartFollowing; - division.bStartFollowing = bStartFollowing; - } - } - return true; - } - } - } - return false; - }; - - // Given index intervals and input function to compare items at indexes, - // divide at the middle change. - // - // DO NOT CALL if start === end, because interval cannot contain common items - // and because this function will throw the “no overlap” error. - const divide = ( - nChange, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - aIndexesR, - division // output - ) => { - const bF = bStart - aStart; // bIndex = bF + aIndex - kF - const bR = bEnd - aEnd; // bIndex = bR + aIndex - kR - const aLength = aEnd - aStart; - const bLength = bEnd - bStart; - - // Because graph has square or portrait orientation, - // length difference is minimum number of items to insert from b. - // Corresponding forward and reverse diagonals in graph - // depend on length difference of the sequences: - // kF = kR - baDeltaLength - // kR = kF + baDeltaLength - const baDeltaLength = bLength - aLength; - - // Optimization: max diagonal in graph intersects corner of shorter side. - let iMaxF = aLength; - let iMaxR = aLength; - - // Initialize no changes yet in forward or reverse direction: - aIndexesF[0] = aStart - 1; // at open start of interval, outside closed start - aIndexesR[0] = aEnd; // at open end of interval - - if (baDeltaLength % 2 === 0) { - // The number of changes in paths is 2 * d if length difference is even. - const dMin = (nChange || baDeltaLength) / 2; - const dMax = (aLength + bLength) / 2; - for (let d = 1; d <= dMax; d += 1) { - iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); - if (d < dMin) { - iMaxR = extendPathsR(d, aStart, bStart, bR, isCommon, aIndexesR, iMaxR); - } else if ( - // If a reverse path overlaps a forward path in the same diagonal, - // return a division of the index intervals at the middle change. - extendOverlappablePathsR( - d, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - iMaxF, - aIndexesR, - iMaxR, - division - ) - ) { - return; - } - } - } else { - // The number of changes in paths is 2 * d - 1 if length difference is odd. - const dMin = ((nChange || baDeltaLength) + 1) / 2; - const dMax = (aLength + bLength + 1) / 2; - - // Unroll first half iteration so loop extends the relevant pairs of paths. - // Because of invariant that intervals have no common items at start or end, - // and limitation not to call divide with empty intervals, - // therefore it cannot be called if a forward path with one change - // would overlap a reverse path with no changes, even if dMin === 1. - let d = 1; - iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); - for (d += 1; d <= dMax; d += 1) { - iMaxR = extendPathsR( - d - 1, - aStart, - bStart, - bR, - isCommon, - aIndexesR, - iMaxR - ); - if (d < dMin) { - iMaxF = extendPathsF(d, aEnd, bEnd, bF, isCommon, aIndexesF, iMaxF); - } else if ( - // If a forward path overlaps a reverse path in the same diagonal, - // return a division of the index intervals at the middle change. - extendOverlappablePathsF( - d, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - iMaxF, - aIndexesR, - iMaxR, - division - ) - ) { - return; - } - } - } - - /* istanbul ignore next */ - throw new Error( - `${pkg}: no overlap aStart=${aStart} aEnd=${aEnd} bStart=${bStart} bEnd=${bEnd}` - ); - }; - - // Given index intervals and input function to compare items at indexes, - // return by output function the number of adjacent items and starting indexes - // of each common subsequence. Divide and conquer with only linear space. - // - // The index intervals are half open [start, end) like array slice method. - // DO NOT CALL if start === end, because interval cannot contain common items - // and because divide function will throw the “no overlap” error. - const findSubsequences = ( - nChange, - aStart, - aEnd, - bStart, - bEnd, - transposed, - callbacks, - aIndexesF, - aIndexesR, - division // temporary memory, not input nor output - ) => { - if (bEnd - bStart < aEnd - aStart) { - // Transpose graph so it has portrait instead of landscape orientation. - // Always compare shorter to longer sequence for consistency and optimization. - transposed = !transposed; - if (transposed && callbacks.length === 1) { - // Lazily wrap callback functions to swap args if graph is transposed. - const {foundSubsequence, isCommon} = callbacks[0]; - callbacks[1] = { - foundSubsequence: (nCommon, bCommon, aCommon) => { - foundSubsequence(nCommon, aCommon, bCommon); - }, - isCommon: (bIndex, aIndex) => isCommon(aIndex, bIndex) - }; - } - const tStart = aStart; - const tEnd = aEnd; - aStart = bStart; - aEnd = bEnd; - bStart = tStart; - bEnd = tEnd; - } - const {foundSubsequence, isCommon} = callbacks[transposed ? 1 : 0]; - - // Divide the index intervals at the middle change. - divide( - nChange, - aStart, - aEnd, - bStart, - bEnd, - isCommon, - aIndexesF, - aIndexesR, - division - ); - const { - nChangePreceding, - aEndPreceding, - bEndPreceding, - nCommonPreceding, - aCommonPreceding, - bCommonPreceding, - nCommonFollowing, - aCommonFollowing, - bCommonFollowing, - nChangeFollowing, - aStartFollowing, - bStartFollowing - } = division; - - // Unless either index interval is empty, they might contain common items. - if (aStart < aEndPreceding && bStart < bEndPreceding) { - // Recursely find and return common subsequences preceding the division. - findSubsequences( - nChangePreceding, - aStart, - aEndPreceding, - bStart, - bEndPreceding, - transposed, - callbacks, - aIndexesF, - aIndexesR, - division - ); - } - - // Return common subsequences that are adjacent to the middle change. - if (nCommonPreceding !== 0) { - foundSubsequence(nCommonPreceding, aCommonPreceding, bCommonPreceding); - } - if (nCommonFollowing !== 0) { - foundSubsequence(nCommonFollowing, aCommonFollowing, bCommonFollowing); - } - - // Unless either index interval is empty, they might contain common items. - if (aStartFollowing < aEnd && bStartFollowing < bEnd) { - // Recursely find and return common subsequences following the division. - findSubsequences( - nChangeFollowing, - aStartFollowing, - aEnd, - bStartFollowing, - bEnd, - transposed, - callbacks, - aIndexesF, - aIndexesR, - division - ); - } - }; - const validateLength = (name, arg) => { - if (typeof arg !== 'number') { - throw new TypeError(`${pkg}: ${name} typeof ${typeof arg} is not a number`); - } - if (!Number.isSafeInteger(arg)) { - throw new RangeError(`${pkg}: ${name} value ${arg} is not a safe integer`); - } - if (arg < 0) { - throw new RangeError(`${pkg}: ${name} value ${arg} is a negative integer`); - } - }; - const validateCallback = (name, arg) => { - const type = typeof arg; - if (type !== 'function') { - throw new TypeError(`${pkg}: ${name} typeof ${type} is not a function`); - } - }; - - // Compare items in two sequences to find a longest common subsequence. - // Given lengths of sequences and input function to compare items at indexes, - // return by output function the number of adjacent items and starting indexes - // of each common subsequence. - function diffSequence(aLength, bLength, isCommon, foundSubsequence) { - validateLength('aLength', aLength); - validateLength('bLength', bLength); - validateCallback('isCommon', isCommon); - validateCallback('foundSubsequence', foundSubsequence); - - // Count common items from the start in the forward direction. - const nCommonF = countCommonItemsF(0, aLength, 0, bLength, isCommon); - if (nCommonF !== 0) { - foundSubsequence(nCommonF, 0, 0); - } - - // Unless both sequences consist of common items only, - // find common items in the half-trimmed index intervals. - if (aLength !== nCommonF || bLength !== nCommonF) { - // Invariant: intervals do not have common items at the start. - // The start of an index interval is closed like array slice method. - const aStart = nCommonF; - const bStart = nCommonF; - - // Count common items from the end in the reverse direction. - const nCommonR = countCommonItemsR( - aStart, - aLength - 1, - bStart, - bLength - 1, - isCommon - ); - - // Invariant: intervals do not have common items at the end. - // The end of an index interval is open like array slice method. - const aEnd = aLength - nCommonR; - const bEnd = bLength - nCommonR; - - // Unless one sequence consists of common items only, - // therefore the other trimmed index interval consists of changes only, - // find common items in the trimmed index intervals. - const nCommonFR = nCommonF + nCommonR; - if (aLength !== nCommonFR && bLength !== nCommonFR) { - const nChange = 0; // number of change items is not yet known - const transposed = false; // call the original unwrapped functions - const callbacks = [ - { - foundSubsequence, - isCommon - } - ]; - - // Indexes in sequence a of last points in furthest reaching paths - // from outside the start at top left in the forward direction: - const aIndexesF = [NOT_YET_SET]; - // from the end at bottom right in the reverse direction: - const aIndexesR = [NOT_YET_SET]; - - // Initialize one object as output of all calls to divide function. - const division = { - aCommonFollowing: NOT_YET_SET, - aCommonPreceding: NOT_YET_SET, - aEndPreceding: NOT_YET_SET, - aStartFollowing: NOT_YET_SET, - bCommonFollowing: NOT_YET_SET, - bCommonPreceding: NOT_YET_SET, - bEndPreceding: NOT_YET_SET, - bStartFollowing: NOT_YET_SET, - nChangeFollowing: NOT_YET_SET, - nChangePreceding: NOT_YET_SET, - nCommonFollowing: NOT_YET_SET, - nCommonPreceding: NOT_YET_SET - }; - - // Find and return common subsequences in the trimmed index intervals. - findSubsequences( - nChange, - aStart, - aEnd, - bStart, - bEnd, - transposed, - callbacks, - aIndexesF, - aIndexesR, - division - ); - } - if (nCommonR !== 0) { - foundSubsequence(nCommonR, aEnd, bEnd); - } - } - } - return build; -} - -var buildExports = /*@__PURE__*/ requireBuild(); -var diffSequences = /*@__PURE__*/getDefaultExportFromCjs(buildExports); - -function formatTrailingSpaces(line, trailingSpaceFormatter) { - return line.replace(/\s+$/, (match) => trailingSpaceFormatter(match)); -} -function printDiffLine(line, isFirstOrLast, color, indicator, trailingSpaceFormatter, emptyFirstOrLastLinePlaceholder) { - return line.length !== 0 ? color(`${indicator} ${formatTrailingSpaces(line, trailingSpaceFormatter)}`) : indicator !== " " ? color(indicator) : isFirstOrLast && emptyFirstOrLastLinePlaceholder.length !== 0 ? color(`${indicator} ${emptyFirstOrLastLinePlaceholder}`) : ""; -} -function printDeleteLine(line, isFirstOrLast, { aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) { - return printDiffLine(line, isFirstOrLast, aColor, aIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder); -} -function printInsertLine(line, isFirstOrLast, { bColor, bIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) { - return printDiffLine(line, isFirstOrLast, bColor, bIndicator, changeLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder); -} -function printCommonLine(line, isFirstOrLast, { commonColor, commonIndicator, commonLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder }) { - return printDiffLine(line, isFirstOrLast, commonColor, commonIndicator, commonLineTrailingSpaceColor, emptyFirstOrLastLinePlaceholder); -} -// In GNU diff format, indexes are one-based instead of zero-based. -function createPatchMark(aStart, aEnd, bStart, bEnd, { patchColor }) { - return patchColor(`@@ -${aStart + 1},${aEnd - aStart} +${bStart + 1},${bEnd - bStart} @@`); -} -// jest --no-expand -// -// Given array of aligned strings with inverse highlight formatting, -// return joined lines with diff formatting (and patch marks, if needed). -function joinAlignedDiffsNoExpand(diffs, options) { - const iLength = diffs.length; - const nContextLines = options.contextLines; - const nContextLines2 = nContextLines + nContextLines; - // First pass: count output lines and see if it has patches. - let jLength = iLength; - let hasExcessAtStartOrEnd = false; - let nExcessesBetweenChanges = 0; - let i = 0; - while (i !== iLength) { - const iStart = i; - while (i !== iLength && diffs[i][0] === DIFF_EQUAL) { - i += 1; - } - if (iStart !== i) { - if (iStart === 0) { - // at start - if (i > nContextLines) { - jLength -= i - nContextLines; - hasExcessAtStartOrEnd = true; - } - } else if (i === iLength) { - // at end - const n = i - iStart; - if (n > nContextLines) { - jLength -= n - nContextLines; - hasExcessAtStartOrEnd = true; - } - } else { - // between changes - const n = i - iStart; - if (n > nContextLines2) { - jLength -= n - nContextLines2; - nExcessesBetweenChanges += 1; - } - } - } - while (i !== iLength && diffs[i][0] !== DIFF_EQUAL) { - i += 1; - } - } - const hasPatch = nExcessesBetweenChanges !== 0 || hasExcessAtStartOrEnd; - if (nExcessesBetweenChanges !== 0) { - jLength += nExcessesBetweenChanges + 1; - } else if (hasExcessAtStartOrEnd) { - jLength += 1; - } - const jLast = jLength - 1; - const lines = []; - let jPatchMark = 0; - if (hasPatch) { - lines.push(""); - } - // Indexes of expected or received lines in current patch: - let aStart = 0; - let bStart = 0; - let aEnd = 0; - let bEnd = 0; - const pushCommonLine = (line) => { - const j = lines.length; - lines.push(printCommonLine(line, j === 0 || j === jLast, options)); - aEnd += 1; - bEnd += 1; - }; - const pushDeleteLine = (line) => { - const j = lines.length; - lines.push(printDeleteLine(line, j === 0 || j === jLast, options)); - aEnd += 1; - }; - const pushInsertLine = (line) => { - const j = lines.length; - lines.push(printInsertLine(line, j === 0 || j === jLast, options)); - bEnd += 1; - }; - // Second pass: push lines with diff formatting (and patch marks, if needed). - i = 0; - while (i !== iLength) { - let iStart = i; - while (i !== iLength && diffs[i][0] === DIFF_EQUAL) { - i += 1; - } - if (iStart !== i) { - if (iStart === 0) { - // at beginning - if (i > nContextLines) { - iStart = i - nContextLines; - aStart = iStart; - bStart = iStart; - aEnd = aStart; - bEnd = bStart; - } - for (let iCommon = iStart; iCommon !== i; iCommon += 1) { - pushCommonLine(diffs[iCommon][1]); - } - } else if (i === iLength) { - // at end - const iEnd = i - iStart > nContextLines ? iStart + nContextLines : i; - for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { - pushCommonLine(diffs[iCommon][1]); - } - } else { - // between changes - const nCommon = i - iStart; - if (nCommon > nContextLines2) { - const iEnd = iStart + nContextLines; - for (let iCommon = iStart; iCommon !== iEnd; iCommon += 1) { - pushCommonLine(diffs[iCommon][1]); - } - lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options); - jPatchMark = lines.length; - lines.push(""); - const nOmit = nCommon - nContextLines2; - aStart = aEnd + nOmit; - bStart = bEnd + nOmit; - aEnd = aStart; - bEnd = bStart; - for (let iCommon = i - nContextLines; iCommon !== i; iCommon += 1) { - pushCommonLine(diffs[iCommon][1]); - } - } else { - for (let iCommon = iStart; iCommon !== i; iCommon += 1) { - pushCommonLine(diffs[iCommon][1]); - } - } - } - } - while (i !== iLength && diffs[i][0] === DIFF_DELETE) { - pushDeleteLine(diffs[i][1]); - i += 1; - } - while (i !== iLength && diffs[i][0] === DIFF_INSERT) { - pushInsertLine(diffs[i][1]); - i += 1; - } - } - if (hasPatch) { - lines[jPatchMark] = createPatchMark(aStart, aEnd, bStart, bEnd, options); - } - return lines.join("\n"); -} -// jest --expand -// -// Given array of aligned strings with inverse highlight formatting, -// return joined lines with diff formatting. -function joinAlignedDiffsExpand(diffs, options) { - return diffs.map((diff, i, diffs) => { - const line = diff[1]; - const isFirstOrLast = i === 0 || i === diffs.length - 1; - switch (diff[0]) { - case DIFF_DELETE: return printDeleteLine(line, isFirstOrLast, options); - case DIFF_INSERT: return printInsertLine(line, isFirstOrLast, options); - default: return printCommonLine(line, isFirstOrLast, options); - } - }).join("\n"); -} - -const noColor = (string) => string; -const DIFF_CONTEXT_DEFAULT = 5; -const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0; -function getDefaultOptions() { - return { - aAnnotation: "Expected", - aColor: c.green, - aIndicator: "-", - bAnnotation: "Received", - bColor: c.red, - bIndicator: "+", - changeColor: c.inverse, - changeLineTrailingSpaceColor: noColor, - commonColor: c.dim, - commonIndicator: " ", - commonLineTrailingSpaceColor: noColor, - compareKeys: undefined, - contextLines: DIFF_CONTEXT_DEFAULT, - emptyFirstOrLastLinePlaceholder: "", - expand: false, - includeChangeCounts: false, - omitAnnotationLines: false, - patchColor: c.yellow, - printBasicPrototype: false, - truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT, - truncateAnnotation: "... Diff result is truncated", - truncateAnnotationColor: noColor - }; -} -function getCompareKeys(compareKeys) { - return compareKeys && typeof compareKeys === "function" ? compareKeys : undefined; -} -function getContextLines(contextLines) { - return typeof contextLines === "number" && Number.isSafeInteger(contextLines) && contextLines >= 0 ? contextLines : DIFF_CONTEXT_DEFAULT; -} -// Pure function returns options with all properties. -function normalizeDiffOptions(options = {}) { - return { - ...getDefaultOptions(), - ...options, - compareKeys: getCompareKeys(options.compareKeys), - contextLines: getContextLines(options.contextLines) - }; -} - -function isEmptyString(lines) { - return lines.length === 1 && lines[0].length === 0; -} -function countChanges(diffs) { - let a = 0; - let b = 0; - diffs.forEach((diff) => { - switch (diff[0]) { - case DIFF_DELETE: - a += 1; - break; - case DIFF_INSERT: - b += 1; - break; - } - }); - return { - a, - b - }; -} -function printAnnotation({ aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator, includeChangeCounts, omitAnnotationLines }, changeCounts) { - if (omitAnnotationLines) { - return ""; - } - let aRest = ""; - let bRest = ""; - if (includeChangeCounts) { - const aCount = String(changeCounts.a); - const bCount = String(changeCounts.b); - // Padding right aligns the ends of the annotations. - const baAnnotationLengthDiff = bAnnotation.length - aAnnotation.length; - const aAnnotationPadding = " ".repeat(Math.max(0, baAnnotationLengthDiff)); - const bAnnotationPadding = " ".repeat(Math.max(0, -baAnnotationLengthDiff)); - // Padding left aligns the ends of the counts. - const baCountLengthDiff = bCount.length - aCount.length; - const aCountPadding = " ".repeat(Math.max(0, baCountLengthDiff)); - const bCountPadding = " ".repeat(Math.max(0, -baCountLengthDiff)); - aRest = `${aAnnotationPadding} ${aIndicator} ${aCountPadding}${aCount}`; - bRest = `${bAnnotationPadding} ${bIndicator} ${bCountPadding}${bCount}`; - } - const a = `${aIndicator} ${aAnnotation}${aRest}`; - const b = `${bIndicator} ${bAnnotation}${bRest}`; - return `${aColor(a)}\n${bColor(b)}\n\n`; -} -function printDiffLines(diffs, truncated, options) { - return printAnnotation(options, countChanges(diffs)) + (options.expand ? joinAlignedDiffsExpand(diffs, options) : joinAlignedDiffsNoExpand(diffs, options)) + (truncated ? options.truncateAnnotationColor(`\n${options.truncateAnnotation}`) : ""); -} -// Compare two arrays of strings line-by-line. Format as comparison lines. -function diffLinesUnified(aLines, bLines, options) { - const normalizedOptions = normalizeDiffOptions(options); - const [diffs, truncated] = diffLinesRaw(isEmptyString(aLines) ? [] : aLines, isEmptyString(bLines) ? [] : bLines, normalizedOptions); - return printDiffLines(diffs, truncated, normalizedOptions); -} -// Given two pairs of arrays of strings: -// Compare the pair of comparison arrays line-by-line. -// Format the corresponding lines in the pair of displayable arrays. -function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCompare, options) { - if (isEmptyString(aLinesDisplay) && isEmptyString(aLinesCompare)) { - aLinesDisplay = []; - aLinesCompare = []; - } - if (isEmptyString(bLinesDisplay) && isEmptyString(bLinesCompare)) { - bLinesDisplay = []; - bLinesCompare = []; - } - if (aLinesDisplay.length !== aLinesCompare.length || bLinesDisplay.length !== bLinesCompare.length) { - // Fall back to diff of display lines. - return diffLinesUnified(aLinesDisplay, bLinesDisplay, options); - } - const [diffs, truncated] = diffLinesRaw(aLinesCompare, bLinesCompare, options); - // Replace comparison lines with displayable lines. - let aIndex = 0; - let bIndex = 0; - diffs.forEach((diff) => { - switch (diff[0]) { - case DIFF_DELETE: - diff[1] = aLinesDisplay[aIndex]; - aIndex += 1; - break; - case DIFF_INSERT: - diff[1] = bLinesDisplay[bIndex]; - bIndex += 1; - break; - default: - diff[1] = bLinesDisplay[bIndex]; - aIndex += 1; - bIndex += 1; - } - }); - return printDiffLines(diffs, truncated, normalizeDiffOptions(options)); -} -// Compare two arrays of strings line-by-line. -function diffLinesRaw(aLines, bLines, options) { - const truncate = (options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? false; - const truncateThreshold = Math.max(Math.floor((options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? 0), 0); - const aLength = truncate ? Math.min(aLines.length, truncateThreshold) : aLines.length; - const bLength = truncate ? Math.min(bLines.length, truncateThreshold) : bLines.length; - const truncated = aLength !== aLines.length || bLength !== bLines.length; - const isCommon = (aIndex, bIndex) => aLines[aIndex] === bLines[bIndex]; - const diffs = []; - let aIndex = 0; - let bIndex = 0; - const foundSubsequence = (nCommon, aCommon, bCommon) => { - for (; aIndex !== aCommon; aIndex += 1) { - diffs.push(new Diff(DIFF_DELETE, aLines[aIndex])); - } - for (; bIndex !== bCommon; bIndex += 1) { - diffs.push(new Diff(DIFF_INSERT, bLines[bIndex])); - } - for (; nCommon !== 0; nCommon -= 1, aIndex += 1, bIndex += 1) { - diffs.push(new Diff(DIFF_EQUAL, bLines[bIndex])); - } - }; - diffSequences(aLength, bLength, isCommon, foundSubsequence); - // After the last common subsequence, push remaining change items. - for (; aIndex !== aLength; aIndex += 1) { - diffs.push(new Diff(DIFF_DELETE, aLines[aIndex])); - } - for (; bIndex !== bLength; bIndex += 1) { - diffs.push(new Diff(DIFF_INSERT, bLines[bIndex])); - } - return [diffs, truncated]; -} - -// get the type of a value with handling the edge cases like `typeof []` -// and `typeof null` -function getType(value) { - if (value === undefined) { - return "undefined"; - } else if (value === null) { - return "null"; - } else if (Array.isArray(value)) { - return "array"; - } else if (typeof value === "boolean") { - return "boolean"; - } else if (typeof value === "function") { - return "function"; - } else if (typeof value === "number") { - return "number"; - } else if (typeof value === "string") { - return "string"; - } else if (typeof value === "bigint") { - return "bigint"; - } else if (typeof value === "object") { - if (value != null) { - if (value.constructor === RegExp) { - return "regexp"; - } else if (value.constructor === Map) { - return "map"; - } else if (value.constructor === Set) { - return "set"; - } else if (value.constructor === Date) { - return "date"; - } - } - return "object"; - } else if (typeof value === "symbol") { - return "symbol"; - } - throw new Error(`value of unknown type: ${value}`); -} - -// platforms compatible -function getNewLineSymbol(string) { - return string.includes("\r\n") ? "\r\n" : "\n"; -} -function diffStrings(a, b, options) { - const truncate = (options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? false; - const truncateThreshold = Math.max(Math.floor((options === null || options === void 0 ? void 0 : options.truncateThreshold) ?? 0), 0); - let aLength = a.length; - let bLength = b.length; - if (truncate) { - const aMultipleLines = a.includes("\n"); - const bMultipleLines = b.includes("\n"); - const aNewLineSymbol = getNewLineSymbol(a); - const bNewLineSymbol = getNewLineSymbol(b); - // multiple-lines string expects a newline to be appended at the end - const _a = aMultipleLines ? `${a.split(aNewLineSymbol, truncateThreshold).join(aNewLineSymbol)}\n` : a; - const _b = bMultipleLines ? `${b.split(bNewLineSymbol, truncateThreshold).join(bNewLineSymbol)}\n` : b; - aLength = _a.length; - bLength = _b.length; - } - const truncated = aLength !== a.length || bLength !== b.length; - const isCommon = (aIndex, bIndex) => a[aIndex] === b[bIndex]; - let aIndex = 0; - let bIndex = 0; - const diffs = []; - const foundSubsequence = (nCommon, aCommon, bCommon) => { - if (aIndex !== aCommon) { - diffs.push(new Diff(DIFF_DELETE, a.slice(aIndex, aCommon))); - } - if (bIndex !== bCommon) { - diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex, bCommon))); - } - aIndex = aCommon + nCommon; - bIndex = bCommon + nCommon; - diffs.push(new Diff(DIFF_EQUAL, b.slice(bCommon, bIndex))); - }; - diffSequences(aLength, bLength, isCommon, foundSubsequence); - // After the last common subsequence, push remaining change items. - if (aIndex !== aLength) { - diffs.push(new Diff(DIFF_DELETE, a.slice(aIndex))); - } - if (bIndex !== bLength) { - diffs.push(new Diff(DIFF_INSERT, b.slice(bIndex))); - } - return [diffs, truncated]; -} - -// Given change op and array of diffs, return concatenated string: -// * include common strings -// * include change strings which have argument op with changeColor -// * exclude change strings which have opposite op -function concatenateRelevantDiffs(op, diffs, changeColor) { - return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op && diff[1].length !== 0 ? changeColor(diff[1]) : ""), ""); -} -// Encapsulate change lines until either a common newline or the end. -class ChangeBuffer { - op; - line; - lines; - changeColor; - constructor(op, changeColor) { - this.op = op; - this.line = []; - this.lines = []; - this.changeColor = changeColor; - } - pushSubstring(substring) { - this.pushDiff(new Diff(this.op, substring)); - } - pushLine() { - // Assume call only if line has at least one diff, - // therefore an empty line must have a diff which has an empty string. - // If line has multiple diffs, then assume it has a common diff, - // therefore change diffs have change color; - // otherwise then it has line color only. - this.lines.push(this.line.length !== 1 ? new Diff(this.op, concatenateRelevantDiffs(this.op, this.line, this.changeColor)) : this.line[0][0] === this.op ? this.line[0] : new Diff(this.op, this.line[0][1])); - this.line.length = 0; - } - isLineEmpty() { - return this.line.length === 0; - } - // Minor input to buffer. - pushDiff(diff) { - this.line.push(diff); - } - // Main input to buffer. - align(diff) { - const string = diff[1]; - if (string.includes("\n")) { - const substrings = string.split("\n"); - const iLast = substrings.length - 1; - substrings.forEach((substring, i) => { - if (i < iLast) { - // The first substring completes the current change line. - // A middle substring is a change line. - this.pushSubstring(substring); - this.pushLine(); - } else if (substring.length !== 0) { - // The last substring starts a change line, if it is not empty. - // Important: This non-empty condition also automatically omits - // the newline appended to the end of expected and received strings. - this.pushSubstring(substring); - } - }); - } else { - // Append non-multiline string to current change line. - this.pushDiff(diff); - } - } - // Output from buffer. - moveLinesTo(lines) { - if (!this.isLineEmpty()) { - this.pushLine(); - } - lines.push(...this.lines); - this.lines.length = 0; - } -} -// Encapsulate common and change lines. -class CommonBuffer { - deleteBuffer; - insertBuffer; - lines; - constructor(deleteBuffer, insertBuffer) { - this.deleteBuffer = deleteBuffer; - this.insertBuffer = insertBuffer; - this.lines = []; - } - pushDiffCommonLine(diff) { - this.lines.push(diff); - } - pushDiffChangeLines(diff) { - const isDiffEmpty = diff[1].length === 0; - // An empty diff string is redundant, unless a change line is empty. - if (!isDiffEmpty || this.deleteBuffer.isLineEmpty()) { - this.deleteBuffer.pushDiff(diff); - } - if (!isDiffEmpty || this.insertBuffer.isLineEmpty()) { - this.insertBuffer.pushDiff(diff); - } - } - flushChangeLines() { - this.deleteBuffer.moveLinesTo(this.lines); - this.insertBuffer.moveLinesTo(this.lines); - } - // Input to buffer. - align(diff) { - const op = diff[0]; - const string = diff[1]; - if (string.includes("\n")) { - const substrings = string.split("\n"); - const iLast = substrings.length - 1; - substrings.forEach((substring, i) => { - if (i === 0) { - const subdiff = new Diff(op, substring); - if (this.deleteBuffer.isLineEmpty() && this.insertBuffer.isLineEmpty()) { - // If both current change lines are empty, - // then the first substring is a common line. - this.flushChangeLines(); - this.pushDiffCommonLine(subdiff); - } else { - // If either current change line is non-empty, - // then the first substring completes the change lines. - this.pushDiffChangeLines(subdiff); - this.flushChangeLines(); - } - } else if (i < iLast) { - // A middle substring is a common line. - this.pushDiffCommonLine(new Diff(op, substring)); - } else if (substring.length !== 0) { - // The last substring starts a change line, if it is not empty. - // Important: This non-empty condition also automatically omits - // the newline appended to the end of expected and received strings. - this.pushDiffChangeLines(new Diff(op, substring)); - } - }); - } else { - // Append non-multiline string to current change lines. - // Important: It cannot be at the end following empty change lines, - // because newline appended to the end of expected and received strings. - this.pushDiffChangeLines(diff); - } - } - // Output from buffer. - getLines() { - this.flushChangeLines(); - return this.lines; - } -} -// Given diffs from expected and received strings, -// return new array of diffs split or joined into lines. -// -// To correctly align a change line at the end, the algorithm: -// * assumes that a newline was appended to the strings -// * omits the last newline from the output array -// -// Assume the function is not called: -// * if either expected or received is empty string -// * if neither expected nor received is multiline string -function getAlignedDiffs(diffs, changeColor) { - const deleteBuffer = new ChangeBuffer(DIFF_DELETE, changeColor); - const insertBuffer = new ChangeBuffer(DIFF_INSERT, changeColor); - const commonBuffer = new CommonBuffer(deleteBuffer, insertBuffer); - diffs.forEach((diff) => { - switch (diff[0]) { - case DIFF_DELETE: - deleteBuffer.align(diff); - break; - case DIFF_INSERT: - insertBuffer.align(diff); - break; - default: commonBuffer.align(diff); - } - }); - return commonBuffer.getLines(); -} - -function hasCommonDiff(diffs, isMultiline) { - if (isMultiline) { - // Important: Ignore common newline that was appended to multiline strings! - const iLast = diffs.length - 1; - return diffs.some((diff, i) => diff[0] === DIFF_EQUAL && (i !== iLast || diff[1] !== "\n")); - } - return diffs.some((diff) => diff[0] === DIFF_EQUAL); -} -// Compare two strings character-by-character. -// Format as comparison lines in which changed substrings have inverse colors. -function diffStringsUnified(a, b, options) { - if (a !== b && a.length !== 0 && b.length !== 0) { - const isMultiline = a.includes("\n") || b.includes("\n"); - // getAlignedDiffs assumes that a newline was appended to the strings. - const [diffs, truncated] = diffStringsRaw(isMultiline ? `${a}\n` : a, isMultiline ? `${b}\n` : b, true, options); - if (hasCommonDiff(diffs, isMultiline)) { - const optionsNormalized = normalizeDiffOptions(options); - const lines = getAlignedDiffs(diffs, optionsNormalized.changeColor); - return printDiffLines(lines, truncated, optionsNormalized); - } - } - // Fall back to line-by-line diff. - return diffLinesUnified(a.split("\n"), b.split("\n"), options); -} -// Compare two strings character-by-character. -// Optionally clean up small common substrings, also known as chaff. -function diffStringsRaw(a, b, cleanup, options) { - const [diffs, truncated] = diffStrings(a, b, options); - if (cleanup) { - diff_cleanupSemantic(diffs); - } - return [diffs, truncated]; -} - -function getCommonMessage(message, options) { - const { commonColor } = normalizeDiffOptions(options); - return commonColor(message); -} -const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins; -const PLUGINS = [ - ReactTestComponent, - ReactElement, - DOMElement, - DOMCollection, - Immutable, - AsymmetricMatcher, - plugins.Error -]; -const FORMAT_OPTIONS = { - maxDepth: 20, - plugins: PLUGINS -}; -const FALLBACK_FORMAT_OPTIONS = { - callToJSON: false, - maxDepth: 8, - plugins: PLUGINS -}; -// Generate a string that will highlight the difference between two values -// with green and red. (similar to how github does code diffing) -/** -* @param a Expected value -* @param b Received value -* @param options Diff options -* @returns {string | null} a string diff -*/ -function diff(a, b, options) { - if (Object.is(a, b)) { - return ""; - } - const aType = getType(a); - let expectedType = aType; - let omitDifference = false; - if (aType === "object" && typeof a.asymmetricMatch === "function") { - if (a.$$typeof !== Symbol.for("jest.asymmetricMatcher")) { - // Do not know expected type of user-defined asymmetric matcher. - return undefined; - } - if (typeof a.getExpectedType !== "function") { - // For example, expect.anything() matches either null or undefined - return undefined; - } - expectedType = a.getExpectedType(); - // Primitive types boolean and number omit difference below. - // For example, omit difference for expect.stringMatching(regexp) - omitDifference = expectedType === "string"; - } - if (expectedType !== getType(b)) { - const { aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator } = normalizeDiffOptions(options); - const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options); - let aDisplay = format(a, formatOptions); - let bDisplay = format(b, formatOptions); - // even if prettyFormat prints successfully big objects, - // large string can choke later on (concatenation? RPC?), - // so truncate it to a reasonable length here. - // (For example, playwright's ElementHandle can become about 200_000_000 length string) - const MAX_LENGTH = 1e5; - function truncate(s) { - return s.length <= MAX_LENGTH ? s : `${s.slice(0, MAX_LENGTH)}...`; - } - aDisplay = truncate(aDisplay); - bDisplay = truncate(bDisplay); - const aDiff = `${aColor(`${aIndicator} ${aAnnotation}:`)} \n${aDisplay}`; - const bDiff = `${bColor(`${bIndicator} ${bAnnotation}:`)} \n${bDisplay}`; - return `${aDiff}\n\n${bDiff}`; - } - if (omitDifference) { - return undefined; - } - switch (aType) { - case "string": return diffLinesUnified(a.split("\n"), b.split("\n"), options); - case "boolean": - case "number": return comparePrimitive(a, b, options); - case "map": return compareObjects(sortMap(a), sortMap(b), options); - case "set": return compareObjects(sortSet(a), sortSet(b), options); - default: return compareObjects(a, b, options); - } -} -function comparePrimitive(a, b, options) { - const aFormat = format(a, FORMAT_OPTIONS); - const bFormat = format(b, FORMAT_OPTIONS); - return aFormat === bFormat ? "" : diffLinesUnified(aFormat.split("\n"), bFormat.split("\n"), options); -} -function sortMap(map) { - return new Map(Array.from(map.entries()).sort()); -} -function sortSet(set) { - return new Set(Array.from(set.values()).sort()); -} -function compareObjects(a, b, options) { - let difference; - let hasThrown = false; - try { - const formatOptions = getFormatOptions(FORMAT_OPTIONS, options); - difference = getObjectsDifference(a, b, formatOptions, options); - } catch { - hasThrown = true; - } - const noDiffMessage = getCommonMessage(NO_DIFF_MESSAGE, options); - // If the comparison yields no results, compare again but this time - // without calling `toJSON`. It's also possible that toJSON might throw. - if (difference === undefined || difference === noDiffMessage) { - const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options); - difference = getObjectsDifference(a, b, formatOptions, options); - if (difference !== noDiffMessage && !hasThrown) { - difference = `${getCommonMessage(SIMILAR_MESSAGE, options)}\n\n${difference}`; - } - } - return difference; -} -function getFormatOptions(formatOptions, options) { - const { compareKeys, printBasicPrototype, maxDepth } = normalizeDiffOptions(options); - return { - ...formatOptions, - compareKeys, - printBasicPrototype, - maxDepth: maxDepth ?? formatOptions.maxDepth - }; -} -function getObjectsDifference(a, b, formatOptions, options) { - const formatOptionsZeroIndent = { - ...formatOptions, - indent: 0 - }; - const aCompare = format(a, formatOptionsZeroIndent); - const bCompare = format(b, formatOptionsZeroIndent); - if (aCompare === bCompare) { - return getCommonMessage(NO_DIFF_MESSAGE, options); - } else { - const aDisplay = format(a, formatOptions); - const bDisplay = format(b, formatOptions); - return diffLinesUnified2(aDisplay.split("\n"), bDisplay.split("\n"), aCompare.split("\n"), bCompare.split("\n"), options); - } -} -const MAX_DIFF_STRING_LENGTH = 2e4; -function isAsymmetricMatcher(data) { - const type = getType$1(data); - return type === "Object" && typeof data.asymmetricMatch === "function"; -} -function isReplaceable(obj1, obj2) { - const obj1Type = getType$1(obj1); - const obj2Type = getType$1(obj2); - return obj1Type === obj2Type && (obj1Type === "Object" || obj1Type === "Array"); -} -function printDiffOrStringify(received, expected, options) { - const { aAnnotation, bAnnotation } = normalizeDiffOptions(options); - if (typeof expected === "string" && typeof received === "string" && expected.length > 0 && received.length > 0 && expected.length <= MAX_DIFF_STRING_LENGTH && received.length <= MAX_DIFF_STRING_LENGTH && expected !== received) { - if (expected.includes("\n") || received.includes("\n")) { - return diffStringsUnified(expected, received, options); - } - const [diffs] = diffStringsRaw(expected, received, true); - const hasCommonDiff = diffs.some((diff) => diff[0] === DIFF_EQUAL); - const printLabel = getLabelPrinter(aAnnotation, bAnnotation); - const expectedLine = printLabel(aAnnotation) + printExpected(getCommonAndChangedSubstrings(diffs, DIFF_DELETE, hasCommonDiff)); - const receivedLine = printLabel(bAnnotation) + printReceived(getCommonAndChangedSubstrings(diffs, DIFF_INSERT, hasCommonDiff)); - return `${expectedLine}\n${receivedLine}`; - } - // if (isLineDiffable(expected, received)) { - const clonedExpected = deepClone(expected, { forceWritable: true }); - const clonedReceived = deepClone(received, { forceWritable: true }); - const { replacedExpected, replacedActual } = replaceAsymmetricMatcher(clonedReceived, clonedExpected); - const difference = diff(replacedExpected, replacedActual, options); - return difference; - // } - // const printLabel = getLabelPrinter(aAnnotation, bAnnotation) - // const expectedLine = printLabel(aAnnotation) + printExpected(expected) - // const receivedLine - // = printLabel(bAnnotation) - // + (stringify(expected) === stringify(received) - // ? 'serializes to the same string' - // : printReceived(received)) - // return `${expectedLine}\n${receivedLine}` -} -function replaceAsymmetricMatcher(actual, expected, actualReplaced = new WeakSet(), expectedReplaced = new WeakSet()) { - // handle asymmetric Error.cause diff - if (actual instanceof Error && expected instanceof Error && typeof actual.cause !== "undefined" && typeof expected.cause === "undefined") { - delete actual.cause; - return { - replacedActual: actual, - replacedExpected: expected - }; - } - if (!isReplaceable(actual, expected)) { - return { - replacedActual: actual, - replacedExpected: expected - }; - } - if (actualReplaced.has(actual) || expectedReplaced.has(expected)) { - return { - replacedActual: actual, - replacedExpected: expected - }; - } - actualReplaced.add(actual); - expectedReplaced.add(expected); - getOwnProperties(expected).forEach((key) => { - const expectedValue = expected[key]; - const actualValue = actual[key]; - if (isAsymmetricMatcher(expectedValue)) { - if (expectedValue.asymmetricMatch(actualValue)) { - actual[key] = expectedValue; - } - } else if (isAsymmetricMatcher(actualValue)) { - if (actualValue.asymmetricMatch(expectedValue)) { - expected[key] = actualValue; - } - } else if (isReplaceable(actualValue, expectedValue)) { - const replaced = replaceAsymmetricMatcher(actualValue, expectedValue, actualReplaced, expectedReplaced); - actual[key] = replaced.replacedActual; - expected[key] = replaced.replacedExpected; - } - }); - return { - replacedActual: actual, - replacedExpected: expected - }; -} -function getLabelPrinter(...strings) { - const maxLength = strings.reduce((max, string) => string.length > max ? string.length : max, 0); - return (string) => `${string}: ${" ".repeat(maxLength - string.length)}`; -} -const SPACE_SYMBOL = "·"; -function replaceTrailingSpaces(text) { - return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length)); -} -function printReceived(object) { - return c.red(replaceTrailingSpaces(stringify(object))); -} -function printExpected(value) { - return c.green(replaceTrailingSpaces(stringify(value))); -} -function getCommonAndChangedSubstrings(diffs, op, hasCommonDiff) { - return diffs.reduce((reduced, diff) => reduced + (diff[0] === DIFF_EQUAL ? diff[1] : diff[0] === op ? hasCommonDiff ? c.inverse(diff[1]) : diff[1] : ""), ""); -} - -export { DIFF_DELETE, DIFF_EQUAL, DIFF_INSERT, Diff, diff, diffLinesRaw, diffLinesUnified, diffLinesUnified2, diffStringsRaw, diffStringsUnified, getLabelPrinter, printDiffOrStringify, replaceAsymmetricMatcher }; diff --git a/node_modules/@vitest/utils/dist/display.d.ts b/node_modules/@vitest/utils/dist/display.d.ts deleted file mode 100644 index 576fa4c..0000000 --- a/node_modules/@vitest/utils/dist/display.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { PrettyFormatOptions } from '@vitest/pretty-format'; - -type Inspect = (value: unknown, options: Options) => string; -interface Options { - showHidden: boolean; - depth: number; - colors: boolean; - customInspect: boolean; - showProxy: boolean; - maxArrayLength: number; - breakLength: number; - truncate: number; - seen: unknown[]; - inspect: Inspect; - stylize: (value: string, styleType: string) => string; -} -type LoupeOptions = Partial; -interface StringifyOptions extends PrettyFormatOptions { - maxLength?: number; -} -declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: StringifyOptions): string; -declare const formatRegExp: RegExp; -declare function format(...args: unknown[]): string; -declare function browserFormat(...args: unknown[]): string; -declare function inspect(obj: unknown, options?: LoupeOptions): string; -declare function objDisplay(obj: unknown, options?: LoupeOptions): string; - -export { browserFormat, format, formatRegExp, inspect, objDisplay, stringify }; -export type { LoupeOptions, StringifyOptions }; diff --git a/node_modules/@vitest/utils/dist/display.js b/node_modules/@vitest/utils/dist/display.js deleted file mode 100644 index 414e9c9..0000000 --- a/node_modules/@vitest/utils/dist/display.js +++ /dev/null @@ -1,742 +0,0 @@ -import { plugins, format as format$1 } from '@vitest/pretty-format'; - -const ansiColors = { - bold: ['1', '22'], - dim: ['2', '22'], - italic: ['3', '23'], - underline: ['4', '24'], - // 5 & 6 are blinking - inverse: ['7', '27'], - hidden: ['8', '28'], - strike: ['9', '29'], - // 10-20 are fonts - // 21-29 are resets for 1-9 - black: ['30', '39'], - red: ['31', '39'], - green: ['32', '39'], - yellow: ['33', '39'], - blue: ['34', '39'], - magenta: ['35', '39'], - cyan: ['36', '39'], - white: ['37', '39'], - brightblack: ['30;1', '39'], - brightred: ['31;1', '39'], - brightgreen: ['32;1', '39'], - brightyellow: ['33;1', '39'], - brightblue: ['34;1', '39'], - brightmagenta: ['35;1', '39'], - brightcyan: ['36;1', '39'], - brightwhite: ['37;1', '39'], - grey: ['90', '39'], -}; -const styles = { - special: 'cyan', - number: 'yellow', - bigint: 'yellow', - boolean: 'yellow', - undefined: 'grey', - null: 'bold', - string: 'green', - symbol: 'green', - date: 'magenta', - regexp: 'red', -}; -const truncator = '…'; -function colorise(value, styleType) { - const color = ansiColors[styles[styleType]] || ansiColors[styleType] || ''; - if (!color) { - return String(value); - } - return `\u001b[${color[0]}m${String(value)}\u001b[${color[1]}m`; -} -function normaliseOptions({ showHidden = false, depth = 2, colors = false, customInspect = true, showProxy = false, maxArrayLength = Infinity, breakLength = Infinity, seen = [], -// eslint-disable-next-line no-shadow -truncate = Infinity, stylize = String, } = {}, inspect) { - const options = { - showHidden: Boolean(showHidden), - depth: Number(depth), - colors: Boolean(colors), - customInspect: Boolean(customInspect), - showProxy: Boolean(showProxy), - maxArrayLength: Number(maxArrayLength), - breakLength: Number(breakLength), - truncate: Number(truncate), - seen, - inspect, - stylize, - }; - if (options.colors) { - options.stylize = colorise; - } - return options; -} -function isHighSurrogate(char) { - return char >= '\ud800' && char <= '\udbff'; -} -function truncate(string, length, tail = truncator) { - string = String(string); - const tailLength = tail.length; - const stringLength = string.length; - if (tailLength > length && stringLength > tailLength) { - return tail; - } - if (stringLength > length && stringLength > tailLength) { - let end = length - tailLength; - if (end > 0 && isHighSurrogate(string[end - 1])) { - end = end - 1; - } - return `${string.slice(0, end)}${tail}`; - } - return string; -} -// eslint-disable-next-line complexity -function inspectList(list, options, inspectItem, separator = ', ') { - inspectItem = inspectItem || options.inspect; - const size = list.length; - if (size === 0) - return ''; - const originalLength = options.truncate; - let output = ''; - let peek = ''; - let truncated = ''; - for (let i = 0; i < size; i += 1) { - const last = i + 1 === list.length; - const secondToLast = i + 2 === list.length; - truncated = `${truncator}(${list.length - i})`; - const value = list[i]; - // If there is more than one remaining we need to account for a separator of `, ` - options.truncate = originalLength - output.length - (last ? 0 : separator.length); - const string = peek || inspectItem(value, options) + (last ? '' : separator); - const nextLength = output.length + string.length; - const truncatedLength = nextLength + truncated.length; - // If this is the last element, and adding it would - // take us over length, but adding the truncator wouldn't - then break now - if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) { - break; - } - // If this isn't the last or second to last element to scan, - // but the string is already over length then break here - if (!last && !secondToLast && truncatedLength > originalLength) { - break; - } - // Peek at the next string to determine if we should - // break early before adding this item to the output - peek = last ? '' : inspectItem(list[i + 1], options) + (secondToLast ? '' : separator); - // If we have one element left, but this element and - // the next takes over length, the break early - if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) { - break; - } - output += string; - // If the next element takes us to length - - // but there are more after that, then we should truncate now - if (!last && !secondToLast && nextLength + peek.length >= originalLength) { - truncated = `${truncator}(${list.length - i - 1})`; - break; - } - truncated = ''; - } - return `${output}${truncated}`; -} -function quoteComplexKey(key) { - if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) { - return key; - } - return JSON.stringify(key) - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); -} -function inspectProperty([key, value], options) { - options.truncate -= 2; - if (typeof key === 'string') { - key = quoteComplexKey(key); - } - else if (typeof key !== 'number') { - key = `[${options.inspect(key, options)}]`; - } - options.truncate -= key.length; - value = options.inspect(value, options); - return `${key}: ${value}`; -} - -function inspectArray(array, options) { - // Object.keys will always output the Array indices first, so we can slice by - // `array.length` to get non-index properties - const nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) - return '[]'; - options.truncate -= 4; - const listContents = inspectList(array, options); - options.truncate -= listContents.length; - let propertyContents = ''; - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map(key => [key, array[key]]), options, inspectProperty); - } - return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ''} ]`; -} - -const getArrayName = (array) => { - // We need to special case Node.js' Buffers, which report to be Uint8Array - // @ts-ignore - if (typeof Buffer === 'function' && array instanceof Buffer) { - return 'Buffer'; - } - if (array[Symbol.toStringTag]) { - return array[Symbol.toStringTag]; - } - return array.constructor.name; -}; -function inspectTypedArray(array, options) { - const name = getArrayName(array); - options.truncate -= name.length + 4; - // Object.keys will always output the Array indices first, so we can slice by - // `array.length` to get non-index properties - const nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) - return `${name}[]`; - // As we know TypedArrays only contain Unsigned Integers, we can skip inspecting each one and simply - // stylise the toString() value of them - let output = ''; - for (let i = 0; i < array.length; i++) { - const string = `${options.stylize(truncate(array[i], options.truncate), 'number')}${i === array.length - 1 ? '' : ', '}`; - options.truncate -= string.length; - if (array[i] !== array.length && options.truncate <= 3) { - output += `${truncator}(${array.length - array[i] + 1})`; - break; - } - output += string; - } - let propertyContents = ''; - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map(key => [key, array[key]]), options, inspectProperty); - } - return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ''} ]`; -} - -function inspectDate(dateObject, options) { - const stringRepresentation = dateObject.toJSON(); - if (stringRepresentation === null) { - return 'Invalid Date'; - } - const split = stringRepresentation.split('T'); - const date = split[0]; - // If we need to - truncate the time portion, but never the date - return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, 'date'); -} - -function inspectFunction(func, options) { - const functionType = func[Symbol.toStringTag] || 'Function'; - const name = func.name; - if (!name) { - return options.stylize(`[${functionType}]`, 'special'); - } - return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, 'special'); -} - -function inspectMapEntry([key, value], options) { - options.truncate -= 4; - key = options.inspect(key, options); - options.truncate -= key.length; - value = options.inspect(value, options); - return `${key} => ${value}`; -} -// IE11 doesn't support `map.entries()` -function mapToEntries(map) { - const entries = []; - map.forEach((value, key) => { - entries.push([key, value]); - }); - return entries; -} -function inspectMap(map, options) { - if (map.size === 0) - return 'Map{}'; - options.truncate -= 7; - return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`; -} - -const isNaN = Number.isNaN || (i => i !== i); // eslint-disable-line no-self-compare -function inspectNumber(number, options) { - if (isNaN(number)) { - return options.stylize('NaN', 'number'); - } - if (number === Infinity) { - return options.stylize('Infinity', 'number'); - } - if (number === -Infinity) { - return options.stylize('-Infinity', 'number'); - } - if (number === 0) { - return options.stylize(1 / number === Infinity ? '+0' : '-0', 'number'); - } - return options.stylize(truncate(String(number), options.truncate), 'number'); -} - -function inspectBigInt(number, options) { - let nums = truncate(number.toString(), options.truncate - 1); - if (nums !== truncator) - nums += 'n'; - return options.stylize(nums, 'bigint'); -} - -function inspectRegExp(value, options) { - const flags = value.toString().split('/')[2]; - const sourceLength = options.truncate - (2 + flags.length); - const source = value.source; - return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, 'regexp'); -} - -// IE11 doesn't support `Array.from(set)` -function arrayFromSet(set) { - const values = []; - set.forEach(value => { - values.push(value); - }); - return values; -} -function inspectSet(set, options) { - if (set.size === 0) - return 'Set{}'; - options.truncate -= 7; - return `Set{ ${inspectList(arrayFromSet(set), options)} }`; -} - -const stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5" + - '\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]', 'g'); -const escapeCharacters = { - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - "'": "\\'", - '\\': '\\\\', -}; -const hex = 16; -function escape(char) { - return (escapeCharacters[char] || - `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-4)}`); -} -function inspectString(string, options) { - if (stringEscapeChars.test(string)) { - string = string.replace(stringEscapeChars, escape); - } - return options.stylize(`'${truncate(string, options.truncate - 2)}'`, 'string'); -} - -function inspectSymbol(value) { - if ('description' in Symbol.prototype) { - return value.description ? `Symbol(${value.description})` : 'Symbol()'; - } - return value.toString(); -} - -const getPromiseValue = () => 'Promise{…}'; - -function inspectObject$1(object, options) { - const properties = Object.getOwnPropertyNames(object); - const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []; - if (properties.length === 0 && symbols.length === 0) { - return '{}'; - } - options.truncate -= 4; - options.seen = options.seen || []; - if (options.seen.includes(object)) { - return '[Circular]'; - } - options.seen.push(object); - const propertyContents = inspectList(properties.map(key => [key, object[key]]), options, inspectProperty); - const symbolContents = inspectList(symbols.map(key => [key, object[key]]), options, inspectProperty); - options.seen.pop(); - let sep = ''; - if (propertyContents && symbolContents) { - sep = ', '; - } - return `{ ${propertyContents}${sep}${symbolContents} }`; -} - -const toStringTag = typeof Symbol !== 'undefined' && Symbol.toStringTag ? Symbol.toStringTag : false; -function inspectClass(value, options) { - let name = ''; - if (toStringTag && toStringTag in value) { - name = value[toStringTag]; - } - name = name || value.constructor.name; - // Babel transforms anonymous classes to the name `_class` - if (!name || name === '_class') { - name = ''; - } - options.truncate -= name.length; - return `${name}${inspectObject$1(value, options)}`; -} - -function inspectArguments(args, options) { - if (args.length === 0) - return 'Arguments[]'; - options.truncate -= 13; - return `Arguments[ ${inspectList(args, options)} ]`; -} - -const errorKeys = [ - 'stack', - 'line', - 'column', - 'name', - 'message', - 'fileName', - 'lineNumber', - 'columnNumber', - 'number', - 'description', - 'cause', -]; -function inspectObject(error, options) { - const properties = Object.getOwnPropertyNames(error).filter(key => errorKeys.indexOf(key) === -1); - const name = error.name; - options.truncate -= name.length; - let message = ''; - if (typeof error.message === 'string') { - message = truncate(error.message, options.truncate); - } - else { - properties.unshift('message'); - } - message = message ? `: ${message}` : ''; - options.truncate -= message.length + 5; - options.seen = options.seen || []; - if (options.seen.includes(error)) { - return '[Circular]'; - } - options.seen.push(error); - const propertyContents = inspectList(properties.map(key => [key, error[key]]), options, inspectProperty); - return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ''}`; -} - -function inspectAttribute([key, value], options) { - options.truncate -= 3; - if (!value) { - return `${options.stylize(String(key), 'yellow')}`; - } - return `${options.stylize(String(key), 'yellow')}=${options.stylize(`"${value}"`, 'string')}`; -} -function inspectNodeCollection(collection, options) { - return inspectList(collection, options, inspectNode, '\n'); -} -function inspectNode(node, options) { - switch (node.nodeType) { - case 1: - return inspectHTML(node, options); - case 3: - return options.inspect(node.data, options); - default: - return options.inspect(node, options); - } -} -// @ts-ignore (Deno doesn't have Element) -function inspectHTML(element, options) { - const properties = element.getAttributeNames(); - const name = element.tagName.toLowerCase(); - const head = options.stylize(`<${name}`, 'special'); - const headClose = options.stylize(`>`, 'special'); - const tail = options.stylize(``, 'special'); - options.truncate -= name.length * 2 + 5; - let propertyContents = ''; - if (properties.length > 0) { - propertyContents += ' '; - propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, ' '); - } - options.truncate -= propertyContents.length; - const truncate = options.truncate; - let children = inspectNodeCollection(element.children, options); - if (children && children.length > truncate) { - children = `${truncator}(${element.children.length})`; - } - return `${head}${propertyContents}${headClose}${children}${tail}`; -} - -/* ! - * loupe - * Copyright(c) 2013 Jake Luer - * MIT Licensed - */ -const symbolsSupported = typeof Symbol === 'function' && typeof Symbol.for === 'function'; -const chaiInspect = symbolsSupported ? Symbol.for('chai/inspect') : '@@chai/inspect'; -const nodeInspect = Symbol.for('nodejs.util.inspect.custom'); -const constructorMap = new WeakMap(); -const stringTagMap = {}; -const baseTypesMap = { - undefined: (value, options) => options.stylize('undefined', 'undefined'), - null: (value, options) => options.stylize('null', 'null'), - boolean: (value, options) => options.stylize(String(value), 'boolean'), - Boolean: (value, options) => options.stylize(String(value), 'boolean'), - number: inspectNumber, - Number: inspectNumber, - bigint: inspectBigInt, - BigInt: inspectBigInt, - string: inspectString, - String: inspectString, - function: inspectFunction, - Function: inspectFunction, - symbol: inspectSymbol, - // A Symbol polyfill will return `Symbol` not `symbol` from typedetect - Symbol: inspectSymbol, - Array: inspectArray, - Date: inspectDate, - Map: inspectMap, - Set: inspectSet, - RegExp: inspectRegExp, - Promise: getPromiseValue, - // WeakSet, WeakMap are totally opaque to us - WeakSet: (value, options) => options.stylize('WeakSet{…}', 'special'), - WeakMap: (value, options) => options.stylize('WeakMap{…}', 'special'), - Arguments: inspectArguments, - Int8Array: inspectTypedArray, - Uint8Array: inspectTypedArray, - Uint8ClampedArray: inspectTypedArray, - Int16Array: inspectTypedArray, - Uint16Array: inspectTypedArray, - Int32Array: inspectTypedArray, - Uint32Array: inspectTypedArray, - Float32Array: inspectTypedArray, - Float64Array: inspectTypedArray, - Generator: () => '', - DataView: () => '', - ArrayBuffer: () => '', - Error: inspectObject, - HTMLCollection: inspectNodeCollection, - NodeList: inspectNodeCollection, -}; -// eslint-disable-next-line complexity -const inspectCustom = (value, options, type, inspectFn) => { - if (chaiInspect in value && typeof value[chaiInspect] === 'function') { - return value[chaiInspect](options); - } - if (nodeInspect in value && typeof value[nodeInspect] === 'function') { - return value[nodeInspect](options.depth, options, inspectFn); - } - if ('inspect' in value && typeof value.inspect === 'function') { - return value.inspect(options.depth, options); - } - if ('constructor' in value && constructorMap.has(value.constructor)) { - return constructorMap.get(value.constructor)(value, options); - } - if (stringTagMap[type]) { - return stringTagMap[type](value, options); - } - return ''; -}; -const toString = Object.prototype.toString; -// eslint-disable-next-line complexity -function inspect$1(value, opts = {}) { - const options = normaliseOptions(opts, inspect$1); - const { customInspect } = options; - let type = value === null ? 'null' : typeof value; - if (type === 'object') { - type = toString.call(value).slice(8, -1); - } - // If it is a base value that we already support, then use Loupe's inspector - if (type in baseTypesMap) { - return baseTypesMap[type](value, options); - } - // If `options.customInspect` is set to true then try to use the custom inspector - if (customInspect && value) { - const output = inspectCustom(value, options, type, inspect$1); - if (output) { - if (typeof output === 'string') - return output; - return inspect$1(output, options); - } - } - const proto = value ? Object.getPrototypeOf(value) : false; - // If it's a plain Object then use Loupe's inspector - if (proto === Object.prototype || proto === null) { - return inspectObject$1(value, options); - } - // Specifically account for HTMLElements - // @ts-ignore - if (value && typeof HTMLElement === 'function' && value instanceof HTMLElement) { - return inspectHTML(value, options); - } - if ('constructor' in value) { - // If it is a class, inspect it like an object but add the constructor name - if (value.constructor !== Object) { - return inspectClass(value, options); - } - // If it is an object with an anonymous prototype, display it as an object. - return inspectObject$1(value, options); - } - // last chance to check if it's an object - if (value === Object(value)) { - return inspectObject$1(value, options); - } - // We have run out of options! Just stringify the value - return options.stylize(String(value), type); -} - -const { AsymmetricMatcher, DOMCollection, DOMElement, Immutable, ReactElement, ReactTestComponent } = plugins; -const PLUGINS = [ - ReactTestComponent, - ReactElement, - DOMElement, - DOMCollection, - Immutable, - AsymmetricMatcher -]; -function stringify(object, maxDepth = 10, { maxLength, ...options } = {}) { - const MAX_LENGTH = maxLength ?? 1e4; - let result; - try { - result = format$1(object, { - maxDepth, - escapeString: false, - plugins: PLUGINS, - ...options - }); - } catch { - result = format$1(object, { - callToJSON: false, - maxDepth, - escapeString: false, - plugins: PLUGINS, - ...options - }); - } - // Prevents infinite loop https://github.com/vitest-dev/vitest/issues/7249 - return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(Math.min(maxDepth, Number.MAX_SAFE_INTEGER) / 2), { - maxLength, - ...options - }) : result; -} -const formatRegExp = /%[sdjifoOc%]/g; -function baseFormat(args, options = {}) { - const formatArg = (item, inspecOptions) => { - if (options.prettifyObject) { - return stringify(item, undefined, { - printBasicPrototype: false, - escapeString: false - }); - } - return inspect(item, inspecOptions); - }; - if (typeof args[0] !== "string") { - const objects = []; - for (let i = 0; i < args.length; i++) { - objects.push(formatArg(args[i], { - depth: 0, - colors: false - })); - } - return objects.join(" "); - } - const len = args.length; - let i = 1; - const template = args[0]; - let str = String(template).replace(formatRegExp, (x) => { - if (x === "%%") { - return "%"; - } - if (i >= len) { - return x; - } - switch (x) { - case "%s": { - const value = args[i++]; - if (typeof value === "bigint") { - return `${value.toString()}n`; - } - if (typeof value === "number" && value === 0 && 1 / value < 0) { - return "-0"; - } - if (typeof value === "object" && value !== null) { - if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) { - return value.toString(); - } - return formatArg(value, { - depth: 0, - colors: false - }); - } - return String(value); - } - case "%d": { - const value = args[i++]; - if (typeof value === "bigint") { - return `${value.toString()}n`; - } - return Number(value).toString(); - } - case "%i": { - const value = args[i++]; - if (typeof value === "bigint") { - return `${value.toString()}n`; - } - return Number.parseInt(String(value)).toString(); - } - case "%f": return Number.parseFloat(String(args[i++])).toString(); - case "%o": return formatArg(args[i++], { - showHidden: true, - showProxy: true - }); - case "%O": return formatArg(args[i++]); - case "%c": { - i++; - return ""; - } - case "%j": try { - return JSON.stringify(args[i++]); - } catch (err) { - const m = err.message; - if (m.includes("circular structure") || m.includes("cyclic structures") || m.includes("cyclic object")) { - return "[Circular]"; - } - throw err; - } - default: return x; - } - }); - for (let x = args[i]; i < len; x = args[++i]) { - if (x === null || typeof x !== "object") { - str += ` ${x}`; - } else { - str += ` ${formatArg(x)}`; - } - } - return str; -} -function format(...args) { - return baseFormat(args); -} -function browserFormat(...args) { - return baseFormat(args, { prettifyObject: true }); -} -function inspect(obj, options = {}) { - if (options.truncate === 0) { - options.truncate = Number.POSITIVE_INFINITY; - } - return inspect$1(obj, options); -} -function objDisplay(obj, options = {}) { - if (typeof options.truncate === "undefined") { - options.truncate = 40; - } - const str = inspect(obj, options); - const type = Object.prototype.toString.call(obj); - if (options.truncate && str.length >= options.truncate) { - if (type === "[object Function]") { - const fn = obj; - return !fn.name ? "[Function]" : `[Function: ${fn.name}]`; - } else if (type === "[object Array]") { - return `[ Array(${obj.length}) ]`; - } else if (type === "[object Object]") { - const keys = Object.keys(obj); - const kstr = keys.length > 2 ? `${keys.splice(0, 2).join(", ")}, ...` : keys.join(", "); - return `{ Object (${kstr}) }`; - } else { - return str; - } - } - return str; -} - -export { browserFormat, format, formatRegExp, inspect, objDisplay, stringify }; diff --git a/node_modules/@vitest/utils/dist/error.d.ts b/node_modules/@vitest/utils/dist/error.d.ts deleted file mode 100644 index ad5d628..0000000 --- a/node_modules/@vitest/utils/dist/error.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { D as DiffOptions } from './types.d-BCElaP-c.js'; -export { serializeValue as serializeError } from './serialize.js'; -import '@vitest/pretty-format'; - -declare function processError(_err: any, diffOptions?: DiffOptions, seen?: WeakSet): any; - -export { processError }; diff --git a/node_modules/@vitest/utils/dist/error.js b/node_modules/@vitest/utils/dist/error.js deleted file mode 100644 index 14886d0..0000000 --- a/node_modules/@vitest/utils/dist/error.js +++ /dev/null @@ -1,42 +0,0 @@ -import { printDiffOrStringify } from './diff.js'; -import { stringify } from './display.js'; -import { serializeValue } from './serialize.js'; -import '@vitest/pretty-format'; -import 'tinyrainbow'; -import './helpers.js'; -import './constants.js'; -import './chunk-_commonjsHelpers.js'; - -function processError(_err, diffOptions, seen = new WeakSet()) { - if (!_err || typeof _err !== "object") { - return { message: String(_err) }; - } - const err = _err; - if (err.showDiff || err.showDiff === undefined && err.expected !== undefined && err.actual !== undefined) { - err.diff = printDiffOrStringify(err.actual, err.expected, { - ...diffOptions, - ...err.diffOptions - }); - } - if ("expected" in err && typeof err.expected !== "string") { - err.expected = stringify(err.expected, 10); - } - if ("actual" in err && typeof err.actual !== "string") { - err.actual = stringify(err.actual, 10); - } - // some Error implementations may not allow rewriting cause - // in most cases, the assignment will lead to "err.cause = err.cause" - try { - if (!seen.has(err) && typeof err.cause === "object") { - seen.add(err); - err.cause = processError(err.cause, diffOptions, seen); - } - } catch {} - try { - return serializeValue(err); - } catch (e) { - return serializeValue(new Error(`Failed to fully serialize error: ${e === null || e === void 0 ? void 0 : e.message}\nInner error message: ${err === null || err === void 0 ? void 0 : err.message}`)); - } -} - -export { processError, serializeValue as serializeError }; diff --git a/node_modules/@vitest/utils/dist/helpers.d.ts b/node_modules/@vitest/utils/dist/helpers.d.ts deleted file mode 100644 index 493817b..0000000 --- a/node_modules/@vitest/utils/dist/helpers.d.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Nullable, Arrayable } from './types.js'; - -declare function nanoid(size?: number): string; - -declare function shuffle(array: T[], seed?: number): T[]; - -interface CloneOptions { - forceWritable?: boolean; -} -interface ErrorOptions { - message?: string; - stackTraceLimit?: number; -} - -/** -* Get original stacktrace without source map support the most performant way. -* - Create only 1 stack frame. -* - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms). -*/ -declare function createSimpleStackTrace(options?: ErrorOptions): string; -declare function notNullish(v: T | null | undefined): v is NonNullable; -declare function assertTypes(value: unknown, name: string, types: string[]): void; -declare function isPrimitive(value: unknown): boolean; -declare function slash(path: string): string; -declare function cleanUrl(url: string): string; -declare const isExternalUrl: (url: string) => boolean; -/** -* Prepend `/@id/` and replace null byte so the id is URL-safe. -* This is prepended to resolved ids that are not valid browser -* import specifiers by the importAnalysis plugin. -*/ -declare function wrapId(id: string): string; -/** -* Undo {@link wrapId}'s `/@id/` and null byte replacements. -*/ -declare function unwrapId(id: string): string; -declare function withTrailingSlash(path: string): string; -declare function isBareImport(id: string): boolean; -declare function toArray(array?: Nullable>): Array; -declare function isObject(item: unknown): boolean; -declare function getType(value: unknown): string; -declare function getOwnProperties(obj: any): (string | symbol)[]; -declare function deepClone(val: T, options?: CloneOptions): T; -declare function clone(val: T, seen: WeakMap, options?: CloneOptions): T; -declare function noop(): void; -declare function objectAttr(source: any, path: string, defaultValue?: undefined): any; -type DeferPromise = Promise & { - resolve: (value: T | PromiseLike) => void; - reject: (reason?: any) => void; -}; -declare function createDefer(): DeferPromise; -/** -* If code starts with a function call, will return its last index, respecting arguments. -* This will return 25 - last ending character of toMatch ")" -* Also works with callbacks -* ``` -* toMatch({ test: '123' }); -* toBeAliased('123') -* ``` -*/ -declare function getCallLastIndex(code: string): number | null; -declare function isNegativeNaN(val: number): boolean; -/** -* Deep merge :P -* -* Will merge objects only if they are plain -* -* Do not merge types - it is very expensive and usually it's better to case a type here -*/ -declare function deepMerge(target: T, ...sources: any[]): T; - -export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, shuffle, slash, toArray, unwrapId, withTrailingSlash, wrapId }; -export type { DeferPromise }; diff --git a/node_modules/@vitest/utils/dist/helpers.js b/node_modules/@vitest/utils/dist/helpers.js deleted file mode 100644 index b19970a..0000000 --- a/node_modules/@vitest/utils/dist/helpers.js +++ /dev/null @@ -1,295 +0,0 @@ -import { VALID_ID_PREFIX, NULL_BYTE_PLACEHOLDER } from './constants.js'; - -// port from nanoid -// https://github.com/ai/nanoid -const urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"; -function nanoid(size = 21) { - let id = ""; - let i = size; - while (i--) { - id += urlAlphabet[Math.random() * 64 | 0]; - } - return id; -} - -const RealDate = Date; -function random(seed) { - const x = Math.sin(seed++) * 1e4; - return x - Math.floor(x); -} -function shuffle(array, seed = RealDate.now()) { - let length = array.length; - while (length) { - const index = Math.floor(random(seed) * length--); - const previous = array[length]; - array[length] = array[index]; - array[index] = previous; - ++seed; - } - return array; -} - -/** -* Get original stacktrace without source map support the most performant way. -* - Create only 1 stack frame. -* - Rewrite prepareStackTrace to bypass "support-stack-trace" (usually takes ~250ms). -*/ -function createSimpleStackTrace(options) { - const { message = "$$stack trace error", stackTraceLimit = 1 } = options || {}; - const limit = Error.stackTraceLimit; - const prepareStackTrace = Error.prepareStackTrace; - Error.stackTraceLimit = stackTraceLimit; - Error.prepareStackTrace = (e) => e.stack; - const err = new Error(message); - const stackTrace = err.stack || ""; - Error.prepareStackTrace = prepareStackTrace; - Error.stackTraceLimit = limit; - return stackTrace; -} -function notNullish(v) { - return v != null; -} -function assertTypes(value, name, types) { - const receivedType = typeof value; - const pass = types.includes(receivedType); - if (!pass) { - throw new TypeError(`${name} value must be ${types.join(" or ")}, received "${receivedType}"`); - } -} -function isPrimitive(value) { - return value === null || typeof value !== "function" && typeof value !== "object"; -} -function slash(path) { - return path.replace(/\\/g, "/"); -} -const postfixRE = /[?#].*$/; -function cleanUrl(url) { - return url.replace(postfixRE, ""); -} -const externalRE = /^(?:[a-z]+:)?\/\//; -const isExternalUrl = (url) => externalRE.test(url); -/** -* Prepend `/@id/` and replace null byte so the id is URL-safe. -* This is prepended to resolved ids that are not valid browser -* import specifiers by the importAnalysis plugin. -*/ -function wrapId(id) { - return id.startsWith(VALID_ID_PREFIX) ? id : VALID_ID_PREFIX + id.replace("\0", NULL_BYTE_PLACEHOLDER); -} -/** -* Undo {@link wrapId}'s `/@id/` and null byte replacements. -*/ -function unwrapId(id) { - return id.startsWith(VALID_ID_PREFIX) ? id.slice(VALID_ID_PREFIX.length).replace(NULL_BYTE_PLACEHOLDER, "\0") : id; -} -function withTrailingSlash(path) { - if (path.at(-1) !== "/") { - return `${path}/`; - } - return path; -} -const bareImportRE = /^(?![a-z]:)[\w@](?!.*:\/\/)/i; -function isBareImport(id) { - return bareImportRE.test(id); -} -function toArray(array) { - if (array === null || array === undefined) { - array = []; - } - if (Array.isArray(array)) { - return array; - } - return [array]; -} -function isObject(item) { - return item != null && typeof item === "object" && !Array.isArray(item); -} -function isFinalObj(obj) { - return obj === Object.prototype || obj === Function.prototype || obj === RegExp.prototype; -} -function getType(value) { - return Object.prototype.toString.apply(value).slice(8, -1); -} -function collectOwnProperties(obj, collector) { - const collect = typeof collector === "function" ? collector : (key) => collector.add(key); - Object.getOwnPropertyNames(obj).forEach(collect); - Object.getOwnPropertySymbols(obj).forEach(collect); -} -function getOwnProperties(obj) { - const ownProps = new Set(); - if (isFinalObj(obj)) { - return []; - } - collectOwnProperties(obj, ownProps); - return Array.from(ownProps); -} -const defaultCloneOptions = { forceWritable: false }; -function deepClone(val, options = defaultCloneOptions) { - const seen = new WeakMap(); - return clone(val, seen, options); -} -function clone(val, seen, options = defaultCloneOptions) { - let k, out; - if (seen.has(val)) { - return seen.get(val); - } - if (Array.isArray(val)) { - out = Array.from({ length: k = val.length }); - seen.set(val, out); - while (k--) { - out[k] = clone(val[k], seen, options); - } - return out; - } - if (Object.prototype.toString.call(val) === "[object Object]") { - out = Object.create(Object.getPrototypeOf(val)); - seen.set(val, out); - // we don't need properties from prototype - const props = getOwnProperties(val); - for (const k of props) { - const descriptor = Object.getOwnPropertyDescriptor(val, k); - if (!descriptor) { - continue; - } - const cloned = clone(val[k], seen, options); - if (options.forceWritable) { - Object.defineProperty(out, k, { - enumerable: descriptor.enumerable, - configurable: true, - writable: true, - value: cloned - }); - } else if ("get" in descriptor) { - Object.defineProperty(out, k, { - ...descriptor, - get() { - return cloned; - } - }); - } else { - Object.defineProperty(out, k, { - ...descriptor, - value: cloned - }); - } - } - return out; - } - return val; -} -function noop() {} -function objectAttr(source, path, defaultValue = undefined) { - // a[3].b -> a.3.b - const paths = path.replace(/\[(\d+)\]/g, ".$1").split("."); - let result = source; - for (const p of paths) { - result = new Object(result)[p]; - if (result === undefined) { - return defaultValue; - } - } - return result; -} -function createDefer() { - let resolve = null; - let reject = null; - const p = new Promise((_resolve, _reject) => { - resolve = _resolve; - reject = _reject; - }); - p.resolve = resolve; - p.reject = reject; - return p; -} -/** -* If code starts with a function call, will return its last index, respecting arguments. -* This will return 25 - last ending character of toMatch ")" -* Also works with callbacks -* ``` -* toMatch({ test: '123' }); -* toBeAliased('123') -* ``` -*/ -function getCallLastIndex(code) { - let charIndex = -1; - let inString = null; - let startedBracers = 0; - let endedBracers = 0; - let beforeChar = null; - while (charIndex <= code.length) { - beforeChar = code[charIndex]; - charIndex++; - const char = code[charIndex]; - const isCharString = char === "\"" || char === "'" || char === "`"; - if (isCharString && beforeChar !== "\\") { - if (inString === char) { - inString = null; - } else if (!inString) { - inString = char; - } - } - if (!inString) { - if (char === "(") { - startedBracers++; - } - if (char === ")") { - endedBracers++; - } - } - if (startedBracers && endedBracers && startedBracers === endedBracers) { - return charIndex; - } - } - return null; -} -function isNegativeNaN(val) { - if (!Number.isNaN(val)) { - return false; - } - const f64 = new Float64Array(1); - f64[0] = val; - const u32 = new Uint32Array(f64.buffer); - const isNegative = u32[1] >>> 31 === 1; - return isNegative; -} -function toString(v) { - return Object.prototype.toString.call(v); -} -function isPlainObject(val) { - return toString(val) === "[object Object]" && (!val.constructor || val.constructor.name === "Object"); -} -function isMergeableObject(item) { - return isPlainObject(item) && !Array.isArray(item); -} -/** -* Deep merge :P -* -* Will merge objects only if they are plain -* -* Do not merge types - it is very expensive and usually it's better to case a type here -*/ -function deepMerge(target, ...sources) { - if (!sources.length) { - return target; - } - const source = sources.shift(); - if (source === undefined) { - return target; - } - if (isMergeableObject(target) && isMergeableObject(source)) { - Object.keys(source).forEach((key) => { - const _source = source; - if (isMergeableObject(_source[key])) { - if (!target[key]) { - target[key] = {}; - } - deepMerge(target[key], _source[key]); - } else { - target[key] = _source[key]; - } - }); - } - return deepMerge(target, ...sources); -} - -export { assertTypes, cleanUrl, clone, createDefer, createSimpleStackTrace, deepClone, deepMerge, getCallLastIndex, getOwnProperties, getType, isBareImport, isExternalUrl, isNegativeNaN, isObject, isPrimitive, nanoid, noop, notNullish, objectAttr, shuffle, slash, toArray, unwrapId, withTrailingSlash, wrapId }; diff --git a/node_modules/@vitest/utils/dist/highlight.d.ts b/node_modules/@vitest/utils/dist/highlight.d.ts deleted file mode 100644 index b3420de..0000000 --- a/node_modules/@vitest/utils/dist/highlight.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Colors } from 'tinyrainbow'; - -interface HighlightOptions { - jsx?: boolean; - colors?: Colors; -} -declare function highlight(code: string, options?: HighlightOptions): string; - -export { highlight }; diff --git a/node_modules/@vitest/utils/dist/highlight.js b/node_modules/@vitest/utils/dist/highlight.js deleted file mode 100644 index 1250062..0000000 --- a/node_modules/@vitest/utils/dist/highlight.js +++ /dev/null @@ -1,538 +0,0 @@ -import { g as getDefaultExportFromCjs } from './chunk-_commonjsHelpers.js'; -import c from 'tinyrainbow'; - -var jsTokens_1; -var hasRequiredJsTokens; - -function requireJsTokens () { - if (hasRequiredJsTokens) return jsTokens_1; - hasRequiredJsTokens = 1; - // Copyright 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Simon Lydell - // License: MIT. - var Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace; - RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\\]).|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/yu; - Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y; - Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/yu; - StringLiteral = /(['"])(?:(?!\1)[^\\\n\r]|\\(?:\r\n|[^]))*(\1)?/y; - NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y; - Template = /[`}](?:[^`\\$]|\\[^]|\$(?!\{))*(`|\$\{)?/y; - WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/yu; - LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y; - MultiLineComment = /\/\*(?:[^*]|\*(?!\/))*(\*\/)?/y; - SingleLineComment = /\/\/.*/y; - JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y; - JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/yu; - JSXString = /(['"])(?:(?!\1)[^])*(\1)?/y; - JSXText = /[^<>{}]+/y; - TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/; - TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/; - KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/; - KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/; - Newline = RegExp(LineTerminatorSequence.source); - jsTokens_1 = function*(input, {jsx = false} = {}) { - var braces, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack; - ({length} = input); - lastIndex = 0; - lastSignificantToken = ""; - stack = [ - {tag: "JS"} - ]; - braces = []; - parenNesting = 0; - postfixIncDec = false; - while (lastIndex < length) { - mode = stack[stack.length - 1]; - switch (mode.tag) { - case "JS": - case "JSNonExpressionParen": - case "InterpolationInTemplate": - case "InterpolationInJSX": - if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { - RegularExpressionLiteral.lastIndex = lastIndex; - if (match = RegularExpressionLiteral.exec(input)) { - lastIndex = RegularExpressionLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield ({ - type: "RegularExpressionLiteral", - value: match[0], - closed: match[1] !== void 0 && match[1] !== "\\" - }); - continue; - } - } - Punctuator.lastIndex = lastIndex; - if (match = Punctuator.exec(input)) { - punctuator = match[0]; - nextLastIndex = Punctuator.lastIndex; - nextLastSignificantToken = punctuator; - switch (punctuator) { - case "(": - if (lastSignificantToken === "?NonExpressionParenKeyword") { - stack.push({ - tag: "JSNonExpressionParen", - nesting: parenNesting - }); - } - parenNesting++; - postfixIncDec = false; - break; - case ")": - parenNesting--; - postfixIncDec = true; - if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) { - stack.pop(); - nextLastSignificantToken = "?NonExpressionParenEnd"; - postfixIncDec = false; - } - break; - case "{": - Punctuator.lastIndex = 0; - isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken)); - braces.push(isExpression); - postfixIncDec = false; - break; - case "}": - switch (mode.tag) { - case "InterpolationInTemplate": - if (braces.length === mode.nesting) { - Template.lastIndex = lastIndex; - match = Template.exec(input); - lastIndex = Template.lastIndex; - lastSignificantToken = match[0]; - if (match[1] === "${") { - lastSignificantToken = "?InterpolationInTemplate"; - postfixIncDec = false; - yield ({ - type: "TemplateMiddle", - value: match[0] - }); - } else { - stack.pop(); - postfixIncDec = true; - yield ({ - type: "TemplateTail", - value: match[0], - closed: match[1] === "`" - }); - } - continue; - } - break; - case "InterpolationInJSX": - if (braces.length === mode.nesting) { - stack.pop(); - lastIndex += 1; - lastSignificantToken = "}"; - yield ({ - type: "JSXPunctuator", - value: "}" - }); - continue; - } - } - postfixIncDec = braces.pop(); - nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}"; - break; - case "]": - postfixIncDec = true; - break; - case "++": - case "--": - nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec"; - break; - case "<": - if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { - stack.push({tag: "JSXTag"}); - lastIndex += 1; - lastSignificantToken = "<"; - yield ({ - type: "JSXPunctuator", - value: punctuator - }); - continue; - } - postfixIncDec = false; - break; - default: - postfixIncDec = false; - } - lastIndex = nextLastIndex; - lastSignificantToken = nextLastSignificantToken; - yield ({ - type: "Punctuator", - value: punctuator - }); - continue; - } - Identifier.lastIndex = lastIndex; - if (match = Identifier.exec(input)) { - lastIndex = Identifier.lastIndex; - nextLastSignificantToken = match[0]; - switch (match[0]) { - case "for": - case "if": - case "while": - case "with": - if (lastSignificantToken !== "." && lastSignificantToken !== "?.") { - nextLastSignificantToken = "?NonExpressionParenKeyword"; - } - } - lastSignificantToken = nextLastSignificantToken; - postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]); - yield ({ - type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName", - value: match[0] - }); - continue; - } - StringLiteral.lastIndex = lastIndex; - if (match = StringLiteral.exec(input)) { - lastIndex = StringLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield ({ - type: "StringLiteral", - value: match[0], - closed: match[2] !== void 0 - }); - continue; - } - NumericLiteral.lastIndex = lastIndex; - if (match = NumericLiteral.exec(input)) { - lastIndex = NumericLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield ({ - type: "NumericLiteral", - value: match[0] - }); - continue; - } - Template.lastIndex = lastIndex; - if (match = Template.exec(input)) { - lastIndex = Template.lastIndex; - lastSignificantToken = match[0]; - if (match[1] === "${") { - lastSignificantToken = "?InterpolationInTemplate"; - stack.push({ - tag: "InterpolationInTemplate", - nesting: braces.length - }); - postfixIncDec = false; - yield ({ - type: "TemplateHead", - value: match[0] - }); - } else { - postfixIncDec = true; - yield ({ - type: "NoSubstitutionTemplate", - value: match[0], - closed: match[1] === "`" - }); - } - continue; - } - break; - case "JSXTag": - case "JSXTagEnd": - JSXPunctuator.lastIndex = lastIndex; - if (match = JSXPunctuator.exec(input)) { - lastIndex = JSXPunctuator.lastIndex; - nextLastSignificantToken = match[0]; - switch (match[0]) { - case "<": - stack.push({tag: "JSXTag"}); - break; - case ">": - stack.pop(); - if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") { - nextLastSignificantToken = "?JSX"; - postfixIncDec = true; - } else { - stack.push({tag: "JSXChildren"}); - } - break; - case "{": - stack.push({ - tag: "InterpolationInJSX", - nesting: braces.length - }); - nextLastSignificantToken = "?InterpolationInJSX"; - postfixIncDec = false; - break; - case "/": - if (lastSignificantToken === "<") { - stack.pop(); - if (stack[stack.length - 1].tag === "JSXChildren") { - stack.pop(); - } - stack.push({tag: "JSXTagEnd"}); - } - } - lastSignificantToken = nextLastSignificantToken; - yield ({ - type: "JSXPunctuator", - value: match[0] - }); - continue; - } - JSXIdentifier.lastIndex = lastIndex; - if (match = JSXIdentifier.exec(input)) { - lastIndex = JSXIdentifier.lastIndex; - lastSignificantToken = match[0]; - yield ({ - type: "JSXIdentifier", - value: match[0] - }); - continue; - } - JSXString.lastIndex = lastIndex; - if (match = JSXString.exec(input)) { - lastIndex = JSXString.lastIndex; - lastSignificantToken = match[0]; - yield ({ - type: "JSXString", - value: match[0], - closed: match[2] !== void 0 - }); - continue; - } - break; - case "JSXChildren": - JSXText.lastIndex = lastIndex; - if (match = JSXText.exec(input)) { - lastIndex = JSXText.lastIndex; - lastSignificantToken = match[0]; - yield ({ - type: "JSXText", - value: match[0] - }); - continue; - } - switch (input[lastIndex]) { - case "<": - stack.push({tag: "JSXTag"}); - lastIndex++; - lastSignificantToken = "<"; - yield ({ - type: "JSXPunctuator", - value: "<" - }); - continue; - case "{": - stack.push({ - tag: "InterpolationInJSX", - nesting: braces.length - }); - lastIndex++; - lastSignificantToken = "?InterpolationInJSX"; - postfixIncDec = false; - yield ({ - type: "JSXPunctuator", - value: "{" - }); - continue; - } - } - WhiteSpace.lastIndex = lastIndex; - if (match = WhiteSpace.exec(input)) { - lastIndex = WhiteSpace.lastIndex; - yield ({ - type: "WhiteSpace", - value: match[0] - }); - continue; - } - LineTerminatorSequence.lastIndex = lastIndex; - if (match = LineTerminatorSequence.exec(input)) { - lastIndex = LineTerminatorSequence.lastIndex; - postfixIncDec = false; - if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) { - lastSignificantToken = "?NoLineTerminatorHere"; - } - yield ({ - type: "LineTerminatorSequence", - value: match[0] - }); - continue; - } - MultiLineComment.lastIndex = lastIndex; - if (match = MultiLineComment.exec(input)) { - lastIndex = MultiLineComment.lastIndex; - if (Newline.test(match[0])) { - postfixIncDec = false; - if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) { - lastSignificantToken = "?NoLineTerminatorHere"; - } - } - yield ({ - type: "MultiLineComment", - value: match[0], - closed: match[1] !== void 0 - }); - continue; - } - SingleLineComment.lastIndex = lastIndex; - if (match = SingleLineComment.exec(input)) { - lastIndex = SingleLineComment.lastIndex; - postfixIncDec = false; - yield ({ - type: "SingleLineComment", - value: match[0] - }); - continue; - } - firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex)); - lastIndex += firstCodePoint.length; - lastSignificantToken = firstCodePoint; - postfixIncDec = false; - yield ({ - type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid", - value: firstCodePoint - }); - } - return void 0; - }; - return jsTokens_1; -} - -var jsTokensExports = /*@__PURE__*/ requireJsTokens(); -var jsTokens = /*@__PURE__*/getDefaultExportFromCjs(jsTokensExports); - -// src/index.ts -var reservedWords = { - keyword: [ - "break", - "case", - "catch", - "continue", - "debugger", - "default", - "do", - "else", - "finally", - "for", - "function", - "if", - "return", - "switch", - "throw", - "try", - "var", - "const", - "while", - "with", - "new", - "this", - "super", - "class", - "extends", - "export", - "import", - "null", - "true", - "false", - "in", - "instanceof", - "typeof", - "void", - "delete" - ], - strict: [ - "implements", - "interface", - "let", - "package", - "private", - "protected", - "public", - "static", - "yield" - ] -}, keywords = new Set(reservedWords.keyword), reservedWordsStrictSet = new Set(reservedWords.strict), sometimesKeywords = /* @__PURE__ */ new Set(["as", "async", "from", "get", "of", "set"]); -function isReservedWord(word) { - return word === "await" || word === "enum"; -} -function isStrictReservedWord(word) { - return isReservedWord(word) || reservedWordsStrictSet.has(word); -} -function isKeyword(word) { - return keywords.has(word); -} -var BRACKET = /^[()[\]{}]$/, getTokenType = function(token) { - if (token.type === "IdentifierName") { - if (isKeyword(token.value) || isStrictReservedWord(token.value) || sometimesKeywords.has(token.value)) - return "Keyword"; - if (token.value[0] && token.value[0] !== token.value[0].toLowerCase()) - return "IdentifierCapitalized"; - } - return token.type === "Punctuator" && BRACKET.test(token.value) ? "Bracket" : token.type === "Invalid" && (token.value === "@" || token.value === "#") ? "Punctuator" : token.type; -}; -function getCallableType(token) { - if (token.type === "IdentifierName") - return "IdentifierCallable"; - if (token.type === "PrivateIdentifier") - return "PrivateIdentifierCallable"; - throw new Error("Not a callable token"); -} -var colorize = (defs, type, value) => { - let colorize2 = defs[type]; - return colorize2 ? colorize2(value) : value; -}, highlightTokens = (defs, text, jsx) => { - let highlighted = "", lastPotentialCallable = null, stackedHighlight = ""; - for (let token of jsTokens(text, { jsx })) { - let type = getTokenType(token); - if (type === "IdentifierName" || type === "PrivateIdentifier") { - lastPotentialCallable && (highlighted += colorize(defs, getTokenType(lastPotentialCallable), lastPotentialCallable.value) + stackedHighlight, stackedHighlight = ""), lastPotentialCallable = token; - continue; - } - if (lastPotentialCallable && (token.type === "WhiteSpace" || token.type === "LineTerminatorSequence" || token.type === "Punctuator" && (token.value === "?." || token.value === "!"))) { - stackedHighlight += colorize(defs, type, token.value); - continue; - } - if (stackedHighlight && !lastPotentialCallable && (highlighted += stackedHighlight, stackedHighlight = ""), lastPotentialCallable) { - let type2 = token.type === "Punctuator" && token.value === "(" ? getCallableType(lastPotentialCallable) : getTokenType(lastPotentialCallable); - highlighted += colorize(defs, type2, lastPotentialCallable.value) + stackedHighlight, stackedHighlight = "", lastPotentialCallable = null; - } - highlighted += colorize(defs, type, token.value); - } - return highlighted; -}; -function highlight$1(code, options = { jsx: false, colors: {} }) { - return code && highlightTokens(options.colors || {}, code, options.jsx); -} - -function getDefs(c) { - const Invalid = (text) => c.white(c.bgRed(c.bold(text))); - return { - Keyword: c.magenta, - IdentifierCapitalized: c.yellow, - Punctuator: c.yellow, - StringLiteral: c.green, - NoSubstitutionTemplate: c.green, - MultiLineComment: c.gray, - SingleLineComment: c.gray, - RegularExpressionLiteral: c.cyan, - NumericLiteral: c.blue, - TemplateHead: (text) => c.green(text.slice(0, text.length - 2)) + c.cyan(text.slice(-2)), - TemplateTail: (text) => c.cyan(text.slice(0, 1)) + c.green(text.slice(1)), - TemplateMiddle: (text) => c.cyan(text.slice(0, 1)) + c.green(text.slice(1, text.length - 2)) + c.cyan(text.slice(-2)), - IdentifierCallable: c.blue, - PrivateIdentifierCallable: (text) => `#${c.blue(text.slice(1))}`, - Invalid, - JSXString: c.green, - JSXIdentifier: c.yellow, - JSXInvalid: Invalid, - JSXPunctuator: c.yellow - }; -} -function highlight(code, options = { jsx: false }) { - return highlight$1(code, { - jsx: options.jsx, - colors: getDefs(options.colors || c) - }); -} - -export { highlight }; diff --git a/node_modules/@vitest/utils/dist/index.d.ts b/node_modules/@vitest/utils/dist/index.d.ts deleted file mode 100644 index d4435cc..0000000 --- a/node_modules/@vitest/utils/dist/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export { LoupeOptions, StringifyOptions } from './display.js'; -export { DeferPromise } from './helpers.js'; -export { SafeTimers } from './timers.js'; -export { ArgumentsType, Arrayable, Awaitable, Constructable, DeepMerge, MergeInsertions, Nullable, ParsedStack, SerializedError, TestError } from './types.js'; -import '@vitest/pretty-format'; diff --git a/node_modules/@vitest/utils/dist/index.js b/node_modules/@vitest/utils/dist/index.js deleted file mode 100644 index 8b13789..0000000 --- a/node_modules/@vitest/utils/dist/index.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/@vitest/utils/dist/offset.d.ts b/node_modules/@vitest/utils/dist/offset.d.ts deleted file mode 100644 index ae65386..0000000 --- a/node_modules/@vitest/utils/dist/offset.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -declare const lineSplitRE: RegExp; -declare function positionToOffset(source: string, lineNumber: number, columnNumber: number): number; -declare function offsetToLineNumber(source: string, offset: number): number; - -export { lineSplitRE, offsetToLineNumber, positionToOffset }; diff --git a/node_modules/@vitest/utils/dist/offset.js b/node_modules/@vitest/utils/dist/offset.js deleted file mode 100644 index d8cb08d..0000000 --- a/node_modules/@vitest/utils/dist/offset.js +++ /dev/null @@ -1,32 +0,0 @@ -const lineSplitRE = /\r?\n/; -function positionToOffset(source, lineNumber, columnNumber) { - const lines = source.split(lineSplitRE); - const nl = /\r\n/.test(source) ? 2 : 1; - let start = 0; - if (lineNumber > lines.length) { - return source.length; - } - for (let i = 0; i < lineNumber - 1; i++) { - start += lines[i].length + nl; - } - return start + columnNumber; -} -function offsetToLineNumber(source, offset) { - if (offset > source.length) { - throw new Error(`offset is longer than source length! offset ${offset} > length ${source.length}`); - } - const lines = source.split(lineSplitRE); - const nl = /\r\n/.test(source) ? 2 : 1; - let counted = 0; - let line = 0; - for (; line < lines.length; line++) { - const lineLength = lines[line].length + nl; - if (counted + lineLength >= offset) { - break; - } - counted += lineLength; - } - return line + 1; -} - -export { lineSplitRE, offsetToLineNumber, positionToOffset }; diff --git a/node_modules/@vitest/utils/dist/resolver.d.ts b/node_modules/@vitest/utils/dist/resolver.d.ts deleted file mode 100644 index 71ebc63..0000000 --- a/node_modules/@vitest/utils/dist/resolver.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -declare function findNearestPackageData(basedir: string): { - type?: "module" | "commonjs"; -}; -declare function getCachedData(cache: Map, basedir: string, originalBasedir: string): NonNullable | undefined; -declare function setCacheData(cache: Map, data: T, basedir: string, originalBasedir: string): void; - -export { findNearestPackageData, getCachedData, setCacheData }; diff --git a/node_modules/@vitest/utils/dist/resolver.js b/node_modules/@vitest/utils/dist/resolver.js deleted file mode 100644 index 83bd3c1..0000000 --- a/node_modules/@vitest/utils/dist/resolver.js +++ /dev/null @@ -1,71 +0,0 @@ -import fs from 'node:fs'; -import { j as join, d as dirname } from './chunk-pathe.M-eThtNZ.js'; - -const packageCache = new Map(); -function findNearestPackageData(basedir) { - const originalBasedir = basedir; - while (basedir) { - var _tryStatSync; - const cached = getCachedData(packageCache, basedir, originalBasedir); - if (cached) { - return cached; - } - const pkgPath = join(basedir, "package.json"); - if ((_tryStatSync = tryStatSync(pkgPath)) === null || _tryStatSync === void 0 ? void 0 : _tryStatSync.isFile()) { - const pkgData = JSON.parse(stripBomTag(fs.readFileSync(pkgPath, "utf8"))); - if (packageCache) { - setCacheData(packageCache, pkgData, basedir, originalBasedir); - } - return pkgData; - } - const nextBasedir = dirname(basedir); - if (nextBasedir === basedir) { - break; - } - basedir = nextBasedir; - } - return {}; -} -function stripBomTag(content) { - if (content.charCodeAt(0) === 65279) { - return content.slice(1); - } - return content; -} -function tryStatSync(file) { - try { - // The "throwIfNoEntry" is a performance optimization for cases where the file does not exist - return fs.statSync(file, { throwIfNoEntry: false }); - } catch {} -} -function getCachedData(cache, basedir, originalBasedir) { - const pkgData = cache.get(getFnpdCacheKey(basedir)); - if (pkgData) { - traverseBetweenDirs(originalBasedir, basedir, (dir) => { - cache.set(getFnpdCacheKey(dir), pkgData); - }); - return pkgData; - } -} -function setCacheData(cache, data, basedir, originalBasedir) { - cache.set(getFnpdCacheKey(basedir), data); - traverseBetweenDirs(originalBasedir, basedir, (dir) => { - cache.set(getFnpdCacheKey(dir), data); - }); -} -function getFnpdCacheKey(basedir) { - return `fnpd_${basedir}`; -} -/** -* Traverse between `longerDir` (inclusive) and `shorterDir` (exclusive) and call `cb` for each dir. -* @param longerDir Longer dir path, e.g. `/User/foo/bar/baz` -* @param shorterDir Shorter dir path, e.g. `/User/foo` -*/ -function traverseBetweenDirs(longerDir, shorterDir, cb) { - while (longerDir !== shorterDir) { - cb(longerDir); - longerDir = dirname(longerDir); - } -} - -export { findNearestPackageData, getCachedData, setCacheData }; diff --git a/node_modules/@vitest/utils/dist/serialize.d.ts b/node_modules/@vitest/utils/dist/serialize.d.ts deleted file mode 100644 index dd8ee7d..0000000 --- a/node_modules/@vitest/utils/dist/serialize.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare function serializeValue(val: any, seen?: WeakMap): any; - -export { serializeValue }; diff --git a/node_modules/@vitest/utils/dist/serialize.js b/node_modules/@vitest/utils/dist/serialize.js deleted file mode 100644 index f3ad0ad..0000000 --- a/node_modules/@vitest/utils/dist/serialize.js +++ /dev/null @@ -1,118 +0,0 @@ -const IS_RECORD_SYMBOL = "@@__IMMUTABLE_RECORD__@@"; -const IS_COLLECTION_SYMBOL = "@@__IMMUTABLE_ITERABLE__@@"; -function isImmutable(v) { - return v && (v[IS_COLLECTION_SYMBOL] || v[IS_RECORD_SYMBOL]); -} -const OBJECT_PROTO = Object.getPrototypeOf({}); -function getUnserializableMessage(err) { - if (err instanceof Error) { - return `: ${err.message}`; - } - if (typeof err === "string") { - return `: ${err}`; - } - return ""; -} -// https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm -function serializeValue(val, seen = new WeakMap()) { - if (!val || typeof val === "string") { - return val; - } - if (val instanceof Error && "toJSON" in val && typeof val.toJSON === "function") { - const jsonValue = val.toJSON(); - if (jsonValue && jsonValue !== val && typeof jsonValue === "object") { - if (typeof val.message === "string") { - safe(() => jsonValue.message ?? (jsonValue.message = normalizeErrorMessage(val.message))); - } - if (typeof val.stack === "string") { - safe(() => jsonValue.stack ?? (jsonValue.stack = val.stack)); - } - if (typeof val.name === "string") { - safe(() => jsonValue.name ?? (jsonValue.name = val.name)); - } - if (val.cause != null) { - safe(() => jsonValue.cause ?? (jsonValue.cause = serializeValue(val.cause, seen))); - } - } - return serializeValue(jsonValue, seen); - } - if (typeof val === "function") { - return `Function<${val.name || "anonymous"}>`; - } - if (typeof val === "symbol") { - return val.toString(); - } - if (typeof val !== "object") { - return val; - } - if (typeof Buffer !== "undefined" && val instanceof Buffer) { - return ``; - } - if (typeof Uint8Array !== "undefined" && val instanceof Uint8Array) { - return ``; - } - // cannot serialize immutables as immutables - if (isImmutable(val)) { - return serializeValue(val.toJSON(), seen); - } - if (val instanceof Promise || val.constructor && val.constructor.prototype === "AsyncFunction") { - return "Promise"; - } - if (typeof Element !== "undefined" && val instanceof Element) { - return val.tagName; - } - if (typeof val.toJSON === "function") { - return serializeValue(val.toJSON(), seen); - } - if (seen.has(val)) { - return seen.get(val); - } - if (Array.isArray(val)) { - // eslint-disable-next-line unicorn/no-new-array -- we need to keep sparse arrays ([1,,3]) - const clone = new Array(val.length); - seen.set(val, clone); - val.forEach((e, i) => { - try { - clone[i] = serializeValue(e, seen); - } catch (err) { - clone[i] = getUnserializableMessage(err); - } - }); - return clone; - } else { - // Objects with `Error` constructors appear to cause problems during worker communication - // using `MessagePort`, so the serialized error object is being recreated as plain object. - const clone = Object.create(null); - seen.set(val, clone); - let obj = val; - while (obj && obj !== OBJECT_PROTO) { - Object.getOwnPropertyNames(obj).forEach((key) => { - if (key in clone) { - return; - } - try { - clone[key] = serializeValue(val[key], seen); - } catch (err) { - // delete in case it has a setter from prototype that might throw - delete clone[key]; - clone[key] = getUnserializableMessage(err); - } - }); - obj = Object.getPrototypeOf(obj); - } - if (val instanceof Error) { - safe(() => val.message = normalizeErrorMessage(val.message)); - } - return clone; - } -} -function safe(fn) { - try { - return fn(); - } catch {} -} -function normalizeErrorMessage(message) { - return message.replace(/__(vite_ssr_import|vi_import)_\d+__\./g, ""); -} - -export { serializeValue }; diff --git a/node_modules/@vitest/utils/dist/source-map.d.ts b/node_modules/@vitest/utils/dist/source-map.d.ts deleted file mode 100644 index 582d24f..0000000 --- a/node_modules/@vitest/utils/dist/source-map.d.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { TestError, ParsedStack } from './types.js'; - -type OriginalMapping = { - source: string | null; - line: number; - column: number; - name: string | null; -}; - -interface StackTraceParserOptions { - ignoreStackEntries?: (RegExp | string)[]; - getSourceMap?: (file: string) => unknown; - getUrlId?: (id: string) => string; - frameFilter?: (error: TestError, frame: ParsedStack) => boolean | void; -} -declare const stackIgnorePatterns: (string | RegExp)[]; - -declare function parseSingleFFOrSafariStack(raw: string): ParsedStack | null; -declare function parseSingleStack(raw: string): ParsedStack | null; -declare function parseSingleV8Stack(raw: string): ParsedStack | null; -declare function createStackString(stacks: ParsedStack[]): string; -declare function parseStacktrace(stack: string, options?: StackTraceParserOptions): ParsedStack[]; -declare function parseErrorStacktrace(e: TestError | Error, options?: StackTraceParserOptions): ParsedStack[]; -interface SourceMapLike { - version: number; - mappings?: string; - names?: string[]; - sources?: string[]; - sourcesContent?: string[]; - sourceRoot?: string; -} -interface Needle { - line: number; - column: number; -} -declare class DecodedMap { - map: SourceMapLike; - _encoded: string; - _decoded: undefined | number[][][]; - _decodedMemo: Stats; - url: string; - version: number; - names: string[]; - resolvedSources: string[]; - constructor(map: SourceMapLike, from: string); -} -interface Stats { - lastKey: number; - lastNeedle: number; - lastIndex: number; -} -declare function getOriginalPosition(map: DecodedMap, needle: Needle): OriginalMapping | null; - -export { DecodedMap, createStackString, stackIgnorePatterns as defaultStackIgnorePatterns, getOriginalPosition, parseErrorStacktrace, parseSingleFFOrSafariStack, parseSingleStack, parseSingleV8Stack, parseStacktrace }; -export type { StackTraceParserOptions }; diff --git a/node_modules/@vitest/utils/dist/source-map.js b/node_modules/@vitest/utils/dist/source-map.js deleted file mode 100644 index b435c91..0000000 --- a/node_modules/@vitest/utils/dist/source-map.js +++ /dev/null @@ -1,478 +0,0 @@ -import { isPrimitive, notNullish } from './helpers.js'; -import { r as resolve } from './chunk-pathe.M-eThtNZ.js'; -import './constants.js'; - -// src/vlq.ts -var comma = ",".charCodeAt(0); -var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -var intToChar = new Uint8Array(64); -var charToInt = new Uint8Array(128); -for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; -} -function decodeInteger(reader, relative) { - let value = 0; - let shift = 0; - let integer = 0; - do { - const c = reader.next(); - integer = charToInt[c]; - value |= (integer & 31) << shift; - shift += 5; - } while (integer & 32); - const shouldNegate = value & 1; - value >>>= 1; - if (shouldNegate) { - value = -2147483648 | -value; - } - return relative + value; -} -function hasMoreVlq(reader, max) { - if (reader.pos >= max) return false; - return reader.peek() !== comma; -} -var StringReader = class { - constructor(buffer) { - this.pos = 0; - this.buffer = buffer; - } - next() { - return this.buffer.charCodeAt(this.pos++); - } - peek() { - return this.buffer.charCodeAt(this.pos); - } - indexOf(char) { - const { buffer, pos } = this; - const idx = buffer.indexOf(char, pos); - return idx === -1 ? buffer.length : idx; - } -}; - -// src/sourcemap-codec.ts -function decode(mappings) { - const { length } = mappings; - const reader = new StringReader(mappings); - const decoded = []; - let genColumn = 0; - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - do { - const semi = reader.indexOf(";"); - const line = []; - let sorted = true; - let lastCol = 0; - genColumn = 0; - while (reader.pos < semi) { - let seg; - genColumn = decodeInteger(reader, genColumn); - if (genColumn < lastCol) sorted = false; - lastCol = genColumn; - if (hasMoreVlq(reader, semi)) { - sourcesIndex = decodeInteger(reader, sourcesIndex); - sourceLine = decodeInteger(reader, sourceLine); - sourceColumn = decodeInteger(reader, sourceColumn); - if (hasMoreVlq(reader, semi)) { - namesIndex = decodeInteger(reader, namesIndex); - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex]; - } else { - seg = [genColumn, sourcesIndex, sourceLine, sourceColumn]; - } - } else { - seg = [genColumn]; - } - line.push(seg); - reader.pos++; - } - if (!sorted) sort(line); - decoded.push(line); - reader.pos = semi + 1; - } while (reader.pos <= length); - return decoded; -} -function sort(line) { - line.sort(sortComparator); -} -function sortComparator(a, b) { - return a[0] - b[0]; -} - -// src/trace-mapping.ts - -// src/sourcemap-segment.ts -var COLUMN = 0; -var SOURCES_INDEX = 1; -var SOURCE_LINE = 2; -var SOURCE_COLUMN = 3; -var NAMES_INDEX = 4; - -// src/binary-search.ts -var found = false; -function binarySearch(haystack, needle, low, high) { - while (low <= high) { - const mid = low + (high - low >> 1); - const cmp = haystack[mid][COLUMN] - needle; - if (cmp === 0) { - found = true; - return mid; - } - if (cmp < 0) { - low = mid + 1; - } else { - high = mid - 1; - } - } - found = false; - return low - 1; -} -function upperBound(haystack, needle, index) { - for (let i = index + 1; i < haystack.length; index = i++) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function lowerBound(haystack, needle, index) { - for (let i = index - 1; i >= 0; index = i--) { - if (haystack[i][COLUMN] !== needle) break; - } - return index; -} -function memoizedBinarySearch(haystack, needle, state, key) { - const { lastKey, lastNeedle, lastIndex } = state; - let low = 0; - let high = haystack.length - 1; - if (key === lastKey) { - if (needle === lastNeedle) { - found = lastIndex !== -1 && haystack[lastIndex][COLUMN] === needle; - return lastIndex; - } - if (needle >= lastNeedle) { - low = lastIndex === -1 ? 0 : lastIndex; - } else { - high = lastIndex; - } - } - state.lastKey = key; - state.lastNeedle = needle; - return state.lastIndex = binarySearch(haystack, needle, low, high); -} - -// src/trace-mapping.ts -var LINE_GTR_ZERO = "`line` must be greater than 0 (lines start at line 1)"; -var COL_GTR_EQ_ZERO = "`column` must be greater than or equal to 0 (columns start at column 0)"; -var LEAST_UPPER_BOUND = -1; -var GREATEST_LOWER_BOUND = 1; -function cast(map) { - return map; -} -function decodedMappings(map) { - var _a; - return (_a = cast(map))._decoded || (_a._decoded = decode(cast(map)._encoded)); -} -function originalPositionFor(map, needle) { - let { line, column, bias } = needle; - line--; - if (line < 0) throw new Error(LINE_GTR_ZERO); - if (column < 0) throw new Error(COL_GTR_EQ_ZERO); - const decoded = decodedMappings(map); - if (line >= decoded.length) return OMapping(null, null, null, null); - const segments = decoded[line]; - const index = traceSegmentInternal( - segments, - cast(map)._decodedMemo, - line, - column, - bias || GREATEST_LOWER_BOUND - ); - if (index === -1) return OMapping(null, null, null, null); - const segment = segments[index]; - if (segment.length === 1) return OMapping(null, null, null, null); - const { names, resolvedSources } = map; - return OMapping( - resolvedSources[segment[SOURCES_INDEX]], - segment[SOURCE_LINE] + 1, - segment[SOURCE_COLUMN], - segment.length === 5 ? names[segment[NAMES_INDEX]] : null - ); -} -function OMapping(source, line, column, name) { - return { source, line, column, name }; -} -function traceSegmentInternal(segments, memo, line, column, bias) { - let index = memoizedBinarySearch(segments, column, memo, line); - if (found) { - index = (bias === LEAST_UPPER_BOUND ? upperBound : lowerBound)(segments, column, index); - } else if (bias === LEAST_UPPER_BOUND) index++; - if (index === -1 || index === segments.length) return -1; - return index; -} - -const CHROME_IE_STACK_REGEXP = /^\s*at .*(?:\S:\d+|\(native\))/m; -const SAFARI_NATIVE_CODE_REGEXP = /^(?:eval@)?(?:\[native code\])?$/; -const stackIgnorePatterns = [ - "node:internal", - /\/packages\/\w+\/dist\//, - /\/@vitest\/\w+\/dist\//, - "/vitest/dist/", - "/vitest/src/", - "/node_modules/chai/", - "/node_modules/tinyspy/", - "/vite/dist/node/module-runner", - "/rolldown-vite/dist/node/module-runner", - "/deps/chunk-", - "/deps/@vitest", - "/deps/loupe", - "/deps/chai", - "/browser-playwright/dist/locators.js", - "/browser-webdriverio/dist/locators.js", - "/browser-preview/dist/locators.js", - /node:\w+/, - /__vitest_test__/, - /__vitest_browser__/, - /\/deps\/vitest_/ -]; -function extractLocation(urlLike) { - // Fail-fast but return locations like "(native)" - if (!urlLike.includes(":")) { - return [urlLike]; - } - const regExp = /(.+?)(?::(\d+))?(?::(\d+))?$/; - const parts = regExp.exec(urlLike.replace(/^\(|\)$/g, "")); - if (!parts) { - return [urlLike]; - } - let url = parts[1]; - if (url.startsWith("async ")) { - url = url.slice(6); - } - if (url.startsWith("http:") || url.startsWith("https:")) { - const urlObj = new URL(url); - urlObj.searchParams.delete("import"); - urlObj.searchParams.delete("browserv"); - url = urlObj.pathname + urlObj.hash + urlObj.search; - } - if (url.startsWith("/@fs/")) { - const isWindows = /^\/@fs\/[a-zA-Z]:\//.test(url); - url = url.slice(isWindows ? 5 : 4); - } - return [ - url, - parts[2] || undefined, - parts[3] || undefined - ]; -} -function parseSingleFFOrSafariStack(raw) { - let line = raw.trim(); - if (SAFARI_NATIVE_CODE_REGEXP.test(line)) { - return null; - } - if (line.includes(" > eval")) { - line = line.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ":$1"); - } - // Early return for lines that don't look like Firefox/Safari stack traces - // Firefox/Safari stack traces must contain '@' and should have location info after it - if (!line.includes("@")) { - return null; - } - // Find the correct @ that separates function name from location - // For cases like '@https://@fs/path' or 'functionName@https://@fs/path' - // we need to find the first @ that precedes a valid location (containing :) - let atIndex = -1; - let locationPart = ""; - let functionName; - // Try each @ from left to right to find the one that gives us a valid location - for (let i = 0; i < line.length; i++) { - if (line[i] === "@") { - const candidateLocation = line.slice(i + 1); - // Minimum length 3 for valid location: 1 for filename + 1 for colon + 1 for line number (e.g., "a:1") - if (candidateLocation.includes(":") && candidateLocation.length >= 3) { - atIndex = i; - locationPart = candidateLocation; - functionName = i > 0 ? line.slice(0, i) : undefined; - break; - } - } - } - // Validate we found a valid location with minimum length (filename:line format) - if (atIndex === -1 || !locationPart.includes(":") || locationPart.length < 3) { - return null; - } - const [url, lineNumber, columnNumber] = extractLocation(locationPart); - if (!url || !lineNumber || !columnNumber) { - return null; - } - return { - file: url, - method: functionName || "", - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} -function parseSingleStack(raw) { - const line = raw.trim(); - if (!CHROME_IE_STACK_REGEXP.test(line)) { - return parseSingleFFOrSafariStack(line); - } - return parseSingleV8Stack(line); -} -// Based on https://github.com/stacktracejs/error-stack-parser -// Credit to stacktracejs -function parseSingleV8Stack(raw) { - let line = raw.trim(); - if (!CHROME_IE_STACK_REGEXP.test(line)) { - return null; - } - if (line.includes("(eval ")) { - line = line.replace(/eval code/g, "eval").replace(/(\(eval at [^()]*)|(,.*$)/g, ""); - } - let sanitizedLine = line.replace(/^\s+/, "").replace(/\(eval code/g, "(").replace(/^.*?\s+/, ""); - // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)" in - // case it has spaces in it, as the string is split on \s+ later on - const location = sanitizedLine.match(/ (\(.+\)$)/); - // remove the parenthesized location from the line, if it was matched - sanitizedLine = location ? sanitizedLine.replace(location[0], "") : sanitizedLine; - // if a location was matched, pass it to extractLocation() otherwise pass all sanitizedLine - // because this line doesn't have function name - const [url, lineNumber, columnNumber] = extractLocation(location ? location[1] : sanitizedLine); - let method = location && sanitizedLine || ""; - let file = url && ["eval", ""].includes(url) ? undefined : url; - if (!file || !lineNumber || !columnNumber) { - return null; - } - if (method.startsWith("async ")) { - method = method.slice(6); - } - if (file.startsWith("file://")) { - file = file.slice(7); - } - // normalize Windows path (\ -> /) - file = file.startsWith("node:") || file.startsWith("internal:") ? file : resolve(file); - if (method) { - method = method.replace(/__vite_ssr_import_\d+__\./g, "").replace(/(Object\.)?__vite_ssr_export_default__\s?/g, ""); - } - return { - method, - file, - line: Number.parseInt(lineNumber), - column: Number.parseInt(columnNumber) - }; -} -function createStackString(stacks) { - return stacks.map((stack) => { - const line = `${stack.file}:${stack.line}:${stack.column}`; - if (stack.method) { - return ` at ${stack.method}(${line})`; - } - return ` at ${line}`; - }).join("\n"); -} -function parseStacktrace(stack, options = {}) { - const { ignoreStackEntries = stackIgnorePatterns } = options; - const stacks = !CHROME_IE_STACK_REGEXP.test(stack) ? parseFFOrSafariStackTrace(stack) : parseV8Stacktrace(stack); - return stacks.map((stack) => { - var _options$getSourceMap; - if (options.getUrlId) { - stack.file = options.getUrlId(stack.file); - } - const map = (_options$getSourceMap = options.getSourceMap) === null || _options$getSourceMap === void 0 ? void 0 : _options$getSourceMap.call(options, stack.file); - if (!map || typeof map !== "object" || !map.version) { - return shouldFilter(ignoreStackEntries, stack.file) ? null : stack; - } - const traceMap = new DecodedMap(map, stack.file); - const position = getOriginalPosition(traceMap, stack); - if (!position) { - return stack; - } - const { line, column, source, name } = position; - let file = source || stack.file; - if (file.match(/\/\w:\//)) { - file = file.slice(1); - } - if (shouldFilter(ignoreStackEntries, file)) { - return null; - } - if (line != null && column != null) { - return { - line, - column, - file, - method: name || stack.method - }; - } - return stack; - }).filter((s) => s != null); -} -function shouldFilter(ignoreStackEntries, file) { - return ignoreStackEntries.some((p) => file.match(p)); -} -function parseFFOrSafariStackTrace(stack) { - return stack.split("\n").map((line) => parseSingleFFOrSafariStack(line)).filter(notNullish); -} -function parseV8Stacktrace(stack) { - return stack.split("\n").map((line) => parseSingleV8Stack(line)).filter(notNullish); -} -function parseErrorStacktrace(e, options = {}) { - if (!e || isPrimitive(e)) { - return []; - } - if ("stacks" in e && e.stacks) { - return e.stacks; - } - const stackStr = e.stack || ""; - // if "stack" property was overwritten at runtime to be something else, - // ignore the value because we don't know how to process it - let stackFrames = typeof stackStr === "string" ? parseStacktrace(stackStr, options) : []; - if (!stackFrames.length) { - const e_ = e; - if (e_.fileName != null && e_.lineNumber != null && e_.columnNumber != null) { - stackFrames = parseStacktrace(`${e_.fileName}:${e_.lineNumber}:${e_.columnNumber}`, options); - } - if (e_.sourceURL != null && e_.line != null && e_._column != null) { - stackFrames = parseStacktrace(`${e_.sourceURL}:${e_.line}:${e_.column}`, options); - } - } - if (options.frameFilter) { - stackFrames = stackFrames.filter((f) => options.frameFilter(e, f) !== false); - } - e.stacks = stackFrames; - return stackFrames; -} -class DecodedMap { - _encoded; - _decoded; - _decodedMemo; - url; - version; - names = []; - resolvedSources; - constructor(map, from) { - this.map = map; - const { mappings, names, sources } = map; - this.version = map.version; - this.names = names || []; - this._encoded = mappings || ""; - this._decodedMemo = memoizedState(); - this.url = from; - this.resolvedSources = (sources || []).map((s) => resolve(s || "", from)); - } -} -function memoizedState() { - return { - lastKey: -1, - lastNeedle: -1, - lastIndex: -1 - }; -} -function getOriginalPosition(map, needle) { - const result = originalPositionFor(map, needle); - if (result.column == null) { - return null; - } - return result; -} - -export { DecodedMap, createStackString, stackIgnorePatterns as defaultStackIgnorePatterns, getOriginalPosition, parseErrorStacktrace, parseSingleFFOrSafariStack, parseSingleStack, parseSingleV8Stack, parseStacktrace }; diff --git a/node_modules/@vitest/utils/dist/timers.d.ts b/node_modules/@vitest/utils/dist/timers.d.ts deleted file mode 100644 index 8dd6025..0000000 --- a/node_modules/@vitest/utils/dist/timers.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -interface SafeTimers { - nextTick?: (cb: () => void) => void; - setImmediate?: { - (callback: (...args: TArgs) => void, ...args: TArgs): any; - __promisify__: (value?: T, options?: any) => Promise; - }; - clearImmediate?: (immediateId: any) => void; - setTimeout: typeof setTimeout; - setInterval: typeof setInterval; - clearInterval: typeof clearInterval; - clearTimeout: typeof clearTimeout; - queueMicrotask: typeof queueMicrotask; -} -declare function getSafeTimers(): SafeTimers; -declare function setSafeTimers(): void; -/** -* Returns a promise that resolves after the specified duration. -* -* @param timeout - Delay in milliseconds -* @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers. -* -* @example -* await delay(100) -* -* @example -* // With mocked timers -* const { setTimeout } = getSafeTimers() -* await delay(100, setTimeout) -*/ -declare function delay(timeout: number, scheduler?: typeof setTimeout): Promise; - -export { delay, getSafeTimers, setSafeTimers }; -export type { SafeTimers }; diff --git a/node_modules/@vitest/utils/dist/timers.js b/node_modules/@vitest/utils/dist/timers.js deleted file mode 100644 index 29229e5..0000000 --- a/node_modules/@vitest/utils/dist/timers.js +++ /dev/null @@ -1,49 +0,0 @@ -const SAFE_TIMERS_SYMBOL = Symbol("vitest:SAFE_TIMERS"); -function getSafeTimers() { - const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis; - const { nextTick: safeNextTick } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis.process || {}; - return { - nextTick: safeNextTick, - setTimeout: safeSetTimeout, - setInterval: safeSetInterval, - clearInterval: safeClearInterval, - clearTimeout: safeClearTimeout, - setImmediate: safeSetImmediate, - clearImmediate: safeClearImmediate, - queueMicrotask: safeQueueMicrotask - }; -} -function setSafeTimers() { - const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis; - const { nextTick: safeNextTick } = globalThis.process || {}; - const timers = { - nextTick: safeNextTick, - setTimeout: safeSetTimeout, - setInterval: safeSetInterval, - clearInterval: safeClearInterval, - clearTimeout: safeClearTimeout, - setImmediate: safeSetImmediate, - clearImmediate: safeClearImmediate, - queueMicrotask: safeQueueMicrotask - }; - globalThis[SAFE_TIMERS_SYMBOL] = timers; -} -/** -* Returns a promise that resolves after the specified duration. -* -* @param timeout - Delay in milliseconds -* @param scheduler - Timer function to use, defaults to `setTimeout`. Useful for mocked timers. -* -* @example -* await delay(100) -* -* @example -* // With mocked timers -* const { setTimeout } = getSafeTimers() -* await delay(100, setTimeout) -*/ -function delay(timeout, scheduler = setTimeout) { - return new Promise((resolve) => scheduler(resolve, timeout)); -} - -export { delay, getSafeTimers, setSafeTimers }; diff --git a/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts b/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts deleted file mode 100644 index cba06c6..0000000 --- a/node_modules/@vitest/utils/dist/types.d-BCElaP-c.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { CompareKeys } from '@vitest/pretty-format'; - -/** -* Copyright (c) Meta Platforms, Inc. and affiliates. -* -* This source code is licensed under the MIT license found in the -* LICENSE file in the root directory of this source tree. -*/ - -type DiffOptionsColor = (arg: string) => string; -interface DiffOptions { - aAnnotation?: string; - aColor?: DiffOptionsColor; - aIndicator?: string; - bAnnotation?: string; - bColor?: DiffOptionsColor; - bIndicator?: string; - changeColor?: DiffOptionsColor; - changeLineTrailingSpaceColor?: DiffOptionsColor; - commonColor?: DiffOptionsColor; - commonIndicator?: string; - commonLineTrailingSpaceColor?: DiffOptionsColor; - contextLines?: number; - emptyFirstOrLastLinePlaceholder?: string; - expand?: boolean; - includeChangeCounts?: boolean; - omitAnnotationLines?: boolean; - patchColor?: DiffOptionsColor; - printBasicPrototype?: boolean; - maxDepth?: number; - compareKeys?: CompareKeys; - truncateThreshold?: number; - truncateAnnotation?: string; - truncateAnnotationColor?: DiffOptionsColor; -} -interface SerializedDiffOptions { - aAnnotation?: string; - aIndicator?: string; - bAnnotation?: string; - bIndicator?: string; - commonIndicator?: string; - contextLines?: number; - emptyFirstOrLastLinePlaceholder?: string; - expand?: boolean; - includeChangeCounts?: boolean; - omitAnnotationLines?: boolean; - printBasicPrototype?: boolean; - maxDepth?: number; - truncateThreshold?: number; - truncateAnnotation?: string; -} - -export type { DiffOptions as D, SerializedDiffOptions as S, DiffOptionsColor as a }; diff --git a/node_modules/@vitest/utils/dist/types.d.ts b/node_modules/@vitest/utils/dist/types.d.ts deleted file mode 100644 index 4e6d810..0000000 --- a/node_modules/@vitest/utils/dist/types.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -type Awaitable = T | PromiseLike; -type Nullable = T | null | undefined; -type Arrayable = T | Array; -type ArgumentsType = T extends (...args: infer U) => any ? U : never; -type MergeInsertions = T extends object ? { [K in keyof T] : MergeInsertions } : T; -type DeepMerge< - F, - S -> = MergeInsertions<{ [K in keyof F | keyof S] : K extends keyof S & keyof F ? DeepMerge : K extends keyof S ? S[K] : K extends keyof F ? F[K] : never }>; -interface Constructable { - new (...args: any[]): any; -} -interface ParsedStack { - method: string; - file: string; - line: number; - column: number; -} -interface SerializedError { - message: string; - stacks?: ParsedStack[]; - stack?: string; - name?: string; - cause?: SerializedError; - [key: string]: unknown; -} -interface TestError extends SerializedError { - cause?: TestError; - diff?: string; - actual?: string; - expected?: string; -} - -export type { ArgumentsType, Arrayable, Awaitable, Constructable, DeepMerge, MergeInsertions, Nullable, ParsedStack, SerializedError, TestError }; diff --git a/node_modules/@vitest/utils/dist/types.js b/node_modules/@vitest/utils/dist/types.js deleted file mode 100644 index 8b13789..0000000 --- a/node_modules/@vitest/utils/dist/types.js +++ /dev/null @@ -1 +0,0 @@ - diff --git a/node_modules/@vitest/utils/error.d.ts b/node_modules/@vitest/utils/error.d.ts deleted file mode 100644 index 9329baa..0000000 --- a/node_modules/@vitest/utils/error.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/error.js' diff --git a/node_modules/@vitest/utils/helpers.d.ts b/node_modules/@vitest/utils/helpers.d.ts deleted file mode 100644 index 0add1d0..0000000 --- a/node_modules/@vitest/utils/helpers.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './dist/helpers.js' diff --git a/node_modules/@vitest/utils/package.json b/node_modules/@vitest/utils/package.json deleted file mode 100644 index 28fd42a..0000000 --- a/node_modules/@vitest/utils/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "@vitest/utils", - "type": "module", - "version": "4.0.16", - "description": "Shared Vitest utility functions", - "license": "MIT", - "funding": "https://opencollective.com/vitest", - "homepage": "https://github.com/vitest-dev/vitest/tree/main/packages/utils#readme", - "repository": { - "type": "git", - "url": "git+https://github.com/vitest-dev/vitest.git", - "directory": "packages/utils" - }, - "bugs": { - "url": "https://github.com/vitest-dev/vitest/issues" - }, - "sideEffects": false, - "exports": { - ".": { - "types": "./dist/index.d.ts", - "default": "./dist/index.js" - }, - "./diff": { - "types": "./dist/diff.d.ts", - "default": "./dist/diff.js" - }, - "./resolver": { - "types": "./dist/resolver.d.ts", - "default": "./dist/resolver.js" - }, - "./error": { - "types": "./dist/error.d.ts", - "default": "./dist/error.js" - }, - "./helpers": { - "types": "./dist/helpers.d.ts", - "default": "./dist/helpers.js" - }, - "./offset": { - "types": "./dist/offset.d.ts", - "default": "./dist/offset.js" - }, - "./constants": { - "types": "./dist/constants.d.ts", - "default": "./dist/constants.js" - }, - "./timers": { - "types": "./dist/timers.d.ts", - "default": "./dist/timers.js" - }, - "./display": { - "types": "./dist/display.d.ts", - "default": "./dist/display.js" - }, - "./highlight": { - "types": "./dist/highlight.d.ts", - "default": "./dist/highlight.js" - }, - "./source-map": { - "types": "./dist/source-map.d.ts", - "default": "./dist/source-map.js" - }, - "./serialize": { - "types": "./dist/serialize.d.ts", - "default": "./dist/serialize.js" - }, - "./*": "./*" - }, - "main": "./dist/index.js", - "module": "./dist/index.js", - "types": "./dist/index.d.ts", - "typesVersions": { - "*": { - "source-map": [ - "dist/source-map.d.ts" - ] - } - }, - "files": [ - "*.d.ts", - "dist" - ], - "dependencies": { - "tinyrainbow": "^3.0.3", - "@vitest/pretty-format": "4.0.16" - }, - "devDependencies": { - "@jridgewell/trace-mapping": "0.3.31", - "@types/estree": "^1.0.8", - "diff-sequences": "^29.6.3", - "loupe": "^3.2.1", - "tinyhighlight": "^0.3.2" - }, - "scripts": { - "build": "premove dist && rollup -c", - "dev": "rollup -c --watch" - } -} \ No newline at end of file diff --git a/node_modules/assertion-error/LICENSE b/node_modules/assertion-error/LICENSE deleted file mode 100644 index 5e9f3ac..0000000 --- a/node_modules/assertion-error/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2013 Jake Luer jake@qualiancy.com (http://qualiancy.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/assertion-error/README.md b/node_modules/assertion-error/README.md deleted file mode 100644 index 37c3928..0000000 --- a/node_modules/assertion-error/README.md +++ /dev/null @@ -1,68 +0,0 @@ -

- AssertionError and AssertionResult classes. -

- -

- - build:? - - downloads:? - - devDependencies:none - -

- -## What is AssertionError? - -Assertion Error is a module that contains two classes: `AssertionError`, which -is an instance of an `Error`, and `AssertionResult` which is not an instance of -Error. - -These can be useful for returning from a function - if the function "succeeds" -return an `AssertionResult` and if the function fails return (or throw) an -`AssertionError`. - -Both `AssertionError` and `AssertionResult` implement the `Result` interface: - -```typescript -interface Result { - name: "AssertionError" | "AssertionResult"; - ok: boolean; - toJSON(...args: unknown[]): Record; -} -``` - -So if a function returns `AssertionResult | AssertionError` it is easy to check -_which_ one is returned by checking either `.name` or `.ok`, or check -`instanceof Error`. - -## Installation - -### Node.js - -`assertion-error` is available on [npm](http://npmjs.org). - -``` -$ npm install --save assertion-error -``` - -### Deno - -`assertion_error` is available on -[Deno.land](https://deno.land/x/assertion_error) - -```typescript -import { - AssertionError, - AssertionResult, -} from "https://deno.land/x/assertion_error@2.0.0/mod.ts"; -``` diff --git a/node_modules/assertion-error/index.d.ts b/node_modules/assertion-error/index.d.ts deleted file mode 100644 index d8fda2c..0000000 --- a/node_modules/assertion-error/index.d.ts +++ /dev/null @@ -1,27 +0,0 @@ -interface Result { - name: "AssertionError" | "AssertionResult"; - ok: boolean; - toJSON(...args: unknown[]): Record; -} - -declare class AssertionError extends Error implements Result { - [key: string]: unknown - name: "AssertionError"; - ok: false; - message: string; - // deno-lint-ignore ban-types - constructor(message: string, props?: T, ssf?: Function); - stack: string; - toJSON(stack?: boolean): Record; -} - -declare class AssertionResult implements Result { - [key: string]: unknown - name: "AssertionResult"; - ok: true; - message: string; - constructor(props?: T); - toJSON(): Record; -} - -export { AssertionError, AssertionResult, Result }; diff --git a/node_modules/assertion-error/index.js b/node_modules/assertion-error/index.js deleted file mode 100644 index 2bfcb81..0000000 --- a/node_modules/assertion-error/index.js +++ /dev/null @@ -1,60 +0,0 @@ -// deno-fmt-ignore-file -// deno-lint-ignore-file -// This code was bundled using `deno bundle` and it's not recommended to edit it manually - -const canElideFrames = "captureStackTrace" in Error; -class AssertionError extends Error { - message; - get name() { - return "AssertionError"; - } - get ok() { - return false; - } - constructor(message = "Unspecified AssertionError", props, ssf){ - super(message); - this.message = message; - if (canElideFrames) { - Error.captureStackTrace(this, ssf || AssertionError); - } - for(const key in props){ - if (!(key in this)) { - this[key] = props[key]; - } - } - } - toJSON(stack) { - return { - ...this, - name: this.name, - message: this.message, - ok: false, - stack: stack !== false ? this.stack : undefined - }; - } -} -class AssertionResult { - get name() { - return "AssertionResult"; - } - get ok() { - return true; - } - constructor(props){ - for(const key in props){ - if (!(key in this)) { - this[key] = props[key]; - } - } - } - toJSON() { - return { - ...this, - name: this.name, - ok: this.ok - }; - } -} -export { AssertionError as AssertionError }; -export { AssertionResult as AssertionResult }; - diff --git a/node_modules/assertion-error/package.json b/node_modules/assertion-error/package.json deleted file mode 100644 index 02dc0f5..0000000 --- a/node_modules/assertion-error/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "assertion-error", - "version": "2.0.1", - "description": "Error constructor for test and validation frameworks that implements standardized AssertionError specification.", - "author": "Jake Luer (http://qualiancy.com)", - "license": "MIT", - "types": "./index.d.ts", - "keywords": [ - "test", - "assertion", - "assertion-error" - ], - "repository": { - "type": "git", - "url": "git@github.com:chaijs/assertion-error.git" - }, - "engines": { - "node": ">=12" - }, - "files": [ - "index.d.ts" - ], - "type": "module", - "module": "index.js", - "main": "index.js", - "scripts": { - "build": "deno bundle mod.ts > index.js", - "pretest": "rm -rf coverage/", - "test": "deno test --coverage=coverage", - "posttest": "deno coverage coverage --lcov > coverage/lcov.info && lcov --summary coverage/lcov.info" - } -} diff --git a/node_modules/chai/LICENSE b/node_modules/chai/LICENSE deleted file mode 100644 index eedbe23..0000000 --- a/node_modules/chai/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 Chai.js Assertion Library - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/chai/README.md b/node_modules/chai/README.md deleted file mode 100644 index 9382e24..0000000 --- a/node_modules/chai/README.md +++ /dev/null @@ -1,162 +0,0 @@ -

- - ChaiJS - -
- chai -

- -

- Chai is a BDD / TDD assertion library for node and the browser that can be delightfully paired with any javascript testing framework. -

- -

- - downloads:? - - - node:? - -
- - Join the Slack chat - - - Join the Gitter chat - - - OpenCollective Backers - -

- -For more information or to download plugins, view the [documentation](http://chaijs.com). - -## What is Chai? - -Chai is an _assertion library_, similar to Node's built-in `assert`. It makes testing much easier by giving you lots of assertions you can run against your code. - -## Installation - -### Node.js - -`chai` is available on [npm](http://npmjs.org). To install it, type: - - $ npm install --save-dev chai - -### Browsers - -You can also use it within the browser; install via npm and use the `index.js` file found within the download. For example: - -```html - -``` - -## Usage - -Import the library in your code, and then pick one of the styles you'd like to use - either `assert`, `expect` or `should`: - -```js -import { assert } from 'chai'; // Using Assert style -import { expect } from 'chai'; // Using Expect style -import { should } from 'chai'; // Using Should style -``` - -### Register the chai testing style globally - -```js -import 'chai/register-assert'; // Using Assert style -import 'chai/register-expect'; // Using Expect style -import 'chai/register-should'; // Using Should style -``` - -### Import assertion styles as local variables - -```js -import { assert } from 'chai'; // Using Assert style -import { expect } from 'chai'; // Using Expect style -import { should } from 'chai'; // Using Should style -should(); // Modifies `Object.prototype` - -import { expect, use } from 'chai'; // Creates local variables `expect` and `use`; useful for plugin use -``` - -### Usage with Mocha - -```bash -mocha spec.js --require chai/register-assert.js # Using Assert style -mocha spec.js --require chai/register-expect.js # Using Expect style -mocha spec.js --require chai/register-should.js # Using Should style -``` - -[Read more about these styles in our docs](http://chaijs.com/guide/styles/). - -## Plugins - -Chai offers a robust Plugin architecture for extending Chai's assertions and interfaces. - -- Need a plugin? View the [official plugin list](http://chaijs.com/plugins). -- Want to build a plugin? Read the [plugin api documentation](http://chaijs.com/guide/plugins/). -- Have a plugin and want it listed? Simply add the following keywords to your package.json: - - `chai-plugin` - - `browser` if your plugin works in the browser as well as Node.js - - `browser-only` if your plugin does not work with Node.js - -### Related Projects - -- [chaijs / chai-docs](https://github.com/chaijs/chai-docs): The chaijs.com website source code. -- [chaijs / assertion-error](https://github.com/chaijs/assertion-error): Custom `Error` constructor thrown upon an assertion failing. -- [chaijs / deep-eql](https://github.com/chaijs/deep-eql): Improved deep equality testing for Node.js and the browser. -- [chaijs / check-error](https://github.com/chaijs/check-error): Error comparison and information related utility for Node.js and the browser. -- [chaijs / loupe](https://github.com/chaijs/loupe): Inspect utility for Node.js and browsers. -- [chaijs / pathval](https://github.com/chaijs/pathval): Object value retrieval given a string path. - -### Contributing - -Thank you very much for considering to contribute! - -Please make sure you follow our [Code Of Conduct](https://github.com/chaijs/chai/blob/master/CODE_OF_CONDUCT.md) and we also strongly recommend reading our [Contributing Guide](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md). - -Here are a few issues other contributors frequently ran into when opening pull requests: - -- Please do not commit changes to the `chai.js` build. We do it once per release. -- Before pushing your commits, please make sure you [rebase](https://github.com/chaijs/chai/blob/master/CONTRIBUTING.md#pull-requests) them. - -### Contributors - -Please see the full -[Contributors Graph](https://github.com/chaijs/chai/graphs/contributors) for our -list of contributors. - -### Core Contributors - -Feel free to reach out to any of the core contributors with your questions or -concerns. We will do our best to respond in a timely manner. - -[![Keith Cirkel](https://avatars3.githubusercontent.com/u/118266?v=3&s=50)](https://github.com/keithamus) -[![James Garbutt](https://avatars3.githubusercontent.com/u/5677153?v=3&s=50)](https://github.com/43081j) -[![Kristján Oddsson](https://avatars3.githubusercontent.com/u/318208?v=3&s=50)](https://github.com/koddsson) - -### Core Contributor Alumni - -This project would not be what it is without the contributions from our prior -core contributors, for whom we are forever grateful: - -[![Jake Luer](https://avatars3.githubusercontent.com/u/58988?v=3&s=50)](https://github.com/logicalparadox) -[![Veselin Todorov](https://avatars3.githubusercontent.com/u/330048?v=3&s=50)](https://github.com/vesln) -[![Lucas Fernandes da Costa](https://avatars3.githubusercontent.com/u/6868147?v=3&s=50)](https://github.com/lucasfcosta) -[![Grant Snodgrass](https://avatars3.githubusercontent.com/u/17260989?v=3&s=50)](https://github.com/meeber) diff --git a/node_modules/chai/index.js b/node_modules/chai/index.js deleted file mode 100644 index 601eb53..0000000 --- a/node_modules/chai/index.js +++ /dev/null @@ -1,4172 +0,0 @@ -var __defProp = Object.defineProperty; -var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); - -// lib/chai/utils/index.js -var utils_exports = {}; -__export(utils_exports, { - addChainableMethod: () => addChainableMethod, - addLengthGuard: () => addLengthGuard, - addMethod: () => addMethod, - addProperty: () => addProperty, - checkError: () => check_error_exports, - compareByInspect: () => compareByInspect, - eql: () => deep_eql_default, - events: () => events, - expectTypes: () => expectTypes, - flag: () => flag, - getActual: () => getActual, - getMessage: () => getMessage2, - getName: () => getName, - getOperator: () => getOperator, - getOwnEnumerableProperties: () => getOwnEnumerableProperties, - getOwnEnumerablePropertySymbols: () => getOwnEnumerablePropertySymbols, - getPathInfo: () => getPathInfo, - hasProperty: () => hasProperty, - inspect: () => inspect2, - isNaN: () => isNaN2, - isNumeric: () => isNumeric, - isProxyEnabled: () => isProxyEnabled, - isRegExp: () => isRegExp2, - objDisplay: () => objDisplay, - overwriteChainableMethod: () => overwriteChainableMethod, - overwriteMethod: () => overwriteMethod, - overwriteProperty: () => overwriteProperty, - proxify: () => proxify, - test: () => test, - transferFlags: () => transferFlags, - type: () => type -}); - -// node_modules/check-error/index.js -var check_error_exports = {}; -__export(check_error_exports, { - compatibleConstructor: () => compatibleConstructor, - compatibleInstance: () => compatibleInstance, - compatibleMessage: () => compatibleMessage, - getConstructorName: () => getConstructorName, - getMessage: () => getMessage -}); -function isErrorInstance(obj) { - return obj instanceof Error || Object.prototype.toString.call(obj) === "[object Error]"; -} -__name(isErrorInstance, "isErrorInstance"); -function isRegExp(obj) { - return Object.prototype.toString.call(obj) === "[object RegExp]"; -} -__name(isRegExp, "isRegExp"); -function compatibleInstance(thrown, errorLike) { - return isErrorInstance(errorLike) && thrown === errorLike; -} -__name(compatibleInstance, "compatibleInstance"); -function compatibleConstructor(thrown, errorLike) { - if (isErrorInstance(errorLike)) { - return thrown.constructor === errorLike.constructor || thrown instanceof errorLike.constructor; - } else if ((typeof errorLike === "object" || typeof errorLike === "function") && errorLike.prototype) { - return thrown.constructor === errorLike || thrown instanceof errorLike; - } - return false; -} -__name(compatibleConstructor, "compatibleConstructor"); -function compatibleMessage(thrown, errMatcher) { - const comparisonString = typeof thrown === "string" ? thrown : thrown.message; - if (isRegExp(errMatcher)) { - return errMatcher.test(comparisonString); - } else if (typeof errMatcher === "string") { - return comparisonString.indexOf(errMatcher) !== -1; - } - return false; -} -__name(compatibleMessage, "compatibleMessage"); -function getConstructorName(errorLike) { - let constructorName = errorLike; - if (isErrorInstance(errorLike)) { - constructorName = errorLike.constructor.name; - } else if (typeof errorLike === "function") { - constructorName = errorLike.name; - if (constructorName === "") { - const newConstructorName = new errorLike().name; - constructorName = newConstructorName || constructorName; - } - } - return constructorName; -} -__name(getConstructorName, "getConstructorName"); -function getMessage(errorLike) { - let msg = ""; - if (errorLike && errorLike.message) { - msg = errorLike.message; - } else if (typeof errorLike === "string") { - msg = errorLike; - } - return msg; -} -__name(getMessage, "getMessage"); - -// lib/chai/utils/flag.js -function flag(obj, key, value) { - let flags = obj.__flags || (obj.__flags = /* @__PURE__ */ Object.create(null)); - if (arguments.length === 3) { - flags[key] = value; - } else { - return flags[key]; - } -} -__name(flag, "flag"); - -// lib/chai/utils/test.js -function test(obj, args) { - let negate = flag(obj, "negate"), expr = args[0]; - return negate ? !expr : expr; -} -__name(test, "test"); - -// lib/chai/utils/type-detect.js -function type(obj) { - if (typeof obj === "undefined") { - return "undefined"; - } - if (obj === null) { - return "null"; - } - const stringTag = obj[Symbol.toStringTag]; - if (typeof stringTag === "string") { - return stringTag; - } - const type3 = Object.prototype.toString.call(obj).slice(8, -1); - return type3; -} -__name(type, "type"); - -// node_modules/assertion-error/index.js -var canElideFrames = "captureStackTrace" in Error; -var _AssertionError = class _AssertionError extends Error { - constructor(message = "Unspecified AssertionError", props, ssf) { - super(message); - __publicField(this, "message"); - this.message = message; - if (canElideFrames) { - Error.captureStackTrace(this, ssf || _AssertionError); - } - for (const key in props) { - if (!(key in this)) { - this[key] = props[key]; - } - } - } - get name() { - return "AssertionError"; - } - get ok() { - return false; - } - toJSON(stack) { - return { - ...this, - name: this.name, - message: this.message, - ok: false, - stack: stack !== false ? this.stack : void 0 - }; - } -}; -__name(_AssertionError, "AssertionError"); -var AssertionError = _AssertionError; - -// lib/chai/utils/expectTypes.js -function expectTypes(obj, types) { - let flagMsg = flag(obj, "message"); - let ssfi = flag(obj, "ssfi"); - flagMsg = flagMsg ? flagMsg + ": " : ""; - obj = flag(obj, "object"); - types = types.map(function(t) { - return t.toLowerCase(); - }); - types.sort(); - let str = types.map(function(t, index) { - let art = ~["a", "e", "i", "o", "u"].indexOf(t.charAt(0)) ? "an" : "a"; - let or = types.length > 1 && index === types.length - 1 ? "or " : ""; - return or + art + " " + t; - }).join(", "); - let objType = type(obj).toLowerCase(); - if (!types.some(function(expected) { - return objType === expected; - })) { - throw new AssertionError( - flagMsg + "object tested must be " + str + ", but " + objType + " given", - void 0, - ssfi - ); - } -} -__name(expectTypes, "expectTypes"); - -// lib/chai/utils/getActual.js -function getActual(obj, args) { - return args.length > 4 ? args[4] : obj._obj; -} -__name(getActual, "getActual"); - -// node_modules/loupe/lib/helpers.js -var ansiColors = { - bold: ["1", "22"], - dim: ["2", "22"], - italic: ["3", "23"], - underline: ["4", "24"], - // 5 & 6 are blinking - inverse: ["7", "27"], - hidden: ["8", "28"], - strike: ["9", "29"], - // 10-20 are fonts - // 21-29 are resets for 1-9 - black: ["30", "39"], - red: ["31", "39"], - green: ["32", "39"], - yellow: ["33", "39"], - blue: ["34", "39"], - magenta: ["35", "39"], - cyan: ["36", "39"], - white: ["37", "39"], - brightblack: ["30;1", "39"], - brightred: ["31;1", "39"], - brightgreen: ["32;1", "39"], - brightyellow: ["33;1", "39"], - brightblue: ["34;1", "39"], - brightmagenta: ["35;1", "39"], - brightcyan: ["36;1", "39"], - brightwhite: ["37;1", "39"], - grey: ["90", "39"] -}; -var styles = { - special: "cyan", - number: "yellow", - bigint: "yellow", - boolean: "yellow", - undefined: "grey", - null: "bold", - string: "green", - symbol: "green", - date: "magenta", - regexp: "red" -}; -var truncator = "\u2026"; -function colorise(value, styleType) { - const color = ansiColors[styles[styleType]] || ansiColors[styleType] || ""; - if (!color) { - return String(value); - } - return `\x1B[${color[0]}m${String(value)}\x1B[${color[1]}m`; -} -__name(colorise, "colorise"); -function normaliseOptions({ - showHidden = false, - depth = 2, - colors = false, - customInspect = true, - showProxy = false, - maxArrayLength = Infinity, - breakLength = Infinity, - seen = [], - // eslint-disable-next-line no-shadow - truncate: truncate2 = Infinity, - stylize = String -} = {}, inspect3) { - const options = { - showHidden: Boolean(showHidden), - depth: Number(depth), - colors: Boolean(colors), - customInspect: Boolean(customInspect), - showProxy: Boolean(showProxy), - maxArrayLength: Number(maxArrayLength), - breakLength: Number(breakLength), - truncate: Number(truncate2), - seen, - inspect: inspect3, - stylize - }; - if (options.colors) { - options.stylize = colorise; - } - return options; -} -__name(normaliseOptions, "normaliseOptions"); -function isHighSurrogate(char) { - return char >= "\uD800" && char <= "\uDBFF"; -} -__name(isHighSurrogate, "isHighSurrogate"); -function truncate(string, length, tail = truncator) { - string = String(string); - const tailLength = tail.length; - const stringLength = string.length; - if (tailLength > length && stringLength > tailLength) { - return tail; - } - if (stringLength > length && stringLength > tailLength) { - let end = length - tailLength; - if (end > 0 && isHighSurrogate(string[end - 1])) { - end = end - 1; - } - return `${string.slice(0, end)}${tail}`; - } - return string; -} -__name(truncate, "truncate"); -function inspectList(list, options, inspectItem, separator = ", ") { - inspectItem = inspectItem || options.inspect; - const size = list.length; - if (size === 0) - return ""; - const originalLength = options.truncate; - let output = ""; - let peek = ""; - let truncated = ""; - for (let i = 0; i < size; i += 1) { - const last = i + 1 === list.length; - const secondToLast = i + 2 === list.length; - truncated = `${truncator}(${list.length - i})`; - const value = list[i]; - options.truncate = originalLength - output.length - (last ? 0 : separator.length); - const string = peek || inspectItem(value, options) + (last ? "" : separator); - const nextLength = output.length + string.length; - const truncatedLength = nextLength + truncated.length; - if (last && nextLength > originalLength && output.length + truncated.length <= originalLength) { - break; - } - if (!last && !secondToLast && truncatedLength > originalLength) { - break; - } - peek = last ? "" : inspectItem(list[i + 1], options) + (secondToLast ? "" : separator); - if (!last && secondToLast && truncatedLength > originalLength && nextLength + peek.length > originalLength) { - break; - } - output += string; - if (!last && !secondToLast && nextLength + peek.length >= originalLength) { - truncated = `${truncator}(${list.length - i - 1})`; - break; - } - truncated = ""; - } - return `${output}${truncated}`; -} -__name(inspectList, "inspectList"); -function quoteComplexKey(key) { - if (key.match(/^[a-zA-Z_][a-zA-Z_0-9]*$/)) { - return key; - } - return JSON.stringify(key).replace(/'/g, "\\'").replace(/\\"/g, '"').replace(/(^"|"$)/g, "'"); -} -__name(quoteComplexKey, "quoteComplexKey"); -function inspectProperty([key, value], options) { - options.truncate -= 2; - if (typeof key === "string") { - key = quoteComplexKey(key); - } else if (typeof key !== "number") { - key = `[${options.inspect(key, options)}]`; - } - options.truncate -= key.length; - value = options.inspect(value, options); - return `${key}: ${value}`; -} -__name(inspectProperty, "inspectProperty"); - -// node_modules/loupe/lib/array.js -function inspectArray(array, options) { - const nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) - return "[]"; - options.truncate -= 4; - const listContents = inspectList(array, options); - options.truncate -= listContents.length; - let propertyContents = ""; - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty); - } - return `[ ${listContents}${propertyContents ? `, ${propertyContents}` : ""} ]`; -} -__name(inspectArray, "inspectArray"); - -// node_modules/loupe/lib/typedarray.js -var getArrayName = /* @__PURE__ */ __name((array) => { - if (typeof Buffer === "function" && array instanceof Buffer) { - return "Buffer"; - } - if (array[Symbol.toStringTag]) { - return array[Symbol.toStringTag]; - } - return array.constructor.name; -}, "getArrayName"); -function inspectTypedArray(array, options) { - const name = getArrayName(array); - options.truncate -= name.length + 4; - const nonIndexProperties = Object.keys(array).slice(array.length); - if (!array.length && !nonIndexProperties.length) - return `${name}[]`; - let output = ""; - for (let i = 0; i < array.length; i++) { - const string = `${options.stylize(truncate(array[i], options.truncate), "number")}${i === array.length - 1 ? "" : ", "}`; - options.truncate -= string.length; - if (array[i] !== array.length && options.truncate <= 3) { - output += `${truncator}(${array.length - array[i] + 1})`; - break; - } - output += string; - } - let propertyContents = ""; - if (nonIndexProperties.length) { - propertyContents = inspectList(nonIndexProperties.map((key) => [key, array[key]]), options, inspectProperty); - } - return `${name}[ ${output}${propertyContents ? `, ${propertyContents}` : ""} ]`; -} -__name(inspectTypedArray, "inspectTypedArray"); - -// node_modules/loupe/lib/date.js -function inspectDate(dateObject, options) { - const stringRepresentation = dateObject.toJSON(); - if (stringRepresentation === null) { - return "Invalid Date"; - } - const split = stringRepresentation.split("T"); - const date = split[0]; - return options.stylize(`${date}T${truncate(split[1], options.truncate - date.length - 1)}`, "date"); -} -__name(inspectDate, "inspectDate"); - -// node_modules/loupe/lib/function.js -function inspectFunction(func, options) { - const functionType = func[Symbol.toStringTag] || "Function"; - const name = func.name; - if (!name) { - return options.stylize(`[${functionType}]`, "special"); - } - return options.stylize(`[${functionType} ${truncate(name, options.truncate - 11)}]`, "special"); -} -__name(inspectFunction, "inspectFunction"); - -// node_modules/loupe/lib/map.js -function inspectMapEntry([key, value], options) { - options.truncate -= 4; - key = options.inspect(key, options); - options.truncate -= key.length; - value = options.inspect(value, options); - return `${key} => ${value}`; -} -__name(inspectMapEntry, "inspectMapEntry"); -function mapToEntries(map) { - const entries = []; - map.forEach((value, key) => { - entries.push([key, value]); - }); - return entries; -} -__name(mapToEntries, "mapToEntries"); -function inspectMap(map, options) { - if (map.size === 0) - return "Map{}"; - options.truncate -= 7; - return `Map{ ${inspectList(mapToEntries(map), options, inspectMapEntry)} }`; -} -__name(inspectMap, "inspectMap"); - -// node_modules/loupe/lib/number.js -var isNaN = Number.isNaN || ((i) => i !== i); -function inspectNumber(number, options) { - if (isNaN(number)) { - return options.stylize("NaN", "number"); - } - if (number === Infinity) { - return options.stylize("Infinity", "number"); - } - if (number === -Infinity) { - return options.stylize("-Infinity", "number"); - } - if (number === 0) { - return options.stylize(1 / number === Infinity ? "+0" : "-0", "number"); - } - return options.stylize(truncate(String(number), options.truncate), "number"); -} -__name(inspectNumber, "inspectNumber"); - -// node_modules/loupe/lib/bigint.js -function inspectBigInt(number, options) { - let nums = truncate(number.toString(), options.truncate - 1); - if (nums !== truncator) - nums += "n"; - return options.stylize(nums, "bigint"); -} -__name(inspectBigInt, "inspectBigInt"); - -// node_modules/loupe/lib/regexp.js -function inspectRegExp(value, options) { - const flags = value.toString().split("/")[2]; - const sourceLength = options.truncate - (2 + flags.length); - const source = value.source; - return options.stylize(`/${truncate(source, sourceLength)}/${flags}`, "regexp"); -} -__name(inspectRegExp, "inspectRegExp"); - -// node_modules/loupe/lib/set.js -function arrayFromSet(set2) { - const values = []; - set2.forEach((value) => { - values.push(value); - }); - return values; -} -__name(arrayFromSet, "arrayFromSet"); -function inspectSet(set2, options) { - if (set2.size === 0) - return "Set{}"; - options.truncate -= 7; - return `Set{ ${inspectList(arrayFromSet(set2), options)} }`; -} -__name(inspectSet, "inspectSet"); - -// node_modules/loupe/lib/string.js -var stringEscapeChars = new RegExp("['\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]", "g"); -var escapeCharacters = { - "\b": "\\b", - " ": "\\t", - "\n": "\\n", - "\f": "\\f", - "\r": "\\r", - "'": "\\'", - "\\": "\\\\" -}; -var hex = 16; -var unicodeLength = 4; -function escape(char) { - return escapeCharacters[char] || `\\u${`0000${char.charCodeAt(0).toString(hex)}`.slice(-unicodeLength)}`; -} -__name(escape, "escape"); -function inspectString(string, options) { - if (stringEscapeChars.test(string)) { - string = string.replace(stringEscapeChars, escape); - } - return options.stylize(`'${truncate(string, options.truncate - 2)}'`, "string"); -} -__name(inspectString, "inspectString"); - -// node_modules/loupe/lib/symbol.js -function inspectSymbol(value) { - if ("description" in Symbol.prototype) { - return value.description ? `Symbol(${value.description})` : "Symbol()"; - } - return value.toString(); -} -__name(inspectSymbol, "inspectSymbol"); - -// node_modules/loupe/lib/promise.js -var getPromiseValue = /* @__PURE__ */ __name(() => "Promise{\u2026}", "getPromiseValue"); -var promise_default = getPromiseValue; - -// node_modules/loupe/lib/object.js -function inspectObject(object, options) { - const properties = Object.getOwnPropertyNames(object); - const symbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(object) : []; - if (properties.length === 0 && symbols.length === 0) { - return "{}"; - } - options.truncate -= 4; - options.seen = options.seen || []; - if (options.seen.includes(object)) { - return "[Circular]"; - } - options.seen.push(object); - const propertyContents = inspectList(properties.map((key) => [key, object[key]]), options, inspectProperty); - const symbolContents = inspectList(symbols.map((key) => [key, object[key]]), options, inspectProperty); - options.seen.pop(); - let sep = ""; - if (propertyContents && symbolContents) { - sep = ", "; - } - return `{ ${propertyContents}${sep}${symbolContents} }`; -} -__name(inspectObject, "inspectObject"); - -// node_modules/loupe/lib/class.js -var toStringTag = typeof Symbol !== "undefined" && Symbol.toStringTag ? Symbol.toStringTag : false; -function inspectClass(value, options) { - let name = ""; - if (toStringTag && toStringTag in value) { - name = value[toStringTag]; - } - name = name || value.constructor.name; - if (!name || name === "_class") { - name = ""; - } - options.truncate -= name.length; - return `${name}${inspectObject(value, options)}`; -} -__name(inspectClass, "inspectClass"); - -// node_modules/loupe/lib/arguments.js -function inspectArguments(args, options) { - if (args.length === 0) - return "Arguments[]"; - options.truncate -= 13; - return `Arguments[ ${inspectList(args, options)} ]`; -} -__name(inspectArguments, "inspectArguments"); - -// node_modules/loupe/lib/error.js -var errorKeys = [ - "stack", - "line", - "column", - "name", - "message", - "fileName", - "lineNumber", - "columnNumber", - "number", - "description", - "cause" -]; -function inspectObject2(error, options) { - const properties = Object.getOwnPropertyNames(error).filter((key) => errorKeys.indexOf(key) === -1); - const name = error.name; - options.truncate -= name.length; - let message = ""; - if (typeof error.message === "string") { - message = truncate(error.message, options.truncate); - } else { - properties.unshift("message"); - } - message = message ? `: ${message}` : ""; - options.truncate -= message.length + 5; - options.seen = options.seen || []; - if (options.seen.includes(error)) { - return "[Circular]"; - } - options.seen.push(error); - const propertyContents = inspectList(properties.map((key) => [key, error[key]]), options, inspectProperty); - return `${name}${message}${propertyContents ? ` { ${propertyContents} }` : ""}`; -} -__name(inspectObject2, "inspectObject"); - -// node_modules/loupe/lib/html.js -function inspectAttribute([key, value], options) { - options.truncate -= 3; - if (!value) { - return `${options.stylize(String(key), "yellow")}`; - } - return `${options.stylize(String(key), "yellow")}=${options.stylize(`"${value}"`, "string")}`; -} -__name(inspectAttribute, "inspectAttribute"); -function inspectNodeCollection(collection, options) { - return inspectList(collection, options, inspectNode, "\n"); -} -__name(inspectNodeCollection, "inspectNodeCollection"); -function inspectNode(node, options) { - switch (node.nodeType) { - case 1: - return inspectHTML(node, options); - case 3: - return options.inspect(node.data, options); - default: - return options.inspect(node, options); - } -} -__name(inspectNode, "inspectNode"); -function inspectHTML(element, options) { - const properties = element.getAttributeNames(); - const name = element.tagName.toLowerCase(); - const head = options.stylize(`<${name}`, "special"); - const headClose = options.stylize(`>`, "special"); - const tail = options.stylize(``, "special"); - options.truncate -= name.length * 2 + 5; - let propertyContents = ""; - if (properties.length > 0) { - propertyContents += " "; - propertyContents += inspectList(properties.map((key) => [key, element.getAttribute(key)]), options, inspectAttribute, " "); - } - options.truncate -= propertyContents.length; - const truncate2 = options.truncate; - let children = inspectNodeCollection(element.children, options); - if (children && children.length > truncate2) { - children = `${truncator}(${element.children.length})`; - } - return `${head}${propertyContents}${headClose}${children}${tail}`; -} -__name(inspectHTML, "inspectHTML"); - -// node_modules/loupe/lib/index.js -var symbolsSupported = typeof Symbol === "function" && typeof Symbol.for === "function"; -var chaiInspect = symbolsSupported ? /* @__PURE__ */ Symbol.for("chai/inspect") : "@@chai/inspect"; -var nodeInspect = /* @__PURE__ */ Symbol.for("nodejs.util.inspect.custom"); -var constructorMap = /* @__PURE__ */ new WeakMap(); -var stringTagMap = {}; -var baseTypesMap = { - undefined: /* @__PURE__ */ __name((value, options) => options.stylize("undefined", "undefined"), "undefined"), - null: /* @__PURE__ */ __name((value, options) => options.stylize("null", "null"), "null"), - boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "boolean"), - Boolean: /* @__PURE__ */ __name((value, options) => options.stylize(String(value), "boolean"), "Boolean"), - number: inspectNumber, - Number: inspectNumber, - bigint: inspectBigInt, - BigInt: inspectBigInt, - string: inspectString, - String: inspectString, - function: inspectFunction, - Function: inspectFunction, - symbol: inspectSymbol, - // A Symbol polyfill will return `Symbol` not `symbol` from typedetect - Symbol: inspectSymbol, - Array: inspectArray, - Date: inspectDate, - Map: inspectMap, - Set: inspectSet, - RegExp: inspectRegExp, - Promise: promise_default, - // WeakSet, WeakMap are totally opaque to us - WeakSet: /* @__PURE__ */ __name((value, options) => options.stylize("WeakSet{\u2026}", "special"), "WeakSet"), - WeakMap: /* @__PURE__ */ __name((value, options) => options.stylize("WeakMap{\u2026}", "special"), "WeakMap"), - Arguments: inspectArguments, - Int8Array: inspectTypedArray, - Uint8Array: inspectTypedArray, - Uint8ClampedArray: inspectTypedArray, - Int16Array: inspectTypedArray, - Uint16Array: inspectTypedArray, - Int32Array: inspectTypedArray, - Uint32Array: inspectTypedArray, - Float32Array: inspectTypedArray, - Float64Array: inspectTypedArray, - Generator: /* @__PURE__ */ __name(() => "", "Generator"), - DataView: /* @__PURE__ */ __name(() => "", "DataView"), - ArrayBuffer: /* @__PURE__ */ __name(() => "", "ArrayBuffer"), - Error: inspectObject2, - HTMLCollection: inspectNodeCollection, - NodeList: inspectNodeCollection -}; -var inspectCustom = /* @__PURE__ */ __name((value, options, type3, inspectFn) => { - if (chaiInspect in value && typeof value[chaiInspect] === "function") { - return value[chaiInspect](options); - } - if (nodeInspect in value && typeof value[nodeInspect] === "function") { - return value[nodeInspect](options.depth, options, inspectFn); - } - if ("inspect" in value && typeof value.inspect === "function") { - return value.inspect(options.depth, options); - } - if ("constructor" in value && constructorMap.has(value.constructor)) { - return constructorMap.get(value.constructor)(value, options); - } - if (stringTagMap[type3]) { - return stringTagMap[type3](value, options); - } - return ""; -}, "inspectCustom"); -var toString = Object.prototype.toString; -function inspect(value, opts = {}) { - const options = normaliseOptions(opts, inspect); - const { customInspect } = options; - let type3 = value === null ? "null" : typeof value; - if (type3 === "object") { - type3 = toString.call(value).slice(8, -1); - } - if (type3 in baseTypesMap) { - return baseTypesMap[type3](value, options); - } - if (customInspect && value) { - const output = inspectCustom(value, options, type3, inspect); - if (output) { - if (typeof output === "string") - return output; - return inspect(output, options); - } - } - const proto = value ? Object.getPrototypeOf(value) : false; - if (proto === Object.prototype || proto === null) { - return inspectObject(value, options); - } - if (value && typeof HTMLElement === "function" && value instanceof HTMLElement) { - return inspectHTML(value, options); - } - if ("constructor" in value) { - if (value.constructor !== Object) { - return inspectClass(value, options); - } - return inspectObject(value, options); - } - if (value === Object(value)) { - return inspectObject(value, options); - } - return options.stylize(String(value), type3); -} -__name(inspect, "inspect"); - -// lib/chai/config.js -var config = { - /** - * ### config.includeStack - * - * User configurable property, influences whether stack trace - * is included in Assertion error message. Default of false - * suppresses stack trace in the error message. - * - * chai.config.includeStack = true; // enable stack on error - * - * @param {boolean} - * @public - */ - includeStack: false, - /** - * ### config.showDiff - * - * User configurable property, influences whether or not - * the `showDiff` flag should be included in the thrown - * AssertionErrors. `false` will always be `false`; `true` - * will be true when the assertion has requested a diff - * be shown. - * - * @param {boolean} - * @public - */ - showDiff: true, - /** - * ### config.truncateThreshold - * - * User configurable property, sets length threshold for actual and - * expected values in assertion errors. If this threshold is exceeded, for - * example for large data structures, the value is replaced with something - * like `[ Array(3) ]` or `{ Object (prop1, prop2) }`. - * - * Set it to zero if you want to disable truncating altogether. - * - * This is especially userful when doing assertions on arrays: having this - * set to a reasonable large value makes the failure messages readily - * inspectable. - * - * chai.config.truncateThreshold = 0; // disable truncating - * - * @param {number} - * @public - */ - truncateThreshold: 40, - /** - * ### config.useProxy - * - * User configurable property, defines if chai will use a Proxy to throw - * an error when a non-existent property is read, which protects users - * from typos when using property-based assertions. - * - * Set it to false if you want to disable this feature. - * - * chai.config.useProxy = false; // disable use of Proxy - * - * This feature is automatically disabled regardless of this config value - * in environments that don't support proxies. - * - * @param {boolean} - * @public - */ - useProxy: true, - /** - * ### config.proxyExcludedKeys - * - * User configurable property, defines which properties should be ignored - * instead of throwing an error if they do not exist on the assertion. - * This is only applied if the environment Chai is running in supports proxies and - * if the `useProxy` configuration setting is enabled. - * By default, `then` and `inspect` will not throw an error if they do not exist on the - * assertion object because the `.inspect` property is read by `util.inspect` (for example, when - * using `console.log` on the assertion object) and `.then` is necessary for promise type-checking. - * - * // By default these keys will not throw an error if they do not exist on the assertion object - * chai.config.proxyExcludedKeys = ['then', 'inspect']; - * - * @param {Array} - * @public - */ - proxyExcludedKeys: ["then", "catch", "inspect", "toJSON"], - /** - * ### config.deepEqual - * - * User configurable property, defines which a custom function to use for deepEqual - * comparisons. - * By default, the function used is the one from the `deep-eql` package without custom comparator. - * - * // use a custom comparator - * chai.config.deepEqual = (expected, actual) => { - * return chai.util.eql(expected, actual, { - * comparator: (expected, actual) => { - * // for non number comparison, use the default behavior - * if(typeof expected !== 'number') return null; - * // allow a difference of 10 between compared numbers - * return typeof actual === 'number' && Math.abs(actual - expected) < 10 - * } - * }) - * }; - * - * @param {Function} - * @public - */ - deepEqual: null -}; - -// lib/chai/utils/inspect.js -function inspect2(obj, showHidden, depth, colors) { - let options = { - colors, - depth: typeof depth === "undefined" ? 2 : depth, - showHidden, - truncate: config.truncateThreshold ? config.truncateThreshold : Infinity - }; - return inspect(obj, options); -} -__name(inspect2, "inspect"); - -// lib/chai/utils/objDisplay.js -function objDisplay(obj) { - let str = inspect2(obj), type3 = Object.prototype.toString.call(obj); - if (config.truncateThreshold && str.length >= config.truncateThreshold) { - if (type3 === "[object Function]") { - return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]"; - } else if (type3 === "[object Array]") { - return "[ Array(" + obj.length + ") ]"; - } else if (type3 === "[object Object]") { - let keys = Object.keys(obj), kstr = keys.length > 2 ? keys.splice(0, 2).join(", ") + ", ..." : keys.join(", "); - return "{ Object (" + kstr + ") }"; - } else { - return str; - } - } else { - return str; - } -} -__name(objDisplay, "objDisplay"); - -// lib/chai/utils/getMessage.js -function getMessage2(obj, args) { - let negate = flag(obj, "negate"); - let val = flag(obj, "object"); - let expected = args[3]; - let actual = getActual(obj, args); - let msg = negate ? args[2] : args[1]; - let flagMsg = flag(obj, "message"); - if (typeof msg === "function") msg = msg(); - msg = msg || ""; - msg = msg.replace(/#\{this\}/g, function() { - return objDisplay(val); - }).replace(/#\{act\}/g, function() { - return objDisplay(actual); - }).replace(/#\{exp\}/g, function() { - return objDisplay(expected); - }); - return flagMsg ? flagMsg + ": " + msg : msg; -} -__name(getMessage2, "getMessage"); - -// lib/chai/utils/transferFlags.js -function transferFlags(assertion, object, includeAll) { - let flags = assertion.__flags || (assertion.__flags = /* @__PURE__ */ Object.create(null)); - if (!object.__flags) { - object.__flags = /* @__PURE__ */ Object.create(null); - } - includeAll = arguments.length === 3 ? includeAll : true; - for (let flag3 in flags) { - if (includeAll || flag3 !== "object" && flag3 !== "ssfi" && flag3 !== "lockSsfi" && flag3 != "message") { - object.__flags[flag3] = flags[flag3]; - } - } -} -__name(transferFlags, "transferFlags"); - -// node_modules/deep-eql/index.js -function type2(obj) { - if (typeof obj === "undefined") { - return "undefined"; - } - if (obj === null) { - return "null"; - } - const stringTag = obj[Symbol.toStringTag]; - if (typeof stringTag === "string") { - return stringTag; - } - const sliceStart = 8; - const sliceEnd = -1; - return Object.prototype.toString.call(obj).slice(sliceStart, sliceEnd); -} -__name(type2, "type"); -function FakeMap() { - this._key = "chai/deep-eql__" + Math.random() + Date.now(); -} -__name(FakeMap, "FakeMap"); -FakeMap.prototype = { - get: /* @__PURE__ */ __name(function get(key) { - return key[this._key]; - }, "get"), - set: /* @__PURE__ */ __name(function set(key, value) { - if (Object.isExtensible(key)) { - Object.defineProperty(key, this._key, { - value, - configurable: true - }); - } - }, "set") -}; -var MemoizeMap = typeof WeakMap === "function" ? WeakMap : FakeMap; -function memoizeCompare(leftHandOperand, rightHandOperand, memoizeMap) { - if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - return null; - } - var leftHandMap = memoizeMap.get(leftHandOperand); - if (leftHandMap) { - var result = leftHandMap.get(rightHandOperand); - if (typeof result === "boolean") { - return result; - } - } - return null; -} -__name(memoizeCompare, "memoizeCompare"); -function memoizeSet(leftHandOperand, rightHandOperand, memoizeMap, result) { - if (!memoizeMap || isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - return; - } - var leftHandMap = memoizeMap.get(leftHandOperand); - if (leftHandMap) { - leftHandMap.set(rightHandOperand, result); - } else { - leftHandMap = new MemoizeMap(); - leftHandMap.set(rightHandOperand, result); - memoizeMap.set(leftHandOperand, leftHandMap); - } -} -__name(memoizeSet, "memoizeSet"); -var deep_eql_default = deepEqual; -function deepEqual(leftHandOperand, rightHandOperand, options) { - if (options && options.comparator) { - return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); - } - var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); - if (simpleResult !== null) { - return simpleResult; - } - return extensiveDeepEqual(leftHandOperand, rightHandOperand, options); -} -__name(deepEqual, "deepEqual"); -function simpleEqual(leftHandOperand, rightHandOperand) { - if (leftHandOperand === rightHandOperand) { - return leftHandOperand !== 0 || 1 / leftHandOperand === 1 / rightHandOperand; - } - if (leftHandOperand !== leftHandOperand && // eslint-disable-line no-self-compare - rightHandOperand !== rightHandOperand) { - return true; - } - if (isPrimitive(leftHandOperand) || isPrimitive(rightHandOperand)) { - return false; - } - return null; -} -__name(simpleEqual, "simpleEqual"); -function extensiveDeepEqual(leftHandOperand, rightHandOperand, options) { - options = options || {}; - options.memoize = options.memoize === false ? false : options.memoize || new MemoizeMap(); - var comparator = options && options.comparator; - var memoizeResultLeft = memoizeCompare(leftHandOperand, rightHandOperand, options.memoize); - if (memoizeResultLeft !== null) { - return memoizeResultLeft; - } - var memoizeResultRight = memoizeCompare(rightHandOperand, leftHandOperand, options.memoize); - if (memoizeResultRight !== null) { - return memoizeResultRight; - } - if (comparator) { - var comparatorResult = comparator(leftHandOperand, rightHandOperand); - if (comparatorResult === false || comparatorResult === true) { - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, comparatorResult); - return comparatorResult; - } - var simpleResult = simpleEqual(leftHandOperand, rightHandOperand); - if (simpleResult !== null) { - return simpleResult; - } - } - var leftHandType = type2(leftHandOperand); - if (leftHandType !== type2(rightHandOperand)) { - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, false); - return false; - } - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, true); - var result = extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options); - memoizeSet(leftHandOperand, rightHandOperand, options.memoize, result); - return result; -} -__name(extensiveDeepEqual, "extensiveDeepEqual"); -function extensiveDeepEqualByType(leftHandOperand, rightHandOperand, leftHandType, options) { - switch (leftHandType) { - case "String": - case "Number": - case "Boolean": - case "Date": - return deepEqual(leftHandOperand.valueOf(), rightHandOperand.valueOf()); - case "Promise": - case "Symbol": - case "function": - case "WeakMap": - case "WeakSet": - return leftHandOperand === rightHandOperand; - case "Error": - return keysEqual(leftHandOperand, rightHandOperand, ["name", "message", "code"], options); - case "Arguments": - case "Int8Array": - case "Uint8Array": - case "Uint8ClampedArray": - case "Int16Array": - case "Uint16Array": - case "Int32Array": - case "Uint32Array": - case "Float32Array": - case "Float64Array": - case "Array": - return iterableEqual(leftHandOperand, rightHandOperand, options); - case "RegExp": - return regexpEqual(leftHandOperand, rightHandOperand); - case "Generator": - return generatorEqual(leftHandOperand, rightHandOperand, options); - case "DataView": - return iterableEqual(new Uint8Array(leftHandOperand.buffer), new Uint8Array(rightHandOperand.buffer), options); - case "ArrayBuffer": - return iterableEqual(new Uint8Array(leftHandOperand), new Uint8Array(rightHandOperand), options); - case "Set": - return entriesEqual(leftHandOperand, rightHandOperand, options); - case "Map": - return entriesEqual(leftHandOperand, rightHandOperand, options); - case "Temporal.PlainDate": - case "Temporal.PlainTime": - case "Temporal.PlainDateTime": - case "Temporal.Instant": - case "Temporal.ZonedDateTime": - case "Temporal.PlainYearMonth": - case "Temporal.PlainMonthDay": - return leftHandOperand.equals(rightHandOperand); - case "Temporal.Duration": - return leftHandOperand.total("nanoseconds") === rightHandOperand.total("nanoseconds"); - case "Temporal.TimeZone": - case "Temporal.Calendar": - return leftHandOperand.toString() === rightHandOperand.toString(); - default: - return objectEqual(leftHandOperand, rightHandOperand, options); - } -} -__name(extensiveDeepEqualByType, "extensiveDeepEqualByType"); -function regexpEqual(leftHandOperand, rightHandOperand) { - return leftHandOperand.toString() === rightHandOperand.toString(); -} -__name(regexpEqual, "regexpEqual"); -function entriesEqual(leftHandOperand, rightHandOperand, options) { - try { - if (leftHandOperand.size !== rightHandOperand.size) { - return false; - } - if (leftHandOperand.size === 0) { - return true; - } - } catch (sizeError) { - return false; - } - var leftHandItems = []; - var rightHandItems = []; - leftHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) { - leftHandItems.push([key, value]); - }, "gatherEntries")); - rightHandOperand.forEach(/* @__PURE__ */ __name(function gatherEntries(key, value) { - rightHandItems.push([key, value]); - }, "gatherEntries")); - return iterableEqual(leftHandItems.sort(), rightHandItems.sort(), options); -} -__name(entriesEqual, "entriesEqual"); -function iterableEqual(leftHandOperand, rightHandOperand, options) { - var length = leftHandOperand.length; - if (length !== rightHandOperand.length) { - return false; - } - if (length === 0) { - return true; - } - var index = -1; - while (++index < length) { - if (deepEqual(leftHandOperand[index], rightHandOperand[index], options) === false) { - return false; - } - } - return true; -} -__name(iterableEqual, "iterableEqual"); -function generatorEqual(leftHandOperand, rightHandOperand, options) { - return iterableEqual(getGeneratorEntries(leftHandOperand), getGeneratorEntries(rightHandOperand), options); -} -__name(generatorEqual, "generatorEqual"); -function hasIteratorFunction(target) { - return typeof Symbol !== "undefined" && typeof target === "object" && typeof Symbol.iterator !== "undefined" && typeof target[Symbol.iterator] === "function"; -} -__name(hasIteratorFunction, "hasIteratorFunction"); -function getIteratorEntries(target) { - if (hasIteratorFunction(target)) { - try { - return getGeneratorEntries(target[Symbol.iterator]()); - } catch (iteratorError) { - return []; - } - } - return []; -} -__name(getIteratorEntries, "getIteratorEntries"); -function getGeneratorEntries(generator) { - var generatorResult = generator.next(); - var accumulator = [generatorResult.value]; - while (generatorResult.done === false) { - generatorResult = generator.next(); - accumulator.push(generatorResult.value); - } - return accumulator; -} -__name(getGeneratorEntries, "getGeneratorEntries"); -function getEnumerableKeys(target) { - var keys = []; - for (var key in target) { - keys.push(key); - } - return keys; -} -__name(getEnumerableKeys, "getEnumerableKeys"); -function getEnumerableSymbols(target) { - var keys = []; - var allKeys = Object.getOwnPropertySymbols(target); - for (var i = 0; i < allKeys.length; i += 1) { - var key = allKeys[i]; - if (Object.getOwnPropertyDescriptor(target, key).enumerable) { - keys.push(key); - } - } - return keys; -} -__name(getEnumerableSymbols, "getEnumerableSymbols"); -function keysEqual(leftHandOperand, rightHandOperand, keys, options) { - var length = keys.length; - if (length === 0) { - return true; - } - for (var i = 0; i < length; i += 1) { - if (deepEqual(leftHandOperand[keys[i]], rightHandOperand[keys[i]], options) === false) { - return false; - } - } - return true; -} -__name(keysEqual, "keysEqual"); -function objectEqual(leftHandOperand, rightHandOperand, options) { - var leftHandKeys = getEnumerableKeys(leftHandOperand); - var rightHandKeys = getEnumerableKeys(rightHandOperand); - var leftHandSymbols = getEnumerableSymbols(leftHandOperand); - var rightHandSymbols = getEnumerableSymbols(rightHandOperand); - leftHandKeys = leftHandKeys.concat(leftHandSymbols); - rightHandKeys = rightHandKeys.concat(rightHandSymbols); - if (leftHandKeys.length && leftHandKeys.length === rightHandKeys.length) { - if (iterableEqual(mapSymbols(leftHandKeys).sort(), mapSymbols(rightHandKeys).sort()) === false) { - return false; - } - return keysEqual(leftHandOperand, rightHandOperand, leftHandKeys, options); - } - var leftHandEntries = getIteratorEntries(leftHandOperand); - var rightHandEntries = getIteratorEntries(rightHandOperand); - if (leftHandEntries.length && leftHandEntries.length === rightHandEntries.length) { - leftHandEntries.sort(); - rightHandEntries.sort(); - return iterableEqual(leftHandEntries, rightHandEntries, options); - } - if (leftHandKeys.length === 0 && leftHandEntries.length === 0 && rightHandKeys.length === 0 && rightHandEntries.length === 0) { - return true; - } - return false; -} -__name(objectEqual, "objectEqual"); -function isPrimitive(value) { - return value === null || typeof value !== "object"; -} -__name(isPrimitive, "isPrimitive"); -function mapSymbols(arr) { - return arr.map(/* @__PURE__ */ __name(function mapSymbol(entry) { - if (typeof entry === "symbol") { - return entry.toString(); - } - return entry; - }, "mapSymbol")); -} -__name(mapSymbols, "mapSymbols"); - -// node_modules/pathval/index.js -function hasProperty(obj, name) { - if (typeof obj === "undefined" || obj === null) { - return false; - } - return name in Object(obj); -} -__name(hasProperty, "hasProperty"); -function parsePath(path) { - const str = path.replace(/([^\\])\[/g, "$1.["); - const parts = str.match(/(\\\.|[^.]+?)+/g); - return parts.map((value) => { - if (value === "constructor" || value === "__proto__" || value === "prototype") { - return {}; - } - const regexp = /^\[(\d+)\]$/; - const mArr = regexp.exec(value); - let parsed = null; - if (mArr) { - parsed = { i: parseFloat(mArr[1]) }; - } else { - parsed = { p: value.replace(/\\([.[\]])/g, "$1") }; - } - return parsed; - }); -} -__name(parsePath, "parsePath"); -function internalGetPathValue(obj, parsed, pathDepth) { - let temporaryValue = obj; - let res = null; - pathDepth = typeof pathDepth === "undefined" ? parsed.length : pathDepth; - for (let i = 0; i < pathDepth; i++) { - const part = parsed[i]; - if (temporaryValue) { - if (typeof part.p === "undefined") { - temporaryValue = temporaryValue[part.i]; - } else { - temporaryValue = temporaryValue[part.p]; - } - if (i === pathDepth - 1) { - res = temporaryValue; - } - } - } - return res; -} -__name(internalGetPathValue, "internalGetPathValue"); -function getPathInfo(obj, path) { - const parsed = parsePath(path); - const last = parsed[parsed.length - 1]; - const info = { - parent: parsed.length > 1 ? internalGetPathValue(obj, parsed, parsed.length - 1) : obj, - name: last.p || last.i, - value: internalGetPathValue(obj, parsed) - }; - info.exists = hasProperty(info.parent, info.name); - return info; -} -__name(getPathInfo, "getPathInfo"); - -// lib/chai/assertion.js -var _Assertion = class _Assertion { - /** - * Creates object for chaining. - * `Assertion` objects contain metadata in the form of flags. Three flags can - * be assigned during instantiation by passing arguments to this constructor: - * - * - `object`: This flag contains the target of the assertion. For example, in - * the assertion `expect(numKittens).to.equal(7);`, the `object` flag will - * contain `numKittens` so that the `equal` assertion can reference it when - * needed. - * - * - `message`: This flag contains an optional custom error message to be - * prepended to the error message that's generated by the assertion when it - * fails. - * - * - `ssfi`: This flag stands for "start stack function indicator". It - * contains a function reference that serves as the starting point for - * removing frames from the stack trace of the error that's created by the - * assertion when it fails. The goal is to provide a cleaner stack trace to - * end users by removing Chai's internal functions. Note that it only works - * in environments that support `Error.captureStackTrace`, and only when - * `Chai.config.includeStack` hasn't been set to `false`. - * - * - `lockSsfi`: This flag controls whether or not the given `ssfi` flag - * should retain its current value, even as assertions are chained off of - * this object. This is usually set to `true` when creating a new assertion - * from within another assertion. It's also temporarily set to `true` before - * an overwritten assertion gets called by the overwriting assertion. - * - * - `eql`: This flag contains the deepEqual function to be used by the assertion. - * - * @param {unknown} obj target of the assertion - * @param {string} [msg] (optional) custom error message - * @param {Function} [ssfi] (optional) starting point for removing stack frames - * @param {boolean} [lockSsfi] (optional) whether or not the ssfi flag is locked - */ - constructor(obj, msg, ssfi, lockSsfi) { - /** @type {{}} */ - __publicField(this, "__flags", {}); - flag(this, "ssfi", ssfi || _Assertion); - flag(this, "lockSsfi", lockSsfi); - flag(this, "object", obj); - flag(this, "message", msg); - flag(this, "eql", config.deepEqual || deep_eql_default); - return proxify(this); - } - /** @returns {boolean} */ - static get includeStack() { - console.warn( - "Assertion.includeStack is deprecated, use chai.config.includeStack instead." - ); - return config.includeStack; - } - /** @param {boolean} value */ - static set includeStack(value) { - console.warn( - "Assertion.includeStack is deprecated, use chai.config.includeStack instead." - ); - config.includeStack = value; - } - /** @returns {boolean} */ - static get showDiff() { - console.warn( - "Assertion.showDiff is deprecated, use chai.config.showDiff instead." - ); - return config.showDiff; - } - /** @param {boolean} value */ - static set showDiff(value) { - console.warn( - "Assertion.showDiff is deprecated, use chai.config.showDiff instead." - ); - config.showDiff = value; - } - /** - * @param {string} name - * @param {Function} fn - */ - static addProperty(name, fn) { - addProperty(this.prototype, name, fn); - } - /** - * @param {string} name - * @param {Function} fn - */ - static addMethod(name, fn) { - addMethod(this.prototype, name, fn); - } - /** - * @param {string} name - * @param {Function} fn - * @param {Function} chainingBehavior - */ - static addChainableMethod(name, fn, chainingBehavior) { - addChainableMethod(this.prototype, name, fn, chainingBehavior); - } - /** - * @param {string} name - * @param {Function} fn - */ - static overwriteProperty(name, fn) { - overwriteProperty(this.prototype, name, fn); - } - /** - * @param {string} name - * @param {Function} fn - */ - static overwriteMethod(name, fn) { - overwriteMethod(this.prototype, name, fn); - } - /** - * @param {string} name - * @param {Function} fn - * @param {Function} chainingBehavior - */ - static overwriteChainableMethod(name, fn, chainingBehavior) { - overwriteChainableMethod(this.prototype, name, fn, chainingBehavior); - } - /** - * ### .assert(expression, message, negateMessage, expected, actual, showDiff) - * - * Executes an expression and check expectations. Throws AssertionError for reporting if test doesn't pass. - * - * @name assert - * @param {unknown} _expr to be tested - * @param {string | Function} msg or function that returns message to display if expression fails - * @param {string | Function} _negateMsg or function that returns negatedMessage to display if negated expression fails - * @param {unknown} expected value (remember to check for negation) - * @param {unknown} _actual (optional) will default to `this.obj` - * @param {boolean} showDiff (optional) when set to `true`, assert will display a diff in addition to the message if expression fails - * @returns {void} - */ - assert(_expr, msg, _negateMsg, expected, _actual, showDiff) { - const ok = test(this, arguments); - if (false !== showDiff) showDiff = true; - if (void 0 === expected && void 0 === _actual) showDiff = false; - if (true !== config.showDiff) showDiff = false; - if (!ok) { - msg = getMessage2(this, arguments); - const actual = getActual(this, arguments); - const assertionErrorObjectProperties = { - actual, - expected, - showDiff - }; - const operator = getOperator(this, arguments); - if (operator) { - assertionErrorObjectProperties.operator = operator; - } - throw new AssertionError( - msg, - assertionErrorObjectProperties, - // @ts-expect-error Not sure what to do about these types yet - config.includeStack ? this.assert : flag(this, "ssfi") - ); - } - } - /** - * Quick reference to stored `actual` value for plugin developers. - * - * @returns {unknown} - */ - get _obj() { - return flag(this, "object"); - } - /** - * Quick reference to stored `actual` value for plugin developers. - * - * @param {unknown} val - */ - set _obj(val) { - flag(this, "object", val); - } -}; -__name(_Assertion, "Assertion"); -var Assertion = _Assertion; - -// lib/chai/utils/events.js -var events = new EventTarget(); -var _PluginEvent = class _PluginEvent extends Event { - constructor(type3, name, fn) { - super(type3); - this.name = String(name); - this.fn = fn; - } -}; -__name(_PluginEvent, "PluginEvent"); -var PluginEvent = _PluginEvent; - -// lib/chai/utils/isProxyEnabled.js -function isProxyEnabled() { - return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined"; -} -__name(isProxyEnabled, "isProxyEnabled"); - -// lib/chai/utils/addProperty.js -function addProperty(ctx, name, getter) { - getter = getter === void 0 ? function() { - } : getter; - Object.defineProperty(ctx, name, { - get: /* @__PURE__ */ __name(function propertyGetter() { - if (!isProxyEnabled() && !flag(this, "lockSsfi")) { - flag(this, "ssfi", propertyGetter); - } - let result = getter.call(this); - if (result !== void 0) return result; - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "propertyGetter"), - configurable: true - }); - events.dispatchEvent(new PluginEvent("addProperty", name, getter)); -} -__name(addProperty, "addProperty"); - -// lib/chai/utils/addLengthGuard.js -var fnLengthDesc = Object.getOwnPropertyDescriptor(function() { -}, "length"); -function addLengthGuard(fn, assertionName, isChainable) { - if (!fnLengthDesc.configurable) return fn; - Object.defineProperty(fn, "length", { - get: /* @__PURE__ */ __name(function() { - if (isChainable) { - throw Error( - "Invalid Chai property: " + assertionName + '.length. Due to a compatibility issue, "length" cannot directly follow "' + assertionName + '". Use "' + assertionName + '.lengthOf" instead.' - ); - } - throw Error( - "Invalid Chai property: " + assertionName + '.length. See docs for proper usage of "' + assertionName + '".' - ); - }, "get") - }); - return fn; -} -__name(addLengthGuard, "addLengthGuard"); - -// lib/chai/utils/getProperties.js -function getProperties(object) { - let result = Object.getOwnPropertyNames(object); - function addProperty2(property) { - if (result.indexOf(property) === -1) { - result.push(property); - } - } - __name(addProperty2, "addProperty"); - let proto = Object.getPrototypeOf(object); - while (proto !== null) { - Object.getOwnPropertyNames(proto).forEach(addProperty2); - proto = Object.getPrototypeOf(proto); - } - return result; -} -__name(getProperties, "getProperties"); - -// lib/chai/utils/proxify.js -var builtins = ["__flags", "__methods", "_obj", "assert"]; -function proxify(obj, nonChainableMethodName) { - if (!isProxyEnabled()) return obj; - return new Proxy(obj, { - get: /* @__PURE__ */ __name(function proxyGetter(target, property) { - if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) { - if (nonChainableMethodName) { - throw Error( - "Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".' - ); - } - let suggestion = null; - let suggestionDistance = 4; - getProperties(target).forEach(function(prop) { - if ( - // we actually mean to check `Object.prototype` here - // eslint-disable-next-line no-prototype-builtins - !Object.prototype.hasOwnProperty(prop) && builtins.indexOf(prop) === -1 - ) { - let dist = stringDistanceCapped(property, prop, suggestionDistance); - if (dist < suggestionDistance) { - suggestion = prop; - suggestionDistance = dist; - } - } - }); - if (suggestion !== null) { - throw Error( - "Invalid Chai property: " + property + '. Did you mean "' + suggestion + '"?' - ); - } else { - throw Error("Invalid Chai property: " + property); - } - } - if (builtins.indexOf(property) === -1 && !flag(target, "lockSsfi")) { - flag(target, "ssfi", proxyGetter); - } - return Reflect.get(target, property); - }, "proxyGetter") - }); -} -__name(proxify, "proxify"); -function stringDistanceCapped(strA, strB, cap) { - if (Math.abs(strA.length - strB.length) >= cap) { - return cap; - } - let memo = []; - for (let i = 0; i <= strA.length; i++) { - memo[i] = Array(strB.length + 1).fill(0); - memo[i][0] = i; - } - for (let j = 0; j < strB.length; j++) { - memo[0][j] = j; - } - for (let i = 1; i <= strA.length; i++) { - let ch = strA.charCodeAt(i - 1); - for (let j = 1; j <= strB.length; j++) { - if (Math.abs(i - j) >= cap) { - memo[i][j] = cap; - continue; - } - memo[i][j] = Math.min( - memo[i - 1][j] + 1, - memo[i][j - 1] + 1, - memo[i - 1][j - 1] + (ch === strB.charCodeAt(j - 1) ? 0 : 1) - ); - } - } - return memo[strA.length][strB.length]; -} -__name(stringDistanceCapped, "stringDistanceCapped"); - -// lib/chai/utils/addMethod.js -function addMethod(ctx, name, method) { - let methodWrapper = /* @__PURE__ */ __name(function() { - if (!flag(this, "lockSsfi")) { - flag(this, "ssfi", methodWrapper); - } - let result = method.apply(this, arguments); - if (result !== void 0) return result; - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "methodWrapper"); - addLengthGuard(methodWrapper, name, false); - ctx[name] = proxify(methodWrapper, name); - events.dispatchEvent(new PluginEvent("addMethod", name, method)); -} -__name(addMethod, "addMethod"); - -// lib/chai/utils/overwriteProperty.js -function overwriteProperty(ctx, name, getter) { - let _get = Object.getOwnPropertyDescriptor(ctx, name), _super = /* @__PURE__ */ __name(function() { - }, "_super"); - if (_get && "function" === typeof _get.get) _super = _get.get; - Object.defineProperty(ctx, name, { - get: /* @__PURE__ */ __name(function overwritingPropertyGetter() { - if (!isProxyEnabled() && !flag(this, "lockSsfi")) { - flag(this, "ssfi", overwritingPropertyGetter); - } - let origLockSsfi = flag(this, "lockSsfi"); - flag(this, "lockSsfi", true); - let result = getter(_super).call(this); - flag(this, "lockSsfi", origLockSsfi); - if (result !== void 0) { - return result; - } - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "overwritingPropertyGetter"), - configurable: true - }); -} -__name(overwriteProperty, "overwriteProperty"); - -// lib/chai/utils/overwriteMethod.js -function overwriteMethod(ctx, name, method) { - let _method = ctx[name], _super = /* @__PURE__ */ __name(function() { - throw new Error(name + " is not a function"); - }, "_super"); - if (_method && "function" === typeof _method) _super = _method; - let overwritingMethodWrapper = /* @__PURE__ */ __name(function() { - if (!flag(this, "lockSsfi")) { - flag(this, "ssfi", overwritingMethodWrapper); - } - let origLockSsfi = flag(this, "lockSsfi"); - flag(this, "lockSsfi", true); - let result = method(_super).apply(this, arguments); - flag(this, "lockSsfi", origLockSsfi); - if (result !== void 0) { - return result; - } - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "overwritingMethodWrapper"); - addLengthGuard(overwritingMethodWrapper, name, false); - ctx[name] = proxify(overwritingMethodWrapper, name); -} -__name(overwriteMethod, "overwriteMethod"); - -// lib/chai/utils/addChainableMethod.js -var canSetPrototype = typeof Object.setPrototypeOf === "function"; -var testFn = /* @__PURE__ */ __name(function() { -}, "testFn"); -var excludeNames = Object.getOwnPropertyNames(testFn).filter(function(name) { - let propDesc = Object.getOwnPropertyDescriptor(testFn, name); - if (typeof propDesc !== "object") return true; - return !propDesc.configurable; -}); -var call = Function.prototype.call; -var apply = Function.prototype.apply; -var _PluginAddChainableMethodEvent = class _PluginAddChainableMethodEvent extends PluginEvent { - constructor(type3, name, fn, chainingBehavior) { - super(type3, name, fn); - this.chainingBehavior = chainingBehavior; - } -}; -__name(_PluginAddChainableMethodEvent, "PluginAddChainableMethodEvent"); -var PluginAddChainableMethodEvent = _PluginAddChainableMethodEvent; -function addChainableMethod(ctx, name, method, chainingBehavior) { - if (typeof chainingBehavior !== "function") { - chainingBehavior = /* @__PURE__ */ __name(function() { - }, "chainingBehavior"); - } - let chainableBehavior = { - method, - chainingBehavior - }; - if (!ctx.__methods) { - ctx.__methods = {}; - } - ctx.__methods[name] = chainableBehavior; - Object.defineProperty(ctx, name, { - get: /* @__PURE__ */ __name(function chainableMethodGetter() { - chainableBehavior.chainingBehavior.call(this); - let chainableMethodWrapper = /* @__PURE__ */ __name(function() { - if (!flag(this, "lockSsfi")) { - flag(this, "ssfi", chainableMethodWrapper); - } - let result = chainableBehavior.method.apply(this, arguments); - if (result !== void 0) { - return result; - } - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "chainableMethodWrapper"); - addLengthGuard(chainableMethodWrapper, name, true); - if (canSetPrototype) { - let prototype = Object.create(this); - prototype.call = call; - prototype.apply = apply; - Object.setPrototypeOf(chainableMethodWrapper, prototype); - } else { - let asserterNames = Object.getOwnPropertyNames(ctx); - asserterNames.forEach(function(asserterName) { - if (excludeNames.indexOf(asserterName) !== -1) { - return; - } - let pd = Object.getOwnPropertyDescriptor(ctx, asserterName); - Object.defineProperty(chainableMethodWrapper, asserterName, pd); - }); - } - transferFlags(this, chainableMethodWrapper); - return proxify(chainableMethodWrapper); - }, "chainableMethodGetter"), - configurable: true - }); - events.dispatchEvent( - new PluginAddChainableMethodEvent( - "addChainableMethod", - name, - method, - chainingBehavior - ) - ); -} -__name(addChainableMethod, "addChainableMethod"); - -// lib/chai/utils/overwriteChainableMethod.js -function overwriteChainableMethod(ctx, name, method, chainingBehavior) { - let chainableBehavior = ctx.__methods[name]; - let _chainingBehavior = chainableBehavior.chainingBehavior; - chainableBehavior.chainingBehavior = /* @__PURE__ */ __name(function overwritingChainableMethodGetter() { - let result = chainingBehavior(_chainingBehavior).call(this); - if (result !== void 0) { - return result; - } - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "overwritingChainableMethodGetter"); - let _method = chainableBehavior.method; - chainableBehavior.method = /* @__PURE__ */ __name(function overwritingChainableMethodWrapper() { - let result = method(_method).apply(this, arguments); - if (result !== void 0) { - return result; - } - let newAssertion = new Assertion(); - transferFlags(this, newAssertion); - return newAssertion; - }, "overwritingChainableMethodWrapper"); -} -__name(overwriteChainableMethod, "overwriteChainableMethod"); - -// lib/chai/utils/compareByInspect.js -function compareByInspect(a, b) { - return inspect2(a) < inspect2(b) ? -1 : 1; -} -__name(compareByInspect, "compareByInspect"); - -// lib/chai/utils/getOwnEnumerablePropertySymbols.js -function getOwnEnumerablePropertySymbols(obj) { - if (typeof Object.getOwnPropertySymbols !== "function") return []; - return Object.getOwnPropertySymbols(obj).filter(function(sym) { - return Object.getOwnPropertyDescriptor(obj, sym).enumerable; - }); -} -__name(getOwnEnumerablePropertySymbols, "getOwnEnumerablePropertySymbols"); - -// lib/chai/utils/getOwnEnumerableProperties.js -function getOwnEnumerableProperties(obj) { - return Object.keys(obj).concat(getOwnEnumerablePropertySymbols(obj)); -} -__name(getOwnEnumerableProperties, "getOwnEnumerableProperties"); - -// lib/chai/utils/isNaN.js -var isNaN2 = Number.isNaN; - -// lib/chai/utils/getOperator.js -function isObjectType(obj) { - let objectType = type(obj); - let objectTypes = ["Array", "Object", "Function"]; - return objectTypes.indexOf(objectType) !== -1; -} -__name(isObjectType, "isObjectType"); -function getOperator(obj, args) { - let operator = flag(obj, "operator"); - let negate = flag(obj, "negate"); - let expected = args[3]; - let msg = negate ? args[2] : args[1]; - if (operator) { - return operator; - } - if (typeof msg === "function") msg = msg(); - msg = msg || ""; - if (!msg) { - return void 0; - } - if (/\shave\s/.test(msg)) { - return void 0; - } - let isObject = isObjectType(expected); - if (/\snot\s/.test(msg)) { - return isObject ? "notDeepStrictEqual" : "notStrictEqual"; - } - return isObject ? "deepStrictEqual" : "strictEqual"; -} -__name(getOperator, "getOperator"); - -// lib/chai/utils/index.js -function getName(fn) { - return fn.name; -} -__name(getName, "getName"); -function isRegExp2(obj) { - return Object.prototype.toString.call(obj) === "[object RegExp]"; -} -__name(isRegExp2, "isRegExp"); -function isNumeric(obj) { - return ["Number", "BigInt"].includes(type(obj)); -} -__name(isNumeric, "isNumeric"); - -// lib/chai/core/assertions.js -var { flag: flag2 } = utils_exports; -[ - "to", - "be", - "been", - "is", - "and", - "has", - "have", - "with", - "that", - "which", - "at", - "of", - "same", - "but", - "does", - "still", - "also" -].forEach(function(chain) { - Assertion.addProperty(chain); -}); -Assertion.addProperty("not", function() { - flag2(this, "negate", true); -}); -Assertion.addProperty("deep", function() { - flag2(this, "deep", true); -}); -Assertion.addProperty("nested", function() { - flag2(this, "nested", true); -}); -Assertion.addProperty("own", function() { - flag2(this, "own", true); -}); -Assertion.addProperty("ordered", function() { - flag2(this, "ordered", true); -}); -Assertion.addProperty("any", function() { - flag2(this, "any", true); - flag2(this, "all", false); -}); -Assertion.addProperty("all", function() { - flag2(this, "all", true); - flag2(this, "any", false); -}); -var functionTypes = { - function: [ - "function", - "asyncfunction", - "generatorfunction", - "asyncgeneratorfunction" - ], - asyncfunction: ["asyncfunction", "asyncgeneratorfunction"], - generatorfunction: ["generatorfunction", "asyncgeneratorfunction"], - asyncgeneratorfunction: ["asyncgeneratorfunction"] -}; -function an(type3, msg) { - if (msg) flag2(this, "message", msg); - type3 = type3.toLowerCase(); - let obj = flag2(this, "object"), article = ~["a", "e", "i", "o", "u"].indexOf(type3.charAt(0)) ? "an " : "a "; - const detectedType = type(obj).toLowerCase(); - if (functionTypes["function"].includes(type3)) { - this.assert( - functionTypes[type3].includes(detectedType), - "expected #{this} to be " + article + type3, - "expected #{this} not to be " + article + type3 - ); - } else { - this.assert( - type3 === detectedType, - "expected #{this} to be " + article + type3, - "expected #{this} not to be " + article + type3 - ); - } -} -__name(an, "an"); -Assertion.addChainableMethod("an", an); -Assertion.addChainableMethod("a", an); -function SameValueZero(a, b) { - return isNaN2(a) && isNaN2(b) || a === b; -} -__name(SameValueZero, "SameValueZero"); -function includeChainingBehavior() { - flag2(this, "contains", true); -} -__name(includeChainingBehavior, "includeChainingBehavior"); -function include(val, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), negate = flag2(this, "negate"), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), descriptor = isDeep ? "deep " : "", isEql = isDeep ? flag2(this, "eql") : SameValueZero; - flagMsg = flagMsg ? flagMsg + ": " : ""; - let included = false; - switch (objType) { - case "string": - included = obj.indexOf(val) !== -1; - break; - case "weakset": - if (isDeep) { - throw new AssertionError( - flagMsg + "unable to use .deep.include with WeakSet", - void 0, - ssfi - ); - } - included = obj.has(val); - break; - case "map": - obj.forEach(function(item) { - included = included || isEql(item, val); - }); - break; - case "set": - if (isDeep) { - obj.forEach(function(item) { - included = included || isEql(item, val); - }); - } else { - included = obj.has(val); - } - break; - case "array": - if (isDeep) { - included = obj.some(function(item) { - return isEql(item, val); - }); - } else { - included = obj.indexOf(val) !== -1; - } - break; - default: { - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + "the given combination of arguments (" + objType + " and " + type(val).toLowerCase() + ") is invalid for this assertion. You can use an array, a map, an object, a set, a string, or a weakset instead of a " + type(val).toLowerCase(), - void 0, - ssfi - ); - } - let props = Object.keys(val); - let firstErr = null; - let numErrs = 0; - props.forEach(function(prop) { - let propAssertion = new Assertion(obj); - transferFlags(this, propAssertion, true); - flag2(propAssertion, "lockSsfi", true); - if (!negate || props.length === 1) { - propAssertion.property(prop, val[prop]); - return; - } - try { - propAssertion.property(prop, val[prop]); - } catch (err) { - if (!check_error_exports.compatibleConstructor(err, AssertionError)) { - throw err; - } - if (firstErr === null) firstErr = err; - numErrs++; - } - }, this); - if (negate && props.length > 1 && numErrs === props.length) { - throw firstErr; - } - return; - } - } - this.assert( - included, - "expected #{this} to " + descriptor + "include " + inspect2(val), - "expected #{this} to not " + descriptor + "include " + inspect2(val) - ); -} -__name(include, "include"); -Assertion.addChainableMethod("include", include, includeChainingBehavior); -Assertion.addChainableMethod("contain", include, includeChainingBehavior); -Assertion.addChainableMethod("contains", include, includeChainingBehavior); -Assertion.addChainableMethod("includes", include, includeChainingBehavior); -Assertion.addProperty("ok", function() { - this.assert( - flag2(this, "object"), - "expected #{this} to be truthy", - "expected #{this} to be falsy" - ); -}); -Assertion.addProperty("true", function() { - this.assert( - true === flag2(this, "object"), - "expected #{this} to be true", - "expected #{this} to be false", - flag2(this, "negate") ? false : true - ); -}); -Assertion.addProperty("numeric", function() { - const object = flag2(this, "object"); - this.assert( - ["Number", "BigInt"].includes(type(object)), - "expected #{this} to be numeric", - "expected #{this} to not be numeric", - flag2(this, "negate") ? false : true - ); -}); -Assertion.addProperty("callable", function() { - const val = flag2(this, "object"); - const ssfi = flag2(this, "ssfi"); - const message = flag2(this, "message"); - const msg = message ? `${message}: ` : ""; - const negate = flag2(this, "negate"); - const assertionMessage = negate ? `${msg}expected ${inspect2(val)} not to be a callable function` : `${msg}expected ${inspect2(val)} to be a callable function`; - const isCallable = [ - "Function", - "AsyncFunction", - "GeneratorFunction", - "AsyncGeneratorFunction" - ].includes(type(val)); - if (isCallable && negate || !isCallable && !negate) { - throw new AssertionError(assertionMessage, void 0, ssfi); - } -}); -Assertion.addProperty("false", function() { - this.assert( - false === flag2(this, "object"), - "expected #{this} to be false", - "expected #{this} to be true", - flag2(this, "negate") ? true : false - ); -}); -Assertion.addProperty("null", function() { - this.assert( - null === flag2(this, "object"), - "expected #{this} to be null", - "expected #{this} not to be null" - ); -}); -Assertion.addProperty("undefined", function() { - this.assert( - void 0 === flag2(this, "object"), - "expected #{this} to be undefined", - "expected #{this} not to be undefined" - ); -}); -Assertion.addProperty("NaN", function() { - this.assert( - isNaN2(flag2(this, "object")), - "expected #{this} to be NaN", - "expected #{this} not to be NaN" - ); -}); -function assertExist() { - let val = flag2(this, "object"); - this.assert( - val !== null && val !== void 0, - "expected #{this} to exist", - "expected #{this} to not exist" - ); -} -__name(assertExist, "assertExist"); -Assertion.addProperty("exist", assertExist); -Assertion.addProperty("exists", assertExist); -Assertion.addProperty("empty", function() { - let val = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), itemsCount; - flagMsg = flagMsg ? flagMsg + ": " : ""; - switch (type(val).toLowerCase()) { - case "array": - case "string": - itemsCount = val.length; - break; - case "map": - case "set": - itemsCount = val.size; - break; - case "weakmap": - case "weakset": - throw new AssertionError( - flagMsg + ".empty was passed a weak collection", - void 0, - ssfi - ); - case "function": { - const msg = flagMsg + ".empty was passed a function " + getName(val); - throw new AssertionError(msg.trim(), void 0, ssfi); - } - default: - if (val !== Object(val)) { - throw new AssertionError( - flagMsg + ".empty was passed non-string primitive " + inspect2(val), - void 0, - ssfi - ); - } - itemsCount = Object.keys(val).length; - } - this.assert( - 0 === itemsCount, - "expected #{this} to be empty", - "expected #{this} not to be empty" - ); -}); -function checkArguments() { - let obj = flag2(this, "object"), type3 = type(obj); - this.assert( - "Arguments" === type3, - "expected #{this} to be arguments but got " + type3, - "expected #{this} to not be arguments" - ); -} -__name(checkArguments, "checkArguments"); -Assertion.addProperty("arguments", checkArguments); -Assertion.addProperty("Arguments", checkArguments); -function assertEqual(val, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"); - if (flag2(this, "deep")) { - let prevLockSsfi = flag2(this, "lockSsfi"); - flag2(this, "lockSsfi", true); - this.eql(val); - flag2(this, "lockSsfi", prevLockSsfi); - } else { - this.assert( - val === obj, - "expected #{this} to equal #{exp}", - "expected #{this} to not equal #{exp}", - val, - this._obj, - true - ); - } -} -__name(assertEqual, "assertEqual"); -Assertion.addMethod("equal", assertEqual); -Assertion.addMethod("equals", assertEqual); -Assertion.addMethod("eq", assertEqual); -function assertEql(obj, msg) { - if (msg) flag2(this, "message", msg); - let eql = flag2(this, "eql"); - this.assert( - eql(obj, flag2(this, "object")), - "expected #{this} to deeply equal #{exp}", - "expected #{this} to not deeply equal #{exp}", - obj, - this._obj, - true - ); -} -__name(assertEql, "assertEql"); -Assertion.addMethod("eql", assertEql); -Assertion.addMethod("eqls", assertEql); -function assertAbove(n, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(); - if (doLength && objType !== "map" && objType !== "set") { - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - } - if (!doLength && objType === "date" && nType !== "date") { - throw new AssertionError( - msgPrefix + "the argument to above must be a date", - void 0, - ssfi - ); - } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { - throw new AssertionError( - msgPrefix + "the argument to above must be a number", - void 0, - ssfi - ); - } else if (!doLength && objType !== "date" && !isNumeric(obj)) { - let printObj = objType === "string" ? "'" + obj + "'" : obj; - throw new AssertionError( - msgPrefix + "expected " + printObj + " to be a number or a date", - void 0, - ssfi - ); - } - if (doLength) { - let descriptor = "length", itemsCount; - if (objType === "map" || objType === "set") { - descriptor = "size"; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount > n, - "expected #{this} to have a " + descriptor + " above #{exp} but got #{act}", - "expected #{this} to not have a " + descriptor + " above #{exp}", - n, - itemsCount - ); - } else { - this.assert( - obj > n, - "expected #{this} to be above #{exp}", - "expected #{this} to be at most #{exp}", - n - ); - } -} -__name(assertAbove, "assertAbove"); -Assertion.addMethod("above", assertAbove); -Assertion.addMethod("gt", assertAbove); -Assertion.addMethod("greaterThan", assertAbove); -function assertLeast(n, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; - if (doLength && objType !== "map" && objType !== "set") { - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - } - if (!doLength && objType === "date" && nType !== "date") { - errorMessage = msgPrefix + "the argument to least must be a date"; - } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { - errorMessage = msgPrefix + "the argument to least must be a number"; - } else if (!doLength && objType !== "date" && !isNumeric(obj)) { - let printObj = objType === "string" ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; - } else { - shouldThrow = false; - } - if (shouldThrow) { - throw new AssertionError(errorMessage, void 0, ssfi); - } - if (doLength) { - let descriptor = "length", itemsCount; - if (objType === "map" || objType === "set") { - descriptor = "size"; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= n, - "expected #{this} to have a " + descriptor + " at least #{exp} but got #{act}", - "expected #{this} to have a " + descriptor + " below #{exp}", - n, - itemsCount - ); - } else { - this.assert( - obj >= n, - "expected #{this} to be at least #{exp}", - "expected #{this} to be below #{exp}", - n - ); - } -} -__name(assertLeast, "assertLeast"); -Assertion.addMethod("least", assertLeast); -Assertion.addMethod("gte", assertLeast); -Assertion.addMethod("greaterThanOrEqual", assertLeast); -function assertBelow(n, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; - if (doLength && objType !== "map" && objType !== "set") { - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - } - if (!doLength && objType === "date" && nType !== "date") { - errorMessage = msgPrefix + "the argument to below must be a date"; - } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { - errorMessage = msgPrefix + "the argument to below must be a number"; - } else if (!doLength && objType !== "date" && !isNumeric(obj)) { - let printObj = objType === "string" ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; - } else { - shouldThrow = false; - } - if (shouldThrow) { - throw new AssertionError(errorMessage, void 0, ssfi); - } - if (doLength) { - let descriptor = "length", itemsCount; - if (objType === "map" || objType === "set") { - descriptor = "size"; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount < n, - "expected #{this} to have a " + descriptor + " below #{exp} but got #{act}", - "expected #{this} to not have a " + descriptor + " below #{exp}", - n, - itemsCount - ); - } else { - this.assert( - obj < n, - "expected #{this} to be below #{exp}", - "expected #{this} to be at least #{exp}", - n - ); - } -} -__name(assertBelow, "assertBelow"); -Assertion.addMethod("below", assertBelow); -Assertion.addMethod("lt", assertBelow); -Assertion.addMethod("lessThan", assertBelow); -function assertMost(n, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), nType = type(n).toLowerCase(), errorMessage, shouldThrow = true; - if (doLength && objType !== "map" && objType !== "set") { - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - } - if (!doLength && objType === "date" && nType !== "date") { - errorMessage = msgPrefix + "the argument to most must be a date"; - } else if (!isNumeric(n) && (doLength || isNumeric(obj))) { - errorMessage = msgPrefix + "the argument to most must be a number"; - } else if (!doLength && objType !== "date" && !isNumeric(obj)) { - let printObj = objType === "string" ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; - } else { - shouldThrow = false; - } - if (shouldThrow) { - throw new AssertionError(errorMessage, void 0, ssfi); - } - if (doLength) { - let descriptor = "length", itemsCount; - if (objType === "map" || objType === "set") { - descriptor = "size"; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount <= n, - "expected #{this} to have a " + descriptor + " at most #{exp} but got #{act}", - "expected #{this} to have a " + descriptor + " above #{exp}", - n, - itemsCount - ); - } else { - this.assert( - obj <= n, - "expected #{this} to be at most #{exp}", - "expected #{this} to be above #{exp}", - n - ); - } -} -__name(assertMost, "assertMost"); -Assertion.addMethod("most", assertMost); -Assertion.addMethod("lte", assertMost); -Assertion.addMethod("lessThanOrEqual", assertMost); -Assertion.addMethod("within", function(start, finish, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), doLength = flag2(this, "doLength"), flagMsg = flag2(this, "message"), msgPrefix = flagMsg ? flagMsg + ": " : "", ssfi = flag2(this, "ssfi"), objType = type(obj).toLowerCase(), startType = type(start).toLowerCase(), finishType = type(finish).toLowerCase(), errorMessage, shouldThrow = true, range = startType === "date" && finishType === "date" ? start.toISOString() + ".." + finish.toISOString() : start + ".." + finish; - if (doLength && objType !== "map" && objType !== "set") { - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - } - if (!doLength && objType === "date" && (startType !== "date" || finishType !== "date")) { - errorMessage = msgPrefix + "the arguments to within must be dates"; - } else if ((!isNumeric(start) || !isNumeric(finish)) && (doLength || isNumeric(obj))) { - errorMessage = msgPrefix + "the arguments to within must be numbers"; - } else if (!doLength && objType !== "date" && !isNumeric(obj)) { - let printObj = objType === "string" ? "'" + obj + "'" : obj; - errorMessage = msgPrefix + "expected " + printObj + " to be a number or a date"; - } else { - shouldThrow = false; - } - if (shouldThrow) { - throw new AssertionError(errorMessage, void 0, ssfi); - } - if (doLength) { - let descriptor = "length", itemsCount; - if (objType === "map" || objType === "set") { - descriptor = "size"; - itemsCount = obj.size; - } else { - itemsCount = obj.length; - } - this.assert( - itemsCount >= start && itemsCount <= finish, - "expected #{this} to have a " + descriptor + " within " + range, - "expected #{this} to not have a " + descriptor + " within " + range - ); - } else { - this.assert( - obj >= start && obj <= finish, - "expected #{this} to be within " + range, - "expected #{this} to not be within " + range - ); - } -}); -function assertInstanceOf(constructor, msg) { - if (msg) flag2(this, "message", msg); - let target = flag2(this, "object"); - let ssfi = flag2(this, "ssfi"); - let flagMsg = flag2(this, "message"); - let isInstanceOf; - try { - isInstanceOf = target instanceof constructor; - } catch (err) { - if (err instanceof TypeError) { - flagMsg = flagMsg ? flagMsg + ": " : ""; - throw new AssertionError( - flagMsg + "The instanceof assertion needs a constructor but " + type(constructor) + " was given.", - void 0, - ssfi - ); - } - throw err; - } - let name = getName(constructor); - if (name == null) { - name = "an unnamed constructor"; - } - this.assert( - isInstanceOf, - "expected #{this} to be an instance of " + name, - "expected #{this} to not be an instance of " + name - ); -} -__name(assertInstanceOf, "assertInstanceOf"); -Assertion.addMethod("instanceof", assertInstanceOf); -Assertion.addMethod("instanceOf", assertInstanceOf); -function assertProperty(name, val, msg) { - if (msg) flag2(this, "message", msg); - let isNested = flag2(this, "nested"), isOwn = flag2(this, "own"), flagMsg = flag2(this, "message"), obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), nameType = typeof name; - flagMsg = flagMsg ? flagMsg + ": " : ""; - if (isNested) { - if (nameType !== "string") { - throw new AssertionError( - flagMsg + "the argument to property must be a string when using nested syntax", - void 0, - ssfi - ); - } - } else { - if (nameType !== "string" && nameType !== "number" && nameType !== "symbol") { - throw new AssertionError( - flagMsg + "the argument to property must be a string, number, or symbol", - void 0, - ssfi - ); - } - } - if (isNested && isOwn) { - throw new AssertionError( - flagMsg + 'The "nested" and "own" flags cannot be combined.', - void 0, - ssfi - ); - } - if (obj === null || obj === void 0) { - throw new AssertionError( - flagMsg + "Target cannot be null or undefined.", - void 0, - ssfi - ); - } - let isDeep = flag2(this, "deep"), negate = flag2(this, "negate"), pathInfo = isNested ? getPathInfo(obj, name) : null, value = isNested ? pathInfo.value : obj[name], isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2; - let descriptor = ""; - if (isDeep) descriptor += "deep "; - if (isOwn) descriptor += "own "; - if (isNested) descriptor += "nested "; - descriptor += "property "; - let hasProperty2; - if (isOwn) hasProperty2 = Object.prototype.hasOwnProperty.call(obj, name); - else if (isNested) hasProperty2 = pathInfo.exists; - else hasProperty2 = hasProperty(obj, name); - if (!negate || arguments.length === 1) { - this.assert( - hasProperty2, - "expected #{this} to have " + descriptor + inspect2(name), - "expected #{this} to not have " + descriptor + inspect2(name) - ); - } - if (arguments.length > 1) { - this.assert( - hasProperty2 && isEql(val, value), - "expected #{this} to have " + descriptor + inspect2(name) + " of #{exp}, but got #{act}", - "expected #{this} to not have " + descriptor + inspect2(name) + " of #{act}", - val, - value - ); - } - flag2(this, "object", value); -} -__name(assertProperty, "assertProperty"); -Assertion.addMethod("property", assertProperty); -function assertOwnProperty(_name, _value, _msg) { - flag2(this, "own", true); - assertProperty.apply(this, arguments); -} -__name(assertOwnProperty, "assertOwnProperty"); -Assertion.addMethod("ownProperty", assertOwnProperty); -Assertion.addMethod("haveOwnProperty", assertOwnProperty); -function assertOwnPropertyDescriptor(name, descriptor, msg) { - if (typeof descriptor === "string") { - msg = descriptor; - descriptor = null; - } - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"); - let actualDescriptor = Object.getOwnPropertyDescriptor(Object(obj), name); - let eql = flag2(this, "eql"); - if (actualDescriptor && descriptor) { - this.assert( - eql(descriptor, actualDescriptor), - "expected the own property descriptor for " + inspect2(name) + " on #{this} to match " + inspect2(descriptor) + ", got " + inspect2(actualDescriptor), - "expected the own property descriptor for " + inspect2(name) + " on #{this} to not match " + inspect2(descriptor), - descriptor, - actualDescriptor, - true - ); - } else { - this.assert( - actualDescriptor, - "expected #{this} to have an own property descriptor for " + inspect2(name), - "expected #{this} to not have an own property descriptor for " + inspect2(name) - ); - } - flag2(this, "object", actualDescriptor); -} -__name(assertOwnPropertyDescriptor, "assertOwnPropertyDescriptor"); -Assertion.addMethod("ownPropertyDescriptor", assertOwnPropertyDescriptor); -Assertion.addMethod("haveOwnPropertyDescriptor", assertOwnPropertyDescriptor); -function assertLengthChain() { - flag2(this, "doLength", true); -} -__name(assertLengthChain, "assertLengthChain"); -function assertLength(n, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), objType = type(obj).toLowerCase(), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), descriptor = "length", itemsCount; - switch (objType) { - case "map": - case "set": - descriptor = "size"; - itemsCount = obj.size; - break; - default: - new Assertion(obj, flagMsg, ssfi, true).to.have.property("length"); - itemsCount = obj.length; - } - this.assert( - itemsCount == n, - "expected #{this} to have a " + descriptor + " of #{exp} but got #{act}", - "expected #{this} to not have a " + descriptor + " of #{act}", - n, - itemsCount - ); -} -__name(assertLength, "assertLength"); -Assertion.addChainableMethod("length", assertLength, assertLengthChain); -Assertion.addChainableMethod("lengthOf", assertLength, assertLengthChain); -function assertMatch(re, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"); - this.assert( - re.exec(obj), - "expected #{this} to match " + re, - "expected #{this} not to match " + re - ); -} -__name(assertMatch, "assertMatch"); -Assertion.addMethod("match", assertMatch); -Assertion.addMethod("matches", assertMatch); -Assertion.addMethod("string", function(str, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(obj, flagMsg, ssfi, true).is.a("string"); - this.assert( - ~obj.indexOf(str), - "expected #{this} to contain " + inspect2(str), - "expected #{this} to not contain " + inspect2(str) - ); -}); -function assertKeys(keys) { - let obj = flag2(this, "object"), objType = type(obj), keysType = type(keys), ssfi = flag2(this, "ssfi"), isDeep = flag2(this, "deep"), str, deepStr = "", actual, ok = true, flagMsg = flag2(this, "message"); - flagMsg = flagMsg ? flagMsg + ": " : ""; - let mixedArgsMsg = flagMsg + "when testing keys against an object or an array you must give a single Array|Object|String argument or multiple String arguments"; - if (objType === "Map" || objType === "Set") { - deepStr = isDeep ? "deeply " : ""; - actual = []; - obj.forEach(function(val, key) { - actual.push(key); - }); - if (keysType !== "Array") { - keys = Array.prototype.slice.call(arguments); - } - } else { - actual = getOwnEnumerableProperties(obj); - switch (keysType) { - case "Array": - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, void 0, ssfi); - } - break; - case "Object": - if (arguments.length > 1) { - throw new AssertionError(mixedArgsMsg, void 0, ssfi); - } - keys = Object.keys(keys); - break; - default: - keys = Array.prototype.slice.call(arguments); - } - keys = keys.map(function(val) { - return typeof val === "symbol" ? val : String(val); - }); - } - if (!keys.length) { - throw new AssertionError(flagMsg + "keys required", void 0, ssfi); - } - let len = keys.length, any = flag2(this, "any"), all = flag2(this, "all"), expected = keys, isEql = isDeep ? flag2(this, "eql") : (val1, val2) => val1 === val2; - if (!any && !all) { - all = true; - } - if (any) { - ok = expected.some(function(expectedKey) { - return actual.some(function(actualKey) { - return isEql(expectedKey, actualKey); - }); - }); - } - if (all) { - ok = expected.every(function(expectedKey) { - return actual.some(function(actualKey) { - return isEql(expectedKey, actualKey); - }); - }); - if (!flag2(this, "contains")) { - ok = ok && keys.length == actual.length; - } - } - if (len > 1) { - keys = keys.map(function(key) { - return inspect2(key); - }); - let last = keys.pop(); - if (all) { - str = keys.join(", ") + ", and " + last; - } - if (any) { - str = keys.join(", ") + ", or " + last; - } - } else { - str = inspect2(keys[0]); - } - str = (len > 1 ? "keys " : "key ") + str; - str = (flag2(this, "contains") ? "contain " : "have ") + str; - this.assert( - ok, - "expected #{this} to " + deepStr + str, - "expected #{this} to not " + deepStr + str, - expected.slice(0).sort(compareByInspect), - actual.sort(compareByInspect), - true - ); -} -__name(assertKeys, "assertKeys"); -Assertion.addMethod("keys", assertKeys); -Assertion.addMethod("key", assertKeys); -function assertThrows(errorLike, errMsgMatcher, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), ssfi = flag2(this, "ssfi"), flagMsg = flag2(this, "message"), negate = flag2(this, "negate") || false; - new Assertion(obj, flagMsg, ssfi, true).is.a("function"); - if (isRegExp2(errorLike) || typeof errorLike === "string") { - errMsgMatcher = errorLike; - errorLike = null; - } - let caughtErr; - let errorWasThrown = false; - try { - obj(); - } catch (err) { - errorWasThrown = true; - caughtErr = err; - } - let everyArgIsUndefined = errorLike === void 0 && errMsgMatcher === void 0; - let everyArgIsDefined = Boolean(errorLike && errMsgMatcher); - let errorLikeFail = false; - let errMsgMatcherFail = false; - if (everyArgIsUndefined || !everyArgIsUndefined && !negate) { - let errorLikeString = "an error"; - if (errorLike instanceof Error) { - errorLikeString = "#{exp}"; - } else if (errorLike) { - errorLikeString = check_error_exports.getConstructorName(errorLike); - } - let actual = caughtErr; - if (caughtErr instanceof Error) { - actual = caughtErr.toString(); - } else if (typeof caughtErr === "string") { - actual = caughtErr; - } else if (caughtErr && (typeof caughtErr === "object" || typeof caughtErr === "function")) { - try { - actual = check_error_exports.getConstructorName(caughtErr); - } catch (_err) { - } - } - this.assert( - errorWasThrown, - "expected #{this} to throw " + errorLikeString, - "expected #{this} to not throw an error but #{act} was thrown", - errorLike && errorLike.toString(), - actual - ); - } - if (errorLike && caughtErr) { - if (errorLike instanceof Error) { - let isCompatibleInstance = check_error_exports.compatibleInstance( - caughtErr, - errorLike - ); - if (isCompatibleInstance === negate) { - if (everyArgIsDefined && negate) { - errorLikeFail = true; - } else { - this.assert( - negate, - "expected #{this} to throw #{exp} but #{act} was thrown", - "expected #{this} to not throw #{exp}" + (caughtErr && !negate ? " but #{act} was thrown" : ""), - errorLike.toString(), - caughtErr.toString() - ); - } - } - } - let isCompatibleConstructor = check_error_exports.compatibleConstructor( - caughtErr, - errorLike - ); - if (isCompatibleConstructor === negate) { - if (everyArgIsDefined && negate) { - errorLikeFail = true; - } else { - this.assert( - negate, - "expected #{this} to throw #{exp} but #{act} was thrown", - "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), - errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), - caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr) - ); - } - } - } - if (caughtErr && errMsgMatcher !== void 0 && errMsgMatcher !== null) { - let placeholder = "including"; - if (isRegExp2(errMsgMatcher)) { - placeholder = "matching"; - } - let isCompatibleMessage = check_error_exports.compatibleMessage( - caughtErr, - errMsgMatcher - ); - if (isCompatibleMessage === negate) { - if (everyArgIsDefined && negate) { - errMsgMatcherFail = true; - } else { - this.assert( - negate, - "expected #{this} to throw error " + placeholder + " #{exp} but got #{act}", - "expected #{this} to throw error not " + placeholder + " #{exp}", - errMsgMatcher, - check_error_exports.getMessage(caughtErr) - ); - } - } - } - if (errorLikeFail && errMsgMatcherFail) { - this.assert( - negate, - "expected #{this} to throw #{exp} but #{act} was thrown", - "expected #{this} to not throw #{exp}" + (caughtErr ? " but #{act} was thrown" : ""), - errorLike instanceof Error ? errorLike.toString() : errorLike && check_error_exports.getConstructorName(errorLike), - caughtErr instanceof Error ? caughtErr.toString() : caughtErr && check_error_exports.getConstructorName(caughtErr) - ); - } - flag2(this, "object", caughtErr); -} -__name(assertThrows, "assertThrows"); -Assertion.addMethod("throw", assertThrows); -Assertion.addMethod("throws", assertThrows); -Assertion.addMethod("Throw", assertThrows); -function respondTo(method, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), itself = flag2(this, "itself"), context = "function" === typeof obj && !itself ? obj.prototype[method] : obj[method]; - this.assert( - "function" === typeof context, - "expected #{this} to respond to " + inspect2(method), - "expected #{this} to not respond to " + inspect2(method) - ); -} -__name(respondTo, "respondTo"); -Assertion.addMethod("respondTo", respondTo); -Assertion.addMethod("respondsTo", respondTo); -Assertion.addProperty("itself", function() { - flag2(this, "itself", true); -}); -function satisfy(matcher, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"); - let result = matcher(obj); - this.assert( - result, - "expected #{this} to satisfy " + objDisplay(matcher), - "expected #{this} to not satisfy" + objDisplay(matcher), - flag2(this, "negate") ? false : true, - result - ); -} -__name(satisfy, "satisfy"); -Assertion.addMethod("satisfy", satisfy); -Assertion.addMethod("satisfies", satisfy); -function closeTo(expected, delta, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(obj, flagMsg, ssfi, true).is.numeric; - let message = "A `delta` value is required for `closeTo`"; - if (delta == void 0) { - throw new AssertionError( - flagMsg ? `${flagMsg}: ${message}` : message, - void 0, - ssfi - ); - } - new Assertion(delta, flagMsg, ssfi, true).is.numeric; - message = "A `expected` value is required for `closeTo`"; - if (expected == void 0) { - throw new AssertionError( - flagMsg ? `${flagMsg}: ${message}` : message, - void 0, - ssfi - ); - } - new Assertion(expected, flagMsg, ssfi, true).is.numeric; - const abs = /* @__PURE__ */ __name((x) => x < 0 ? -x : x, "abs"); - const strip = /* @__PURE__ */ __name((number) => parseFloat(parseFloat(number).toPrecision(12)), "strip"); - this.assert( - strip(abs(obj - expected)) <= delta, - "expected #{this} to be close to " + expected + " +/- " + delta, - "expected #{this} not to be close to " + expected + " +/- " + delta - ); -} -__name(closeTo, "closeTo"); -Assertion.addMethod("closeTo", closeTo); -Assertion.addMethod("approximately", closeTo); -function isSubsetOf(_subset, _superset, cmp, contains, ordered) { - let superset = Array.from(_superset); - let subset = Array.from(_subset); - if (!contains) { - if (subset.length !== superset.length) return false; - superset = superset.slice(); - } - return subset.every(function(elem, idx) { - if (ordered) return cmp ? cmp(elem, superset[idx]) : elem === superset[idx]; - if (!cmp) { - let matchIdx = superset.indexOf(elem); - if (matchIdx === -1) return false; - if (!contains) superset.splice(matchIdx, 1); - return true; - } - return superset.some(function(elem2, matchIdx) { - if (!cmp(elem, elem2)) return false; - if (!contains) superset.splice(matchIdx, 1); - return true; - }); - }); -} -__name(isSubsetOf, "isSubsetOf"); -Assertion.addMethod("members", function(subset, msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(obj, flagMsg, ssfi, true).to.be.iterable; - new Assertion(subset, flagMsg, ssfi, true).to.be.iterable; - let contains = flag2(this, "contains"); - let ordered = flag2(this, "ordered"); - let subject, failMsg, failNegateMsg; - if (contains) { - subject = ordered ? "an ordered superset" : "a superset"; - failMsg = "expected #{this} to be " + subject + " of #{exp}"; - failNegateMsg = "expected #{this} to not be " + subject + " of #{exp}"; - } else { - subject = ordered ? "ordered members" : "members"; - failMsg = "expected #{this} to have the same " + subject + " as #{exp}"; - failNegateMsg = "expected #{this} to not have the same " + subject + " as #{exp}"; - } - let cmp = flag2(this, "deep") ? flag2(this, "eql") : void 0; - this.assert( - isSubsetOf(subset, obj, cmp, contains, ordered), - failMsg, - failNegateMsg, - subset, - obj, - true - ); -}); -Assertion.addProperty("iterable", function(msg) { - if (msg) flag2(this, "message", msg); - let obj = flag2(this, "object"); - this.assert( - obj != void 0 && obj[Symbol.iterator], - "expected #{this} to be an iterable", - "expected #{this} to not be an iterable", - obj - ); -}); -function oneOf(list, msg) { - if (msg) flag2(this, "message", msg); - let expected = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"), contains = flag2(this, "contains"), isDeep = flag2(this, "deep"), eql = flag2(this, "eql"); - new Assertion(list, flagMsg, ssfi, true).to.be.an("array"); - if (contains) { - this.assert( - list.some(function(possibility) { - return expected.indexOf(possibility) > -1; - }), - "expected #{this} to contain one of #{exp}", - "expected #{this} to not contain one of #{exp}", - list, - expected - ); - } else { - if (isDeep) { - this.assert( - list.some(function(possibility) { - return eql(expected, possibility); - }), - "expected #{this} to deeply equal one of #{exp}", - "expected #{this} to deeply equal one of #{exp}", - list, - expected - ); - } else { - this.assert( - list.indexOf(expected) > -1, - "expected #{this} to be one of #{exp}", - "expected #{this} to not be one of #{exp}", - list, - expected - ); - } - } -} -__name(oneOf, "oneOf"); -Assertion.addMethod("oneOf", oneOf); -function assertChanges(subject, prop, msg) { - if (msg) flag2(this, "message", msg); - let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(fn, flagMsg, ssfi, true).is.a("function"); - let initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a("function"); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - fn(); - let final = prop === void 0 || prop === null ? subject() : subject[prop]; - let msgObj = prop === void 0 || prop === null ? initial : "." + prop; - flag2(this, "deltaMsgObj", msgObj); - flag2(this, "initialDeltaValue", initial); - flag2(this, "finalDeltaValue", final); - flag2(this, "deltaBehavior", "change"); - flag2(this, "realDelta", final !== initial); - this.assert( - initial !== final, - "expected " + msgObj + " to change", - "expected " + msgObj + " to not change" - ); -} -__name(assertChanges, "assertChanges"); -Assertion.addMethod("change", assertChanges); -Assertion.addMethod("changes", assertChanges); -function assertIncreases(subject, prop, msg) { - if (msg) flag2(this, "message", msg); - let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(fn, flagMsg, ssfi, true).is.a("function"); - let initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a("function"); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - new Assertion(initial, flagMsg, ssfi, true).is.a("number"); - fn(); - let final = prop === void 0 || prop === null ? subject() : subject[prop]; - let msgObj = prop === void 0 || prop === null ? initial : "." + prop; - flag2(this, "deltaMsgObj", msgObj); - flag2(this, "initialDeltaValue", initial); - flag2(this, "finalDeltaValue", final); - flag2(this, "deltaBehavior", "increase"); - flag2(this, "realDelta", final - initial); - this.assert( - final - initial > 0, - "expected " + msgObj + " to increase", - "expected " + msgObj + " to not increase" - ); -} -__name(assertIncreases, "assertIncreases"); -Assertion.addMethod("increase", assertIncreases); -Assertion.addMethod("increases", assertIncreases); -function assertDecreases(subject, prop, msg) { - if (msg) flag2(this, "message", msg); - let fn = flag2(this, "object"), flagMsg = flag2(this, "message"), ssfi = flag2(this, "ssfi"); - new Assertion(fn, flagMsg, ssfi, true).is.a("function"); - let initial; - if (!prop) { - new Assertion(subject, flagMsg, ssfi, true).is.a("function"); - initial = subject(); - } else { - new Assertion(subject, flagMsg, ssfi, true).to.have.property(prop); - initial = subject[prop]; - } - new Assertion(initial, flagMsg, ssfi, true).is.a("number"); - fn(); - let final = prop === void 0 || prop === null ? subject() : subject[prop]; - let msgObj = prop === void 0 || prop === null ? initial : "." + prop; - flag2(this, "deltaMsgObj", msgObj); - flag2(this, "initialDeltaValue", initial); - flag2(this, "finalDeltaValue", final); - flag2(this, "deltaBehavior", "decrease"); - flag2(this, "realDelta", initial - final); - this.assert( - final - initial < 0, - "expected " + msgObj + " to decrease", - "expected " + msgObj + " to not decrease" - ); -} -__name(assertDecreases, "assertDecreases"); -Assertion.addMethod("decrease", assertDecreases); -Assertion.addMethod("decreases", assertDecreases); -function assertDelta(delta, msg) { - if (msg) flag2(this, "message", msg); - let msgObj = flag2(this, "deltaMsgObj"); - let initial = flag2(this, "initialDeltaValue"); - let final = flag2(this, "finalDeltaValue"); - let behavior = flag2(this, "deltaBehavior"); - let realDelta = flag2(this, "realDelta"); - let expression; - if (behavior === "change") { - expression = Math.abs(final - initial) === Math.abs(delta); - } else { - expression = realDelta === Math.abs(delta); - } - this.assert( - expression, - "expected " + msgObj + " to " + behavior + " by " + delta, - "expected " + msgObj + " to not " + behavior + " by " + delta - ); -} -__name(assertDelta, "assertDelta"); -Assertion.addMethod("by", assertDelta); -Assertion.addProperty("extensible", function() { - let obj = flag2(this, "object"); - let isExtensible = obj === Object(obj) && Object.isExtensible(obj); - this.assert( - isExtensible, - "expected #{this} to be extensible", - "expected #{this} to not be extensible" - ); -}); -Assertion.addProperty("sealed", function() { - let obj = flag2(this, "object"); - let isSealed = obj === Object(obj) ? Object.isSealed(obj) : true; - this.assert( - isSealed, - "expected #{this} to be sealed", - "expected #{this} to not be sealed" - ); -}); -Assertion.addProperty("frozen", function() { - let obj = flag2(this, "object"); - let isFrozen = obj === Object(obj) ? Object.isFrozen(obj) : true; - this.assert( - isFrozen, - "expected #{this} to be frozen", - "expected #{this} to not be frozen" - ); -}); -Assertion.addProperty("finite", function(_msg) { - let obj = flag2(this, "object"); - this.assert( - typeof obj === "number" && isFinite(obj), - "expected #{this} to be a finite number", - "expected #{this} to not be a finite number" - ); -}); -function compareSubset(expected, actual) { - if (expected === actual) { - return true; - } - if (typeof actual !== typeof expected) { - return false; - } - if (typeof expected !== "object" || expected === null) { - return expected === actual; - } - if (!actual) { - return false; - } - if (Array.isArray(expected)) { - if (!Array.isArray(actual)) { - return false; - } - return expected.every(function(exp) { - return actual.some(function(act) { - return compareSubset(exp, act); - }); - }); - } - if (expected instanceof Date) { - if (actual instanceof Date) { - return expected.getTime() === actual.getTime(); - } else { - return false; - } - } - return Object.keys(expected).every(function(key) { - let expectedValue = expected[key]; - let actualValue = actual[key]; - if (typeof expectedValue === "object" && expectedValue !== null && actualValue !== null) { - return compareSubset(expectedValue, actualValue); - } - if (typeof expectedValue === "function") { - return expectedValue(actualValue); - } - return actualValue === expectedValue; - }); -} -__name(compareSubset, "compareSubset"); -Assertion.addMethod("containSubset", function(expected) { - const actual = flag(this, "object"); - const showDiff = config.showDiff; - this.assert( - compareSubset(expected, actual), - "expected #{act} to contain subset #{exp}", - "expected #{act} to not contain subset #{exp}", - expected, - actual, - showDiff - ); -}); - -// lib/chai/interface/expect.js -function expect(val, message) { - return new Assertion(val, message); -} -__name(expect, "expect"); -expect.fail = function(actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = void 0; - } - message = message || "expect.fail()"; - throw new AssertionError( - message, - { - actual, - expected, - operator - }, - expect.fail - ); -}; - -// lib/chai/interface/should.js -var should_exports = {}; -__export(should_exports, { - Should: () => Should, - should: () => should -}); -function loadShould() { - function shouldGetter() { - if (this instanceof String || this instanceof Number || this instanceof Boolean || typeof Symbol === "function" && this instanceof Symbol || typeof BigInt === "function" && this instanceof BigInt) { - return new Assertion(this.valueOf(), null, shouldGetter); - } - return new Assertion(this, null, shouldGetter); - } - __name(shouldGetter, "shouldGetter"); - function shouldSetter(value) { - Object.defineProperty(this, "should", { - value, - enumerable: true, - configurable: true, - writable: true - }); - } - __name(shouldSetter, "shouldSetter"); - Object.defineProperty(Object.prototype, "should", { - set: shouldSetter, - get: shouldGetter, - configurable: true - }); - let should2 = {}; - should2.fail = function(actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = void 0; - } - message = message || "should.fail()"; - throw new AssertionError( - message, - { - actual, - expected, - operator - }, - should2.fail - ); - }; - should2.equal = function(actual, expected, message) { - new Assertion(actual, message).to.equal(expected); - }; - should2.Throw = function(fn, errt, errs, msg) { - new Assertion(fn, msg).to.Throw(errt, errs); - }; - should2.exist = function(val, msg) { - new Assertion(val, msg).to.exist; - }; - should2.not = {}; - should2.not.equal = function(actual, expected, msg) { - new Assertion(actual, msg).to.not.equal(expected); - }; - should2.not.Throw = function(fn, errt, errs, msg) { - new Assertion(fn, msg).to.not.Throw(errt, errs); - }; - should2.not.exist = function(val, msg) { - new Assertion(val, msg).to.not.exist; - }; - should2["throw"] = should2["Throw"]; - should2.not["throw"] = should2.not["Throw"]; - return should2; -} -__name(loadShould, "loadShould"); -var should = loadShould; -var Should = loadShould; - -// lib/chai/interface/assert.js -function assert(express, errmsg) { - let test2 = new Assertion(null, null, assert, true); - test2.assert(express, errmsg, "[ negation message unavailable ]"); -} -__name(assert, "assert"); -assert.fail = function(actual, expected, message, operator) { - if (arguments.length < 2) { - message = actual; - actual = void 0; - } - message = message || "assert.fail()"; - throw new AssertionError( - message, - { - actual, - expected, - operator - }, - assert.fail - ); -}; -assert.isOk = function(val, msg) { - new Assertion(val, msg, assert.isOk, true).is.ok; -}; -assert.isNotOk = function(val, msg) { - new Assertion(val, msg, assert.isNotOk, true).is.not.ok; -}; -assert.equal = function(act, exp, msg) { - let test2 = new Assertion(act, msg, assert.equal, true); - test2.assert( - exp == flag(test2, "object"), - "expected #{this} to equal #{exp}", - "expected #{this} to not equal #{act}", - exp, - act, - true - ); -}; -assert.notEqual = function(act, exp, msg) { - let test2 = new Assertion(act, msg, assert.notEqual, true); - test2.assert( - exp != flag(test2, "object"), - "expected #{this} to not equal #{exp}", - "expected #{this} to equal #{act}", - exp, - act, - true - ); -}; -assert.strictEqual = function(act, exp, msg) { - new Assertion(act, msg, assert.strictEqual, true).to.equal(exp); -}; -assert.notStrictEqual = function(act, exp, msg) { - new Assertion(act, msg, assert.notStrictEqual, true).to.not.equal(exp); -}; -assert.deepEqual = assert.deepStrictEqual = function(act, exp, msg) { - new Assertion(act, msg, assert.deepEqual, true).to.eql(exp); -}; -assert.notDeepEqual = function(act, exp, msg) { - new Assertion(act, msg, assert.notDeepEqual, true).to.not.eql(exp); -}; -assert.isAbove = function(val, abv, msg) { - new Assertion(val, msg, assert.isAbove, true).to.be.above(abv); -}; -assert.isAtLeast = function(val, atlst, msg) { - new Assertion(val, msg, assert.isAtLeast, true).to.be.least(atlst); -}; -assert.isBelow = function(val, blw, msg) { - new Assertion(val, msg, assert.isBelow, true).to.be.below(blw); -}; -assert.isAtMost = function(val, atmst, msg) { - new Assertion(val, msg, assert.isAtMost, true).to.be.most(atmst); -}; -assert.isTrue = function(val, msg) { - new Assertion(val, msg, assert.isTrue, true).is["true"]; -}; -assert.isNotTrue = function(val, msg) { - new Assertion(val, msg, assert.isNotTrue, true).to.not.equal(true); -}; -assert.isFalse = function(val, msg) { - new Assertion(val, msg, assert.isFalse, true).is["false"]; -}; -assert.isNotFalse = function(val, msg) { - new Assertion(val, msg, assert.isNotFalse, true).to.not.equal(false); -}; -assert.isNull = function(val, msg) { - new Assertion(val, msg, assert.isNull, true).to.equal(null); -}; -assert.isNotNull = function(val, msg) { - new Assertion(val, msg, assert.isNotNull, true).to.not.equal(null); -}; -assert.isNaN = function(val, msg) { - new Assertion(val, msg, assert.isNaN, true).to.be.NaN; -}; -assert.isNotNaN = function(value, message) { - new Assertion(value, message, assert.isNotNaN, true).not.to.be.NaN; -}; -assert.exists = function(val, msg) { - new Assertion(val, msg, assert.exists, true).to.exist; -}; -assert.notExists = function(val, msg) { - new Assertion(val, msg, assert.notExists, true).to.not.exist; -}; -assert.isUndefined = function(val, msg) { - new Assertion(val, msg, assert.isUndefined, true).to.equal(void 0); -}; -assert.isDefined = function(val, msg) { - new Assertion(val, msg, assert.isDefined, true).to.not.equal(void 0); -}; -assert.isCallable = function(value, message) { - new Assertion(value, message, assert.isCallable, true).is.callable; -}; -assert.isNotCallable = function(value, message) { - new Assertion(value, message, assert.isNotCallable, true).is.not.callable; -}; -assert.isObject = function(val, msg) { - new Assertion(val, msg, assert.isObject, true).to.be.a("object"); -}; -assert.isNotObject = function(val, msg) { - new Assertion(val, msg, assert.isNotObject, true).to.not.be.a("object"); -}; -assert.isArray = function(val, msg) { - new Assertion(val, msg, assert.isArray, true).to.be.an("array"); -}; -assert.isNotArray = function(val, msg) { - new Assertion(val, msg, assert.isNotArray, true).to.not.be.an("array"); -}; -assert.isString = function(val, msg) { - new Assertion(val, msg, assert.isString, true).to.be.a("string"); -}; -assert.isNotString = function(val, msg) { - new Assertion(val, msg, assert.isNotString, true).to.not.be.a("string"); -}; -assert.isNumber = function(val, msg) { - new Assertion(val, msg, assert.isNumber, true).to.be.a("number"); -}; -assert.isNotNumber = function(val, msg) { - new Assertion(val, msg, assert.isNotNumber, true).to.not.be.a("number"); -}; -assert.isNumeric = function(val, msg) { - new Assertion(val, msg, assert.isNumeric, true).is.numeric; -}; -assert.isNotNumeric = function(val, msg) { - new Assertion(val, msg, assert.isNotNumeric, true).is.not.numeric; -}; -assert.isFinite = function(val, msg) { - new Assertion(val, msg, assert.isFinite, true).to.be.finite; -}; -assert.isBoolean = function(val, msg) { - new Assertion(val, msg, assert.isBoolean, true).to.be.a("boolean"); -}; -assert.isNotBoolean = function(val, msg) { - new Assertion(val, msg, assert.isNotBoolean, true).to.not.be.a("boolean"); -}; -assert.typeOf = function(val, type3, msg) { - new Assertion(val, msg, assert.typeOf, true).to.be.a(type3); -}; -assert.notTypeOf = function(value, type3, message) { - new Assertion(value, message, assert.notTypeOf, true).to.not.be.a(type3); -}; -assert.instanceOf = function(val, type3, msg) { - new Assertion(val, msg, assert.instanceOf, true).to.be.instanceOf(type3); -}; -assert.notInstanceOf = function(val, type3, msg) { - new Assertion(val, msg, assert.notInstanceOf, true).to.not.be.instanceOf( - type3 - ); -}; -assert.include = function(exp, inc, msg) { - new Assertion(exp, msg, assert.include, true).include(inc); -}; -assert.notInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notInclude, true).not.include(inc); -}; -assert.deepInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepInclude, true).deep.include(inc); -}; -assert.notDeepInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepInclude, true).not.deep.include(inc); -}; -assert.nestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.nestedInclude, true).nested.include(inc); -}; -assert.notNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notNestedInclude, true).not.nested.include( - inc - ); -}; -assert.deepNestedInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepNestedInclude, true).deep.nested.include( - inc - ); -}; -assert.notDeepNestedInclude = function(exp, inc, msg) { - new Assertion( - exp, - msg, - assert.notDeepNestedInclude, - true - ).not.deep.nested.include(inc); -}; -assert.ownInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.ownInclude, true).own.include(inc); -}; -assert.notOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notOwnInclude, true).not.own.include(inc); -}; -assert.deepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.deepOwnInclude, true).deep.own.include(inc); -}; -assert.notDeepOwnInclude = function(exp, inc, msg) { - new Assertion(exp, msg, assert.notDeepOwnInclude, true).not.deep.own.include( - inc - ); -}; -assert.match = function(exp, re, msg) { - new Assertion(exp, msg, assert.match, true).to.match(re); -}; -assert.notMatch = function(exp, re, msg) { - new Assertion(exp, msg, assert.notMatch, true).to.not.match(re); -}; -assert.property = function(obj, prop, msg) { - new Assertion(obj, msg, assert.property, true).to.have.property(prop); -}; -assert.notProperty = function(obj, prop, msg) { - new Assertion(obj, msg, assert.notProperty, true).to.not.have.property(prop); -}; -assert.propertyVal = function(obj, prop, val, msg) { - new Assertion(obj, msg, assert.propertyVal, true).to.have.property(prop, val); -}; -assert.notPropertyVal = function(obj, prop, val, msg) { - new Assertion(obj, msg, assert.notPropertyVal, true).to.not.have.property( - prop, - val - ); -}; -assert.deepPropertyVal = function(obj, prop, val, msg) { - new Assertion(obj, msg, assert.deepPropertyVal, true).to.have.deep.property( - prop, - val - ); -}; -assert.notDeepPropertyVal = function(obj, prop, val, msg) { - new Assertion( - obj, - msg, - assert.notDeepPropertyVal, - true - ).to.not.have.deep.property(prop, val); -}; -assert.ownProperty = function(obj, prop, msg) { - new Assertion(obj, msg, assert.ownProperty, true).to.have.own.property(prop); -}; -assert.notOwnProperty = function(obj, prop, msg) { - new Assertion(obj, msg, assert.notOwnProperty, true).to.not.have.own.property( - prop - ); -}; -assert.ownPropertyVal = function(obj, prop, value, msg) { - new Assertion(obj, msg, assert.ownPropertyVal, true).to.have.own.property( - prop, - value - ); -}; -assert.notOwnPropertyVal = function(obj, prop, value, msg) { - new Assertion( - obj, - msg, - assert.notOwnPropertyVal, - true - ).to.not.have.own.property(prop, value); -}; -assert.deepOwnPropertyVal = function(obj, prop, value, msg) { - new Assertion( - obj, - msg, - assert.deepOwnPropertyVal, - true - ).to.have.deep.own.property(prop, value); -}; -assert.notDeepOwnPropertyVal = function(obj, prop, value, msg) { - new Assertion( - obj, - msg, - assert.notDeepOwnPropertyVal, - true - ).to.not.have.deep.own.property(prop, value); -}; -assert.nestedProperty = function(obj, prop, msg) { - new Assertion(obj, msg, assert.nestedProperty, true).to.have.nested.property( - prop - ); -}; -assert.notNestedProperty = function(obj, prop, msg) { - new Assertion( - obj, - msg, - assert.notNestedProperty, - true - ).to.not.have.nested.property(prop); -}; -assert.nestedPropertyVal = function(obj, prop, val, msg) { - new Assertion( - obj, - msg, - assert.nestedPropertyVal, - true - ).to.have.nested.property(prop, val); -}; -assert.notNestedPropertyVal = function(obj, prop, val, msg) { - new Assertion( - obj, - msg, - assert.notNestedPropertyVal, - true - ).to.not.have.nested.property(prop, val); -}; -assert.deepNestedPropertyVal = function(obj, prop, val, msg) { - new Assertion( - obj, - msg, - assert.deepNestedPropertyVal, - true - ).to.have.deep.nested.property(prop, val); -}; -assert.notDeepNestedPropertyVal = function(obj, prop, val, msg) { - new Assertion( - obj, - msg, - assert.notDeepNestedPropertyVal, - true - ).to.not.have.deep.nested.property(prop, val); -}; -assert.lengthOf = function(exp, len, msg) { - new Assertion(exp, msg, assert.lengthOf, true).to.have.lengthOf(len); -}; -assert.hasAnyKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyKeys, true).to.have.any.keys(keys); -}; -assert.hasAllKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllKeys, true).to.have.all.keys(keys); -}; -assert.containsAllKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.containsAllKeys, true).to.contain.all.keys( - keys - ); -}; -assert.doesNotHaveAnyKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAnyKeys, true).to.not.have.any.keys( - keys - ); -}; -assert.doesNotHaveAllKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.doesNotHaveAllKeys, true).to.not.have.all.keys( - keys - ); -}; -assert.hasAnyDeepKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.hasAnyDeepKeys, true).to.have.any.deep.keys( - keys - ); -}; -assert.hasAllDeepKeys = function(obj, keys, msg) { - new Assertion(obj, msg, assert.hasAllDeepKeys, true).to.have.all.deep.keys( - keys - ); -}; -assert.containsAllDeepKeys = function(obj, keys, msg) { - new Assertion( - obj, - msg, - assert.containsAllDeepKeys, - true - ).to.contain.all.deep.keys(keys); -}; -assert.doesNotHaveAnyDeepKeys = function(obj, keys, msg) { - new Assertion( - obj, - msg, - assert.doesNotHaveAnyDeepKeys, - true - ).to.not.have.any.deep.keys(keys); -}; -assert.doesNotHaveAllDeepKeys = function(obj, keys, msg) { - new Assertion( - obj, - msg, - assert.doesNotHaveAllDeepKeys, - true - ).to.not.have.all.deep.keys(keys); -}; -assert.throws = function(fn, errorLike, errMsgMatcher, msg) { - if ("string" === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - let assertErr = new Assertion(fn, msg, assert.throws, true).to.throw( - errorLike, - errMsgMatcher - ); - return flag(assertErr, "object"); -}; -assert.doesNotThrow = function(fn, errorLike, errMsgMatcher, message) { - if ("string" === typeof errorLike || errorLike instanceof RegExp) { - errMsgMatcher = errorLike; - errorLike = null; - } - new Assertion(fn, message, assert.doesNotThrow, true).to.not.throw( - errorLike, - errMsgMatcher - ); -}; -assert.operator = function(val, operator, val2, msg) { - let ok; - switch (operator) { - case "==": - ok = val == val2; - break; - case "===": - ok = val === val2; - break; - case ">": - ok = val > val2; - break; - case ">=": - ok = val >= val2; - break; - case "<": - ok = val < val2; - break; - case "<=": - ok = val <= val2; - break; - case "!=": - ok = val != val2; - break; - case "!==": - ok = val !== val2; - break; - default: - msg = msg ? msg + ": " : msg; - throw new AssertionError( - msg + 'Invalid operator "' + operator + '"', - void 0, - assert.operator - ); - } - let test2 = new Assertion(ok, msg, assert.operator, true); - test2.assert( - true === flag(test2, "object"), - "expected " + inspect2(val) + " to be " + operator + " " + inspect2(val2), - "expected " + inspect2(val) + " to not be " + operator + " " + inspect2(val2) - ); -}; -assert.closeTo = function(act, exp, delta, msg) { - new Assertion(act, msg, assert.closeTo, true).to.be.closeTo(exp, delta); -}; -assert.approximately = function(act, exp, delta, msg) { - new Assertion(act, msg, assert.approximately, true).to.be.approximately( - exp, - delta - ); -}; -assert.sameMembers = function(set1, set2, msg) { - new Assertion(set1, msg, assert.sameMembers, true).to.have.same.members(set2); -}; -assert.notSameMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.notSameMembers, - true - ).to.not.have.same.members(set2); -}; -assert.sameDeepMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.sameDeepMembers, - true - ).to.have.same.deep.members(set2); -}; -assert.notSameDeepMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.notSameDeepMembers, - true - ).to.not.have.same.deep.members(set2); -}; -assert.sameOrderedMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.sameOrderedMembers, - true - ).to.have.same.ordered.members(set2); -}; -assert.notSameOrderedMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.notSameOrderedMembers, - true - ).to.not.have.same.ordered.members(set2); -}; -assert.sameDeepOrderedMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.sameDeepOrderedMembers, - true - ).to.have.same.deep.ordered.members(set2); -}; -assert.notSameDeepOrderedMembers = function(set1, set2, msg) { - new Assertion( - set1, - msg, - assert.notSameDeepOrderedMembers, - true - ).to.not.have.same.deep.ordered.members(set2); -}; -assert.includeMembers = function(superset, subset, msg) { - new Assertion(superset, msg, assert.includeMembers, true).to.include.members( - subset - ); -}; -assert.notIncludeMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.notIncludeMembers, - true - ).to.not.include.members(subset); -}; -assert.includeDeepMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.includeDeepMembers, - true - ).to.include.deep.members(subset); -}; -assert.notIncludeDeepMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.notIncludeDeepMembers, - true - ).to.not.include.deep.members(subset); -}; -assert.includeOrderedMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.includeOrderedMembers, - true - ).to.include.ordered.members(subset); -}; -assert.notIncludeOrderedMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.notIncludeOrderedMembers, - true - ).to.not.include.ordered.members(subset); -}; -assert.includeDeepOrderedMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.includeDeepOrderedMembers, - true - ).to.include.deep.ordered.members(subset); -}; -assert.notIncludeDeepOrderedMembers = function(superset, subset, msg) { - new Assertion( - superset, - msg, - assert.notIncludeDeepOrderedMembers, - true - ).to.not.include.deep.ordered.members(subset); -}; -assert.oneOf = function(inList, list, msg) { - new Assertion(inList, msg, assert.oneOf, true).to.be.oneOf(list); -}; -assert.isIterable = function(obj, msg) { - if (obj == void 0 || !obj[Symbol.iterator]) { - msg = msg ? `${msg} expected ${inspect2(obj)} to be an iterable` : `expected ${inspect2(obj)} to be an iterable`; - throw new AssertionError(msg, void 0, assert.isIterable); - } -}; -assert.changes = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - new Assertion(fn, msg, assert.changes, true).to.change(obj, prop); -}; -assert.changesBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.changesBy, true).to.change(obj, prop).by(delta); -}; -assert.doesNotChange = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - return new Assertion(fn, msg, assert.doesNotChange, true).to.not.change( - obj, - prop - ); -}; -assert.changesButNotBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.changesButNotBy, true).to.change(obj, prop).but.not.by(delta); -}; -assert.increases = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - return new Assertion(fn, msg, assert.increases, true).to.increase(obj, prop); -}; -assert.increasesBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.increasesBy, true).to.increase(obj, prop).by(delta); -}; -assert.doesNotIncrease = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - return new Assertion(fn, msg, assert.doesNotIncrease, true).to.not.increase( - obj, - prop - ); -}; -assert.increasesButNotBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.increasesButNotBy, true).to.increase(obj, prop).but.not.by(delta); -}; -assert.decreases = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - return new Assertion(fn, msg, assert.decreases, true).to.decrease(obj, prop); -}; -assert.decreasesBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.decreasesBy, true).to.decrease(obj, prop).by(delta); -}; -assert.doesNotDecrease = function(fn, obj, prop, msg) { - if (arguments.length === 3 && typeof obj === "function") { - msg = prop; - prop = null; - } - return new Assertion(fn, msg, assert.doesNotDecrease, true).to.not.decrease( - obj, - prop - ); -}; -assert.doesNotDecreaseBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - return new Assertion(fn, msg, assert.doesNotDecreaseBy, true).to.not.decrease(obj, prop).by(delta); -}; -assert.decreasesButNotBy = function(fn, obj, prop, delta, msg) { - if (arguments.length === 4 && typeof obj === "function") { - let tmpMsg = delta; - delta = prop; - msg = tmpMsg; - } else if (arguments.length === 3) { - delta = prop; - prop = null; - } - new Assertion(fn, msg, assert.decreasesButNotBy, true).to.decrease(obj, prop).but.not.by(delta); -}; -assert.ifError = function(val) { - if (val) { - throw val; - } -}; -assert.isExtensible = function(obj, msg) { - new Assertion(obj, msg, assert.isExtensible, true).to.be.extensible; -}; -assert.isNotExtensible = function(obj, msg) { - new Assertion(obj, msg, assert.isNotExtensible, true).to.not.be.extensible; -}; -assert.isSealed = function(obj, msg) { - new Assertion(obj, msg, assert.isSealed, true).to.be.sealed; -}; -assert.isNotSealed = function(obj, msg) { - new Assertion(obj, msg, assert.isNotSealed, true).to.not.be.sealed; -}; -assert.isFrozen = function(obj, msg) { - new Assertion(obj, msg, assert.isFrozen, true).to.be.frozen; -}; -assert.isNotFrozen = function(obj, msg) { - new Assertion(obj, msg, assert.isNotFrozen, true).to.not.be.frozen; -}; -assert.isEmpty = function(val, msg) { - new Assertion(val, msg, assert.isEmpty, true).to.be.empty; -}; -assert.isNotEmpty = function(val, msg) { - new Assertion(val, msg, assert.isNotEmpty, true).to.not.be.empty; -}; -assert.containsSubset = function(val, exp, msg) { - new Assertion(val, msg).to.containSubset(exp); -}; -assert.doesNotContainSubset = function(val, exp, msg) { - new Assertion(val, msg).to.not.containSubset(exp); -}; -var aliases = [ - ["isOk", "ok"], - ["isNotOk", "notOk"], - ["throws", "throw"], - ["throws", "Throw"], - ["isExtensible", "extensible"], - ["isNotExtensible", "notExtensible"], - ["isSealed", "sealed"], - ["isNotSealed", "notSealed"], - ["isFrozen", "frozen"], - ["isNotFrozen", "notFrozen"], - ["isEmpty", "empty"], - ["isNotEmpty", "notEmpty"], - ["isCallable", "isFunction"], - ["isNotCallable", "isNotFunction"], - ["containsSubset", "containSubset"] -]; -for (const [name, as] of aliases) { - assert[as] = assert[name]; -} - -// lib/chai.js -var used = []; -function use(fn) { - const exports = { - use, - AssertionError, - util: utils_exports, - config, - expect, - assert, - Assertion, - ...should_exports - }; - if (!~used.indexOf(fn)) { - fn(exports, utils_exports); - used.push(fn); - } - return exports; -} -__name(use, "use"); -export { - Assertion, - AssertionError, - Should, - assert, - config, - expect, - should, - use, - utils_exports as util -}; diff --git a/node_modules/chai/package.json b/node_modules/chai/package.json deleted file mode 100644 index f2ad34b..0000000 --- a/node_modules/chai/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "author": "Jake Luer ", - "name": "chai", - "type": "module", - "description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", - "keywords": [ - "test", - "assertion", - "assert", - "testing", - "chai" - ], - "files": [ - "index.js", - "register-*.js" - ], - "homepage": "http://chaijs.com", - "license": "MIT", - "contributors": [ - "Jake Luer ", - "Domenic Denicola (http://domenicdenicola.com)", - "Veselin Todorov ", - "John Firebaugh " - ], - "version": "6.2.2", - "repository": { - "type": "git", - "url": "https://github.com/chaijs/chai" - }, - "bugs": { - "url": "https://github.com/chaijs/chai/issues" - }, - "main": "./index.js", - "scripts": { - "build": "esbuild --bundle --format=esm --target=es2021 --keep-names --legal-comments=none --outfile=index.js lib/chai.js", - "prebuild": "npm run clean", - "format": "prettier --write lib", - "pretest": "npm run lint", - "test": "npm run test-node && npm run test-chrome", - "test-node": "c8 --99 --check-coverage mocha --require ./test/bootstrap/index.js test/*.js", - "test-chrome": "web-test-runner --playwright", - "lint": "npm run lint:js && npm run lint:format", - "lint:js": "eslint lib/", - "lint:format": "prettier --check lib", - "lint:types": "tsc", - "clean": "rm -rf index.js coverage/" - }, - "engines": { - "node": ">=18" - }, - "devDependencies": { - "@eslint/js": "^9.17.0", - "@rollup/plugin-commonjs": "^29.0.0", - "@web/dev-server-rollup": "^0.6.1", - "@web/test-runner": "^0.20.0", - "@web/test-runner-playwright": "^0.11.0", - "assertion-error": "^2.0.1", - "c8": "^10.1.3", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "esbuild": "^0.27.0", - "eslint": "^9.0.0", - "eslint-plugin-jsdoc": "^61.0.0", - "globals": "^16.3.0", - "loupe": "^3.1.0", - "mocha": "^11.0.0", - "pathval": "^2.0.0", - "prettier": "^3.4.2", - "typescript": "~5.9.0" - } -} diff --git a/node_modules/chai/register-assert.js b/node_modules/chai/register-assert.js deleted file mode 100644 index f593717..0000000 --- a/node_modules/chai/register-assert.js +++ /dev/null @@ -1,3 +0,0 @@ -import {assert} from './index.js'; - -globalThis.assert = assert; diff --git a/node_modules/chai/register-expect.js b/node_modules/chai/register-expect.js deleted file mode 100644 index 2807b89..0000000 --- a/node_modules/chai/register-expect.js +++ /dev/null @@ -1,3 +0,0 @@ -import {expect} from './index.js'; - -globalThis.expect = expect; diff --git a/node_modules/chai/register-should.js b/node_modules/chai/register-should.js deleted file mode 100644 index 1339ee4..0000000 --- a/node_modules/chai/register-should.js +++ /dev/null @@ -1,3 +0,0 @@ -import {should} from './index.js'; - -globalThis.should = should(); diff --git a/node_modules/es-module-lexer/LICENSE b/node_modules/es-module-lexer/LICENSE deleted file mode 100644 index c795a27..0000000 --- a/node_modules/es-module-lexer/LICENSE +++ /dev/null @@ -1,10 +0,0 @@ -MIT License ------------ - -Copyright (C) 2018-2022 Guy Bedford - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/es-module-lexer/README.md b/node_modules/es-module-lexer/README.md deleted file mode 100644 index 310f4ee..0000000 --- a/node_modules/es-module-lexer/README.md +++ /dev/null @@ -1,338 +0,0 @@ -# ES Module Lexer - -[![Build Status][actions-image]][actions-url] - -A JS module syntax lexer used in [es-module-shims](https://github.com/guybedford/es-module-shims). - -Outputs the list of exports and locations of import specifiers, including dynamic import and import meta handling. - -Supports new syntax features including import attributes and source phase imports. - -A very small single JS file (4KiB gzipped) that includes inlined Web Assembly for very fast source analysis of ECMAScript module syntax only. - -For an example of the performance, Angular 1 (720KiB) is fully parsed in 5ms, in comparison to the fastest JS parser, Acorn which takes over 100ms. - -_Comprehensively handles the JS language grammar while remaining small and fast. - ~10ms per MB of JS cold and ~5ms per MB of JS warm, [see benchmarks](#benchmarks) for more info._ - -> [Built with](https://github.com/guybedford/es-module-lexer/blob/main/chompfile.toml) [Chomp](https://chompbuild.com/) - -### Usage - -``` -npm install es-module-lexer -``` - -See [src/lexer.ts](src/lexer.ts) for the type definitions. - -For use in CommonJS: - -```js -const { init, parse } = require('es-module-lexer'); - -(async () => { - // either await init, or call parse asynchronously - // this is necessary for the Web Assembly boot - await init; - - const source = 'export var p = 5'; - const [imports, exports] = parse(source); - - // Returns "p" - source.slice(exports[0].s, exports[0].e); - // Returns "p" - source.slice(exports[0].ls, exports[0].le); -})(); -``` - -An ES module version is also available: - -```js -import { init, parse } from 'es-module-lexer'; - -(async () => { - await init; - - const source = ` - import { name } from 'mod\\u1011'; - import json from './json.json' assert { type: 'json' } - export var p = 5; - export function q () { - - }; - export { x as 'external name' } from 'external'; - - // Comments provided to demonstrate edge cases - import /*comment!*/ ( 'asdf', { assert: { type: 'json' }}); - import /*comment!*/.meta.asdf; - - // Source phase imports: - import source mod from './mod.wasm'; - import.source('./mod.wasm'); - `; - - const [imports, exports] = parse(source, 'optional-sourcename'); - - // Returns "modထ" - imports[0].n - // Returns "mod\u1011" - source.slice(imports[0].s, imports[0].e); - // "s" = start - // "e" = end - - // Returns "import { name } from 'mod'" - source.slice(imports[0].ss, imports[0].se); - // "ss" = statement start - // "se" = statement end - - // Returns "{ type: 'json' }" - source.slice(imports[1].a, imports[1].se); - // "a" = assert, -1 for no assertion - - // Returns "external" - source.slice(imports[2].s, imports[2].e); - - // Returns "p" - source.slice(exports[0].s, exports[0].e); - // Returns "p" - source.slice(exports[0].ls, exports[0].le); - // Returns "q" - source.slice(exports[1].s, exports[1].e); - // Returns "q" - source.slice(exports[1].ls, exports[1].le); - // Returns "'external name'" - source.slice(exports[2].s, exports[2].e); - // Returns -1 - exports[2].ls; - // Returns -1 - exports[2].le; - - // Import type is provided by `t` value - // (1 for static, 2, for dynamic) - // Returns true - imports[2].t == 2; - - // Returns "asdf" (only for string literal dynamic imports) - imports[2].n - // Returns "import /*comment!*/ ( 'asdf', { assert: { type: 'json' } })" - source.slice(imports[3].ss, imports[3].se); - // Returns "'asdf'" - source.slice(imports[3].s, imports[3].e); - // Returns "( 'asdf', { assert: { type: 'json' } })" - source.slice(imports[3].d, imports[3].se); - // Returns "{ assert: { type: 'json' } }" - source.slice(imports[3].a, imports[3].se - 1); - - // For non-string dynamic import expressions: - // - n will be undefined - // - a is currently -1 even if there is an assertion - // - e is currently the character before the closing ) - - // For nested dynamic imports, the se value of the outer import is -1 as end tracking does not - // currently support nested dynamic immports - - // import.meta is indicated by imports[3].d === -2 - // Returns true - imports[4].d === -2; - // Returns "import /*comment!*/.meta" - source.slice(imports[4].s, imports[4].e); - // ss and se are the same for import meta - - // Returns "'./mod.wasm'" - source.slice(imports[5].s, imports[5].e); - - // Import type 4 and 5 for static and dynamic source phase - imports[5].t === 4; - imports[6].t === 5; -})(); -``` - -### CSP asm.js Build - -The default version of the library uses Wasm and (safe) eval usage for performance and a minimal footprint. - -Neither of these represent security escalation possibilities since there are no execution string injection vectors, but that can still violate existing CSP policies for applications. - -For a version that works with CSP eval disabled, use the `es-module-lexer/js` build: - -```js -import { parse } from 'es-module-lexer/js'; -``` - -Instead of Web Assembly, this uses an asm.js build which is almost as fast as the Wasm version ([see benchmarks below](#benchmarks)). - -### Escape Sequences - -To handle escape sequences in specifier strings, the `.n` field of imported specifiers will be provided where possible. - -For dynamic import expressions, this field will be empty if not a valid JS string. - -### Facade Detection - -Facade modules that only use import / export syntax can be detected via the third return value: - -```js -const [,, facade] = parse(` - export * from 'external'; - import * as ns from 'external2'; - export { a as b } from 'external3'; - export { ns }; -`); -facade === true; -``` - -### ESM Detection - -Modules that uses ESM syntaxes can be detected via the fourth return value: - -```js -const [,,, hasModuleSyntax] = parse(` - export {} -`); -hasModuleSyntax === true; -``` - -Dynamic imports are ignored since they can be used in Non-ESM files. - -```js -const [,,, hasModuleSyntax] = parse(` - import('./foo.js') -`); -hasModuleSyntax === false; -``` - -### Environment Support - -Node.js 10+, and [all browsers with Web Assembly support](https://caniuse.com/#feat=wasm). - -### Grammar Support - -* Token state parses all line comments, block comments, strings, template strings, blocks, parens and punctuators. -* Division operator / regex token ambiguity is handled via backtracking checks against punctuator prefixes, including closing brace or paren backtracking. -* Always correctly parses valid JS source, but may parse invalid JS source without errors. - -### Limitations - -The lexing approach is designed to deal with the full language grammar including RegEx / division operator ambiguity through backtracking and paren / brace tracking. - -The only limitation to the reduced parser is that the "exports" list may not correctly gather all export identifiers in the following edge cases: - -```js -// Only "a" is detected as an export, "q" isn't -export var a = 'asdf', q = z; - -// "b" is not detected as an export -export var { a: b } = asdf; -``` - -The above cases are handled gracefully in that the lexer will keep going fine, it will just not properly detect the export names above. - -### Benchmarks - -Benchmarks can be run with `npm run bench`. - -Current results for a high spec machine: - -#### Wasm Build - -``` -Module load time -> 5ms -Cold Run, All Samples -test/samples/*.js (3123 KiB) -> 18ms - -Warm Runs (average of 25 runs) -test/samples/angular.js (739 KiB) -> 3ms -test/samples/angular.min.js (188 KiB) -> 1ms -test/samples/d3.js (508 KiB) -> 3ms -test/samples/d3.min.js (274 KiB) -> 2ms -test/samples/magic-string.js (35 KiB) -> 0ms -test/samples/magic-string.min.js (20 KiB) -> 0ms -test/samples/rollup.js (929 KiB) -> 4.32ms -test/samples/rollup.min.js (429 KiB) -> 2.16ms - -Warm Runs, All Samples (average of 25 runs) -test/samples/*.js (3123 KiB) -> 14.16ms -``` - -#### JS Build (asm.js) - -``` -Module load time -> 2ms -Cold Run, All Samples -test/samples/*.js (3123 KiB) -> 34ms - -Warm Runs (average of 25 runs) -test/samples/angular.js (739 KiB) -> 3ms -test/samples/angular.min.js (188 KiB) -> 1ms -test/samples/d3.js (508 KiB) -> 3ms -test/samples/d3.min.js (274 KiB) -> 2ms -test/samples/magic-string.js (35 KiB) -> 0ms -test/samples/magic-string.min.js (20 KiB) -> 0ms -test/samples/rollup.js (929 KiB) -> 5ms -test/samples/rollup.min.js (429 KiB) -> 3.04ms - -Warm Runs, All Samples (average of 25 runs) -test/samples/*.js (3123 KiB) -> 17.12ms -``` - -### Building - -This project uses [Chomp](https://chompbuild.com) for building. - -With Chomp installed, download the WASI SDK 12.0 from https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-12. - -- [Linux](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz) -- [Windows (MinGW)](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-mingw.tar.gz) -- [macOS](https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-macos.tar.gz) - -Locate the WASI-SDK as a sibling folder, or customize the path via the `WASI_PATH` environment variable. - -Emscripten emsdk is also assumed to be a sibling folder or via the `EMSDK_PATH` environment variable. - -Example setup: - -``` -git clone https://github.com:guybedford/es-module-lexer -git clone https://github.com/emscripten-core/emsdk -cd emsdk -git checkout 1.40.1-fastcomp -./emsdk install 1.40.1-fastcomp -cd .. -wget https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk-12.0-linux.tar.gz -gunzip wasi-sdk-12.0-linux.tar.gz -tar -xf wasi-sdk-12.0-linux.tar -mv wasi-sdk-12.0-linux.tar wasi-sdk-12.0 -cargo install chompbuild -cd es-module-lexer -chomp test -``` - -For the `asm.js` build, git clone `emsdk` from is assumed to be a sibling folder as well. - -### License - -MIT - -[actions-image]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml/badge.svg -[actions-url]: https://github.com/guybedford/es-module-lexer/actions/workflows/build.yml diff --git a/node_modules/es-module-lexer/dist/lexer.asm.js b/node_modules/es-module-lexer/dist/lexer.asm.js deleted file mode 100644 index d64300d..0000000 --- a/node_modules/es-module-lexer/dist/lexer.asm.js +++ /dev/null @@ -1,2 +0,0 @@ -/* es-module-lexer 1.7.0 */ -let e,a,r,i=2<<19;const s=1===new Uint8Array(new Uint16Array([1]).buffer)[0]?function(e,a){const r=e.length;let i=0;for(;i>>8}},f="xportmportlassforetaourceeferromsyncunctionssertvoyiedelecontininstantybreareturdebuggeawaithrwhileifcatcfinallels";let t,c,n;export function parse(k,l="@"){t=k,c=l;const u=2*t.length+(2<<18);if(u>i||!e){for(;u>i;)i*=2;a=new ArrayBuffer(i),s(f,new Uint16Array(a,16,114)),e=function(e,a,r){"use asm";var i=new e.Int8Array(r),s=new e.Int16Array(r),f=new e.Int32Array(r),t=new e.Uint8Array(r),c=new e.Uint16Array(r),n=1040;function b(){var e=0,a=0,r=0,t=0,c=0,b=0,u=0;u=n;n=n+10240|0;i[812]=1;i[811]=0;s[403]=0;s[404]=0;f[71]=f[2];i[813]=0;f[70]=0;i[810]=0;f[72]=u+2048;f[73]=u;i[814]=0;e=(f[3]|0)+-2|0;f[74]=e;a=e+(f[68]<<1)|0;f[75]=a;e:while(1){r=e+2|0;f[74]=r;if(e>>>0>=a>>>0){t=18;break}a:do{switch(s[r>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if((((s[404]|0)==0?H(r)|0:0)?(m(e+4|0,16,10)|0)==0:0)?(k(),(i[812]|0)==0):0){t=9;break e}else t=17;break}case 105:{if(H(r)|0?(m(e+4|0,26,10)|0)==0:0){l();t=17}else t=17;break}case 59:{t=17;break}case 47:switch(s[e+4>>1]|0){case 47:{P();break a}case 42:{y(1);break a}default:{t=16;break e}}default:{t=16;break e}}}while(0);if((t|0)==17){t=0;f[71]=f[74]}e=f[74]|0;a=f[75]|0}if((t|0)==9){e=f[74]|0;f[71]=e;t=19}else if((t|0)==16){i[812]=0;f[74]=e;t=19}else if((t|0)==18)if(!(i[810]|0)){e=r;t=19}else e=0;do{if((t|0)==19){e:while(1){a=e+2|0;f[74]=a;if(e>>>0>=(f[75]|0)>>>0){t=92;break}a:do{switch(s[a>>1]|0){case 9:case 10:case 11:case 12:case 13:case 32:break;case 101:{if(((s[404]|0)==0?H(a)|0:0)?(m(e+4|0,16,10)|0)==0:0){k();t=91}else t=91;break}case 105:{if(H(a)|0?(m(e+4|0,26,10)|0)==0:0){l();t=91}else t=91;break}case 99:{if((H(a)|0?(m(e+4|0,36,8)|0)==0:0)?V(s[e+12>>1]|0)|0:0){i[814]=1;t=91}else t=91;break}case 40:{r=f[72]|0;e=s[404]|0;t=e&65535;f[r+(t<<3)>>2]=1;a=f[71]|0;s[404]=e+1<<16>>16;f[r+(t<<3)+4>>2]=a;t=91;break}case 41:{a=s[404]|0;if(!(a<<16>>16)){t=36;break e}r=a+-1<<16>>16;s[404]=r;t=s[403]|0;a=t&65535;if(t<<16>>16!=0?(f[(f[72]|0)+((r&65535)<<3)>>2]|0)==5:0){a=f[(f[73]|0)+(a+-1<<2)>>2]|0;r=a+4|0;if(!(f[r>>2]|0))f[r>>2]=(f[71]|0)+2;f[a+12>>2]=e+4;s[403]=t+-1<<16>>16;t=91}else t=91;break}case 123:{t=f[71]|0;r=f[65]|0;e=t;do{if((s[t>>1]|0)==41&(r|0)!=0?(f[r+4>>2]|0)==(t|0):0){a=f[66]|0;f[65]=a;if(!a){f[61]=0;break}else{f[a+32>>2]=0;break}}}while(0);r=f[72]|0;a=s[404]|0;t=a&65535;f[r+(t<<3)>>2]=(i[814]|0)==0?2:6;s[404]=a+1<<16>>16;f[r+(t<<3)+4>>2]=e;i[814]=0;t=91;break}case 125:{e=s[404]|0;if(!(e<<16>>16)){t=49;break e}r=f[72]|0;t=e+-1<<16>>16;s[404]=t;if((f[r+((t&65535)<<3)>>2]|0)==4){h();t=91}else t=91;break}case 39:{v(39);t=91;break}case 34:{v(34);t=91;break}case 47:switch(s[e+4>>1]|0){case 47:{P();break a}case 42:{y(1);break a}default:{e=f[71]|0;a=s[e>>1]|0;r:do{if(!(U(a)|0))if(a<<16>>16==41){r=s[404]|0;if(!(D(f[(f[72]|0)+((r&65535)<<3)+4>>2]|0)|0))t=65}else t=64;else switch(a<<16>>16){case 46:if(((s[e+-2>>1]|0)+-48&65535)<10){t=64;break r}else break r;case 43:if((s[e+-2>>1]|0)==43){t=64;break r}else break r;case 45:if((s[e+-2>>1]|0)==45){t=64;break r}else break r;default:break r}}while(0);if((t|0)==64){r=s[404]|0;t=65}r:do{if((t|0)==65){t=0;if(r<<16>>16!=0?(c=f[72]|0,b=(r&65535)+-1|0,a<<16>>16==102?(f[c+(b<<3)>>2]|0)==1:0):0){if((s[e+-2>>1]|0)==111?$(f[c+(b<<3)+4>>2]|0,44,3)|0:0)break}else t=69;if((t|0)==69?(0,a<<16>>16==125):0){t=f[72]|0;r=r&65535;if(p(f[t+(r<<3)+4>>2]|0)|0)break;if((f[t+(r<<3)>>2]|0)==6)break}if(!(o(e)|0)){switch(a<<16>>16){case 0:break r;case 47:{if(i[813]|0)break r;break}default:{}}t=f[67]|0;if((t|0?e>>>0>=(f[t>>2]|0)>>>0:0)?e>>>0<=(f[t+4>>2]|0)>>>0:0){g();i[813]=0;t=91;break a}r=f[3]|0;do{if(e>>>0<=r>>>0)break;e=e+-2|0;f[71]=e;a=s[e>>1]|0}while(!(E(a)|0));if(F(a)|0){do{if(e>>>0<=r>>>0)break;e=e+-2|0;f[71]=e}while(F(s[e>>1]|0)|0);if(j(e)|0){g();i[813]=0;t=91;break a}}i[813]=1;t=91;break a}}}while(0);g();i[813]=0;t=91;break a}}case 96:{r=f[72]|0;a=s[404]|0;t=a&65535;f[r+(t<<3)+4>>2]=f[71];s[404]=a+1<<16>>16;f[r+(t<<3)>>2]=3;h();t=91;break}default:t=91}}while(0);if((t|0)==91){t=0;f[71]=f[74]}e=f[74]|0}if((t|0)==36){T();e=0;break}else if((t|0)==49){T();e=0;break}else if((t|0)==92){e=(i[810]|0)==0?(s[403]|s[404])<<16>>16==0:0;break}}}while(0);n=u;return e|0}function k(){var e=0,a=0,r=0,t=0,c=0,n=0,b=0,k=0,l=0,o=0,h=0,d=0,C=0,g=0;k=f[74]|0;l=f[67]|0;g=k+12|0;f[74]=g;r=w(1)|0;e=f[74]|0;if(!((e|0)==(g|0)?!(I(r)|0):0))C=3;e:do{if((C|0)==3){a:do{switch(r<<16>>16){case 123:{f[74]=e+2;e=w(1)|0;a=f[74]|0;while(1){if(W(e)|0){v(e);e=(f[74]|0)+2|0;f[74]=e}else{q(e)|0;e=f[74]|0}w(1)|0;e=A(a,e)|0;if(e<<16>>16==44){f[74]=(f[74]|0)+2;e=w(1)|0}if(e<<16>>16==125){C=15;break}g=a;a=f[74]|0;if((a|0)==(g|0)){C=12;break}if(a>>>0>(f[75]|0)>>>0){C=14;break}}if((C|0)==12){T();break e}else if((C|0)==14){T();break e}else if((C|0)==15){i[811]=1;f[74]=(f[74]|0)+2;break a}break}case 42:{f[74]=e+2;w(1)|0;g=f[74]|0;A(g,g)|0;break}default:{i[812]=0;switch(r<<16>>16){case 100:{k=e+14|0;f[74]=k;switch((w(1)|0)<<16>>16){case 97:{a=f[74]|0;if((m(a+2|0,80,8)|0)==0?(c=a+10|0,F(s[c>>1]|0)|0):0){f[74]=c;w(0)|0;C=22}break}case 102:{C=22;break}case 99:{a=f[74]|0;if(((m(a+2|0,36,8)|0)==0?(t=a+10|0,g=s[t>>1]|0,V(g)|0|g<<16>>16==123):0)?(f[74]=t,n=w(1)|0,n<<16>>16!=123):0){d=n;C=31}break}default:{}}r:do{if((C|0)==22?(b=f[74]|0,(m(b+2|0,88,14)|0)==0):0){r=b+16|0;a=s[r>>1]|0;if(!(V(a)|0))switch(a<<16>>16){case 40:case 42:break;default:break r}f[74]=r;a=w(1)|0;if(a<<16>>16==42){f[74]=(f[74]|0)+2;a=w(1)|0}if(a<<16>>16!=40){d=a;C=31}}}while(0);if((C|0)==31?(o=f[74]|0,q(d)|0,h=f[74]|0,h>>>0>o>>>0):0){O(e,k,o,h);f[74]=(f[74]|0)+-2;break e}O(e,k,0,0);f[74]=e+12;break e}case 97:{f[74]=e+10;w(0)|0;e=f[74]|0;C=35;break}case 102:{C=35;break}case 99:{if((m(e+2|0,36,8)|0)==0?(a=e+10|0,E(s[a>>1]|0)|0):0){f[74]=a;g=w(1)|0;C=f[74]|0;q(g)|0;g=f[74]|0;O(C,g,C,g);f[74]=(f[74]|0)+-2;break e}e=e+4|0;f[74]=e;break}case 108:case 118:break;default:break e}if((C|0)==35){f[74]=e+16;e=w(1)|0;if(e<<16>>16==42){f[74]=(f[74]|0)+2;e=w(1)|0}C=f[74]|0;q(e)|0;g=f[74]|0;O(C,g,C,g);f[74]=(f[74]|0)+-2;break e}f[74]=e+6;i[812]=0;r=w(1)|0;e=f[74]|0;r=(q(r)|0|32)<<16>>16==123;t=f[74]|0;if(r){f[74]=t+2;g=w(1)|0;e=f[74]|0;q(g)|0}r:while(1){a=f[74]|0;if((a|0)==(e|0))break;O(e,a,e,a);a=w(1)|0;if(r)switch(a<<16>>16){case 93:case 125:break e;default:{}}e=f[74]|0;if(a<<16>>16!=44){C=51;break}f[74]=e+2;a=w(1)|0;e=f[74]|0;switch(a<<16>>16){case 91:case 123:{C=51;break r}default:{}}q(a)|0}if((C|0)==51)f[74]=e+-2;if(!r)break e;f[74]=t+-2;break e}}}while(0);g=(w(1)|0)<<16>>16==102;e=f[74]|0;if(g?(m(e+2|0,74,6)|0)==0:0){f[74]=e+8;u(k,w(1)|0,0);e=(l|0)==0?248:l+16|0;while(1){e=f[e>>2]|0;if(!e)break e;f[e+12>>2]=0;f[e+8>>2]=0;e=e+16|0}}f[74]=e+-2}}while(0);return}function l(){var e=0,a=0,r=0,t=0,c=0,n=0,b=0;b=f[74]|0;c=b+12|0;f[74]=c;e=w(1)|0;t=f[74]|0;e:do{if(e<<16>>16!=46){if(!(e<<16>>16==115&t>>>0>c>>>0)){if(!(e<<16>>16==100&t>>>0>(b+10|0)>>>0)){t=0;n=28;break}if(m(t+2|0,66,8)|0){a=t;e=100;t=0;n=59;break}e=t+10|0;if(!(V(s[e>>1]|0)|0)){a=t;e=100;t=0;n=59;break}f[74]=e;e=w(1)|0;if(e<<16>>16==42){e=42;t=2;n=61;break}f[74]=t;t=0;n=28;break}if((m(t+2|0,56,10)|0)==0?(r=t+12|0,V(s[r>>1]|0)|0):0){f[74]=r;e=w(1)|0;a=f[74]|0;if((a|0)!=(r|0)){if(e<<16>>16!=102){t=1;n=28;break}if(m(a+2|0,74,6)|0){e=102;t=1;n=59;break}if(!(E(s[a+8>>1]|0)|0)){e=102;t=1;n=59;break}}f[74]=t;t=0;n=28}else{a=t;e=115;t=0;n=59}}else{f[74]=t+2;switch((w(1)|0)<<16>>16){case 109:{e=f[74]|0;if(m(e+2|0,50,6)|0)break e;a=f[71]|0;if(!(G(a)|0)?(s[a>>1]|0)==46:0)break e;d(b,b,e+8|0,2);break e}case 115:{e=f[74]|0;if(m(e+2|0,56,10)|0)break e;a=f[71]|0;if(!(G(a)|0)?(s[a>>1]|0)==46:0)break e;f[74]=e+12;e=w(1)|0;t=1;n=28;break e}case 100:{e=f[74]|0;if(m(e+2|0,66,8)|0)break e;a=f[71]|0;if(!(G(a)|0)?(s[a>>1]|0)==46:0)break e;f[74]=e+10;e=w(1)|0;t=2;n=28;break e}default:break e}}}while(0);e:do{if((n|0)==28){if(e<<16>>16==40){r=f[72]|0;a=s[404]|0;c=a&65535;f[r+(c<<3)>>2]=5;e=f[74]|0;s[404]=a+1<<16>>16;f[r+(c<<3)+4>>2]=e;if((s[f[71]>>1]|0)==46)break;f[74]=e+2;a=w(1)|0;d(b,f[74]|0,0,e);if(!t)e=f[65]|0;else{e=f[65]|0;f[e+28>>2]=(t|0)==1?5:7}c=f[73]|0;b=s[403]|0;s[403]=b+1<<16>>16;f[c+((b&65535)<<2)>>2]=e;switch(a<<16>>16){case 39:{v(39);break}case 34:{v(34);break}default:{f[74]=(f[74]|0)+-2;break e}}e=(f[74]|0)+2|0;f[74]=e;switch((w(1)|0)<<16>>16){case 44:{f[74]=(f[74]|0)+2;w(1)|0;c=f[65]|0;f[c+4>>2]=e;b=f[74]|0;f[c+16>>2]=b;i[c+24>>0]=1;f[74]=b+-2;break e}case 41:{s[404]=(s[404]|0)+-1<<16>>16;b=f[65]|0;f[b+4>>2]=e;f[b+12>>2]=(f[74]|0)+2;i[b+24>>0]=1;s[403]=(s[403]|0)+-1<<16>>16;break e}default:{f[74]=(f[74]|0)+-2;break e}}}if(!((t|0)==0&e<<16>>16==123)){switch(e<<16>>16){case 42:case 39:case 34:{n=61;break e}default:{}}a=f[74]|0;n=59;break}e=f[74]|0;if(s[404]|0){f[74]=e+-2;break}while(1){if(e>>>0>=(f[75]|0)>>>0)break;e=w(1)|0;if(!(W(e)|0)){if(e<<16>>16==125){n=49;break}}else v(e);e=(f[74]|0)+2|0;f[74]=e}if((n|0)==49)f[74]=(f[74]|0)+2;c=(w(1)|0)<<16>>16==102;e=f[74]|0;if(c?m(e+2|0,74,6)|0:0){T();break}f[74]=e+8;e=w(1)|0;if(W(e)|0){u(b,e,0);break}else{T();break}}}while(0);if((n|0)==59)if((a|0)==(c|0))f[74]=b+10;else n=61;do{if((n|0)==61){if(!((e<<16>>16==42|(t|0)!=2)&(s[404]|0)==0)){f[74]=(f[74]|0)+-2;break}e=f[75]|0;a=f[74]|0;while(1){if(a>>>0>=e>>>0){n=68;break}r=s[a>>1]|0;if(W(r)|0){n=66;break}n=a+2|0;f[74]=n;a=n}if((n|0)==66){u(b,r,t);break}else if((n|0)==68){T();break}}}while(0);return}function u(e,a,r){e=e|0;a=a|0;r=r|0;var i=0,t=0;i=(f[74]|0)+2|0;switch(a<<16>>16){case 39:{v(39);t=5;break}case 34:{v(34);t=5;break}default:T()}do{if((t|0)==5){d(e,i,f[74]|0,1);if((r|0)>0)f[(f[65]|0)+28>>2]=(r|0)==1?4:6;f[74]=(f[74]|0)+2;a=w(0)|0;r=a<<16>>16==97;if(r){i=f[74]|0;if(m(i+2|0,102,10)|0)t=13}else{i=f[74]|0;if(!(((a<<16>>16==119?(s[i+2>>1]|0)==105:0)?(s[i+4>>1]|0)==116:0)?(s[i+6>>1]|0)==104:0))t=13}if((t|0)==13){f[74]=i+-2;break}f[74]=i+((r?6:4)<<1);if((w(1)|0)<<16>>16!=123){f[74]=i;break}r=f[74]|0;a=r;e:while(1){f[74]=a+2;a=w(1)|0;switch(a<<16>>16){case 39:{v(39);f[74]=(f[74]|0)+2;a=w(1)|0;break}case 34:{v(34);f[74]=(f[74]|0)+2;a=w(1)|0;break}default:a=q(a)|0}if(a<<16>>16!=58){t=22;break}f[74]=(f[74]|0)+2;switch((w(1)|0)<<16>>16){case 39:{v(39);break}case 34:{v(34);break}default:{t=26;break e}}f[74]=(f[74]|0)+2;switch((w(1)|0)<<16>>16){case 125:{t=31;break e}case 44:break;default:{t=30;break e}}f[74]=(f[74]|0)+2;if((w(1)|0)<<16>>16==125){t=31;break}a=f[74]|0}if((t|0)==22){f[74]=i;break}else if((t|0)==26){f[74]=i;break}else if((t|0)==30){f[74]=i;break}else if((t|0)==31){t=f[65]|0;f[t+16>>2]=r;f[t+12>>2]=(f[74]|0)+2;break}}}while(0);return}function o(e){e=e|0;e:do{switch(s[e>>1]|0){case 100:switch(s[e+-2>>1]|0){case 105:{e=$(e+-4|0,112,2)|0;break e}case 108:{e=$(e+-4|0,116,3)|0;break e}default:{e=0;break e}}case 101:switch(s[e+-2>>1]|0){case 115:switch(s[e+-4>>1]|0){case 108:{e=B(e+-6|0,101)|0;break e}case 97:{e=B(e+-6|0,99)|0;break e}default:{e=0;break e}}case 116:{e=$(e+-4|0,122,4)|0;break e}case 117:{e=$(e+-4|0,130,6)|0;break e}default:{e=0;break e}}case 102:{if((s[e+-2>>1]|0)==111?(s[e+-4>>1]|0)==101:0)switch(s[e+-6>>1]|0){case 99:{e=$(e+-8|0,142,6)|0;break e}case 112:{e=$(e+-8|0,154,2)|0;break e}default:{e=0;break e}}else e=0;break}case 107:{e=$(e+-2|0,158,4)|0;break}case 110:{e=e+-2|0;if(B(e,105)|0)e=1;else e=$(e,166,5)|0;break}case 111:{e=B(e+-2|0,100)|0;break}case 114:{e=$(e+-2|0,176,7)|0;break}case 116:{e=$(e+-2|0,190,4)|0;break}case 119:switch(s[e+-2>>1]|0){case 101:{e=B(e+-4|0,110)|0;break e}case 111:{e=$(e+-4|0,198,3)|0;break e}default:{e=0;break e}}default:e=0}}while(0);return e|0}function h(){var e=0,a=0,r=0,i=0;a=f[75]|0;r=f[74]|0;e:while(1){e=r+2|0;if(r>>>0>=a>>>0){a=10;break}switch(s[e>>1]|0){case 96:{a=7;break e}case 36:{if((s[r+4>>1]|0)==123){a=6;break e}break}case 92:{e=r+4|0;break}default:{}}r=e}if((a|0)==6){e=r+4|0;f[74]=e;a=f[72]|0;i=s[404]|0;r=i&65535;f[a+(r<<3)>>2]=4;s[404]=i+1<<16>>16;f[a+(r<<3)+4>>2]=e}else if((a|0)==7){f[74]=e;r=f[72]|0;i=(s[404]|0)+-1<<16>>16;s[404]=i;if((f[r+((i&65535)<<3)>>2]|0)!=3)T()}else if((a|0)==10){f[74]=e;T()}return}function w(e){e=e|0;var a=0,r=0,i=0;r=f[74]|0;e:do{a=s[r>>1]|0;a:do{if(a<<16>>16!=47)if(e)if(V(a)|0)break;else break e;else if(F(a)|0)break;else break e;else switch(s[r+2>>1]|0){case 47:{P();break a}case 42:{y(e);break a}default:{a=47;break e}}}while(0);i=f[74]|0;r=i+2|0;f[74]=r}while(i>>>0<(f[75]|0)>>>0);return a|0}function d(e,a,r,s){e=e|0;a=a|0;r=r|0;s=s|0;var t=0,c=0;c=f[69]|0;f[69]=c+36;t=f[65]|0;f[((t|0)==0?244:t+32|0)>>2]=c;f[66]=t;f[65]=c;f[c+8>>2]=e;if(2==(s|0)){e=3;t=r}else{t=1==(s|0);e=t?1:2;t=t?r+2|0:0}f[c+12>>2]=t;f[c+28>>2]=e;f[c>>2]=a;f[c+4>>2]=r;f[c+16>>2]=0;f[c+20>>2]=s;a=1==(s|0);i[c+24>>0]=a&1;f[c+32>>2]=0;if(a|2==(s|0))i[811]=1;return}function v(e){e=e|0;var a=0,r=0,i=0,t=0;t=f[75]|0;a=f[74]|0;while(1){i=a+2|0;if(a>>>0>=t>>>0){a=9;break}r=s[i>>1]|0;if(r<<16>>16==e<<16>>16){a=10;break}if(r<<16>>16==92){r=a+4|0;if((s[r>>1]|0)==13){a=a+6|0;a=(s[a>>1]|0)==10?a:r}else a=r}else if(Z(r)|0){a=9;break}else a=i}if((a|0)==9){f[74]=i;T()}else if((a|0)==10)f[74]=i;return}function A(e,a){e=e|0;a=a|0;var r=0,i=0,t=0,c=0;r=f[74]|0;i=s[r>>1]|0;c=(e|0)==(a|0);t=c?0:e;c=c?0:a;if(i<<16>>16==97){f[74]=r+4;r=w(1)|0;e=f[74]|0;if(W(r)|0){v(r);a=(f[74]|0)+2|0;f[74]=a}else{q(r)|0;a=f[74]|0}i=w(1)|0;r=f[74]|0}if((r|0)!=(e|0))O(e,a,t,c);return i|0}function C(){var e=0,a=0,r=0;r=f[75]|0;a=f[74]|0;e:while(1){e=a+2|0;if(a>>>0>=r>>>0){a=6;break}switch(s[e>>1]|0){case 13:case 10:{a=6;break e}case 93:{a=7;break e}case 92:{e=a+4|0;break}default:{}}a=e}if((a|0)==6){f[74]=e;T();e=0}else if((a|0)==7){f[74]=e;e=93}return e|0}function g(){var e=0,a=0,r=0;e:while(1){e=f[74]|0;a=e+2|0;f[74]=a;if(e>>>0>=(f[75]|0)>>>0){r=7;break}switch(s[a>>1]|0){case 13:case 10:{r=7;break e}case 47:break e;case 91:{C()|0;break}case 92:{f[74]=e+4;break}default:{}}}if((r|0)==7)T();return}function p(e){e=e|0;switch(s[e>>1]|0){case 62:{e=(s[e+-2>>1]|0)==61;break}case 41:case 59:{e=1;break}case 104:{e=$(e+-2|0,218,4)|0;break}case 121:{e=$(e+-2|0,226,6)|0;break}case 101:{e=$(e+-2|0,238,3)|0;break}default:e=0}return e|0}function y(e){e=e|0;var a=0,r=0,i=0,t=0,c=0;t=(f[74]|0)+2|0;f[74]=t;r=f[75]|0;while(1){a=t+2|0;if(t>>>0>=r>>>0)break;i=s[a>>1]|0;if(!e?Z(i)|0:0)break;if(i<<16>>16==42?(s[t+4>>1]|0)==47:0){c=8;break}t=a}if((c|0)==8){f[74]=a;a=t+4|0}f[74]=a;return}function m(e,a,r){e=e|0;a=a|0;r=r|0;var s=0,f=0;e:do{if(!r)e=0;else{while(1){s=i[e>>0]|0;f=i[a>>0]|0;if(s<<24>>24!=f<<24>>24)break;r=r+-1|0;if(!r){e=0;break e}else{e=e+1|0;a=a+1|0}}e=(s&255)-(f&255)|0}}while(0);return e|0}function I(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:{e=1;break}default:if((e&-8)<<16>>16==40|(e+-58&65535)<6)e=1;else{switch(e<<16>>16){case 91:case 93:case 94:{e=1;break e}default:{}}e=(e+-123&65535)<4}}}while(0);return e|0}function U(e){e=e|0;e:do{switch(e<<16>>16){case 38:case 37:case 33:break;default:if(!((e+-58&65535)<6|(e+-40&65535)<7&e<<16>>16!=41)){switch(e<<16>>16){case 91:case 94:break e;default:{}}return e<<16>>16!=125&(e+-123&65535)<4|0}}}while(0);return 1}function x(e){e=e|0;var a=0;a=s[e>>1]|0;e:do{if((a+-9&65535)>=5){switch(a<<16>>16){case 160:case 32:{a=1;break e}default:{}}if(I(a)|0)return a<<16>>16!=46|(G(e)|0)|0;else a=0}else a=1}while(0);return a|0}function S(e){e=e|0;var a=0,r=0,i=0,t=0;r=n;n=n+16|0;i=r;f[i>>2]=0;f[68]=e;a=f[3]|0;t=a+(e<<1)|0;e=t+2|0;s[t>>1]=0;f[i>>2]=e;f[69]=e;f[61]=0;f[65]=0;f[63]=0;f[62]=0;f[67]=0;f[64]=0;n=r;return a|0}function O(e,a,r,s){e=e|0;a=a|0;r=r|0;s=s|0;var t=0,c=0;t=f[69]|0;f[69]=t+20;c=f[67]|0;f[((c|0)==0?248:c+16|0)>>2]=t;f[67]=t;f[t>>2]=e;f[t+4>>2]=a;f[t+8>>2]=r;f[t+12>>2]=s;f[t+16>>2]=0;i[811]=1;return}function $(e,a,r){e=e|0;a=a|0;r=r|0;var i=0,s=0;i=e+(0-r<<1)|0;s=i+2|0;e=f[3]|0;if(s>>>0>=e>>>0?(m(s,a,r<<1)|0)==0:0)if((s|0)==(e|0))e=1;else e=x(i)|0;else e=0;return e|0}function j(e){e=e|0;switch(s[e>>1]|0){case 107:{e=$(e+-2|0,158,4)|0;break}case 101:{if((s[e+-2>>1]|0)==117)e=$(e+-4|0,130,6)|0;else e=0;break}default:e=0}return e|0}function B(e,a){e=e|0;a=a|0;var r=0;r=f[3]|0;if(r>>>0<=e>>>0?(s[e>>1]|0)==a<<16>>16:0)if((r|0)==(e|0))r=1;else r=E(s[e+-2>>1]|0)|0;else r=0;return r|0}function E(e){e=e|0;e:do{if((e+-9&65535)<5)e=1;else{switch(e<<16>>16){case 32:case 160:{e=1;break e}default:{}}e=e<<16>>16!=46&(I(e)|0)}}while(0);return e|0}function P(){var e=0,a=0,r=0;e=f[75]|0;r=f[74]|0;e:while(1){a=r+2|0;if(r>>>0>=e>>>0)break;switch(s[a>>1]|0){case 13:case 10:break e;default:r=a}}f[74]=a;return}function q(e){e=e|0;while(1){if(V(e)|0)break;if(I(e)|0)break;e=(f[74]|0)+2|0;f[74]=e;e=s[e>>1]|0;if(!(e<<16>>16)){e=0;break}}return e|0}function z(){var e=0;e=f[(f[63]|0)+20>>2]|0;switch(e|0){case 1:{e=-1;break}case 2:{e=-2;break}default:e=e-(f[3]|0)>>1}return e|0}function D(e){e=e|0;if(!($(e,204,5)|0)?!($(e,44,3)|0):0)e=$(e,214,2)|0;else e=1;return e|0}function F(e){e=e|0;switch(e<<16>>16){case 160:case 32:case 12:case 11:case 9:{e=1;break}default:e=0}return e|0}function G(e){e=e|0;if((s[e>>1]|0)==46?(s[e+-2>>1]|0)==46:0)e=(s[e+-4>>1]|0)==46;else e=0;return e|0}function H(e){e=e|0;if((f[3]|0)==(e|0))e=1;else e=x(e+-2|0)|0;return e|0}function J(){var e=0;e=f[(f[64]|0)+12>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function K(){var e=0;e=f[(f[63]|0)+12>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function L(){var e=0;e=f[(f[64]|0)+8>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function M(){var e=0;e=f[(f[63]|0)+16>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function N(){var e=0;e=f[(f[63]|0)+4>>2]|0;if(!e)e=-1;else e=e-(f[3]|0)>>1;return e|0}function Q(){var e=0;e=f[63]|0;e=f[((e|0)==0?244:e+32|0)>>2]|0;f[63]=e;return(e|0)!=0|0}function R(){var e=0;e=f[64]|0;e=f[((e|0)==0?248:e+16|0)>>2]|0;f[64]=e;return(e|0)!=0|0}function T(){i[810]=1;f[70]=(f[74]|0)-(f[3]|0)>>1;f[74]=(f[75]|0)+2;return}function V(e){e=e|0;return(e|128)<<16>>16==160|(e+-9&65535)<5|0}function W(e){e=e|0;return e<<16>>16==39|e<<16>>16==34|0}function X(){return(f[(f[63]|0)+8>>2]|0)-(f[3]|0)>>1|0}function Y(){return(f[(f[64]|0)+4>>2]|0)-(f[3]|0)>>1|0}function Z(e){e=e|0;return e<<16>>16==13|e<<16>>16==10|0}function _(){return(f[f[63]>>2]|0)-(f[3]|0)>>1|0}function ee(){return(f[f[64]>>2]|0)-(f[3]|0)>>1|0}function ae(){return t[(f[63]|0)+24>>0]|0|0}function re(e){e=e|0;f[3]=e;return}function ie(){return f[(f[63]|0)+28>>2]|0}function se(){return(i[811]|0)!=0|0}function fe(){return(i[812]|0)!=0|0}function te(){return f[70]|0}function ce(e){e=e|0;n=e+992+15&-16;return 992}return{su:ce,ai:M,e:te,ee:Y,ele:J,els:L,es:ee,f:fe,id:z,ie:N,ip:ae,is:_,it:ie,ms:se,p:b,re:R,ri:Q,sa:S,se:K,ses:re,ss:X}}("undefined"!=typeof self?self:global,{},a),r=e.su(i-(2<<17))}const h=t.length+1;e.ses(r),e.sa(h-1),s(t,new Uint16Array(a,r,h)),e.p()||(n=e.e(),o());const w=[],d=[];for(;e.ri();){const a=e.is(),r=e.ie(),i=e.ai(),s=e.id(),f=e.ss(),c=e.se(),n=e.it();let k;e.ip()&&(k=b(-1===s?a:a+1,t.charCodeAt(-1===s?a-1:a))),w.push({t:n,n:k,s:a,e:r,ss:f,se:c,d:s,a:i})}for(;e.re();){const a=e.es(),r=e.ee(),i=e.els(),s=e.ele(),f=t.charCodeAt(a),c=i>=0?t.charCodeAt(i):-1;d.push({s:a,e:r,ls:i,le:s,n:34===f||39===f?b(a+1,f):t.slice(a,r),ln:i<0?void 0:34===c||39===c?b(i+1,c):t.slice(i,s)})}return[w,d,!!e.f(),!!e.ms()]}function b(e,a){n=e;let r="",i=n;for(;;){n>=t.length&&o();const e=t.charCodeAt(n);if(e===a)break;92===e?(r+=t.slice(i,n),r+=k(),i=n):(8232===e||8233===e||u(e)&&o(),++n)}return r+=t.slice(i,n++),r}function k(){let e=t.charCodeAt(++n);switch(++n,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(l(2));case 117:return function(){const e=t.charCodeAt(n);let a;123===e?(++n,a=l(t.indexOf("}",n)-n),++n,a>1114111&&o()):a=l(4);return a<=65535?String.fromCharCode(a):(a-=65536,String.fromCharCode(55296+(a>>10),56320+(1023&a)))}();case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===t.charCodeAt(n)&&++n;case 10:return"";case 56:case 57:o();default:if(e>=48&&e<=55){let a=t.substr(n-1,3).match(/^[0-7]+/)[0],r=parseInt(a,8);return r>255&&(a=a.slice(0,-1),r=parseInt(a,8)),n+=a.length-1,e=t.charCodeAt(n),"0"===a&&56!==e&&57!==e||o(),String.fromCharCode(r)}return u(e)?"":String.fromCharCode(e)}}function l(e){const a=n;let r=0,i=0;for(let a=0;a=97)e=s-97+10;else if(s>=65)e=s-65+10;else{if(!(s>=48&&s<=57))break;e=s-48}if(e>=16)break;i=s,r=16*r+e}else 95!==i&&0!==a||o(),i=s}return 95!==i&&n-a===e||o(),r}function u(e){return 13===e||10===e}function o(){throw Object.assign(Error(`Parse error ${c}:${t.slice(0,n).split("\n").length}:${n-t.lastIndexOf("\n",n-1)}`),{idx:n})} diff --git a/node_modules/es-module-lexer/dist/lexer.cjs b/node_modules/es-module-lexer/dist/lexer.cjs deleted file mode 100644 index 4b0c87b..0000000 --- a/node_modules/es-module-lexer/dist/lexer.cjs +++ /dev/null @@ -1 +0,0 @@ -"use strict";var ImportType;exports.initSync=exports.init=exports.ImportType=void 0,exports.parse=parse,exports.ImportType=ImportType,function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase",A[A.StaticDeferPhase=6]="StaticDeferPhase",A[A.DynamicDeferPhase=7]="DynamicDeferPhase"}(ImportType||(exports.ImportType=ImportType={}));const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];function parse(E,g="@"){if(!C)return init.then((()=>parse(E)));const I=E.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let D;C.ip()&&(D=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),o.push({n:D,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g})}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?void 0:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===o||"'"===o?k(K):K})}function k(A){try{return(0,eval)(A)}catch(A){}}return[o,D,!!C.f(),!!C.ms()]}function Q(A,Q){const C=A.length;let B=0;for(;B>>8}}function B(A,Q){const C=A.length;let B=0;for(;B{return A="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABwAGAgUEBQFwAQEBBQMBAAEGDwJ/AUHA8gALfwBBwPIACwd6FQZtZW1vcnkCAAJzYQAAAWUAAwJpcwAEAmllAAUCc3MABgJzZQAHAml0AAgCYWkACQJpZAAKAmlwAAsCZXMADAJlZQANA2VscwAOA2VsZQAPAnJpABACcmUAEQFmABICbXMAEwVwYXJzZQAUC19faGVhcF9iYXNlAwEKzkQwaAEBf0EAIAA2AoAKQQAoAtwJIgEgAEEBdGoiAEEAOwEAQQAgAEECaiIANgKECkEAIAA2AogKQQBBADYC4AlBAEEANgLwCUEAQQA2AugJQQBBADYC5AlBAEEANgL4CUEAQQA2AuwJIAEL0wEBA39BACgC8AkhBEEAQQAoAogKIgU2AvAJQQAgBDYC9AlBACAFQSRqNgKICiAEQSBqQeAJIAQbIAU2AgBBACgC1AkhBEEAKALQCSEG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B4QBGDQAgASEEIAAhBQwBC0EAIAJBBGo2ArAKQQEQKSECQQAoArAKIQUCQAJAIAJBIkYNACACQSdGDQAgAhAsGkEAKAKwCiEEDAELIAIQGkEAQQAoArAKQQJqIgQ2ArAKC0EBECkhA0EAKAKwCiECCwJAIAIgBUYNACAFIARBACAAIAAgAUYiAhtBACABIAIbEAILIAMLcgEEf0EAKAKwCiEAQQAoArQKIQECQAJAA0AgAEECaiECIAAgAU8NAQJAAkAgAi8BACIDQaR/ag4CAQQACyACIQAgA0F2ag4EAgEBAgELIABBBGohAAwACwtBACACNgKwChAlQQAPC0EAIAI2ArAKQd0AC0kBA39BACEDAkAgAkUNAAJAA0AgAC0AACIEIAEtAAAiBUcNASABQQFqIQEgAEEBaiEAIAJBf2oiAg0ADAILCyAEIAVrIQMLIAMLC+wBAgBBgAgLzgEAAHgAcABvAHIAdABtAHAAbwByAHQAZgBvAHIAZQB0AGEAbwB1AHIAYwBlAHIAbwBtAHUAbgBjAHQAaQBvAG4AcwBzAGUAcgB0AHYAbwB5AGkAZQBkAGUAbABlAGMAbwBuAHQAaQBuAGkAbgBzAHQAYQBuAHQAeQBiAHIAZQBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=","undefined"!=typeof Buffer?Buffer.from(A,"base64"):Uint8Array.from(atob(A),(A=>A.charCodeAt(0)));var A},init=WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({exports:A})=>{C=A}));exports.init=init;const initSync=()=>{if(C)return;const A=new WebAssembly.Module(E());C=new WebAssembly.Instance(A).exports};exports.initSync=initSync; \ No newline at end of file diff --git a/node_modules/es-module-lexer/dist/lexer.js b/node_modules/es-module-lexer/dist/lexer.js deleted file mode 100644 index 6f9404d..0000000 --- a/node_modules/es-module-lexer/dist/lexer.js +++ /dev/null @@ -1,2 +0,0 @@ -/* es-module-lexer 1.7.0 */ -export var ImportType;!function(A){A[A.Static=1]="Static",A[A.Dynamic=2]="Dynamic",A[A.ImportMeta=3]="ImportMeta",A[A.StaticSourcePhase=4]="StaticSourcePhase",A[A.DynamicSourcePhase=5]="DynamicSourcePhase",A[A.StaticDeferPhase=6]="StaticDeferPhase",A[A.DynamicDeferPhase=7]="DynamicDeferPhase"}(ImportType||(ImportType={}));const A=1===new Uint8Array(new Uint16Array([1]).buffer)[0];export function parse(E,g="@"){if(!C)return init.then((()=>parse(E)));const I=E.length+1,w=(C.__heap_base.value||C.__heap_base)+4*I-C.memory.buffer.byteLength;w>0&&C.memory.grow(Math.ceil(w/65536));const K=C.sa(I-1);if((A?B:Q)(E,new Uint16Array(C.memory.buffer,K,I)),!C.parse())throw Object.assign(new Error(`Parse error ${g}:${E.slice(0,C.e()).split("\n").length}:${C.e()-E.lastIndexOf("\n",C.e()-1)}`),{idx:C.e()});const o=[],D=[];for(;C.ri();){const A=C.is(),Q=C.ie(),B=C.it(),g=C.ai(),I=C.id(),w=C.ss(),K=C.se();let D;C.ip()&&(D=k(E.slice(-1===I?A-1:A,-1===I?Q+1:Q))),o.push({n:D,t:B,s:A,e:Q,ss:w,se:K,d:I,a:g})}for(;C.re();){const A=C.es(),Q=C.ee(),B=C.els(),g=C.ele(),I=E.slice(A,Q),w=I[0],K=B<0?void 0:E.slice(B,g),o=K?K[0]:"";D.push({s:A,e:Q,ls:B,le:g,n:'"'===w||"'"===w?k(I):I,ln:'"'===o||"'"===o?k(K):K})}function k(A){try{return(0,eval)(A)}catch(A){}}return[o,D,!!C.f(),!!C.ms()]}function Q(A,Q){const B=A.length;let C=0;for(;C>>8}}function B(A,Q){const B=A.length;let C=0;for(;C{return A="AGFzbQEAAAABKwhgAX8Bf2AEf39/fwBgAAF/YAAAYAF/AGADf39/AX9gAn9/AX9gA39/fwADMTAAAQECAgICAgICAgICAgICAgICAgIAAwMDBAQAAAUAAAAAAAMDAwAGAAAABw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QBhAHIAZQB0AHUAcgBkAGUAYgB1AGcAZwBlAGEAdwBhAGkAdABoAHIAdwBoAGkAbABlAGkAZgBjAGEAdABjAGYAaQBuAGEAbABsAGUAbABzAABB0AkLEAEAAAACAAAAAAQAAEA5AAA=","undefined"!=typeof Buffer?Buffer.from(A,"base64"):Uint8Array.from(atob(A),(A=>A.charCodeAt(0)));var A};export const init=WebAssembly.compile(E()).then(WebAssembly.instantiate).then((({exports:A})=>{C=A}));export const initSync=()=>{if(C)return;const A=new WebAssembly.Module(E());C=new WebAssembly.Instance(A).exports}; \ No newline at end of file diff --git a/node_modules/es-module-lexer/lexer.js b/node_modules/es-module-lexer/lexer.js deleted file mode 100644 index 587fafe..0000000 --- a/node_modules/es-module-lexer/lexer.js +++ /dev/null @@ -1,925 +0,0 @@ -let source, pos, end, - openTokenDepth, - lastTokenPos, - openTokenPosStack, - openClassPosStack, - curDynamicImport, - templateStackDepth, - facade, - lastSlashWasDivision, - nextBraceIsClass, - templateDepth, - templateStack, - imports, - exports, - name; - -function addImport (ss, s, e, d) { - const impt = { ss, se: d === -2 ? e : d === -1 ? e + 1 : 0, s, e, d, a: -1, n: undefined }; - imports.push(impt); - return impt; -} - -function addExport (s, e, ls, le) { - exports.push({ - s, - e, - ls, - le, - n: s[0] === '"' ? readString(s, '"') : s[0] === "'" ? readString(s, "'") : source.slice(s, e), - ln: ls[0] === '"' ? readString(ls, '"') : ls[0] === "'" ? readString(ls, "'") : source.slice(ls, le) - }); -} - -function readName (impt) { - let { d, s } = impt; - if (d !== -1) - s++; - impt.n = readString(s, source.charCodeAt(s - 1)); -} - -// Note: parsing is based on the _assumption_ that the source is already valid -export function parse (_source, _name) { - openTokenDepth = 0; - curDynamicImport = null; - templateDepth = -1; - lastTokenPos = -1; - lastSlashWasDivision = false; - templateStack = Array(1024); - templateStackDepth = 0; - openTokenPosStack = Array(1024); - openClassPosStack = Array(1024); - nextBraceIsClass = false; - facade = true; - name = _name || '@'; - - imports = []; - exports = []; - - source = _source; - pos = -1; - end = source.length - 1; - let ch = 0; - - // start with a pure "module-only" parser - m: while (pos++ < end) { - ch = source.charCodeAt(pos); - - if (ch === 32 || ch < 14 && ch > 8) - continue; - - switch (ch) { - case 101/*e*/: - if (openTokenDepth === 0 && keywordStart(pos) && source.startsWith('xport', pos + 1)) { - tryParseExportStatement(); - // export might have been a non-pure declaration - if (!facade) { - lastTokenPos = pos; - break m; - } - } - break; - case 105/*i*/: - if (keywordStart(pos) && source.startsWith('mport', pos + 1)) - tryParseImportStatement(); - break; - case 59/*;*/: - break; - case 47/*/*/: { - const next_ch = source.charCodeAt(pos + 1); - if (next_ch === 47/*/*/) { - lineComment(); - // dont update lastToken - continue; - } - else if (next_ch === 42/***/) { - blockComment(true); - // dont update lastToken - continue; - } - // fallthrough - } - default: - // as soon as we hit a non-module token, we go to main parser - facade = false; - pos--; - break m; - } - lastTokenPos = pos; - } - - while (pos++ < end) { - ch = source.charCodeAt(pos); - - if (ch === 32 || ch < 14 && ch > 8) - continue; - - switch (ch) { - case 101/*e*/: - if (openTokenDepth === 0 && keywordStart(pos) && source.startsWith('xport', pos + 1)) - tryParseExportStatement(); - break; - case 105/*i*/: - if (keywordStart(pos) && source.startsWith('mport', pos + 1)) - tryParseImportStatement(); - break; - case 99/*c*/: - if (keywordStart(pos) && source.startsWith('lass', pos + 1) && isBrOrWs(source.charCodeAt(pos + 5))) - nextBraceIsClass = true; - break; - case 40/*(*/: - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 41/*)*/: - if (openTokenDepth === 0) - syntaxError(); - openTokenDepth--; - if (curDynamicImport && curDynamicImport.d === openTokenPosStack[openTokenDepth]) { - if (curDynamicImport.e === 0) - curDynamicImport.e = pos; - curDynamicImport.se = pos; - curDynamicImport = null; - } - break; - case 123/*{*/: - // dynamic import followed by { is not a dynamic import (so remove) - // this is a sneaky way to get around { import () {} } v { import () } - // block / object ambiguity without a parser (assuming source is valid) - if (source.charCodeAt(lastTokenPos) === 41/*)*/ && imports.length && imports[imports.length - 1].e === lastTokenPos) { - imports.pop(); - } - openClassPosStack[openTokenDepth] = nextBraceIsClass; - nextBraceIsClass = false; - openTokenPosStack[openTokenDepth++] = lastTokenPos; - break; - case 125/*}*/: - if (openTokenDepth === 0) - syntaxError(); - if (openTokenDepth-- === templateDepth) { - templateDepth = templateStack[--templateStackDepth]; - templateString(); - } - else { - if (templateDepth !== -1 && openTokenDepth < templateDepth) - syntaxError(); - } - break; - case 39/*'*/: - case 34/*"*/: - stringLiteral(ch); - break; - case 47/*/*/: { - const next_ch = source.charCodeAt(pos + 1); - if (next_ch === 47/*/*/) { - lineComment(); - // dont update lastToken - continue; - } - else if (next_ch === 42/***/) { - blockComment(true); - // dont update lastToken - continue; - } - else { - // Division / regex ambiguity handling based on checking backtrack analysis of: - // - what token came previously (lastToken) - // - if a closing brace or paren, what token came before the corresponding - // opening brace or paren (lastOpenTokenIndex) - const lastToken = source.charCodeAt(lastTokenPos); - const lastExport = exports[exports.length - 1]; - if (isExpressionPunctuator(lastToken) && - !(lastToken === 46/*.*/ && (source.charCodeAt(lastTokenPos - 1) >= 48/*0*/ && source.charCodeAt(lastTokenPos - 1) <= 57/*9*/)) && - !(lastToken === 43/*+*/ && source.charCodeAt(lastTokenPos - 1) === 43/*+*/) && !(lastToken === 45/*-*/ && source.charCodeAt(lastTokenPos - 1) === 45/*-*/) || - lastToken === 41/*)*/ && isParenKeyword(openTokenPosStack[openTokenDepth]) || - lastToken === 125/*}*/ && (isExpressionTerminator(openTokenPosStack[openTokenDepth]) || openClassPosStack[openTokenDepth]) || - lastToken === 47/*/*/ && lastSlashWasDivision || - isExpressionKeyword(lastTokenPos) || - !lastToken) { - regularExpression(); - lastSlashWasDivision = false; - } - else if (lastExport && lastTokenPos >= lastExport.s && lastTokenPos <= lastExport.e) { - // export default /some-regexp/ - regularExpression(); - lastSlashWasDivision = false; - } - else { - lastSlashWasDivision = true; - } - } - break; - } - case 96/*`*/: - templateString(); - break; - } - lastTokenPos = pos; - } - - if (templateDepth !== -1 || openTokenDepth) - syntaxError(); - - return [imports, exports, facade]; -} - -function tryParseImportStatement () { - const startPos = pos; - - pos += 6; - - let ch = commentWhitespace(true); - - switch (ch) { - // dynamic import - case 40/*(*/: - openTokenPosStack[openTokenDepth++] = startPos; - if (source.charCodeAt(lastTokenPos) === 46/*.*/) - return; - // dynamic import indicated by positive d - const impt = addImport(startPos, pos + 1, 0, startPos); - curDynamicImport = impt; - // try parse a string, to record a safe dynamic import string - pos++; - ch = commentWhitespace(true); - if (ch === 39/*'*/ || ch === 34/*"*/) { - stringLiteral(ch); - } - else { - pos--; - return; - } - pos++; - ch = commentWhitespace(true); - if (ch === 44/*,*/) { - impt.e = pos; - pos++; - ch = commentWhitespace(true); - impt.a = pos; - readName(impt); - pos--; - } - else if (ch === 41/*)*/) { - openTokenDepth--; - impt.e = pos; - impt.se = pos; - readName(impt); - } - else { - pos--; - } - return; - // import.meta - case 46/*.*/: - pos++; - ch = commentWhitespace(true); - // import.meta indicated by d === -2 - if (ch === 109/*m*/ && source.startsWith('eta', pos + 1) && source.charCodeAt(lastTokenPos) !== 46/*.*/) - addImport(startPos, startPos, pos + 4, -2); - return; - - default: - // no space after "import" -> not an import keyword - if (pos === startPos + 6) - break; - case 34/*"*/: - case 39/*'*/: - case 123/*{*/: - case 42/***/: - // import statement only permitted at base-level - if (openTokenDepth !== 0) { - pos--; - return; - } - while (pos < end) { - ch = source.charCodeAt(pos); - if (ch === 39/*'*/ || ch === 34/*"*/) { - readImportString(startPos, ch); - return; - } - pos++; - } - syntaxError(); - } -} - -function tryParseExportStatement () { - const sStartPos = pos; - const prevExport = exports.length; - - pos += 6; - - const curPos = pos; - - let ch = commentWhitespace(true); - - if (pos === curPos && !isPunctuator(ch)) - return; - - switch (ch) { - // export default ... - case 100/*d*/: - addExport(pos, pos + 7, -1, -1); - return; - - // export async? function*? name () { - case 97/*a*/: - pos += 5; - commentWhitespace(true); - // fallthrough - case 102/*f*/: - pos += 8; - ch = commentWhitespace(true); - if (ch === 42/***/) { - pos++; - ch = commentWhitespace(true); - } - const startPos = pos; - ch = readToWsOrPunctuator(ch); - addExport(startPos, pos, startPos, pos); - pos--; - return; - - // export class name ... - case 99/*c*/: - if (source.startsWith('lass', pos + 1) && isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos + 5))) { - pos += 5; - ch = commentWhitespace(true); - const startPos = pos; - ch = readToWsOrPunctuator(ch); - addExport(startPos, pos, startPos, pos); - pos--; - return; - } - pos += 2; - // fallthrough - - // export var/let/const name = ...(, name = ...)+ - case 118/*v*/: - case 109/*l*/: - // destructured initializations not currently supported (skipped for { or [) - // also, lexing names after variable equals is skipped (export var p = function () { ... }, q = 5 skips "q") - pos += 2; - facade = false; - do { - pos++; - ch = commentWhitespace(true); - const startPos = pos; - ch = readToWsOrPunctuator(ch); - // dont yet handle [ { destructurings - if (ch === 123/*{*/ || ch === 91/*[*/) { - pos--; - return; - } - if (pos === startPos) - return; - addExport(startPos, pos, startPos, pos); - ch = commentWhitespace(true); - if (ch === 61/*=*/) { - pos--; - return; - } - } while (ch === 44/*,*/); - pos--; - return; - - - // export {...} - case 123/*{*/: - pos++; - ch = commentWhitespace(true); - while (true) { - const startPos = pos; - readToWsOrPunctuator(ch); - const endPos = pos; - commentWhitespace(true); - ch = readExportAs(startPos, endPos); - // , - if (ch === 44/*,*/) { - pos++; - ch = commentWhitespace(true); - } - if (ch === 125/*}*/) - break; - if (pos === startPos) - return syntaxError(); - if (pos > end) - return syntaxError(); - } - pos++; - ch = commentWhitespace(true); - break; - - // export * - // export * as X - case 42/***/: - pos++; - commentWhitespace(true); - ch = readExportAs(pos, pos); - ch = commentWhitespace(true); - break; - } - - // from ... - if (ch === 102/*f*/ && source.startsWith('rom', pos + 1)) { - pos += 4; - readImportString(sStartPos, commentWhitespace(true)); - - // There were no local names. - for (let i = prevExport; i < exports.length; ++i) { - exports[i].ls = exports[i].le = -1; - exports[i].ln = undefined; - } - } - else { - pos--; - } -} - -/* - * Ported from Acorn - * - * MIT License - - * Copyright (C) 2012-2020 by various contributors (see AUTHORS) - - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -let acornPos; -function readString (start, quote) { - acornPos = start; - let out = '', chunkStart = acornPos; - for (;;) { - if (acornPos >= source.length) syntaxError(); - const ch = source.charCodeAt(acornPos); - if (ch === quote) break; - if (ch === 92) { // '\' - out += source.slice(chunkStart, acornPos); - out += readEscapedChar(); - chunkStart = acornPos; - } - else if (ch === 0x2028 || ch === 0x2029) { - ++acornPos; - } - else { - if (isBr(ch)) syntaxError(); - ++acornPos; - } - } - out += source.slice(chunkStart, acornPos++); - return out; -} - -// Used to read escaped characters - -function readEscapedChar () { - let ch = source.charCodeAt(++acornPos); - ++acornPos; - switch (ch) { - case 110: return '\n'; // 'n' -> '\n' - case 114: return '\r'; // 'r' -> '\r' - case 120: return String.fromCharCode(readHexChar(2)); // 'x' - case 117: return readCodePointToString(); // 'u' - case 116: return '\t'; // 't' -> '\t' - case 98: return '\b'; // 'b' -> '\b' - case 118: return '\u000b'; // 'v' -> '\u000b' - case 102: return '\f'; // 'f' -> '\f' - case 13: if (source.charCodeAt(acornPos) === 10) ++acornPos; // '\r\n' - case 10: // ' \n' - return ''; - case 56: - case 57: - syntaxError(); - default: - if (ch >= 48 && ch <= 55) { - let octalStr = source.substr(acornPos - 1, 3).match(/^[0-7]+/)[0]; - let octal = parseInt(octalStr, 8); - if (octal > 255) { - octalStr = octalStr.slice(0, -1); - octal = parseInt(octalStr, 8); - } - acornPos += octalStr.length - 1; - ch = source.charCodeAt(acornPos); - if (octalStr !== '0' || ch === 56 || ch === 57) - syntaxError(); - return String.fromCharCode(octal); - } - if (isBr(ch)) { - // Unicode new line characters after \ get removed from output in both - // template literals and strings - return ''; - } - return String.fromCharCode(ch); - } -} - -// Used to read character escape sequences ('\x', '\u', '\U'). - -function readHexChar (len) { - const start = acornPos; - let total = 0, lastCode = 0; - for (let i = 0; i < len; ++i, ++acornPos) { - let code = source.charCodeAt(acornPos), val; - - if (code === 95) { - if (lastCode === 95 || i === 0) syntaxError(); - lastCode = code; - continue; - } - - if (code >= 97) val = code - 97 + 10; // a - else if (code >= 65) val = code - 65 + 10; // A - else if (code >= 48 && code <= 57) val = code - 48; // 0-9 - else break; - if (val >= 16) break; - lastCode = code; - total = total * 16 + val; - } - - if (lastCode === 95 || acornPos - start !== len) syntaxError(); - - return total; -} - -// Read a string value, interpreting backslash-escapes. - -function readCodePointToString () { - const ch = source.charCodeAt(acornPos); - let code; - if (ch === 123) { // '{' - ++acornPos; - code = readHexChar(source.indexOf('}', acornPos) - acornPos); - ++acornPos; - if (code > 0x10FFFF) syntaxError(); - } else { - code = readHexChar(4); - } - // UTF-16 Decoding - if (code <= 0xFFFF) return String.fromCharCode(code); - code -= 0x10000; - return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00); -} - -/* - * - */ - -function readExportAs (startPos, endPos) { - let ch = source.charCodeAt(pos); - let ls = startPos, le = endPos; - if (ch === 97 /*a*/) { - pos += 2; - ch = commentWhitespace(true); - startPos = pos; - readToWsOrPunctuator(ch); - endPos = pos; - ch = commentWhitespace(true); - } - if (pos !== startPos) - addExport(startPos, endPos, ls, le); - return ch; -} - -function readImportString (ss, ch) { - const startPos = pos + 1; - if (ch === 39/*'*/ || ch === 34/*"*/) { - stringLiteral(ch); - } - else { - syntaxError(); - return; - } - const impt = addImport(ss, startPos, pos, -1); - readName(impt); - pos++; - ch = commentWhitespace(false); - if (ch !== 97/*a*/ || !source.startsWith('ssert', pos + 1)) { - pos--; - return; - } - const assertIndex = pos; - - pos += 6; - ch = commentWhitespace(true); - if (ch !== 123/*{*/) { - pos = assertIndex; - return; - } - const assertStart = pos; - do { - pos++; - ch = commentWhitespace(true); - if (ch === 39/*'*/ || ch === 34/*"*/) { - stringLiteral(ch); - pos++; - ch = commentWhitespace(true); - } - else { - ch = readToWsOrPunctuator(ch); - } - if (ch !== 58/*:*/) { - pos = assertIndex; - return; - } - pos++; - ch = commentWhitespace(true); - if (ch === 39/*'*/ || ch === 34/*"*/) { - stringLiteral(ch); - } - else { - pos = assertIndex; - return; - } - pos++; - ch = commentWhitespace(true); - if (ch === 44/*,*/) { - pos++; - ch = commentWhitespace(true); - if (ch === 125/*}*/) - break; - continue; - } - if (ch === 125/*}*/) - break; - pos = assertIndex; - return; - } while (true); - impt.a = assertStart; - impt.se = pos + 1; -} - -function commentWhitespace (br) { - let ch; - do { - ch = source.charCodeAt(pos); - if (ch === 47/*/*/) { - const next_ch = source.charCodeAt(pos + 1); - if (next_ch === 47/*/*/) - lineComment(); - else if (next_ch === 42/***/) - blockComment(br); - else - return ch; - } - else if (br ? !isBrOrWs(ch): !isWsNotBr(ch)) { - return ch; - } - } while (pos++ < end); - return ch; -} - -function templateString () { - while (pos++ < end) { - const ch = source.charCodeAt(pos); - if (ch === 36/*$*/ && source.charCodeAt(pos + 1) === 123/*{*/) { - pos++; - templateStack[templateStackDepth++] = templateDepth; - templateDepth = ++openTokenDepth; - return; - } - if (ch === 96/*`*/) - return; - if (ch === 92/*\*/) - pos++; - } - syntaxError(); -} - -function blockComment (br) { - pos++; - while (pos++ < end) { - const ch = source.charCodeAt(pos); - if (!br && isBr(ch)) - return; - if (ch === 42/***/ && source.charCodeAt(pos + 1) === 47/*/*/) { - pos++; - return; - } - } -} - -function lineComment () { - while (pos++ < end) { - const ch = source.charCodeAt(pos); - if (ch === 10/*\n*/ || ch === 13/*\r*/) - return; - } -} - -function stringLiteral (quote) { - while (pos++ < end) { - let ch = source.charCodeAt(pos); - if (ch === quote) - return; - if (ch === 92/*\*/) { - ch = source.charCodeAt(++pos); - if (ch === 13/*\r*/ && source.charCodeAt(pos + 1) === 10/*\n*/) - pos++; - } - else if (isBr(ch)) - break; - } - syntaxError(); -} - -function regexCharacterClass () { - while (pos++ < end) { - let ch = source.charCodeAt(pos); - if (ch === 93/*]*/) - return ch; - if (ch === 92/*\*/) - pos++; - else if (ch === 10/*\n*/ || ch === 13/*\r*/) - break; - } - syntaxError(); -} - -function regularExpression () { - while (pos++ < end) { - let ch = source.charCodeAt(pos); - if (ch === 47/*/*/) - return; - if (ch === 91/*[*/) - ch = regexCharacterClass(); - else if (ch === 92/*\*/) - pos++; - else if (ch === 10/*\n*/ || ch === 13/*\r*/) - break; - } - syntaxError(); -} - -function readToWsOrPunctuator (ch) { - do { - if (isBrOrWs(ch) || isPunctuator(ch)) - return ch; - } while (ch = source.charCodeAt(++pos)); - return ch; -} - -// Note: non-asii BR and whitespace checks omitted for perf / footprint -// if there is a significant user need this can be reconsidered -function isBr (c) { - return c === 13/*\r*/ || c === 10/*\n*/; -} - -function isWsNotBr (c) { - return c === 9 || c === 11 || c === 12 || c === 32 || c === 160; -} - -function isBrOrWs (c) { - return c > 8 && c < 14 || c === 32 || c === 160; -} - -function isBrOrWsOrPunctuatorNotDot (c) { - return c > 8 && c < 14 || c === 32 || c === 160 || isPunctuator(c) && c !== 46/*.*/; -} - -function keywordStart (pos) { - return pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1)); -} - -function readPrecedingKeyword (pos, match) { - if (pos < match.length - 1) - return false; - return source.startsWith(match, pos - match.length + 1) && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - match.length))); -} - -function readPrecedingKeyword1 (pos, ch) { - return source.charCodeAt(pos) === ch && (pos === 0 || isBrOrWsOrPunctuatorNotDot(source.charCodeAt(pos - 1))); -} - -// Detects one of case, debugger, delete, do, else, in, instanceof, new, -// return, throw, typeof, void, yield, await -function isExpressionKeyword (pos) { - switch (source.charCodeAt(pos)) { - case 100/*d*/: - switch (source.charCodeAt(pos - 1)) { - case 105/*i*/: - // void - return readPrecedingKeyword(pos - 2, 'vo'); - case 108/*l*/: - // yield - return readPrecedingKeyword(pos - 2, 'yie'); - default: - return false; - } - case 101/*e*/: - switch (source.charCodeAt(pos - 1)) { - case 115/*s*/: - switch (source.charCodeAt(pos - 2)) { - case 108/*l*/: - // else - return readPrecedingKeyword1(pos - 3, 101/*e*/); - case 97/*a*/: - // case - return readPrecedingKeyword1(pos - 3, 99/*c*/); - default: - return false; - } - case 116/*t*/: - // delete - return readPrecedingKeyword(pos - 2, 'dele'); - default: - return false; - } - case 102/*f*/: - if (source.charCodeAt(pos - 1) !== 111/*o*/ || source.charCodeAt(pos - 2) !== 101/*e*/) - return false; - switch (source.charCodeAt(pos - 3)) { - case 99/*c*/: - // instanceof - return readPrecedingKeyword(pos - 4, 'instan'); - case 112/*p*/: - // typeof - return readPrecedingKeyword(pos - 4, 'ty'); - default: - return false; - } - case 110/*n*/: - // in, return - return readPrecedingKeyword1(pos - 1, 105/*i*/) || readPrecedingKeyword(pos - 1, 'retur'); - case 111/*o*/: - // do - return readPrecedingKeyword1(pos - 1, 100/*d*/); - case 114/*r*/: - // debugger - return readPrecedingKeyword(pos - 1, 'debugge'); - case 116/*t*/: - // await - return readPrecedingKeyword(pos - 1, 'awai'); - case 119/*w*/: - switch (source.charCodeAt(pos - 1)) { - case 101/*e*/: - // new - return readPrecedingKeyword1(pos - 2, 110/*n*/); - case 111/*o*/: - // throw - return readPrecedingKeyword(pos - 2, 'thr'); - default: - return false; - } - } - return false; -} - -function isParenKeyword (curPos) { - return source.charCodeAt(curPos) === 101/*e*/ && source.startsWith('whil', curPos - 4) || - source.charCodeAt(curPos) === 114/*r*/ && source.startsWith('fo', curPos - 2) || - source.charCodeAt(curPos - 1) === 105/*i*/ && source.charCodeAt(curPos) === 102/*f*/; -} - -function isPunctuator (ch) { - // 23 possible punctuator endings: !%&()*+,-./:;<=>?[]^{}|~ - return ch === 33/*!*/ || ch === 37/*%*/ || ch === 38/*&*/ || - ch > 39 && ch < 48 || ch > 57 && ch < 64 || - ch === 91/*[*/ || ch === 93/*]*/ || ch === 94/*^*/ || - ch > 122 && ch < 127; -} - -function isExpressionPunctuator (ch) { - // 20 possible expression endings: !%&(*+,-.:;<=>?[^{|~ - return ch === 33/*!*/ || ch === 37/*%*/ || ch === 38/*&*/ || - ch > 39 && ch < 47 && ch !== 41 || ch > 57 && ch < 64 || - ch === 91/*[*/ || ch === 94/*^*/ || ch > 122 && ch < 127 && ch !== 125/*}*/; -} - -function isExpressionTerminator (curPos) { - // detects: - // => ; ) finally catch else - // as all of these followed by a { will indicate a statement brace - switch (source.charCodeAt(curPos)) { - case 62/*>*/: - return source.charCodeAt(curPos - 1) === 61/*=*/; - case 59/*;*/: - case 41/*)*/: - return true; - case 104/*h*/: - return source.startsWith('catc', curPos - 4); - case 121/*y*/: - return source.startsWith('finall', curPos - 6); - case 101/*e*/: - return source.startsWith('els', curPos - 3); - } - return false; -} - -function syntaxError () { - throw Object.assign(new Error(`Parse error ${name}:${source.slice(0, pos).split('\n').length}:${pos - source.lastIndexOf('\n', pos - 1)}`), { idx: pos }); -} \ No newline at end of file diff --git a/node_modules/es-module-lexer/package.json b/node_modules/es-module-lexer/package.json deleted file mode 100644 index 98a3adf..0000000 --- a/node_modules/es-module-lexer/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "es-module-lexer", - "version": "1.7.0", - "description": "Lexes ES modules returning their import/export metadata", - "main": "dist/lexer.cjs", - "module": "dist/lexer.js", - "types": "types/lexer.d.ts", - "exports": { - ".": { - "types": "./types/lexer.d.ts", - "module": "./dist/lexer.js", - "import": "./dist/lexer.js", - "require": "./dist/lexer.cjs" - }, - "./js": { - "types": "./types/lexer.d.ts", - "default": "./dist/lexer.asm.js" - } - }, - "scripts": { - "build": "npm install -g chomp ; chomp build", - "test": "npm install -g chomp ; chomp test" - }, - "author": "Guy Bedford", - "license": "MIT", - "devDependencies": { - "@babel/cli": "^7.5.5", - "@babel/core": "^7.5.5", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", - "@swc/cli": "^0.1.57", - "@swc/core": "^1.2.224", - "@types/node": "^18.7.1", - "kleur": "^2.0.2", - "mocha": "^5.2.0", - "terser": "^5.19.4", - "typescript": "^4.7.4" - }, - "files": [ - "dist", - "types", - "lexer.js" - ], - "type": "module", - "repository": { - "type": "git", - "url": "git+https://github.com/guybedford/es-module-lexer.git" - }, - "bugs": { - "url": "https://github.com/guybedford/es-module-lexer/issues" - }, - "homepage": "https://github.com/guybedford/es-module-lexer#readme", - "directories": { - "lib": "lib", - "test": "test" - }, - "keywords": [] -} diff --git a/node_modules/es-module-lexer/types/lexer.d.ts b/node_modules/es-module-lexer/types/lexer.d.ts deleted file mode 100644 index dd15b64..0000000 --- a/node_modules/es-module-lexer/types/lexer.d.ts +++ /dev/null @@ -1,195 +0,0 @@ -export declare enum ImportType { - /** - * A normal static using any syntax variations - * import .. from 'module' - */ - Static = 1, - /** - * A dynamic import expression `import(specifier)` - * or `import(specifier, opts)` - */ - Dynamic = 2, - /** - * An import.meta expression - */ - ImportMeta = 3, - /** - * A source phase import - * import source x from 'module' - */ - StaticSourcePhase = 4, - /** - * A dynamic source phase import - * import.source('module') - */ - DynamicSourcePhase = 5, - /** - * A defer phase import - * import defer * as x from 'module' - */ - StaticDeferPhase = 6, - /** - * A dynamic defer phase import - * import.defer('module') - */ - DynamicDeferPhase = 7 -} -export interface ImportSpecifier { - /** - * Module name - * - * To handle escape sequences in specifier strings, the .n field of imported specifiers will be provided where possible. - * - * For dynamic import expressions, this field will be empty if not a valid JS string. - * For static import expressions, this field will always be populated. - * - * @example - * const [imports1, exports1] = parse(String.raw`import './\u0061\u0062.js'`); - * imports1[0].n; - * // Returns "./ab.js" - * - * const [imports2, exports2] = parse(`import("./ab.js")`); - * imports2[0].n; - * // Returns "./ab.js" - * - * const [imports3, exports3] = parse(`import("./" + "ab.js")`); - * imports3[0].n; - * // Returns undefined - */ - readonly n: string | undefined; - /** - * Type of import statement - */ - readonly t: ImportType; - /** - * Start of module specifier - * - * @example - * const source = `import { a } from 'asdf'`; - * const [imports, exports] = parse(source); - * source.substring(imports[0].s, imports[0].e); - * // Returns "asdf" - */ - readonly s: number; - /** - * End of module specifier - */ - readonly e: number; - /** - * Start of import statement - * - * @example - * const source = `import { a } from 'asdf'`; - * const [imports, exports] = parse(source); - * source.substring(imports[0].ss, imports[0].se); - * // Returns "import { a } from 'asdf';" - */ - readonly ss: number; - /** - * End of import statement - */ - readonly se: number; - /** - * If this import keyword is a dynamic import, this is the start value. - * If this import keyword is a static import, this is -1. - * If this import keyword is an import.meta expresion, this is -2. - */ - readonly d: number; - /** - * If this import has an import assertion, this is the start value. - * Otherwise this is `-1`. - */ - readonly a: number; -} -export interface ExportSpecifier { - /** - * Exported name - * - * @example - * const source = `export default []`; - * const [imports, exports] = parse(source); - * exports[0].n; - * // Returns "default" - * - * @example - * const source = `export const asdf = 42`; - * const [imports, exports] = parse(source); - * exports[0].n; - * // Returns "asdf" - */ - readonly n: string; - /** - * Local name, or undefined. - * - * @example - * const source = `export default []`; - * const [imports, exports] = parse(source); - * exports[0].ln; - * // Returns undefined - * - * @example - * const asdf = 42; - * const source = `export { asdf as a }`; - * const [imports, exports] = parse(source); - * exports[0].ln; - * // Returns "asdf" - */ - readonly ln: string | undefined; - /** - * Start of exported name - * - * @example - * const source = `export default []`; - * const [imports, exports] = parse(source); - * source.substring(exports[0].s, exports[0].e); - * // Returns "default" - * - * @example - * const source = `export { 42 as asdf }`; - * const [imports, exports] = parse(source); - * source.substring(exports[0].s, exports[0].e); - * // Returns "asdf" - */ - readonly s: number; - /** - * End of exported name - */ - readonly e: number; - /** - * Start of local name, or -1. - * - * @example - * const asdf = 42; - * const source = `export { asdf as a }`; - * const [imports, exports] = parse(source); - * source.substring(exports[0].ls, exports[0].le); - * // Returns "asdf" - */ - readonly ls: number; - /** - * End of local name, or -1. - */ - readonly le: number; -} -export interface ParseError extends Error { - idx: number; -} -/** - * Outputs the list of exports and locations of import specifiers, - * including dynamic import and import meta handling. - * - * @param source Source code to parser - * @param name Optional sourcename - * @returns Tuple contaning imports list and exports list. - */ -export declare function parse(source: string, name?: string): readonly [ - imports: ReadonlyArray, - exports: ReadonlyArray, - facade: boolean, - hasModuleSyntax: boolean -]; -/** - * Wait for init to resolve before calling `parse`. - */ -export declare const init: Promise; -export declare const initSync: () => void; diff --git a/node_modules/esbuild/LICENSE.md b/node_modules/esbuild/LICENSE.md deleted file mode 100644 index 2027e8d..0000000 --- a/node_modules/esbuild/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Evan Wallace - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/esbuild/README.md b/node_modules/esbuild/README.md deleted file mode 100644 index 93863d1..0000000 --- a/node_modules/esbuild/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# esbuild - -This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details. diff --git a/node_modules/esbuild/bin/esbuild b/node_modules/esbuild/bin/esbuild deleted file mode 100755 index 8935f40..0000000 Binary files a/node_modules/esbuild/bin/esbuild and /dev/null differ diff --git a/node_modules/esbuild/install.js b/node_modules/esbuild/install.js deleted file mode 100644 index 1019e62..0000000 --- a/node_modules/esbuild/install.js +++ /dev/null @@ -1,289 +0,0 @@ -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); - -// lib/npm/node-platform.ts -var fs = require("fs"); -var os = require("os"); -var path = require("path"); -var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; -var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild"; -var knownWindowsPackages = { - "win32 arm64 LE": "@esbuild/win32-arm64", - "win32 ia32 LE": "@esbuild/win32-ia32", - "win32 x64 LE": "@esbuild/win32-x64" -}; -var knownUnixlikePackages = { - "aix ppc64 BE": "@esbuild/aix-ppc64", - "android arm64 LE": "@esbuild/android-arm64", - "darwin arm64 LE": "@esbuild/darwin-arm64", - "darwin x64 LE": "@esbuild/darwin-x64", - "freebsd arm64 LE": "@esbuild/freebsd-arm64", - "freebsd x64 LE": "@esbuild/freebsd-x64", - "linux arm LE": "@esbuild/linux-arm", - "linux arm64 LE": "@esbuild/linux-arm64", - "linux ia32 LE": "@esbuild/linux-ia32", - "linux mips64el LE": "@esbuild/linux-mips64el", - "linux ppc64 LE": "@esbuild/linux-ppc64", - "linux riscv64 LE": "@esbuild/linux-riscv64", - "linux s390x BE": "@esbuild/linux-s390x", - "linux x64 LE": "@esbuild/linux-x64", - "linux loong64 LE": "@esbuild/linux-loong64", - "netbsd arm64 LE": "@esbuild/netbsd-arm64", - "netbsd x64 LE": "@esbuild/netbsd-x64", - "openbsd arm64 LE": "@esbuild/openbsd-arm64", - "openbsd x64 LE": "@esbuild/openbsd-x64", - "sunos x64 LE": "@esbuild/sunos-x64" -}; -var knownWebAssemblyFallbackPackages = { - "android arm LE": "@esbuild/android-arm", - "android x64 LE": "@esbuild/android-x64", - "openharmony arm64 LE": "@esbuild/openharmony-arm64" -}; -function pkgAndSubpathForCurrentPlatform() { - let pkg; - let subpath; - let isWASM = false; - let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; - if (platformKey in knownWindowsPackages) { - pkg = knownWindowsPackages[platformKey]; - subpath = "esbuild.exe"; - } else if (platformKey in knownUnixlikePackages) { - pkg = knownUnixlikePackages[platformKey]; - subpath = "bin/esbuild"; - } else if (platformKey in knownWebAssemblyFallbackPackages) { - pkg = knownWebAssemblyFallbackPackages[platformKey]; - subpath = "bin/esbuild"; - isWASM = true; - } else { - throw new Error(`Unsupported platform: ${platformKey}`); - } - return { pkg, subpath, isWASM }; -} -function downloadedBinPath(pkg, subpath) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`); -} - -// lib/npm/node-install.ts -var fs2 = require("fs"); -var os2 = require("os"); -var path2 = require("path"); -var zlib = require("zlib"); -var https = require("https"); -var child_process = require("child_process"); -var versionFromPackageJSON = require(path2.join(__dirname, "package.json")).version; -var toPath = path2.join(__dirname, "bin", "esbuild"); -var isToPathJS = true; -function validateBinaryVersion(...command) { - command.push("--version"); - let stdout; - try { - stdout = child_process.execFileSync(command.shift(), command, { - // Without this, this install script strangely crashes with the error - // "EACCES: permission denied, write" but only on Ubuntu Linux when node is - // installed from the Snap Store. This is not a problem when you download - // the official version of node. The problem appears to be that stderr - // (i.e. file descriptor 2) isn't writable? - // - // More info: - // - https://snapcraft.io/ (what the Snap Store is) - // - https://nodejs.org/dist/ (download the official version of node) - // - https://github.com/evanw/esbuild/issues/1711#issuecomment-1027554035 - // - stdio: "pipe" - }).toString().trim(); - } catch (err) { - if (os2.platform() === "darwin" && /_SecTrustEvaluateWithError/.test(err + "")) { - let os3 = "this version of macOS"; - try { - os3 = "macOS " + child_process.execFileSync("sw_vers", ["-productVersion"]).toString().trim(); - } catch { - } - throw new Error(`The "esbuild" package cannot be installed because ${os3} is too outdated. - -The Go compiler (which esbuild relies on) no longer supports ${os3}, -which means the "esbuild" binary executable can't be run. You can either: - - * Update your version of macOS to one that the Go compiler supports - * Use the "esbuild-wasm" package instead of the "esbuild" package - * Build esbuild yourself using an older version of the Go compiler -`); - } - throw err; - } - if (stdout !== versionFromPackageJSON) { - throw new Error(`Expected ${JSON.stringify(versionFromPackageJSON)} but got ${JSON.stringify(stdout)}`); - } -} -function isYarn() { - const { npm_config_user_agent } = process.env; - if (npm_config_user_agent) { - return /\byarn\//.test(npm_config_user_agent); - } - return false; -} -function fetch(url) { - return new Promise((resolve, reject) => { - https.get(url, (res) => { - if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) - return fetch(res.headers.location).then(resolve, reject); - if (res.statusCode !== 200) - return reject(new Error(`Server responded with ${res.statusCode}`)); - let chunks = []; - res.on("data", (chunk) => chunks.push(chunk)); - res.on("end", () => resolve(Buffer.concat(chunks))); - }).on("error", reject); - }); -} -function extractFileFromTarGzip(buffer, subpath) { - try { - buffer = zlib.unzipSync(buffer); - } catch (err) { - throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`); - } - let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, ""); - let offset = 0; - subpath = `package/${subpath}`; - while (offset < buffer.length) { - let name = str(offset, 100); - let size = parseInt(str(offset + 124, 12), 8); - offset += 512; - if (!isNaN(size)) { - if (name === subpath) return buffer.subarray(offset, offset + size); - offset += size + 511 & ~511; - } - } - throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`); -} -function installUsingNPM(pkg, subpath, binPath) { - const env = { ...process.env, npm_config_global: void 0 }; - const esbuildLibDir = path2.dirname(require.resolve("esbuild")); - const installDir = path2.join(esbuildLibDir, "npm-install"); - fs2.mkdirSync(installDir); - try { - fs2.writeFileSync(path2.join(installDir, "package.json"), "{}"); - child_process.execSync( - `npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${versionFromPackageJSON}`, - { cwd: installDir, stdio: "pipe", env } - ); - const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath); - fs2.renameSync(installedBinPath, binPath); - } finally { - try { - removeRecursive(installDir); - } catch { - } - } -} -function removeRecursive(dir) { - for (const entry of fs2.readdirSync(dir)) { - const entryPath = path2.join(dir, entry); - let stats; - try { - stats = fs2.lstatSync(entryPath); - } catch { - continue; - } - if (stats.isDirectory()) removeRecursive(entryPath); - else fs2.unlinkSync(entryPath); - } - fs2.rmdirSync(dir); -} -function applyManualBinaryPathOverride(overridePath) { - const pathString = JSON.stringify(overridePath); - fs2.writeFileSync(toPath, `#!/usr/bin/env node -require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' }); -`); - const libMain = path2.join(__dirname, "lib", "main.js"); - const code = fs2.readFileSync(libMain, "utf8"); - fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString}; -${code}`); -} -function maybeOptimizePackage(binPath) { - const { isWASM } = pkgAndSubpathForCurrentPlatform(); - if (os2.platform() !== "win32" && !isYarn() && !isWASM) { - const tempPath = path2.join(__dirname, "bin-esbuild"); - try { - fs2.linkSync(binPath, tempPath); - fs2.renameSync(tempPath, toPath); - isToPathJS = false; - fs2.unlinkSync(tempPath); - } catch { - } - } -} -async function downloadDirectlyFromNPM(pkg, subpath, binPath) { - const url = `https://registry.npmjs.org/${pkg}/-/${pkg.replace("@esbuild/", "")}-${versionFromPackageJSON}.tgz`; - console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`); - try { - fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath)); - fs2.chmodSync(binPath, 493); - } catch (e) { - console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`); - throw e; - } -} -async function checkAndPreparePackage() { - if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { - if (!fs2.existsSync(ESBUILD_BINARY_PATH)) { - console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`); - } else { - applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); - return; - } - } - const { pkg, subpath } = pkgAndSubpathForCurrentPlatform(); - let binPath; - try { - binPath = require.resolve(`${pkg}/${subpath}`); - } catch (e) { - console.error(`[esbuild] Failed to find package "${pkg}" on the file system - -This can happen if you use the "--no-optional" flag. The "optionalDependencies" -package.json feature is used by esbuild to install the correct binary executable -for your current platform. This install script will now attempt to work around -this. If that fails, you need to remove the "--no-optional" flag to use esbuild. -`); - binPath = downloadedBinPath(pkg, subpath); - try { - console.error(`[esbuild] Trying to install package "${pkg}" using npm`); - installUsingNPM(pkg, subpath, binPath); - } catch (e2) { - console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`); - try { - await downloadDirectlyFromNPM(pkg, subpath, binPath); - } catch (e3) { - throw new Error(`Failed to install package "${pkg}"`); - } - } - } - maybeOptimizePackage(binPath); -} -checkAndPreparePackage().then(() => { - if (isToPathJS) { - validateBinaryVersion(process.execPath, toPath); - } else { - validateBinaryVersion(toPath); - } -}); diff --git a/node_modules/esbuild/lib/main.d.ts b/node_modules/esbuild/lib/main.d.ts deleted file mode 100644 index 9e69c39..0000000 --- a/node_modules/esbuild/lib/main.d.ts +++ /dev/null @@ -1,716 +0,0 @@ -export type Platform = 'browser' | 'node' | 'neutral' -export type Format = 'iife' | 'cjs' | 'esm' -export type Loader = 'base64' | 'binary' | 'copy' | 'css' | 'dataurl' | 'default' | 'empty' | 'file' | 'js' | 'json' | 'jsx' | 'local-css' | 'text' | 'ts' | 'tsx' -export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent' -export type Charset = 'ascii' | 'utf8' -export type Drop = 'console' | 'debugger' -export type AbsPaths = 'code' | 'log' | 'metafile' - -interface CommonOptions { - /** Documentation: https://esbuild.github.io/api/#sourcemap */ - sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both' - /** Documentation: https://esbuild.github.io/api/#legal-comments */ - legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external' - /** Documentation: https://esbuild.github.io/api/#source-root */ - sourceRoot?: string - /** Documentation: https://esbuild.github.io/api/#sources-content */ - sourcesContent?: boolean - - /** Documentation: https://esbuild.github.io/api/#format */ - format?: Format - /** Documentation: https://esbuild.github.io/api/#global-name */ - globalName?: string - /** Documentation: https://esbuild.github.io/api/#target */ - target?: string | string[] - /** Documentation: https://esbuild.github.io/api/#supported */ - supported?: Record - /** Documentation: https://esbuild.github.io/api/#platform */ - platform?: Platform - - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleProps?: RegExp - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - reserveProps?: RegExp - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleQuoted?: boolean - /** Documentation: https://esbuild.github.io/api/#mangle-props */ - mangleCache?: Record - /** Documentation: https://esbuild.github.io/api/#drop */ - drop?: Drop[] - /** Documentation: https://esbuild.github.io/api/#drop-labels */ - dropLabels?: string[] - /** Documentation: https://esbuild.github.io/api/#minify */ - minify?: boolean - /** Documentation: https://esbuild.github.io/api/#minify */ - minifyWhitespace?: boolean - /** Documentation: https://esbuild.github.io/api/#minify */ - minifyIdentifiers?: boolean - /** Documentation: https://esbuild.github.io/api/#minify */ - minifySyntax?: boolean - /** Documentation: https://esbuild.github.io/api/#line-limit */ - lineLimit?: number - /** Documentation: https://esbuild.github.io/api/#charset */ - charset?: Charset - /** Documentation: https://esbuild.github.io/api/#tree-shaking */ - treeShaking?: boolean - /** Documentation: https://esbuild.github.io/api/#ignore-annotations */ - ignoreAnnotations?: boolean - - /** Documentation: https://esbuild.github.io/api/#jsx */ - jsx?: 'transform' | 'preserve' | 'automatic' - /** Documentation: https://esbuild.github.io/api/#jsx-factory */ - jsxFactory?: string - /** Documentation: https://esbuild.github.io/api/#jsx-fragment */ - jsxFragment?: string - /** Documentation: https://esbuild.github.io/api/#jsx-import-source */ - jsxImportSource?: string - /** Documentation: https://esbuild.github.io/api/#jsx-development */ - jsxDev?: boolean - /** Documentation: https://esbuild.github.io/api/#jsx-side-effects */ - jsxSideEffects?: boolean - - /** Documentation: https://esbuild.github.io/api/#define */ - define?: { [key: string]: string } - /** Documentation: https://esbuild.github.io/api/#pure */ - pure?: string[] - /** Documentation: https://esbuild.github.io/api/#keep-names */ - keepNames?: boolean - - /** Documentation: https://esbuild.github.io/api/#abs-paths */ - absPaths?: AbsPaths[] - /** Documentation: https://esbuild.github.io/api/#color */ - color?: boolean - /** Documentation: https://esbuild.github.io/api/#log-level */ - logLevel?: LogLevel - /** Documentation: https://esbuild.github.io/api/#log-limit */ - logLimit?: number - /** Documentation: https://esbuild.github.io/api/#log-override */ - logOverride?: Record - - /** Documentation: https://esbuild.github.io/api/#tsconfig-raw */ - tsconfigRaw?: string | TsconfigRaw -} - -export interface TsconfigRaw { - compilerOptions?: { - alwaysStrict?: boolean - baseUrl?: string - experimentalDecorators?: boolean - importsNotUsedAsValues?: 'remove' | 'preserve' | 'error' - jsx?: 'preserve' | 'react-native' | 'react' | 'react-jsx' | 'react-jsxdev' - jsxFactory?: string - jsxFragmentFactory?: string - jsxImportSource?: string - paths?: Record - preserveValueImports?: boolean - strict?: boolean - target?: string - useDefineForClassFields?: boolean - verbatimModuleSyntax?: boolean - } -} - -export interface BuildOptions extends CommonOptions { - /** Documentation: https://esbuild.github.io/api/#bundle */ - bundle?: boolean - /** Documentation: https://esbuild.github.io/api/#splitting */ - splitting?: boolean - /** Documentation: https://esbuild.github.io/api/#preserve-symlinks */ - preserveSymlinks?: boolean - /** Documentation: https://esbuild.github.io/api/#outfile */ - outfile?: string - /** Documentation: https://esbuild.github.io/api/#metafile */ - metafile?: boolean - /** Documentation: https://esbuild.github.io/api/#outdir */ - outdir?: string - /** Documentation: https://esbuild.github.io/api/#outbase */ - outbase?: string - /** Documentation: https://esbuild.github.io/api/#external */ - external?: string[] - /** Documentation: https://esbuild.github.io/api/#packages */ - packages?: 'bundle' | 'external' - /** Documentation: https://esbuild.github.io/api/#alias */ - alias?: Record - /** Documentation: https://esbuild.github.io/api/#loader */ - loader?: { [ext: string]: Loader } - /** Documentation: https://esbuild.github.io/api/#resolve-extensions */ - resolveExtensions?: string[] - /** Documentation: https://esbuild.github.io/api/#main-fields */ - mainFields?: string[] - /** Documentation: https://esbuild.github.io/api/#conditions */ - conditions?: string[] - /** Documentation: https://esbuild.github.io/api/#write */ - write?: boolean - /** Documentation: https://esbuild.github.io/api/#allow-overwrite */ - allowOverwrite?: boolean - /** Documentation: https://esbuild.github.io/api/#tsconfig */ - tsconfig?: string - /** Documentation: https://esbuild.github.io/api/#out-extension */ - outExtension?: { [ext: string]: string } - /** Documentation: https://esbuild.github.io/api/#public-path */ - publicPath?: string - /** Documentation: https://esbuild.github.io/api/#entry-names */ - entryNames?: string - /** Documentation: https://esbuild.github.io/api/#chunk-names */ - chunkNames?: string - /** Documentation: https://esbuild.github.io/api/#asset-names */ - assetNames?: string - /** Documentation: https://esbuild.github.io/api/#inject */ - inject?: string[] - /** Documentation: https://esbuild.github.io/api/#banner */ - banner?: { [type: string]: string } - /** Documentation: https://esbuild.github.io/api/#footer */ - footer?: { [type: string]: string } - /** Documentation: https://esbuild.github.io/api/#entry-points */ - entryPoints?: (string | { in: string, out: string })[] | Record - /** Documentation: https://esbuild.github.io/api/#stdin */ - stdin?: StdinOptions - /** Documentation: https://esbuild.github.io/plugins/ */ - plugins?: Plugin[] - /** Documentation: https://esbuild.github.io/api/#working-directory */ - absWorkingDir?: string - /** Documentation: https://esbuild.github.io/api/#node-paths */ - nodePaths?: string[]; // The "NODE_PATH" variable from Node.js -} - -export interface StdinOptions { - contents: string | Uint8Array - resolveDir?: string - sourcefile?: string - loader?: Loader -} - -export interface Message { - id: string - pluginName: string - text: string - location: Location | null - notes: Note[] - - /** - * Optional user-specified data that is passed through unmodified. You can - * use this to stash the original error, for example. - */ - detail: any -} - -export interface Note { - text: string - location: Location | null -} - -export interface Location { - file: string - namespace: string - /** 1-based */ - line: number - /** 0-based, in bytes */ - column: number - /** in bytes */ - length: number - lineText: string - suggestion: string -} - -export interface OutputFile { - path: string - contents: Uint8Array - hash: string - /** "contents" as text (changes automatically with "contents") */ - readonly text: string -} - -export interface BuildResult { - errors: Message[] - warnings: Message[] - /** Only when "write: false" */ - outputFiles: OutputFile[] | (ProvidedOptions['write'] extends false ? never : undefined) - /** Only when "metafile: true" */ - metafile: Metafile | (ProvidedOptions['metafile'] extends true ? never : undefined) - /** Only when "mangleCache" is present */ - mangleCache: Record | (ProvidedOptions['mangleCache'] extends Object ? never : undefined) -} - -export interface BuildFailure extends Error { - errors: Message[] - warnings: Message[] -} - -/** Documentation: https://esbuild.github.io/api/#serve-arguments */ -export interface ServeOptions { - port?: number - host?: string - servedir?: string - keyfile?: string - certfile?: string - fallback?: string - cors?: CORSOptions - onRequest?: (args: ServeOnRequestArgs) => void -} - -/** Documentation: https://esbuild.github.io/api/#cors */ -export interface CORSOptions { - origin?: string | string[] -} - -export interface ServeOnRequestArgs { - remoteAddress: string - method: string - path: string - status: number - /** The time to generate the response, not to send it */ - timeInMS: number -} - -/** Documentation: https://esbuild.github.io/api/#serve-return-values */ -export interface ServeResult { - port: number - hosts: string[] -} - -export interface TransformOptions extends CommonOptions { - /** Documentation: https://esbuild.github.io/api/#sourcefile */ - sourcefile?: string - /** Documentation: https://esbuild.github.io/api/#loader */ - loader?: Loader - /** Documentation: https://esbuild.github.io/api/#banner */ - banner?: string - /** Documentation: https://esbuild.github.io/api/#footer */ - footer?: string -} - -export interface TransformResult { - code: string - map: string - warnings: Message[] - /** Only when "mangleCache" is present */ - mangleCache: Record | (ProvidedOptions['mangleCache'] extends Object ? never : undefined) - /** Only when "legalComments" is "external" */ - legalComments: string | (ProvidedOptions['legalComments'] extends 'external' ? never : undefined) -} - -export interface TransformFailure extends Error { - errors: Message[] - warnings: Message[] -} - -export interface Plugin { - name: string - setup: (build: PluginBuild) => (void | Promise) -} - -export interface PluginBuild { - /** Documentation: https://esbuild.github.io/plugins/#build-options */ - initialOptions: BuildOptions - - /** Documentation: https://esbuild.github.io/plugins/#resolve */ - resolve(path: string, options?: ResolveOptions): Promise - - /** Documentation: https://esbuild.github.io/plugins/#on-start */ - onStart(callback: () => - (OnStartResult | null | void | Promise)): void - - /** Documentation: https://esbuild.github.io/plugins/#on-end */ - onEnd(callback: (result: BuildResult) => - (OnEndResult | null | void | Promise)): void - - /** Documentation: https://esbuild.github.io/plugins/#on-resolve */ - onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => - (OnResolveResult | null | undefined | Promise)): void - - /** Documentation: https://esbuild.github.io/plugins/#on-load */ - onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => - (OnLoadResult | null | undefined | Promise)): void - - /** Documentation: https://esbuild.github.io/plugins/#on-dispose */ - onDispose(callback: () => void): void - - // This is a full copy of the esbuild library in case you need it - esbuild: { - context: typeof context, - build: typeof build, - buildSync: typeof buildSync, - transform: typeof transform, - transformSync: typeof transformSync, - formatMessages: typeof formatMessages, - formatMessagesSync: typeof formatMessagesSync, - analyzeMetafile: typeof analyzeMetafile, - analyzeMetafileSync: typeof analyzeMetafileSync, - initialize: typeof initialize, - version: typeof version, - } -} - -/** Documentation: https://esbuild.github.io/plugins/#resolve-options */ -export interface ResolveOptions { - pluginName?: string - importer?: string - namespace?: string - resolveDir?: string - kind?: ImportKind - pluginData?: any - with?: Record -} - -/** Documentation: https://esbuild.github.io/plugins/#resolve-results */ -export interface ResolveResult { - errors: Message[] - warnings: Message[] - - path: string - external: boolean - sideEffects: boolean - namespace: string - suffix: string - pluginData: any -} - -export interface OnStartResult { - errors?: PartialMessage[] - warnings?: PartialMessage[] -} - -export interface OnEndResult { - errors?: PartialMessage[] - warnings?: PartialMessage[] -} - -/** Documentation: https://esbuild.github.io/plugins/#on-resolve-options */ -export interface OnResolveOptions { - filter: RegExp - namespace?: string -} - -/** Documentation: https://esbuild.github.io/plugins/#on-resolve-arguments */ -export interface OnResolveArgs { - path: string - importer: string - namespace: string - resolveDir: string - kind: ImportKind - pluginData: any - with: Record -} - -export type ImportKind = - | 'entry-point' - - // JS - | 'import-statement' - | 'require-call' - | 'dynamic-import' - | 'require-resolve' - - // CSS - | 'import-rule' - | 'composes-from' - | 'url-token' - -/** Documentation: https://esbuild.github.io/plugins/#on-resolve-results */ -export interface OnResolveResult { - pluginName?: string - - errors?: PartialMessage[] - warnings?: PartialMessage[] - - path?: string - external?: boolean - sideEffects?: boolean - namespace?: string - suffix?: string - pluginData?: any - - watchFiles?: string[] - watchDirs?: string[] -} - -/** Documentation: https://esbuild.github.io/plugins/#on-load-options */ -export interface OnLoadOptions { - filter: RegExp - namespace?: string -} - -/** Documentation: https://esbuild.github.io/plugins/#on-load-arguments */ -export interface OnLoadArgs { - path: string - namespace: string - suffix: string - pluginData: any - with: Record -} - -/** Documentation: https://esbuild.github.io/plugins/#on-load-results */ -export interface OnLoadResult { - pluginName?: string - - errors?: PartialMessage[] - warnings?: PartialMessage[] - - contents?: string | Uint8Array - resolveDir?: string - loader?: Loader - pluginData?: any - - watchFiles?: string[] - watchDirs?: string[] -} - -export interface PartialMessage { - id?: string - pluginName?: string - text?: string - location?: Partial | null - notes?: PartialNote[] - detail?: any -} - -export interface PartialNote { - text?: string - location?: Partial | null -} - -/** Documentation: https://esbuild.github.io/api/#metafile */ -export interface Metafile { - inputs: { - [path: string]: { - bytes: number - imports: { - path: string - kind: ImportKind - external?: boolean - original?: string - with?: Record - }[] - format?: 'cjs' | 'esm' - with?: Record - } - } - outputs: { - [path: string]: { - bytes: number - inputs: { - [path: string]: { - bytesInOutput: number - } - } - imports: { - path: string - kind: ImportKind | 'file-loader' - external?: boolean - }[] - exports: string[] - entryPoint?: string - cssBundle?: string - } - } -} - -export interface FormatMessagesOptions { - kind: 'error' | 'warning' - color?: boolean - terminalWidth?: number -} - -export interface AnalyzeMetafileOptions { - color?: boolean - verbose?: boolean -} - -/** Documentation: https://esbuild.github.io/api/#watch-arguments */ -export interface WatchOptions { - delay?: number // In milliseconds -} - -export interface BuildContext { - /** Documentation: https://esbuild.github.io/api/#rebuild */ - rebuild(): Promise> - - /** Documentation: https://esbuild.github.io/api/#watch */ - watch(options?: WatchOptions): Promise - - /** Documentation: https://esbuild.github.io/api/#serve */ - serve(options?: ServeOptions): Promise - - cancel(): Promise - dispose(): Promise -} - -// This is a TypeScript type-level function which replaces any keys in "In" -// that aren't in "Out" with "never". We use this to reject properties with -// typos in object literals. See: https://stackoverflow.com/questions/49580725 -type SameShape = In & { [Key in Exclude]: never } - -/** - * This function invokes the "esbuild" command-line tool for you. It returns a - * promise that either resolves with a "BuildResult" object or rejects with a - * "BuildFailure" object. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#build - */ -export declare function build(options: SameShape): Promise> - -/** - * This is the advanced long-running form of "build" that supports additional - * features such as watch mode and a local development server. - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#build - */ -export declare function context(options: SameShape): Promise> - -/** - * This function transforms a single JavaScript file. It can be used to minify - * JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript - * to older JavaScript. It returns a promise that is either resolved with a - * "TransformResult" object or rejected with a "TransformFailure" object. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#transform - */ -export declare function transform(input: string | Uint8Array, options?: SameShape): Promise> - -/** - * Converts log messages to formatted message strings suitable for printing in - * the terminal. This allows you to reuse the built-in behavior of esbuild's - * log message formatter. This is a batch-oriented API for efficiency. - * - * - Works in node: yes - * - Works in browser: yes - */ -export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise - -/** - * Pretty-prints an analysis of the metafile JSON to a string. This is just for - * convenience to be able to match esbuild's pretty-printing exactly. If you want - * to customize it, you can just inspect the data in the metafile yourself. - * - * - Works in node: yes - * - Works in browser: yes - * - * Documentation: https://esbuild.github.io/api/#analyze - */ -export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise - -/** - * A synchronous version of "build". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#build - */ -export declare function buildSync(options: SameShape): BuildResult - -/** - * A synchronous version of "transform". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#transform - */ -export declare function transformSync(input: string | Uint8Array, options?: SameShape): TransformResult - -/** - * A synchronous version of "formatMessages". - * - * - Works in node: yes - * - Works in browser: no - */ -export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[] - -/** - * A synchronous version of "analyzeMetafile". - * - * - Works in node: yes - * - Works in browser: no - * - * Documentation: https://esbuild.github.io/api/#analyze - */ -export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string - -/** - * This configures the browser-based version of esbuild. It is necessary to - * call this first and wait for the returned promise to be resolved before - * making other API calls when using esbuild in the browser. - * - * - Works in node: yes - * - Works in browser: yes ("options" is required) - * - * Documentation: https://esbuild.github.io/api/#browser - */ -export declare function initialize(options: InitializeOptions): Promise - -export interface InitializeOptions { - /** - * The URL of the "esbuild.wasm" file. This must be provided when running - * esbuild in the browser. - */ - wasmURL?: string | URL - - /** - * The result of calling "new WebAssembly.Module(buffer)" where "buffer" - * is a typed array or ArrayBuffer containing the binary code of the - * "esbuild.wasm" file. - * - * You can use this as an alternative to "wasmURL" for environments where it's - * not possible to download the WebAssembly module. - */ - wasmModule?: WebAssembly.Module - - /** - * By default esbuild runs the WebAssembly-based browser API in a web worker - * to avoid blocking the UI thread. This can be disabled by setting "worker" - * to false. - */ - worker?: boolean -} - -export let version: string - -// Call this function to terminate esbuild's child process. The child process -// is not terminated and re-created after each API call because it's more -// efficient to keep it around when there are multiple API calls. -// -// In node this happens automatically before the parent node process exits. So -// you only need to call this if you know you will not make any more esbuild -// API calls and you want to clean up resources. -// -// Unlike node, Deno lacks the necessary APIs to clean up child processes -// automatically. You must manually call stop() in Deno when you're done -// using esbuild or Deno will continue running forever. -// -// Another reason you might want to call this is if you are using esbuild from -// within a Deno test. Deno fails tests that create a child process without -// killing it before the test ends, so you have to call this function (and -// await the returned promise) in every Deno test that uses esbuild. -export declare function stop(): Promise - -// Note: These declarations exist to avoid type errors when you omit "dom" from -// "lib" in your "tsconfig.json" file. TypeScript confusingly declares the -// global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do -// with the browser DOM and is present in many non-browser JavaScript runtimes -// (e.g. node and deno). Declaring it here allows esbuild's API to be used in -// these scenarios. -// -// There's an open issue about getting this problem corrected (although these -// declarations will need to remain even if this is fixed for backward -// compatibility with older TypeScript versions): -// -// https://github.com/microsoft/TypeScript-DOM-lib-generator/issues/826 -// -declare global { - namespace WebAssembly { - interface Module { - } - } - interface URL { - } -} diff --git a/node_modules/esbuild/lib/main.js b/node_modules/esbuild/lib/main.js deleted file mode 100644 index 65bacc8..0000000 --- a/node_modules/esbuild/lib/main.js +++ /dev/null @@ -1,2242 +0,0 @@ -"use strict"; -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); -}; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( - // If the importer is in node compatibility mode or this is not an ESM - // file that has been converted to a CommonJS file using a Babel- - // compatible transform (i.e. "__esModule" has not been set), then set - // "default" to the CommonJS "module.exports" for node compatibility. - isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, - mod -)); -var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - -// lib/npm/node.ts -var node_exports = {}; -__export(node_exports, { - analyzeMetafile: () => analyzeMetafile, - analyzeMetafileSync: () => analyzeMetafileSync, - build: () => build, - buildSync: () => buildSync, - context: () => context, - default: () => node_default, - formatMessages: () => formatMessages, - formatMessagesSync: () => formatMessagesSync, - initialize: () => initialize, - stop: () => stop, - transform: () => transform, - transformSync: () => transformSync, - version: () => version -}); -module.exports = __toCommonJS(node_exports); - -// lib/shared/stdio_protocol.ts -function encodePacket(packet) { - let visit = (value) => { - if (value === null) { - bb.write8(0); - } else if (typeof value === "boolean") { - bb.write8(1); - bb.write8(+value); - } else if (typeof value === "number") { - bb.write8(2); - bb.write32(value | 0); - } else if (typeof value === "string") { - bb.write8(3); - bb.write(encodeUTF8(value)); - } else if (value instanceof Uint8Array) { - bb.write8(4); - bb.write(value); - } else if (value instanceof Array) { - bb.write8(5); - bb.write32(value.length); - for (let item of value) { - visit(item); - } - } else { - let keys = Object.keys(value); - bb.write8(6); - bb.write32(keys.length); - for (let key of keys) { - bb.write(encodeUTF8(key)); - visit(value[key]); - } - } - }; - let bb = new ByteBuffer(); - bb.write32(0); - bb.write32(packet.id << 1 | +!packet.isRequest); - visit(packet.value); - writeUInt32LE(bb.buf, bb.len - 4, 0); - return bb.buf.subarray(0, bb.len); -} -function decodePacket(bytes) { - let visit = () => { - switch (bb.read8()) { - case 0: - return null; - case 1: - return !!bb.read8(); - case 2: - return bb.read32(); - case 3: - return decodeUTF8(bb.read()); - case 4: - return bb.read(); - case 5: { - let count = bb.read32(); - let value2 = []; - for (let i = 0; i < count; i++) { - value2.push(visit()); - } - return value2; - } - case 6: { - let count = bb.read32(); - let value2 = {}; - for (let i = 0; i < count; i++) { - value2[decodeUTF8(bb.read())] = visit(); - } - return value2; - } - default: - throw new Error("Invalid packet"); - } - }; - let bb = new ByteBuffer(bytes); - let id = bb.read32(); - let isRequest = (id & 1) === 0; - id >>>= 1; - let value = visit(); - if (bb.ptr !== bytes.length) { - throw new Error("Invalid packet"); - } - return { id, isRequest, value }; -} -var ByteBuffer = class { - constructor(buf = new Uint8Array(1024)) { - this.buf = buf; - this.len = 0; - this.ptr = 0; - } - _write(delta) { - if (this.len + delta > this.buf.length) { - let clone = new Uint8Array((this.len + delta) * 2); - clone.set(this.buf); - this.buf = clone; - } - this.len += delta; - return this.len - delta; - } - write8(value) { - let offset = this._write(1); - this.buf[offset] = value; - } - write32(value) { - let offset = this._write(4); - writeUInt32LE(this.buf, value, offset); - } - write(bytes) { - let offset = this._write(4 + bytes.length); - writeUInt32LE(this.buf, bytes.length, offset); - this.buf.set(bytes, offset + 4); - } - _read(delta) { - if (this.ptr + delta > this.buf.length) { - throw new Error("Invalid packet"); - } - this.ptr += delta; - return this.ptr - delta; - } - read8() { - return this.buf[this._read(1)]; - } - read32() { - return readUInt32LE(this.buf, this._read(4)); - } - read() { - let length = this.read32(); - let bytes = new Uint8Array(length); - let ptr = this._read(bytes.length); - bytes.set(this.buf.subarray(ptr, ptr + length)); - return bytes; - } -}; -var encodeUTF8; -var decodeUTF8; -var encodeInvariant; -if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") { - let encoder = new TextEncoder(); - let decoder = new TextDecoder(); - encodeUTF8 = (text) => encoder.encode(text); - decodeUTF8 = (bytes) => decoder.decode(bytes); - encodeInvariant = 'new TextEncoder().encode("")'; -} else if (typeof Buffer !== "undefined") { - encodeUTF8 = (text) => Buffer.from(text); - decodeUTF8 = (bytes) => { - let { buffer, byteOffset, byteLength } = bytes; - return Buffer.from(buffer, byteOffset, byteLength).toString(); - }; - encodeInvariant = 'Buffer.from("")'; -} else { - throw new Error("No UTF-8 codec found"); -} -if (!(encodeUTF8("") instanceof Uint8Array)) - throw new Error(`Invariant violation: "${encodeInvariant} instanceof Uint8Array" is incorrectly false - -This indicates that your JavaScript environment is broken. You cannot use -esbuild in this environment because esbuild relies on this invariant. This -is not a problem with esbuild. You need to fix your environment instead. -`); -function readUInt32LE(buffer, offset) { - return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24; -} -function writeUInt32LE(buffer, value, offset) { - buffer[offset++] = value; - buffer[offset++] = value >> 8; - buffer[offset++] = value >> 16; - buffer[offset++] = value >> 24; -} - -// lib/shared/common.ts -var quote = JSON.stringify; -var buildLogLevelDefault = "warning"; -var transformLogLevelDefault = "silent"; -function validateAndJoinStringArray(values, what) { - const toJoin = []; - for (const value of values) { - validateStringValue(value, what); - if (value.indexOf(",") >= 0) throw new Error(`Invalid ${what}: ${value}`); - toJoin.push(value); - } - return toJoin.join(","); -} -var canBeAnything = () => null; -var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean"; -var mustBeString = (value) => typeof value === "string" ? null : "a string"; -var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object"; -var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer"; -var mustBeValidPortNumber = (value) => typeof value === "number" && value === (value | 0) && value >= 0 && value <= 65535 ? null : "a valid port number"; -var mustBeFunction = (value) => typeof value === "function" ? null : "a function"; -var mustBeArray = (value) => Array.isArray(value) ? null : "an array"; -var mustBeArrayOfStrings = (value) => Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "an array of strings"; -var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object"; -var mustBeEntryPoints = (value) => typeof value === "object" && value !== null ? null : "an array or an object"; -var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module"; -var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null"; -var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean"; -var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object"; -var mustBeStringOrArrayOfStrings = (value) => typeof value === "string" || Array.isArray(value) && value.every((x) => typeof x === "string") ? null : "a string or an array of strings"; -var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array"; -var mustBeStringOrURL = (value) => typeof value === "string" || value instanceof URL ? null : "a string or a URL"; -function getFlag(object, keys, key, mustBeFn) { - let value = object[key]; - keys[key + ""] = true; - if (value === void 0) return void 0; - let mustBe = mustBeFn(value); - if (mustBe !== null) throw new Error(`${quote(key)} must be ${mustBe}`); - return value; -} -function checkForInvalidFlags(object, keys, where) { - for (let key in object) { - if (!(key in keys)) { - throw new Error(`Invalid option ${where}: ${quote(key)}`); - } - } -} -function validateInitializeOptions(options) { - let keys = /* @__PURE__ */ Object.create(null); - let wasmURL = getFlag(options, keys, "wasmURL", mustBeStringOrURL); - let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule); - let worker = getFlag(options, keys, "worker", mustBeBoolean); - checkForInvalidFlags(options, keys, "in initialize() call"); - return { - wasmURL, - wasmModule, - worker - }; -} -function validateMangleCache(mangleCache) { - let validated; - if (mangleCache !== void 0) { - validated = /* @__PURE__ */ Object.create(null); - for (let key in mangleCache) { - let value = mangleCache[key]; - if (typeof value === "string" || value === false) { - validated[key] = value; - } else { - throw new Error(`Expected ${quote(key)} in mangle cache to map to either a string or false`); - } - } - } - return validated; -} -function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) { - let color = getFlag(options, keys, "color", mustBeBoolean); - let logLevel = getFlag(options, keys, "logLevel", mustBeString); - let logLimit = getFlag(options, keys, "logLimit", mustBeInteger); - if (color !== void 0) flags.push(`--color=${color}`); - else if (isTTY2) flags.push(`--color=true`); - flags.push(`--log-level=${logLevel || logLevelDefault}`); - flags.push(`--log-limit=${logLimit || 0}`); -} -function validateStringValue(value, what, key) { - if (typeof value !== "string") { - throw new Error(`Expected value for ${what}${key !== void 0 ? " " + quote(key) : ""} to be a string, got ${typeof value} instead`); - } - return value; -} -function pushCommonFlags(flags, options, keys) { - let legalComments = getFlag(options, keys, "legalComments", mustBeString); - let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString); - let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean); - let target = getFlag(options, keys, "target", mustBeStringOrArrayOfStrings); - let format = getFlag(options, keys, "format", mustBeString); - let globalName = getFlag(options, keys, "globalName", mustBeString); - let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp); - let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp); - let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean); - let minify = getFlag(options, keys, "minify", mustBeBoolean); - let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean); - let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean); - let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean); - let lineLimit = getFlag(options, keys, "lineLimit", mustBeInteger); - let drop = getFlag(options, keys, "drop", mustBeArrayOfStrings); - let dropLabels = getFlag(options, keys, "dropLabels", mustBeArrayOfStrings); - let charset = getFlag(options, keys, "charset", mustBeString); - let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean); - let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean); - let jsx = getFlag(options, keys, "jsx", mustBeString); - let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString); - let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString); - let jsxImportSource = getFlag(options, keys, "jsxImportSource", mustBeString); - let jsxDev = getFlag(options, keys, "jsxDev", mustBeBoolean); - let jsxSideEffects = getFlag(options, keys, "jsxSideEffects", mustBeBoolean); - let define = getFlag(options, keys, "define", mustBeObject); - let logOverride = getFlag(options, keys, "logOverride", mustBeObject); - let supported = getFlag(options, keys, "supported", mustBeObject); - let pure = getFlag(options, keys, "pure", mustBeArrayOfStrings); - let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean); - let platform = getFlag(options, keys, "platform", mustBeString); - let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject); - let absPaths = getFlag(options, keys, "absPaths", mustBeArrayOfStrings); - if (legalComments) flags.push(`--legal-comments=${legalComments}`); - if (sourceRoot !== void 0) flags.push(`--source-root=${sourceRoot}`); - if (sourcesContent !== void 0) flags.push(`--sources-content=${sourcesContent}`); - if (target) flags.push(`--target=${validateAndJoinStringArray(Array.isArray(target) ? target : [target], "target")}`); - if (format) flags.push(`--format=${format}`); - if (globalName) flags.push(`--global-name=${globalName}`); - if (platform) flags.push(`--platform=${platform}`); - if (tsconfigRaw) flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`); - if (minify) flags.push("--minify"); - if (minifySyntax) flags.push("--minify-syntax"); - if (minifyWhitespace) flags.push("--minify-whitespace"); - if (minifyIdentifiers) flags.push("--minify-identifiers"); - if (lineLimit) flags.push(`--line-limit=${lineLimit}`); - if (charset) flags.push(`--charset=${charset}`); - if (treeShaking !== void 0) flags.push(`--tree-shaking=${treeShaking}`); - if (ignoreAnnotations) flags.push(`--ignore-annotations`); - if (drop) for (let what of drop) flags.push(`--drop:${validateStringValue(what, "drop")}`); - if (dropLabels) flags.push(`--drop-labels=${validateAndJoinStringArray(dropLabels, "drop label")}`); - if (absPaths) flags.push(`--abs-paths=${validateAndJoinStringArray(absPaths, "abs paths")}`); - if (mangleProps) flags.push(`--mangle-props=${jsRegExpToGoRegExp(mangleProps)}`); - if (reserveProps) flags.push(`--reserve-props=${jsRegExpToGoRegExp(reserveProps)}`); - if (mangleQuoted !== void 0) flags.push(`--mangle-quoted=${mangleQuoted}`); - if (jsx) flags.push(`--jsx=${jsx}`); - if (jsxFactory) flags.push(`--jsx-factory=${jsxFactory}`); - if (jsxFragment) flags.push(`--jsx-fragment=${jsxFragment}`); - if (jsxImportSource) flags.push(`--jsx-import-source=${jsxImportSource}`); - if (jsxDev) flags.push(`--jsx-dev`); - if (jsxSideEffects) flags.push(`--jsx-side-effects`); - if (define) { - for (let key in define) { - if (key.indexOf("=") >= 0) throw new Error(`Invalid define: ${key}`); - flags.push(`--define:${key}=${validateStringValue(define[key], "define", key)}`); - } - } - if (logOverride) { - for (let key in logOverride) { - if (key.indexOf("=") >= 0) throw new Error(`Invalid log override: ${key}`); - flags.push(`--log-override:${key}=${validateStringValue(logOverride[key], "log override", key)}`); - } - } - if (supported) { - for (let key in supported) { - if (key.indexOf("=") >= 0) throw new Error(`Invalid supported: ${key}`); - const value = supported[key]; - if (typeof value !== "boolean") throw new Error(`Expected value for supported ${quote(key)} to be a boolean, got ${typeof value} instead`); - flags.push(`--supported:${key}=${value}`); - } - } - if (pure) for (let fn of pure) flags.push(`--pure:${validateStringValue(fn, "pure")}`); - if (keepNames) flags.push(`--keep-names`); -} -function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) { - var _a2; - let flags = []; - let entries = []; - let keys = /* @__PURE__ */ Object.create(null); - let stdinContents = null; - let stdinResolveDir = null; - pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); - pushCommonFlags(flags, options, keys); - let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); - let bundle = getFlag(options, keys, "bundle", mustBeBoolean); - let splitting = getFlag(options, keys, "splitting", mustBeBoolean); - let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean); - let metafile = getFlag(options, keys, "metafile", mustBeBoolean); - let outfile = getFlag(options, keys, "outfile", mustBeString); - let outdir = getFlag(options, keys, "outdir", mustBeString); - let outbase = getFlag(options, keys, "outbase", mustBeString); - let tsconfig = getFlag(options, keys, "tsconfig", mustBeString); - let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArrayOfStrings); - let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArrayOfStrings); - let mainFields = getFlag(options, keys, "mainFields", mustBeArrayOfStrings); - let conditions = getFlag(options, keys, "conditions", mustBeArrayOfStrings); - let external = getFlag(options, keys, "external", mustBeArrayOfStrings); - let packages = getFlag(options, keys, "packages", mustBeString); - let alias = getFlag(options, keys, "alias", mustBeObject); - let loader = getFlag(options, keys, "loader", mustBeObject); - let outExtension = getFlag(options, keys, "outExtension", mustBeObject); - let publicPath = getFlag(options, keys, "publicPath", mustBeString); - let entryNames = getFlag(options, keys, "entryNames", mustBeString); - let chunkNames = getFlag(options, keys, "chunkNames", mustBeString); - let assetNames = getFlag(options, keys, "assetNames", mustBeString); - let inject = getFlag(options, keys, "inject", mustBeArrayOfStrings); - let banner = getFlag(options, keys, "banner", mustBeObject); - let footer = getFlag(options, keys, "footer", mustBeObject); - let entryPoints = getFlag(options, keys, "entryPoints", mustBeEntryPoints); - let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString); - let stdin = getFlag(options, keys, "stdin", mustBeObject); - let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault; - let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean); - let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); - keys.plugins = true; - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (sourcemap) flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`); - if (bundle) flags.push("--bundle"); - if (allowOverwrite) flags.push("--allow-overwrite"); - if (splitting) flags.push("--splitting"); - if (preserveSymlinks) flags.push("--preserve-symlinks"); - if (metafile) flags.push(`--metafile`); - if (outfile) flags.push(`--outfile=${outfile}`); - if (outdir) flags.push(`--outdir=${outdir}`); - if (outbase) flags.push(`--outbase=${outbase}`); - if (tsconfig) flags.push(`--tsconfig=${tsconfig}`); - if (packages) flags.push(`--packages=${packages}`); - if (resolveExtensions) flags.push(`--resolve-extensions=${validateAndJoinStringArray(resolveExtensions, "resolve extension")}`); - if (publicPath) flags.push(`--public-path=${publicPath}`); - if (entryNames) flags.push(`--entry-names=${entryNames}`); - if (chunkNames) flags.push(`--chunk-names=${chunkNames}`); - if (assetNames) flags.push(`--asset-names=${assetNames}`); - if (mainFields) flags.push(`--main-fields=${validateAndJoinStringArray(mainFields, "main field")}`); - if (conditions) flags.push(`--conditions=${validateAndJoinStringArray(conditions, "condition")}`); - if (external) for (let name of external) flags.push(`--external:${validateStringValue(name, "external")}`); - if (alias) { - for (let old in alias) { - if (old.indexOf("=") >= 0) throw new Error(`Invalid package name in alias: ${old}`); - flags.push(`--alias:${old}=${validateStringValue(alias[old], "alias", old)}`); - } - } - if (banner) { - for (let type in banner) { - if (type.indexOf("=") >= 0) throw new Error(`Invalid banner file type: ${type}`); - flags.push(`--banner:${type}=${validateStringValue(banner[type], "banner", type)}`); - } - } - if (footer) { - for (let type in footer) { - if (type.indexOf("=") >= 0) throw new Error(`Invalid footer file type: ${type}`); - flags.push(`--footer:${type}=${validateStringValue(footer[type], "footer", type)}`); - } - } - if (inject) for (let path3 of inject) flags.push(`--inject:${validateStringValue(path3, "inject")}`); - if (loader) { - for (let ext in loader) { - if (ext.indexOf("=") >= 0) throw new Error(`Invalid loader extension: ${ext}`); - flags.push(`--loader:${ext}=${validateStringValue(loader[ext], "loader", ext)}`); - } - } - if (outExtension) { - for (let ext in outExtension) { - if (ext.indexOf("=") >= 0) throw new Error(`Invalid out extension: ${ext}`); - flags.push(`--out-extension:${ext}=${validateStringValue(outExtension[ext], "out extension", ext)}`); - } - } - if (entryPoints) { - if (Array.isArray(entryPoints)) { - for (let i = 0, n = entryPoints.length; i < n; i++) { - let entryPoint = entryPoints[i]; - if (typeof entryPoint === "object" && entryPoint !== null) { - let entryPointKeys = /* @__PURE__ */ Object.create(null); - let input = getFlag(entryPoint, entryPointKeys, "in", mustBeString); - let output = getFlag(entryPoint, entryPointKeys, "out", mustBeString); - checkForInvalidFlags(entryPoint, entryPointKeys, "in entry point at index " + i); - if (input === void 0) throw new Error('Missing property "in" for entry point at index ' + i); - if (output === void 0) throw new Error('Missing property "out" for entry point at index ' + i); - entries.push([output, input]); - } else { - entries.push(["", validateStringValue(entryPoint, "entry point at index " + i)]); - } - } - } else { - for (let key in entryPoints) { - entries.push([key, validateStringValue(entryPoints[key], "entry point", key)]); - } - } - } - if (stdin) { - let stdinKeys = /* @__PURE__ */ Object.create(null); - let contents = getFlag(stdin, stdinKeys, "contents", mustBeStringOrUint8Array); - let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString); - let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString); - let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString); - checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object'); - if (sourcefile) flags.push(`--sourcefile=${sourcefile}`); - if (loader2) flags.push(`--loader=${loader2}`); - if (resolveDir) stdinResolveDir = resolveDir; - if (typeof contents === "string") stdinContents = encodeUTF8(contents); - else if (contents instanceof Uint8Array) stdinContents = contents; - } - let nodePaths = []; - if (nodePathsInput) { - for (let value of nodePathsInput) { - value += ""; - nodePaths.push(value); - } - } - return { - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir, - nodePaths, - mangleCache: validateMangleCache(mangleCache) - }; -} -function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) { - let flags = []; - let keys = /* @__PURE__ */ Object.create(null); - pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); - pushCommonFlags(flags, options, keys); - let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); - let sourcefile = getFlag(options, keys, "sourcefile", mustBeString); - let loader = getFlag(options, keys, "loader", mustBeString); - let banner = getFlag(options, keys, "banner", mustBeString); - let footer = getFlag(options, keys, "footer", mustBeString); - let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (sourcemap) flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`); - if (sourcefile) flags.push(`--sourcefile=${sourcefile}`); - if (loader) flags.push(`--loader=${loader}`); - if (banner) flags.push(`--banner=${banner}`); - if (footer) flags.push(`--footer=${footer}`); - return { - flags, - mangleCache: validateMangleCache(mangleCache) - }; -} -function createChannel(streamIn) { - const requestCallbacksByKey = {}; - const closeData = { didClose: false, reason: "" }; - let responseCallbacks = {}; - let nextRequestID = 0; - let nextBuildKey = 0; - let stdout = new Uint8Array(16 * 1024); - let stdoutUsed = 0; - let readFromStdout = (chunk) => { - let limit = stdoutUsed + chunk.length; - if (limit > stdout.length) { - let swap = new Uint8Array(limit * 2); - swap.set(stdout); - stdout = swap; - } - stdout.set(chunk, stdoutUsed); - stdoutUsed += chunk.length; - let offset = 0; - while (offset + 4 <= stdoutUsed) { - let length = readUInt32LE(stdout, offset); - if (offset + 4 + length > stdoutUsed) { - break; - } - offset += 4; - handleIncomingPacket(stdout.subarray(offset, offset + length)); - offset += length; - } - if (offset > 0) { - stdout.copyWithin(0, offset, stdoutUsed); - stdoutUsed -= offset; - } - }; - let afterClose = (error) => { - closeData.didClose = true; - if (error) closeData.reason = ": " + (error.message || error); - const text = "The service was stopped" + closeData.reason; - for (let id in responseCallbacks) { - responseCallbacks[id](text, null); - } - responseCallbacks = {}; - }; - let sendRequest = (refs, value, callback) => { - if (closeData.didClose) return callback("The service is no longer running" + closeData.reason, null); - let id = nextRequestID++; - responseCallbacks[id] = (error, response) => { - try { - callback(error, response); - } finally { - if (refs) refs.unref(); - } - }; - if (refs) refs.ref(); - streamIn.writeToStdin(encodePacket({ id, isRequest: true, value })); - }; - let sendResponse = (id, value) => { - if (closeData.didClose) throw new Error("The service is no longer running" + closeData.reason); - streamIn.writeToStdin(encodePacket({ id, isRequest: false, value })); - }; - let handleRequest = async (id, request) => { - try { - if (request.command === "ping") { - sendResponse(id, {}); - return; - } - if (typeof request.key === "number") { - const requestCallbacks = requestCallbacksByKey[request.key]; - if (!requestCallbacks) { - return; - } - const callback = requestCallbacks[request.command]; - if (callback) { - await callback(id, request); - return; - } - } - throw new Error(`Invalid command: ` + request.command); - } catch (e) { - const errors = [extractErrorMessageV8(e, streamIn, null, void 0, "")]; - try { - sendResponse(id, { errors }); - } catch { - } - } - }; - let isFirstPacket = true; - let handleIncomingPacket = (bytes) => { - if (isFirstPacket) { - isFirstPacket = false; - let binaryVersion = String.fromCharCode(...bytes); - if (binaryVersion !== "0.27.2") { - throw new Error(`Cannot start service: Host version "${"0.27.2"}" does not match binary version ${quote(binaryVersion)}`); - } - return; - } - let packet = decodePacket(bytes); - if (packet.isRequest) { - handleRequest(packet.id, packet.value); - } else { - let callback = responseCallbacks[packet.id]; - delete responseCallbacks[packet.id]; - if (packet.value.error) callback(packet.value.error, {}); - else callback(null, packet.value); - } - }; - let buildOrContext = ({ callName, refs, options, isTTY: isTTY2, defaultWD: defaultWD2, callback }) => { - let refCount = 0; - const buildKey = nextBuildKey++; - const requestCallbacks = {}; - const buildRefs = { - ref() { - if (++refCount === 1) { - if (refs) refs.ref(); - } - }, - unref() { - if (--refCount === 0) { - delete requestCallbacksByKey[buildKey]; - if (refs) refs.unref(); - } - } - }; - requestCallbacksByKey[buildKey] = requestCallbacks; - buildRefs.ref(); - buildOrContextImpl( - callName, - buildKey, - sendRequest, - sendResponse, - buildRefs, - streamIn, - requestCallbacks, - options, - isTTY2, - defaultWD2, - (err, res) => { - try { - callback(err, res); - } finally { - buildRefs.unref(); - } - } - ); - }; - let transform2 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => { - const details = createObjectStash(); - let start = (inputPath) => { - try { - if (typeof input !== "string" && !(input instanceof Uint8Array)) - throw new Error('The input to "transform" must be a string or a Uint8Array'); - let { - flags, - mangleCache - } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault); - let request = { - command: "transform", - flags, - inputFS: inputPath !== null, - input: inputPath !== null ? encodeUTF8(inputPath) : typeof input === "string" ? encodeUTF8(input) : input - }; - if (mangleCache) request.mangleCache = mangleCache; - sendRequest(refs, request, (error, response) => { - if (error) return callback(new Error(error), null); - let errors = replaceDetailsInMessages(response.errors, details); - let warnings = replaceDetailsInMessages(response.warnings, details); - let outstanding = 1; - let next = () => { - if (--outstanding === 0) { - let result = { - warnings, - code: response.code, - map: response.map, - mangleCache: void 0, - legalComments: void 0 - }; - if ("legalComments" in response) result.legalComments = response == null ? void 0 : response.legalComments; - if (response.mangleCache) result.mangleCache = response == null ? void 0 : response.mangleCache; - callback(null, result); - } - }; - if (errors.length > 0) return callback(failureErrorWithLog("Transform failed", errors, warnings), null); - if (response.codeFS) { - outstanding++; - fs3.readFile(response.code, (err, contents) => { - if (err !== null) { - callback(err, null); - } else { - response.code = contents; - next(); - } - }); - } - if (response.mapFS) { - outstanding++; - fs3.readFile(response.map, (err, contents) => { - if (err !== null) { - callback(err, null); - } else { - response.map = contents; - next(); - } - }); - } - next(); - }); - } catch (e) { - let flags = []; - try { - pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault); - } catch { - } - const error = extractErrorMessageV8(e, streamIn, details, void 0, ""); - sendRequest(refs, { command: "error", flags, error }, () => { - error.detail = details.load(error.detail); - callback(failureErrorWithLog("Transform failed", [error], []), null); - }); - } - }; - if ((typeof input === "string" || input instanceof Uint8Array) && input.length > 1024 * 1024) { - let next = start; - start = () => fs3.writeFile(input, next); - } - start(null); - }; - let formatMessages2 = ({ callName, refs, messages, options, callback }) => { - if (!options) throw new Error(`Missing second argument in ${callName}() call`); - let keys = {}; - let kind = getFlag(options, keys, "kind", mustBeString); - let color = getFlag(options, keys, "color", mustBeBoolean); - let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - if (kind === void 0) throw new Error(`Missing "kind" in ${callName}() call`); - if (kind !== "error" && kind !== "warning") throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`); - let request = { - command: "format-msgs", - messages: sanitizeMessages(messages, "messages", null, "", terminalWidth), - isWarning: kind === "warning" - }; - if (color !== void 0) request.color = color; - if (terminalWidth !== void 0) request.terminalWidth = terminalWidth; - sendRequest(refs, request, (error, response) => { - if (error) return callback(new Error(error), null); - callback(null, response.messages); - }); - }; - let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => { - if (options === void 0) options = {}; - let keys = {}; - let color = getFlag(options, keys, "color", mustBeBoolean); - let verbose = getFlag(options, keys, "verbose", mustBeBoolean); - checkForInvalidFlags(options, keys, `in ${callName}() call`); - let request = { - command: "analyze-metafile", - metafile - }; - if (color !== void 0) request.color = color; - if (verbose !== void 0) request.verbose = verbose; - sendRequest(refs, request, (error, response) => { - if (error) return callback(new Error(error), null); - callback(null, response.result); - }); - }; - return { - readFromStdout, - afterClose, - service: { - buildOrContext, - transform: transform2, - formatMessages: formatMessages2, - analyzeMetafile: analyzeMetafile2 - } - }; -} -function buildOrContextImpl(callName, buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, options, isTTY2, defaultWD2, callback) { - const details = createObjectStash(); - const isContext = callName === "context"; - const handleError = (e, pluginName) => { - const flags = []; - try { - pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault); - } catch { - } - const message = extractErrorMessageV8(e, streamIn, details, void 0, pluginName); - sendRequest(refs, { command: "error", flags, error: message }, () => { - message.detail = details.load(message.detail); - callback(failureErrorWithLog(isContext ? "Context failed" : "Build failed", [message], []), null); - }); - }; - let plugins; - if (typeof options === "object") { - const value = options.plugins; - if (value !== void 0) { - if (!Array.isArray(value)) return handleError(new Error(`"plugins" must be an array`), ""); - plugins = value; - } - } - if (plugins && plugins.length > 0) { - if (streamIn.isSync) return handleError(new Error("Cannot use plugins in synchronous API calls"), ""); - handlePlugins( - buildKey, - sendRequest, - sendResponse, - refs, - streamIn, - requestCallbacks, - options, - plugins, - details - ).then( - (result) => { - if (!result.ok) return handleError(result.error, result.pluginName); - try { - buildOrContextContinue(result.requestPlugins, result.runOnEndCallbacks, result.scheduleOnDisposeCallbacks); - } catch (e) { - handleError(e, ""); - } - }, - (e) => handleError(e, "") - ); - return; - } - try { - buildOrContextContinue(null, (result, done) => done([], []), () => { - }); - } catch (e) { - handleError(e, ""); - } - function buildOrContextContinue(requestPlugins, runOnEndCallbacks, scheduleOnDisposeCallbacks) { - const writeDefault = streamIn.hasFS; - const { - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir, - nodePaths, - mangleCache - } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault); - if (write && !streamIn.hasFS) throw new Error(`The "write" option is unavailable in this environment`); - const request = { - command: "build", - key: buildKey, - entries, - flags, - write, - stdinContents, - stdinResolveDir, - absWorkingDir: absWorkingDir || defaultWD2, - nodePaths, - context: isContext - }; - if (requestPlugins) request.plugins = requestPlugins; - if (mangleCache) request.mangleCache = mangleCache; - const buildResponseToResult = (response, callback2) => { - const result = { - errors: replaceDetailsInMessages(response.errors, details), - warnings: replaceDetailsInMessages(response.warnings, details), - outputFiles: void 0, - metafile: void 0, - mangleCache: void 0 - }; - const originalErrors = result.errors.slice(); - const originalWarnings = result.warnings.slice(); - if (response.outputFiles) result.outputFiles = response.outputFiles.map(convertOutputFiles); - if (response.metafile) result.metafile = JSON.parse(response.metafile); - if (response.mangleCache) result.mangleCache = response.mangleCache; - if (response.writeToStdout !== void 0) console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, "")); - runOnEndCallbacks(result, (onEndErrors, onEndWarnings) => { - if (originalErrors.length > 0 || onEndErrors.length > 0) { - const error = failureErrorWithLog("Build failed", originalErrors.concat(onEndErrors), originalWarnings.concat(onEndWarnings)); - return callback2(error, null, onEndErrors, onEndWarnings); - } - callback2(null, result, onEndErrors, onEndWarnings); - }); - }; - let latestResultPromise; - let provideLatestResult; - if (isContext) - requestCallbacks["on-end"] = (id, request2) => new Promise((resolve) => { - buildResponseToResult(request2, (err, result, onEndErrors, onEndWarnings) => { - const response = { - errors: onEndErrors, - warnings: onEndWarnings - }; - if (provideLatestResult) provideLatestResult(err, result); - latestResultPromise = void 0; - provideLatestResult = void 0; - sendResponse(id, response); - resolve(); - }); - }); - sendRequest(refs, request, (error, response) => { - if (error) return callback(new Error(error), null); - if (!isContext) { - return buildResponseToResult(response, (err, res) => { - scheduleOnDisposeCallbacks(); - return callback(err, res); - }); - } - if (response.errors.length > 0) { - return callback(failureErrorWithLog("Context failed", response.errors, response.warnings), null); - } - let didDispose = false; - const result = { - rebuild: () => { - if (!latestResultPromise) latestResultPromise = new Promise((resolve, reject) => { - let settlePromise; - provideLatestResult = (err, result2) => { - if (!settlePromise) settlePromise = () => err ? reject(err) : resolve(result2); - }; - const triggerAnotherBuild = () => { - const request2 = { - command: "rebuild", - key: buildKey - }; - sendRequest(refs, request2, (error2, response2) => { - if (error2) { - reject(new Error(error2)); - } else if (settlePromise) { - settlePromise(); - } else { - triggerAnotherBuild(); - } - }); - }; - triggerAnotherBuild(); - }); - return latestResultPromise; - }, - watch: (options2 = {}) => new Promise((resolve, reject) => { - if (!streamIn.hasFS) throw new Error(`Cannot use the "watch" API in this environment`); - const keys = {}; - const delay = getFlag(options2, keys, "delay", mustBeInteger); - checkForInvalidFlags(options2, keys, `in watch() call`); - const request2 = { - command: "watch", - key: buildKey - }; - if (delay) request2.delay = delay; - sendRequest(refs, request2, (error2) => { - if (error2) reject(new Error(error2)); - else resolve(void 0); - }); - }), - serve: (options2 = {}) => new Promise((resolve, reject) => { - if (!streamIn.hasFS) throw new Error(`Cannot use the "serve" API in this environment`); - const keys = {}; - const port = getFlag(options2, keys, "port", mustBeValidPortNumber); - const host = getFlag(options2, keys, "host", mustBeString); - const servedir = getFlag(options2, keys, "servedir", mustBeString); - const keyfile = getFlag(options2, keys, "keyfile", mustBeString); - const certfile = getFlag(options2, keys, "certfile", mustBeString); - const fallback = getFlag(options2, keys, "fallback", mustBeString); - const cors = getFlag(options2, keys, "cors", mustBeObject); - const onRequest = getFlag(options2, keys, "onRequest", mustBeFunction); - checkForInvalidFlags(options2, keys, `in serve() call`); - const request2 = { - command: "serve", - key: buildKey, - onRequest: !!onRequest - }; - if (port !== void 0) request2.port = port; - if (host !== void 0) request2.host = host; - if (servedir !== void 0) request2.servedir = servedir; - if (keyfile !== void 0) request2.keyfile = keyfile; - if (certfile !== void 0) request2.certfile = certfile; - if (fallback !== void 0) request2.fallback = fallback; - if (cors) { - const corsKeys = {}; - const origin = getFlag(cors, corsKeys, "origin", mustBeStringOrArrayOfStrings); - checkForInvalidFlags(cors, corsKeys, `on "cors" object`); - if (Array.isArray(origin)) request2.corsOrigin = origin; - else if (origin !== void 0) request2.corsOrigin = [origin]; - } - sendRequest(refs, request2, (error2, response2) => { - if (error2) return reject(new Error(error2)); - if (onRequest) { - requestCallbacks["serve-request"] = (id, request3) => { - onRequest(request3.args); - sendResponse(id, {}); - }; - } - resolve(response2); - }); - }), - cancel: () => new Promise((resolve) => { - if (didDispose) return resolve(); - const request2 = { - command: "cancel", - key: buildKey - }; - sendRequest(refs, request2, () => { - resolve(); - }); - }), - dispose: () => new Promise((resolve) => { - if (didDispose) return resolve(); - didDispose = true; - const request2 = { - command: "dispose", - key: buildKey - }; - sendRequest(refs, request2, () => { - resolve(); - scheduleOnDisposeCallbacks(); - refs.unref(); - }); - }) - }; - refs.ref(); - callback(null, result); - }); - } -} -var handlePlugins = async (buildKey, sendRequest, sendResponse, refs, streamIn, requestCallbacks, initialOptions, plugins, details) => { - let onStartCallbacks = []; - let onEndCallbacks = []; - let onResolveCallbacks = {}; - let onLoadCallbacks = {}; - let onDisposeCallbacks = []; - let nextCallbackID = 0; - let i = 0; - let requestPlugins = []; - let isSetupDone = false; - plugins = [...plugins]; - for (let item of plugins) { - let keys = {}; - if (typeof item !== "object") throw new Error(`Plugin at index ${i} must be an object`); - const name = getFlag(item, keys, "name", mustBeString); - if (typeof name !== "string" || name === "") throw new Error(`Plugin at index ${i} is missing a name`); - try { - let setup = getFlag(item, keys, "setup", mustBeFunction); - if (typeof setup !== "function") throw new Error(`Plugin is missing a setup function`); - checkForInvalidFlags(item, keys, `on plugin ${quote(name)}`); - let plugin = { - name, - onStart: false, - onEnd: false, - onResolve: [], - onLoad: [] - }; - i++; - let resolve = (path3, options = {}) => { - if (!isSetupDone) throw new Error('Cannot call "resolve" before plugin setup has completed'); - if (typeof path3 !== "string") throw new Error(`The path to resolve must be a string`); - let keys2 = /* @__PURE__ */ Object.create(null); - let pluginName = getFlag(options, keys2, "pluginName", mustBeString); - let importer = getFlag(options, keys2, "importer", mustBeString); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString); - let kind = getFlag(options, keys2, "kind", mustBeString); - let pluginData = getFlag(options, keys2, "pluginData", canBeAnything); - let importAttributes = getFlag(options, keys2, "with", mustBeObject); - checkForInvalidFlags(options, keys2, "in resolve() call"); - return new Promise((resolve2, reject) => { - const request = { - command: "resolve", - path: path3, - key: buildKey, - pluginName: name - }; - if (pluginName != null) request.pluginName = pluginName; - if (importer != null) request.importer = importer; - if (namespace != null) request.namespace = namespace; - if (resolveDir != null) request.resolveDir = resolveDir; - if (kind != null) request.kind = kind; - else throw new Error(`Must specify "kind" when calling "resolve"`); - if (pluginData != null) request.pluginData = details.store(pluginData); - if (importAttributes != null) request.with = sanitizeStringMap(importAttributes, "with"); - sendRequest(refs, request, (error, response) => { - if (error !== null) reject(new Error(error)); - else resolve2({ - errors: replaceDetailsInMessages(response.errors, details), - warnings: replaceDetailsInMessages(response.warnings, details), - path: response.path, - external: response.external, - sideEffects: response.sideEffects, - namespace: response.namespace, - suffix: response.suffix, - pluginData: details.load(response.pluginData) - }); - }); - }); - }; - let promise = setup({ - initialOptions, - resolve, - onStart(callback) { - let registeredText = `This error came from the "onStart" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); - onStartCallbacks.push({ name, callback, note: registeredNote }); - plugin.onStart = true; - }, - onEnd(callback) { - let registeredText = `This error came from the "onEnd" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd"); - onEndCallbacks.push({ name, callback, note: registeredNote }); - plugin.onEnd = true; - }, - onResolve(options, callback) { - let registeredText = `This error came from the "onResolve" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve"); - let keys2 = {}; - let filter = getFlag(options, keys2, "filter", mustBeRegExp); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${quote(name)}`); - if (filter == null) throw new Error(`onResolve() call is missing a filter`); - let id = nextCallbackID++; - onResolveCallbacks[id] = { name, callback, note: registeredNote }; - plugin.onResolve.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); - }, - onLoad(options, callback) { - let registeredText = `This error came from the "onLoad" callback registered here:`; - let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad"); - let keys2 = {}; - let filter = getFlag(options, keys2, "filter", mustBeRegExp); - let namespace = getFlag(options, keys2, "namespace", mustBeString); - checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${quote(name)}`); - if (filter == null) throw new Error(`onLoad() call is missing a filter`); - let id = nextCallbackID++; - onLoadCallbacks[id] = { name, callback, note: registeredNote }; - plugin.onLoad.push({ id, filter: jsRegExpToGoRegExp(filter), namespace: namespace || "" }); - }, - onDispose(callback) { - onDisposeCallbacks.push(callback); - }, - esbuild: streamIn.esbuild - }); - if (promise) await promise; - requestPlugins.push(plugin); - } catch (e) { - return { ok: false, error: e, pluginName: name }; - } - } - requestCallbacks["on-start"] = async (id, request) => { - details.clear(); - let response = { errors: [], warnings: [] }; - await Promise.all(onStartCallbacks.map(async ({ name, callback, note }) => { - try { - let result = await callback(); - if (result != null) { - if (typeof result !== "object") throw new Error(`Expected onStart() callback in plugin ${quote(name)} to return an object`); - let keys = {}; - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${quote(name)}`); - if (errors != null) response.errors.push(...sanitizeMessages(errors, "errors", details, name, void 0)); - if (warnings != null) response.warnings.push(...sanitizeMessages(warnings, "warnings", details, name, void 0)); - } - } catch (e) { - response.errors.push(extractErrorMessageV8(e, streamIn, details, note && note(), name)); - } - })); - sendResponse(id, response); - }; - requestCallbacks["on-resolve"] = async (id, request) => { - let response = {}, name = "", callback, note; - for (let id2 of request.ids) { - try { - ({ name, callback, note } = onResolveCallbacks[id2]); - let result = await callback({ - path: request.path, - importer: request.importer, - namespace: request.namespace, - resolveDir: request.resolveDir, - kind: request.kind, - pluginData: details.load(request.pluginData), - with: request.with - }); - if (result != null) { - if (typeof result !== "object") throw new Error(`Expected onResolve() callback in plugin ${quote(name)} to return an object`); - let keys = {}; - let pluginName = getFlag(result, keys, "pluginName", mustBeString); - let path3 = getFlag(result, keys, "path", mustBeString); - let namespace = getFlag(result, keys, "namespace", mustBeString); - let suffix = getFlag(result, keys, "suffix", mustBeString); - let external = getFlag(result, keys, "external", mustBeBoolean); - let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean); - let pluginData = getFlag(result, keys, "pluginData", canBeAnything); - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); - let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); - checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${quote(name)}`); - response.id = id2; - if (pluginName != null) response.pluginName = pluginName; - if (path3 != null) response.path = path3; - if (namespace != null) response.namespace = namespace; - if (suffix != null) response.suffix = suffix; - if (external != null) response.external = external; - if (sideEffects != null) response.sideEffects = sideEffects; - if (pluginData != null) response.pluginData = details.store(pluginData); - if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name, void 0); - if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); - if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); - if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); - break; - } - } catch (e) { - response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] }; - break; - } - } - sendResponse(id, response); - }; - requestCallbacks["on-load"] = async (id, request) => { - let response = {}, name = "", callback, note; - for (let id2 of request.ids) { - try { - ({ name, callback, note } = onLoadCallbacks[id2]); - let result = await callback({ - path: request.path, - namespace: request.namespace, - suffix: request.suffix, - pluginData: details.load(request.pluginData), - with: request.with - }); - if (result != null) { - if (typeof result !== "object") throw new Error(`Expected onLoad() callback in plugin ${quote(name)} to return an object`); - let keys = {}; - let pluginName = getFlag(result, keys, "pluginName", mustBeString); - let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array); - let resolveDir = getFlag(result, keys, "resolveDir", mustBeString); - let pluginData = getFlag(result, keys, "pluginData", canBeAnything); - let loader = getFlag(result, keys, "loader", mustBeString); - let errors = getFlag(result, keys, "errors", mustBeArray); - let warnings = getFlag(result, keys, "warnings", mustBeArray); - let watchFiles = getFlag(result, keys, "watchFiles", mustBeArrayOfStrings); - let watchDirs = getFlag(result, keys, "watchDirs", mustBeArrayOfStrings); - checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${quote(name)}`); - response.id = id2; - if (pluginName != null) response.pluginName = pluginName; - if (contents instanceof Uint8Array) response.contents = contents; - else if (contents != null) response.contents = encodeUTF8(contents); - if (resolveDir != null) response.resolveDir = resolveDir; - if (pluginData != null) response.pluginData = details.store(pluginData); - if (loader != null) response.loader = loader; - if (errors != null) response.errors = sanitizeMessages(errors, "errors", details, name, void 0); - if (warnings != null) response.warnings = sanitizeMessages(warnings, "warnings", details, name, void 0); - if (watchFiles != null) response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); - if (watchDirs != null) response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); - break; - } - } catch (e) { - response = { id: id2, errors: [extractErrorMessageV8(e, streamIn, details, note && note(), name)] }; - break; - } - } - sendResponse(id, response); - }; - let runOnEndCallbacks = (result, done) => done([], []); - if (onEndCallbacks.length > 0) { - runOnEndCallbacks = (result, done) => { - (async () => { - const onEndErrors = []; - const onEndWarnings = []; - for (const { name, callback, note } of onEndCallbacks) { - let newErrors; - let newWarnings; - try { - const value = await callback(result); - if (value != null) { - if (typeof value !== "object") throw new Error(`Expected onEnd() callback in plugin ${quote(name)} to return an object`); - let keys = {}; - let errors = getFlag(value, keys, "errors", mustBeArray); - let warnings = getFlag(value, keys, "warnings", mustBeArray); - checkForInvalidFlags(value, keys, `from onEnd() callback in plugin ${quote(name)}`); - if (errors != null) newErrors = sanitizeMessages(errors, "errors", details, name, void 0); - if (warnings != null) newWarnings = sanitizeMessages(warnings, "warnings", details, name, void 0); - } - } catch (e) { - newErrors = [extractErrorMessageV8(e, streamIn, details, note && note(), name)]; - } - if (newErrors) { - onEndErrors.push(...newErrors); - try { - result.errors.push(...newErrors); - } catch { - } - } - if (newWarnings) { - onEndWarnings.push(...newWarnings); - try { - result.warnings.push(...newWarnings); - } catch { - } - } - } - done(onEndErrors, onEndWarnings); - })(); - }; - } - let scheduleOnDisposeCallbacks = () => { - for (const cb of onDisposeCallbacks) { - setTimeout(() => cb(), 0); - } - }; - isSetupDone = true; - return { - ok: true, - requestPlugins, - runOnEndCallbacks, - scheduleOnDisposeCallbacks - }; -}; -function createObjectStash() { - const map = /* @__PURE__ */ new Map(); - let nextID = 0; - return { - clear() { - map.clear(); - }, - load(id) { - return map.get(id); - }, - store(value) { - if (value === void 0) return -1; - const id = nextID++; - map.set(id, value); - return id; - } - }; -} -function extractCallerV8(e, streamIn, ident) { - let note; - let tried = false; - return () => { - if (tried) return note; - tried = true; - try { - let lines = (e.stack + "").split("\n"); - lines.splice(1, 1); - let location = parseStackLinesV8(streamIn, lines, ident); - if (location) { - note = { text: e.message, location }; - return note; - } - } catch { - } - }; -} -function extractErrorMessageV8(e, streamIn, stash, note, pluginName) { - let text = "Internal error"; - let location = null; - try { - text = (e && e.message || e) + ""; - } catch { - } - try { - location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), ""); - } catch { - } - return { id: "", pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 }; -} -function parseStackLinesV8(streamIn, lines, ident) { - let at = " at "; - if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) { - for (let i = 1; i < lines.length; i++) { - let line = lines[i]; - if (!line.startsWith(at)) continue; - line = line.slice(at.length); - while (true) { - let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line); - if (match) { - line = match[1]; - continue; - } - match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line); - if (match) { - line = match[1]; - continue; - } - match = /^(\S+):(\d+):(\d+)$/.exec(line); - if (match) { - let contents; - try { - contents = streamIn.readFileSync(match[1], "utf8"); - } catch { - break; - } - let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ""; - let column = +match[3] - 1; - let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0; - return { - file: match[1], - namespace: "file", - line: +match[2], - column: encodeUTF8(lineText.slice(0, column)).length, - length: encodeUTF8(lineText.slice(column, column + length)).length, - lineText: lineText + "\n" + lines.slice(1).join("\n"), - suggestion: "" - }; - } - break; - } - } - } - return null; -} -function failureErrorWithLog(text, errors, warnings) { - let limit = 5; - text += errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => { - if (i === limit) return "\n..."; - if (!e.location) return ` -error: ${e.text}`; - let { file, line, column } = e.location; - let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : ""; - return ` -${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`; - }).join(""); - let error = new Error(text); - for (const [key, value] of [["errors", errors], ["warnings", warnings]]) { - Object.defineProperty(error, key, { - configurable: true, - enumerable: true, - get: () => value, - set: (value2) => Object.defineProperty(error, key, { - configurable: true, - enumerable: true, - value: value2 - }) - }); - } - return error; -} -function replaceDetailsInMessages(messages, stash) { - for (const message of messages) { - message.detail = stash.load(message.detail); - } - return messages; -} -function sanitizeLocation(location, where, terminalWidth) { - if (location == null) return null; - let keys = {}; - let file = getFlag(location, keys, "file", mustBeString); - let namespace = getFlag(location, keys, "namespace", mustBeString); - let line = getFlag(location, keys, "line", mustBeInteger); - let column = getFlag(location, keys, "column", mustBeInteger); - let length = getFlag(location, keys, "length", mustBeInteger); - let lineText = getFlag(location, keys, "lineText", mustBeString); - let suggestion = getFlag(location, keys, "suggestion", mustBeString); - checkForInvalidFlags(location, keys, where); - if (lineText) { - const relevantASCII = lineText.slice( - 0, - (column && column > 0 ? column : 0) + (length && length > 0 ? length : 0) + (terminalWidth && terminalWidth > 0 ? terminalWidth : 80) - ); - if (!/[\x7F-\uFFFF]/.test(relevantASCII) && !/\n/.test(lineText)) { - lineText = relevantASCII; - } - } - return { - file: file || "", - namespace: namespace || "", - line: line || 0, - column: column || 0, - length: length || 0, - lineText: lineText || "", - suggestion: suggestion || "" - }; -} -function sanitizeMessages(messages, property, stash, fallbackPluginName, terminalWidth) { - let messagesClone = []; - let index = 0; - for (const message of messages) { - let keys = {}; - let id = getFlag(message, keys, "id", mustBeString); - let pluginName = getFlag(message, keys, "pluginName", mustBeString); - let text = getFlag(message, keys, "text", mustBeString); - let location = getFlag(message, keys, "location", mustBeObjectOrNull); - let notes = getFlag(message, keys, "notes", mustBeArray); - let detail = getFlag(message, keys, "detail", canBeAnything); - let where = `in element ${index} of "${property}"`; - checkForInvalidFlags(message, keys, where); - let notesClone = []; - if (notes) { - for (const note of notes) { - let noteKeys = {}; - let noteText = getFlag(note, noteKeys, "text", mustBeString); - let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull); - checkForInvalidFlags(note, noteKeys, where); - notesClone.push({ - text: noteText || "", - location: sanitizeLocation(noteLocation, where, terminalWidth) - }); - } - } - messagesClone.push({ - id: id || "", - pluginName: pluginName || fallbackPluginName, - text: text || "", - location: sanitizeLocation(location, where, terminalWidth), - notes: notesClone, - detail: stash ? stash.store(detail) : -1 - }); - index++; - } - return messagesClone; -} -function sanitizeStringArray(values, property) { - const result = []; - for (const value of values) { - if (typeof value !== "string") throw new Error(`${quote(property)} must be an array of strings`); - result.push(value); - } - return result; -} -function sanitizeStringMap(map, property) { - const result = /* @__PURE__ */ Object.create(null); - for (const key in map) { - const value = map[key]; - if (typeof value !== "string") throw new Error(`key ${quote(key)} in object ${quote(property)} must be a string`); - result[key] = value; - } - return result; -} -function convertOutputFiles({ path: path3, contents, hash }) { - let text = null; - return { - path: path3, - contents, - hash, - get text() { - const binary = this.contents; - if (text === null || binary !== contents) { - contents = binary; - text = decodeUTF8(binary); - } - return text; - } - }; -} -function jsRegExpToGoRegExp(regexp) { - let result = regexp.source; - if (regexp.flags) result = `(?${regexp.flags})${result}`; - return result; -} - -// lib/npm/node-platform.ts -var fs = require("fs"); -var os = require("os"); -var path = require("path"); -var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; -var isValidBinaryPath = (x) => !!x && x !== "/usr/bin/esbuild"; -var packageDarwin_arm64 = "@esbuild/darwin-arm64"; -var packageDarwin_x64 = "@esbuild/darwin-x64"; -var knownWindowsPackages = { - "win32 arm64 LE": "@esbuild/win32-arm64", - "win32 ia32 LE": "@esbuild/win32-ia32", - "win32 x64 LE": "@esbuild/win32-x64" -}; -var knownUnixlikePackages = { - "aix ppc64 BE": "@esbuild/aix-ppc64", - "android arm64 LE": "@esbuild/android-arm64", - "darwin arm64 LE": "@esbuild/darwin-arm64", - "darwin x64 LE": "@esbuild/darwin-x64", - "freebsd arm64 LE": "@esbuild/freebsd-arm64", - "freebsd x64 LE": "@esbuild/freebsd-x64", - "linux arm LE": "@esbuild/linux-arm", - "linux arm64 LE": "@esbuild/linux-arm64", - "linux ia32 LE": "@esbuild/linux-ia32", - "linux mips64el LE": "@esbuild/linux-mips64el", - "linux ppc64 LE": "@esbuild/linux-ppc64", - "linux riscv64 LE": "@esbuild/linux-riscv64", - "linux s390x BE": "@esbuild/linux-s390x", - "linux x64 LE": "@esbuild/linux-x64", - "linux loong64 LE": "@esbuild/linux-loong64", - "netbsd arm64 LE": "@esbuild/netbsd-arm64", - "netbsd x64 LE": "@esbuild/netbsd-x64", - "openbsd arm64 LE": "@esbuild/openbsd-arm64", - "openbsd x64 LE": "@esbuild/openbsd-x64", - "sunos x64 LE": "@esbuild/sunos-x64" -}; -var knownWebAssemblyFallbackPackages = { - "android arm LE": "@esbuild/android-arm", - "android x64 LE": "@esbuild/android-x64", - "openharmony arm64 LE": "@esbuild/openharmony-arm64" -}; -function pkgAndSubpathForCurrentPlatform() { - let pkg; - let subpath; - let isWASM = false; - let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; - if (platformKey in knownWindowsPackages) { - pkg = knownWindowsPackages[platformKey]; - subpath = "esbuild.exe"; - } else if (platformKey in knownUnixlikePackages) { - pkg = knownUnixlikePackages[platformKey]; - subpath = "bin/esbuild"; - } else if (platformKey in knownWebAssemblyFallbackPackages) { - pkg = knownWebAssemblyFallbackPackages[platformKey]; - subpath = "bin/esbuild"; - isWASM = true; - } else { - throw new Error(`Unsupported platform: ${platformKey}`); - } - return { pkg, subpath, isWASM }; -} -function pkgForSomeOtherPlatform() { - const libMainJS = require.resolve("esbuild"); - const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); - if (path.basename(nodeModulesDirectory) === "node_modules") { - for (const unixKey in knownUnixlikePackages) { - try { - const pkg = knownUnixlikePackages[unixKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg; - } catch { - } - } - for (const windowsKey in knownWindowsPackages) { - try { - const pkg = knownWindowsPackages[windowsKey]; - if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) return pkg; - } catch { - } - } - } - return null; -} -function downloadedBinPath(pkg, subpath) { - const esbuildLibDir = path.dirname(require.resolve("esbuild")); - return path.join(esbuildLibDir, `downloaded-${pkg.replace("/", "-")}-${path.basename(subpath)}`); -} -function generateBinPath() { - if (isValidBinaryPath(ESBUILD_BINARY_PATH)) { - if (!fs.existsSync(ESBUILD_BINARY_PATH)) { - console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ESBUILD_BINARY_PATH}`); - } else { - return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; - } - } - const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); - let binPath; - try { - binPath = require.resolve(`${pkg}/${subpath}`); - } catch (e) { - binPath = downloadedBinPath(pkg, subpath); - if (!fs.existsSync(binPath)) { - try { - require.resolve(pkg); - } catch { - const otherPkg = pkgForSomeOtherPlatform(); - if (otherPkg) { - let suggestions = ` -Specifically the "${otherPkg}" package is present but this platform -needs the "${pkg}" package instead. People often get into this -situation by installing esbuild on Windows or macOS and copying "node_modules" -into a Docker image that runs Linux, or by copying "node_modules" between -Windows and WSL environments. - -If you are installing with npm, you can try not copying the "node_modules" -directory when you copy the files over, and running "npm ci" or "npm install" -on the destination platform after the copy. Or you could consider using yarn -instead of npm which has built-in support for installing a package on multiple -platforms simultaneously. - -If you are installing with yarn, you can try listing both this platform and the -other platform in your ".yarnrc.yml" file using the "supportedArchitectures" -feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures -Keep in mind that this means multiple copies of esbuild will be present. -`; - if (pkg === packageDarwin_x64 && otherPkg === packageDarwin_arm64 || pkg === packageDarwin_arm64 && otherPkg === packageDarwin_x64) { - suggestions = ` -Specifically the "${otherPkg}" package is present but this platform -needs the "${pkg}" package instead. People often get into this -situation by installing esbuild with npm running inside of Rosetta 2 and then -trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta -2 is Apple's on-the-fly x86_64-to-arm64 translation service). - -If you are installing with npm, you can try ensuring that both npm and node are -not running under Rosetta 2 and then reinstalling esbuild. This likely involves -changing how you installed npm and/or node. For example, installing node with -the universal installer here should work: https://nodejs.org/en/download/. Or -you could consider using yarn instead of npm which has built-in support for -installing a package on multiple platforms simultaneously. - -If you are installing with yarn, you can try listing both "arm64" and "x64" -in your ".yarnrc.yml" file using the "supportedArchitectures" feature: -https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures -Keep in mind that this means multiple copies of esbuild will be present. -`; - } - throw new Error(` -You installed esbuild for another platform than the one you're currently using. -This won't work because esbuild is written with native code and needs to -install a platform-specific binary executable. -${suggestions} -Another alternative is to use the "esbuild-wasm" package instead, which works -the same way on all platforms. But it comes with a heavy performance cost and -can sometimes be 10x slower than the "esbuild" package, so you may also not -want to do that. -`); - } - throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. - -If you are installing esbuild with npm, make sure that you don't specify the -"--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature -of "package.json" is used by esbuild to install the correct binary executable -for your current platform.`); - } - throw e; - } - } - if (/\.zip\//.test(binPath)) { - let pnpapi; - try { - pnpapi = require("pnpapi"); - } catch (e) { - } - if (pnpapi) { - const root = pnpapi.getPackageInformation(pnpapi.topLevel).packageLocation; - const binTargetPath = path.join( - root, - "node_modules", - ".cache", - "esbuild", - `pnpapi-${pkg.replace("/", "-")}-${"0.27.2"}-${path.basename(subpath)}` - ); - if (!fs.existsSync(binTargetPath)) { - fs.mkdirSync(path.dirname(binTargetPath), { recursive: true }); - fs.copyFileSync(binPath, binTargetPath); - fs.chmodSync(binTargetPath, 493); - } - return { binPath: binTargetPath, isWASM }; - } - } - return { binPath, isWASM }; -} - -// lib/npm/node.ts -var child_process = require("child_process"); -var crypto = require("crypto"); -var path2 = require("path"); -var fs2 = require("fs"); -var os2 = require("os"); -var tty = require("tty"); -var worker_threads; -if (process.env.ESBUILD_WORKER_THREADS !== "0") { - try { - worker_threads = require("worker_threads"); - } catch { - } - let [major, minor] = process.versions.node.split("."); - if ( - // { - if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) { - throw new Error( - `The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle. - -More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.` - ); - } - if (false) { - return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]]; - } else { - const { binPath, isWASM } = generateBinPath(); - if (isWASM) { - return ["node", [binPath]]; - } else { - return [binPath, []]; - } - } -}; -var isTTY = () => tty.isatty(2); -var fsSync = { - readFile(tempFile, callback) { - try { - let contents = fs2.readFileSync(tempFile, "utf8"); - try { - fs2.unlinkSync(tempFile); - } catch { - } - callback(null, contents); - } catch (err) { - callback(err, null); - } - }, - writeFile(contents, callback) { - try { - let tempFile = randomFileName(); - fs2.writeFileSync(tempFile, contents); - callback(tempFile); - } catch { - callback(null); - } - } -}; -var fsAsync = { - readFile(tempFile, callback) { - try { - fs2.readFile(tempFile, "utf8", (err, contents) => { - try { - fs2.unlink(tempFile, () => callback(err, contents)); - } catch { - callback(err, contents); - } - }); - } catch (err) { - callback(err, null); - } - }, - writeFile(contents, callback) { - try { - let tempFile = randomFileName(); - fs2.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile)); - } catch { - callback(null); - } - } -}; -var version = "0.27.2"; -var build = (options) => ensureServiceIsRunning().build(options); -var context = (buildOptions) => ensureServiceIsRunning().context(buildOptions); -var transform = (input, options) => ensureServiceIsRunning().transform(input, options); -var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); -var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); -var buildSync = (options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.buildSync(options); - } - let result; - runServiceSync((service) => service.buildOrContext({ - callName: "buildSync", - refs: null, - options, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => { - if (err) throw err; - result = res; - } - })); - return result; -}; -var transformSync = (input, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.transformSync(input, options); - } - let result; - runServiceSync((service) => service.transform({ - callName: "transformSync", - refs: null, - input, - options: options || {}, - isTTY: isTTY(), - fs: fsSync, - callback: (err, res) => { - if (err) throw err; - result = res; - } - })); - return result; -}; -var formatMessagesSync = (messages, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.formatMessagesSync(messages, options); - } - let result; - runServiceSync((service) => service.formatMessages({ - callName: "formatMessagesSync", - refs: null, - messages, - options, - callback: (err, res) => { - if (err) throw err; - result = res; - } - })); - return result; -}; -var analyzeMetafileSync = (metafile, options) => { - if (worker_threads && !isInternalWorkerThread) { - if (!workerThreadService) workerThreadService = startWorkerThreadService(worker_threads); - return workerThreadService.analyzeMetafileSync(metafile, options); - } - let result; - runServiceSync((service) => service.analyzeMetafile({ - callName: "analyzeMetafileSync", - refs: null, - metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), - options, - callback: (err, res) => { - if (err) throw err; - result = res; - } - })); - return result; -}; -var stop = () => { - if (stopService) stopService(); - if (workerThreadService) workerThreadService.stop(); - return Promise.resolve(); -}; -var initializeWasCalled = false; -var initialize = (options) => { - options = validateInitializeOptions(options || {}); - if (options.wasmURL) throw new Error(`The "wasmURL" option only works in the browser`); - if (options.wasmModule) throw new Error(`The "wasmModule" option only works in the browser`); - if (options.worker) throw new Error(`The "worker" option only works in the browser`); - if (initializeWasCalled) throw new Error('Cannot call "initialize" more than once'); - ensureServiceIsRunning(); - initializeWasCalled = true; - return Promise.resolve(); -}; -var defaultWD = process.cwd(); -var longLivedService; -var stopService; -var ensureServiceIsRunning = () => { - if (longLivedService) return longLivedService; - let [command, args] = esbuildCommandAndArgs(); - let child = child_process.spawn(command, args.concat(`--service=${"0.27.2"}`, "--ping"), { - windowsHide: true, - stdio: ["pipe", "pipe", "inherit"], - cwd: defaultWD - }); - let { readFromStdout, afterClose, service } = createChannel({ - writeToStdin(bytes) { - child.stdin.write(bytes, (err) => { - if (err) afterClose(err); - }); - }, - readFileSync: fs2.readFileSync, - isSync: false, - hasFS: true, - esbuild: node_exports - }); - child.stdin.on("error", afterClose); - child.on("error", afterClose); - const stdin = child.stdin; - const stdout = child.stdout; - stdout.on("data", readFromStdout); - stdout.on("end", afterClose); - stopService = () => { - stdin.destroy(); - stdout.destroy(); - child.kill(); - initializeWasCalled = false; - longLivedService = void 0; - stopService = void 0; - }; - let refCount = 0; - child.unref(); - if (stdin.unref) { - stdin.unref(); - } - if (stdout.unref) { - stdout.unref(); - } - const refs = { - ref() { - if (++refCount === 1) child.ref(); - }, - unref() { - if (--refCount === 0) child.unref(); - } - }; - longLivedService = { - build: (options) => new Promise((resolve, reject) => { - service.buildOrContext({ - callName: "build", - refs, - options, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => err ? reject(err) : resolve(res) - }); - }), - context: (options) => new Promise((resolve, reject) => service.buildOrContext({ - callName: "context", - refs, - options, - isTTY: isTTY(), - defaultWD, - callback: (err, res) => err ? reject(err) : resolve(res) - })), - transform: (input, options) => new Promise((resolve, reject) => service.transform({ - callName: "transform", - refs, - input, - options: options || {}, - isTTY: isTTY(), - fs: fsAsync, - callback: (err, res) => err ? reject(err) : resolve(res) - })), - formatMessages: (messages, options) => new Promise((resolve, reject) => service.formatMessages({ - callName: "formatMessages", - refs, - messages, - options, - callback: (err, res) => err ? reject(err) : resolve(res) - })), - analyzeMetafile: (metafile, options) => new Promise((resolve, reject) => service.analyzeMetafile({ - callName: "analyzeMetafile", - refs, - metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), - options, - callback: (err, res) => err ? reject(err) : resolve(res) - })) - }; - return longLivedService; -}; -var runServiceSync = (callback) => { - let [command, args] = esbuildCommandAndArgs(); - let stdin = new Uint8Array(); - let { readFromStdout, afterClose, service } = createChannel({ - writeToStdin(bytes) { - if (stdin.length !== 0) throw new Error("Must run at most one command"); - stdin = bytes; - }, - isSync: true, - hasFS: true, - esbuild: node_exports - }); - callback(service); - let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.27.2"}`), { - cwd: defaultWD, - windowsHide: true, - input: stdin, - // We don't know how large the output could be. If it's too large, the - // command will fail with ENOBUFS. Reserve 16mb for now since that feels - // like it should be enough. Also allow overriding this with an environment - // variable. - maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024 - }); - readFromStdout(stdout); - afterClose(null); -}; -var randomFileName = () => { - return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`); -}; -var workerThreadService = null; -var startWorkerThreadService = (worker_threads2) => { - let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel(); - let worker = new worker_threads2.Worker(__filename, { - workerData: { workerPort, defaultWD, esbuildVersion: "0.27.2" }, - transferList: [workerPort], - // From node's documentation: https://nodejs.org/api/worker_threads.html - // - // Take care when launching worker threads from preload scripts (scripts loaded - // and run using the `-r` command line flag). Unless the `execArgv` option is - // explicitly set, new Worker threads automatically inherit the command line flags - // from the running process and will preload the same preload scripts as the main - // thread. If the preload script unconditionally launches a worker thread, every - // thread spawned will spawn another until the application crashes. - // - execArgv: [] - }); - let nextID = 0; - let fakeBuildError = (text) => { - let error = new Error(`Build failed with 1 error: -error: ${text}`); - let errors = [{ id: "", pluginName: "", text, location: null, notes: [], detail: void 0 }]; - error.errors = errors; - error.warnings = []; - return error; - }; - let validateBuildSyncOptions = (options) => { - if (!options) return; - let plugins = options.plugins; - if (plugins && plugins.length > 0) throw fakeBuildError(`Cannot use plugins in synchronous API calls`); - }; - let applyProperties = (object, properties) => { - for (let key in properties) { - object[key] = properties[key]; - } - }; - let runCallSync = (command, args) => { - let id = nextID++; - let sharedBuffer = new SharedArrayBuffer(8); - let sharedBufferView = new Int32Array(sharedBuffer); - let msg = { sharedBuffer, id, command, args }; - worker.postMessage(msg); - let status = Atomics.wait(sharedBufferView, 0, 0); - if (status !== "ok" && status !== "not-equal") throw new Error("Internal error: Atomics.wait() failed: " + status); - let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); - if (id !== id2) throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); - if (reject) { - applyProperties(reject, properties); - throw reject; - } - return resolve; - }; - worker.unref(); - return { - buildSync(options) { - validateBuildSyncOptions(options); - return runCallSync("build", [options]); - }, - transformSync(input, options) { - return runCallSync("transform", [input, options]); - }, - formatMessagesSync(messages, options) { - return runCallSync("formatMessages", [messages, options]); - }, - analyzeMetafileSync(metafile, options) { - return runCallSync("analyzeMetafile", [metafile, options]); - }, - stop() { - worker.terminate(); - workerThreadService = null; - } - }; -}; -var startSyncServiceWorker = () => { - let workerPort = worker_threads.workerData.workerPort; - let parentPort = worker_threads.parentPort; - let extractProperties = (object) => { - let properties = {}; - if (object && typeof object === "object") { - for (let key in object) { - properties[key] = object[key]; - } - } - return properties; - }; - try { - let service = ensureServiceIsRunning(); - defaultWD = worker_threads.workerData.defaultWD; - parentPort.on("message", (msg) => { - (async () => { - let { sharedBuffer, id, command, args } = msg; - let sharedBufferView = new Int32Array(sharedBuffer); - try { - switch (command) { - case "build": - workerPort.postMessage({ id, resolve: await service.build(args[0]) }); - break; - case "transform": - workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) }); - break; - case "formatMessages": - workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) }); - break; - case "analyzeMetafile": - workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) }); - break; - default: - throw new Error(`Invalid command: ${command}`); - } - } catch (reject) { - workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); - } - Atomics.add(sharedBufferView, 0, 1); - Atomics.notify(sharedBufferView, 0, Infinity); - })(); - }); - } catch (reject) { - parentPort.on("message", (msg) => { - let { sharedBuffer, id } = msg; - let sharedBufferView = new Int32Array(sharedBuffer); - workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); - Atomics.add(sharedBufferView, 0, 1); - Atomics.notify(sharedBufferView, 0, Infinity); - }); - } -}; -if (isInternalWorkerThread) { - startSyncServiceWorker(); -} -var node_default = node_exports; -// Annotate the CommonJS export names for ESM import in node: -0 && (module.exports = { - analyzeMetafile, - analyzeMetafileSync, - build, - buildSync, - context, - formatMessages, - formatMessagesSync, - initialize, - stop, - transform, - transformSync, - version -}); diff --git a/node_modules/esbuild/package.json b/node_modules/esbuild/package.json deleted file mode 100644 index dec92c2..0000000 --- a/node_modules/esbuild/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "esbuild", - "version": "0.27.2", - "description": "An extremely fast JavaScript and CSS bundler and minifier.", - "repository": { - "type": "git", - "url": "git+https://github.com/evanw/esbuild.git" - }, - "scripts": { - "postinstall": "node install.js" - }, - "main": "lib/main.js", - "types": "lib/main.d.ts", - "engines": { - "node": ">=18" - }, - "bin": { - "esbuild": "bin/esbuild" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.2", - "@esbuild/android-arm": "0.27.2", - "@esbuild/android-arm64": "0.27.2", - "@esbuild/android-x64": "0.27.2", - "@esbuild/darwin-arm64": "0.27.2", - "@esbuild/darwin-x64": "0.27.2", - "@esbuild/freebsd-arm64": "0.27.2", - "@esbuild/freebsd-x64": "0.27.2", - "@esbuild/linux-arm": "0.27.2", - "@esbuild/linux-arm64": "0.27.2", - "@esbuild/linux-ia32": "0.27.2", - "@esbuild/linux-loong64": "0.27.2", - "@esbuild/linux-mips64el": "0.27.2", - "@esbuild/linux-ppc64": "0.27.2", - "@esbuild/linux-riscv64": "0.27.2", - "@esbuild/linux-s390x": "0.27.2", - "@esbuild/linux-x64": "0.27.2", - "@esbuild/netbsd-arm64": "0.27.2", - "@esbuild/netbsd-x64": "0.27.2", - "@esbuild/openbsd-arm64": "0.27.2", - "@esbuild/openbsd-x64": "0.27.2", - "@esbuild/openharmony-arm64": "0.27.2", - "@esbuild/sunos-x64": "0.27.2", - "@esbuild/win32-arm64": "0.27.2", - "@esbuild/win32-ia32": "0.27.2", - "@esbuild/win32-x64": "0.27.2" - }, - "license": "MIT" -} diff --git a/node_modules/estree-walker/LICENSE b/node_modules/estree-walker/LICENSE deleted file mode 100644 index 63b6209..0000000 --- a/node_modules/estree-walker/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/contributors) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/estree-walker/README.md b/node_modules/estree-walker/README.md deleted file mode 100644 index d739d1b..0000000 --- a/node_modules/estree-walker/README.md +++ /dev/null @@ -1,48 +0,0 @@ -# estree-walker - -Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn). - - -## Installation - -```bash -npm i estree-walker -``` - - -## Usage - -```js -var walk = require('estree-walker').walk; -var acorn = require('acorn'); - -ast = acorn.parse(sourceCode, options); // https://github.com/acornjs/acorn - -walk(ast, { - enter(node, parent, prop, index) { - // some code happens - }, - leave(node, parent, prop, index) { - // some code happens - } -}); -``` - -Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called. - -Call `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one. - -Call `this.remove()` in either `enter` or `leave` to remove the current node. - -## Why not use estraverse? - -The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys. - -estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.) - -None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful. - - -## License - -MIT diff --git a/node_modules/estree-walker/package.json b/node_modules/estree-walker/package.json deleted file mode 100644 index c9f54ed..0000000 --- a/node_modules/estree-walker/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "estree-walker", - "description": "Traverse an ESTree-compliant AST", - "version": "3.0.3", - "private": false, - "author": "Rich Harris", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/Rich-Harris/estree-walker" - }, - "type": "module", - "module": "./src/index.js", - "exports": { - "./package.json": "./package.json", - ".": { - "types": "./types/index.d.ts", - "import": "./src/index.js" - } - }, - "types": "types/index.d.ts", - "scripts": { - "prepublishOnly": "tsc && npm test", - "test": "uvu test" - }, - "dependencies": { - "@types/estree": "^1.0.0" - }, - "devDependencies": { - "typescript": "^4.9.0", - "uvu": "^0.5.1" - }, - "files": [ - "src", - "types", - "README.md" - ] -} diff --git a/node_modules/estree-walker/src/async.js b/node_modules/estree-walker/src/async.js deleted file mode 100644 index f068c71..0000000 --- a/node_modules/estree-walker/src/async.js +++ /dev/null @@ -1,152 +0,0 @@ -import { WalkerBase } from './walker.js'; - -/** - * @typedef { import('estree').Node} Node - * @typedef { import('./walker.js').WalkerContext} WalkerContext - * @typedef {( - * this: WalkerContext, - * node: Node, - * parent: Node | null, - * key: string | number | symbol | null | undefined, - * index: number | null | undefined - * ) => Promise} AsyncHandler - */ - -export class AsyncWalker extends WalkerBase { - /** - * - * @param {AsyncHandler} [enter] - * @param {AsyncHandler} [leave] - */ - constructor(enter, leave) { - super(); - - /** @type {boolean} */ - this.should_skip = false; - - /** @type {boolean} */ - this.should_remove = false; - - /** @type {Node | null} */ - this.replacement = null; - - /** @type {WalkerContext} */ - this.context = { - skip: () => (this.should_skip = true), - remove: () => (this.should_remove = true), - replace: (node) => (this.replacement = node) - }; - - /** @type {AsyncHandler | undefined} */ - this.enter = enter; - - /** @type {AsyncHandler | undefined} */ - this.leave = leave; - } - - /** - * @template {Node} Parent - * @param {Node} node - * @param {Parent | null} parent - * @param {keyof Parent} [prop] - * @param {number | null} [index] - * @returns {Promise} - */ - async visit(node, parent, prop, index) { - if (node) { - if (this.enter) { - const _should_skip = this.should_skip; - const _should_remove = this.should_remove; - const _replacement = this.replacement; - this.should_skip = false; - this.should_remove = false; - this.replacement = null; - - await this.enter.call(this.context, node, parent, prop, index); - - if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index, node); - } - - if (this.should_remove) { - this.remove(parent, prop, index); - } - - const skipped = this.should_skip; - const removed = this.should_remove; - - this.should_skip = _should_skip; - this.should_remove = _should_remove; - this.replacement = _replacement; - - if (skipped) return node; - if (removed) return null; - } - - /** @type {keyof Node} */ - let key; - - for (key in node) { - /** @type {unknown} */ - const value = node[key]; - - if (value && typeof value === 'object') { - if (Array.isArray(value)) { - const nodes = /** @type {Array} */ (value); - for (let i = 0; i < nodes.length; i += 1) { - const item = nodes[i]; - if (isNode(item)) { - if (!(await this.visit(item, node, key, i))) { - // removed - i--; - } - } - } - } else if (isNode(value)) { - await this.visit(value, node, key, null); - } - } - } - - if (this.leave) { - const _replacement = this.replacement; - const _should_remove = this.should_remove; - this.replacement = null; - this.should_remove = false; - - await this.leave.call(this.context, node, parent, prop, index); - - if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index, node); - } - - if (this.should_remove) { - this.remove(parent, prop, index); - } - - const removed = this.should_remove; - - this.replacement = _replacement; - this.should_remove = _should_remove; - - if (removed) return null; - } - } - - return node; - } -} - -/** - * Ducktype a node. - * - * @param {unknown} value - * @returns {value is Node} - */ -function isNode(value) { - return ( - value !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string' - ); -} diff --git a/node_modules/estree-walker/src/index.js b/node_modules/estree-walker/src/index.js deleted file mode 100644 index 933ea4f..0000000 --- a/node_modules/estree-walker/src/index.js +++ /dev/null @@ -1,34 +0,0 @@ -import { SyncWalker } from './sync.js'; -import { AsyncWalker } from './async.js'; - -/** - * @typedef {import('estree').Node} Node - * @typedef {import('./sync.js').SyncHandler} SyncHandler - * @typedef {import('./async.js').AsyncHandler} AsyncHandler - */ - -/** - * @param {Node} ast - * @param {{ - * enter?: SyncHandler - * leave?: SyncHandler - * }} walker - * @returns {Node | null} - */ -export function walk(ast, { enter, leave }) { - const instance = new SyncWalker(enter, leave); - return instance.visit(ast, null); -} - -/** - * @param {Node} ast - * @param {{ - * enter?: AsyncHandler - * leave?: AsyncHandler - * }} walker - * @returns {Promise} - */ -export async function asyncWalk(ast, { enter, leave }) { - const instance = new AsyncWalker(enter, leave); - return await instance.visit(ast, null); -} diff --git a/node_modules/estree-walker/src/sync.js b/node_modules/estree-walker/src/sync.js deleted file mode 100644 index 171fb36..0000000 --- a/node_modules/estree-walker/src/sync.js +++ /dev/null @@ -1,152 +0,0 @@ -import { WalkerBase } from './walker.js'; - -/** - * @typedef { import('estree').Node} Node - * @typedef { import('./walker.js').WalkerContext} WalkerContext - * @typedef {( - * this: WalkerContext, - * node: Node, - * parent: Node | null, - * key: string | number | symbol | null | undefined, - * index: number | null | undefined - * ) => void} SyncHandler - */ - -export class SyncWalker extends WalkerBase { - /** - * - * @param {SyncHandler} [enter] - * @param {SyncHandler} [leave] - */ - constructor(enter, leave) { - super(); - - /** @type {boolean} */ - this.should_skip = false; - - /** @type {boolean} */ - this.should_remove = false; - - /** @type {Node | null} */ - this.replacement = null; - - /** @type {WalkerContext} */ - this.context = { - skip: () => (this.should_skip = true), - remove: () => (this.should_remove = true), - replace: (node) => (this.replacement = node) - }; - - /** @type {SyncHandler | undefined} */ - this.enter = enter; - - /** @type {SyncHandler | undefined} */ - this.leave = leave; - } - - /** - * @template {Node} Parent - * @param {Node} node - * @param {Parent | null} parent - * @param {keyof Parent} [prop] - * @param {number | null} [index] - * @returns {Node | null} - */ - visit(node, parent, prop, index) { - if (node) { - if (this.enter) { - const _should_skip = this.should_skip; - const _should_remove = this.should_remove; - const _replacement = this.replacement; - this.should_skip = false; - this.should_remove = false; - this.replacement = null; - - this.enter.call(this.context, node, parent, prop, index); - - if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index, node); - } - - if (this.should_remove) { - this.remove(parent, prop, index); - } - - const skipped = this.should_skip; - const removed = this.should_remove; - - this.should_skip = _should_skip; - this.should_remove = _should_remove; - this.replacement = _replacement; - - if (skipped) return node; - if (removed) return null; - } - - /** @type {keyof Node} */ - let key; - - for (key in node) { - /** @type {unknown} */ - const value = node[key]; - - if (value && typeof value === 'object') { - if (Array.isArray(value)) { - const nodes = /** @type {Array} */ (value); - for (let i = 0; i < nodes.length; i += 1) { - const item = nodes[i]; - if (isNode(item)) { - if (!this.visit(item, node, key, i)) { - // removed - i--; - } - } - } - } else if (isNode(value)) { - this.visit(value, node, key, null); - } - } - } - - if (this.leave) { - const _replacement = this.replacement; - const _should_remove = this.should_remove; - this.replacement = null; - this.should_remove = false; - - this.leave.call(this.context, node, parent, prop, index); - - if (this.replacement) { - node = this.replacement; - this.replace(parent, prop, index, node); - } - - if (this.should_remove) { - this.remove(parent, prop, index); - } - - const removed = this.should_remove; - - this.replacement = _replacement; - this.should_remove = _should_remove; - - if (removed) return null; - } - } - - return node; - } -} - -/** - * Ducktype a node. - * - * @param {unknown} value - * @returns {value is Node} - */ -function isNode(value) { - return ( - value !== null && typeof value === 'object' && 'type' in value && typeof value.type === 'string' - ); -} diff --git a/node_modules/estree-walker/src/walker.js b/node_modules/estree-walker/src/walker.js deleted file mode 100644 index 6dc6bd7..0000000 --- a/node_modules/estree-walker/src/walker.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @typedef { import('estree').Node} Node - * @typedef {{ - * skip: () => void; - * remove: () => void; - * replace: (node: Node) => void; - * }} WalkerContext - */ - -export class WalkerBase { - constructor() { - /** @type {boolean} */ - this.should_skip = false; - - /** @type {boolean} */ - this.should_remove = false; - - /** @type {Node | null} */ - this.replacement = null; - - /** @type {WalkerContext} */ - this.context = { - skip: () => (this.should_skip = true), - remove: () => (this.should_remove = true), - replace: (node) => (this.replacement = node) - }; - } - - /** - * @template {Node} Parent - * @param {Parent | null | undefined} parent - * @param {keyof Parent | null | undefined} prop - * @param {number | null | undefined} index - * @param {Node} node - */ - replace(parent, prop, index, node) { - if (parent && prop) { - if (index != null) { - /** @type {Array} */ (parent[prop])[index] = node; - } else { - /** @type {Node} */ (parent[prop]) = node; - } - } - } - - /** - * @template {Node} Parent - * @param {Parent | null | undefined} parent - * @param {keyof Parent | null | undefined} prop - * @param {number | null | undefined} index - */ - remove(parent, prop, index) { - if (parent && prop) { - if (index !== null && index !== undefined) { - /** @type {Array} */ (parent[prop]).splice(index, 1); - } else { - delete parent[prop]; - } - } - } -} diff --git a/node_modules/estree-walker/types/async.d.ts b/node_modules/estree-walker/types/async.d.ts deleted file mode 100644 index db0825a..0000000 --- a/node_modules/estree-walker/types/async.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @typedef { import('estree').Node} Node - * @typedef { import('./walker.js').WalkerContext} WalkerContext - * @typedef {( - * this: WalkerContext, - * node: Node, - * parent: Node | null, - * key: string | number | symbol | null | undefined, - * index: number | null | undefined - * ) => Promise} AsyncHandler - */ -export class AsyncWalker extends WalkerBase { - /** - * - * @param {AsyncHandler} [enter] - * @param {AsyncHandler} [leave] - */ - constructor(enter?: AsyncHandler | undefined, leave?: AsyncHandler | undefined); - /** @type {AsyncHandler | undefined} */ - enter: AsyncHandler | undefined; - /** @type {AsyncHandler | undefined} */ - leave: AsyncHandler | undefined; - /** - * @template {Node} Parent - * @param {Node} node - * @param {Parent | null} parent - * @param {keyof Parent} [prop] - * @param {number | null} [index] - * @returns {Promise} - */ - visit(node: Node, parent: Parent | null, prop?: keyof Parent | undefined, index?: number | null | undefined): Promise; -} -export type Node = import('estree').Node; -export type WalkerContext = import('./walker.js').WalkerContext; -export type AsyncHandler = (this: WalkerContext, node: Node, parent: Node | null, key: string | number | symbol | null | undefined, index: number | null | undefined) => Promise; -import { WalkerBase } from "./walker.js"; diff --git a/node_modules/estree-walker/types/index.d.ts b/node_modules/estree-walker/types/index.d.ts deleted file mode 100644 index c25afed..0000000 --- a/node_modules/estree-walker/types/index.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * @typedef {import('estree').Node} Node - * @typedef {import('./sync.js').SyncHandler} SyncHandler - * @typedef {import('./async.js').AsyncHandler} AsyncHandler - */ -/** - * @param {Node} ast - * @param {{ - * enter?: SyncHandler - * leave?: SyncHandler - * }} walker - * @returns {Node | null} - */ -export function walk(ast: Node, { enter, leave }: { - enter?: SyncHandler; - leave?: SyncHandler; -}): Node | null; -/** - * @param {Node} ast - * @param {{ - * enter?: AsyncHandler - * leave?: AsyncHandler - * }} walker - * @returns {Promise} - */ -export function asyncWalk(ast: Node, { enter, leave }: { - enter?: AsyncHandler; - leave?: AsyncHandler; -}): Promise; -export type Node = import('estree').Node; -export type SyncHandler = import('./sync.js').SyncHandler; -export type AsyncHandler = import('./async.js').AsyncHandler; diff --git a/node_modules/estree-walker/types/sync.d.ts b/node_modules/estree-walker/types/sync.d.ts deleted file mode 100644 index 3612b7f..0000000 --- a/node_modules/estree-walker/types/sync.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/** - * @typedef { import('estree').Node} Node - * @typedef { import('./walker.js').WalkerContext} WalkerContext - * @typedef {( - * this: WalkerContext, - * node: Node, - * parent: Node | null, - * key: string | number | symbol | null | undefined, - * index: number | null | undefined - * ) => void} SyncHandler - */ -export class SyncWalker extends WalkerBase { - /** - * - * @param {SyncHandler} [enter] - * @param {SyncHandler} [leave] - */ - constructor(enter?: SyncHandler | undefined, leave?: SyncHandler | undefined); - /** @type {SyncHandler | undefined} */ - enter: SyncHandler | undefined; - /** @type {SyncHandler | undefined} */ - leave: SyncHandler | undefined; - /** - * @template {Node} Parent - * @param {Node} node - * @param {Parent | null} parent - * @param {keyof Parent} [prop] - * @param {number | null} [index] - * @returns {Node | null} - */ - visit(node: Node, parent: Parent | null, prop?: keyof Parent | undefined, index?: number | null | undefined): Node | null; -} -export type Node = import('estree').Node; -export type WalkerContext = import('./walker.js').WalkerContext; -export type SyncHandler = (this: WalkerContext, node: Node, parent: Node | null, key: string | number | symbol | null | undefined, index: number | null | undefined) => void; -import { WalkerBase } from "./walker.js"; diff --git a/node_modules/estree-walker/types/walker.d.ts b/node_modules/estree-walker/types/walker.d.ts deleted file mode 100644 index a3fa29c..0000000 --- a/node_modules/estree-walker/types/walker.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -/** - * @typedef { import('estree').Node} Node - * @typedef {{ - * skip: () => void; - * remove: () => void; - * replace: (node: Node) => void; - * }} WalkerContext - */ -export class WalkerBase { - /** @type {boolean} */ - should_skip: boolean; - /** @type {boolean} */ - should_remove: boolean; - /** @type {Node | null} */ - replacement: Node | null; - /** @type {WalkerContext} */ - context: WalkerContext; - /** - * @template {Node} Parent - * @param {Parent | null | undefined} parent - * @param {keyof Parent | null | undefined} prop - * @param {number | null | undefined} index - * @param {Node} node - */ - replace(parent: Parent | null | undefined, prop: keyof Parent | null | undefined, index: number | null | undefined, node: Node): void; - /** - * @template {Node} Parent - * @param {Parent | null | undefined} parent - * @param {keyof Parent | null | undefined} prop - * @param {number | null | undefined} index - */ - remove(parent: Parent_1 | null | undefined, prop: keyof Parent_1 | null | undefined, index: number | null | undefined): void; -} -export type Node = import('estree').Node; -export type WalkerContext = { - skip: () => void; - remove: () => void; - replace: (node: Node) => void; -}; diff --git a/node_modules/expect-type/LICENSE b/node_modules/expect-type/LICENSE deleted file mode 100644 index deede24..0000000 --- a/node_modules/expect-type/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - Copyright 2024 Misha Kaletsky - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/node_modules/expect-type/README.md b/node_modules/expect-type/README.md deleted file mode 100644 index 9aaf8ca..0000000 --- a/node_modules/expect-type/README.md +++ /dev/null @@ -1,925 +0,0 @@ -# expect-type - -[![CI](https://github.com/mmkal/expect-type/actions/workflows/ci.yml/badge.svg)](https://github.com/mmkal/expect-type/actions/workflows/ci.yml) -![npm](https://img.shields.io/npm/dt/expect-type) -[![X Follow](https://img.shields.io/twitter/follow/mmkal)](https://x.com/mmkalmmkal) - -Compile-time tests for types. Useful to make sure types don't regress into being overly permissive as changes go in over time. - -Similar to `expect`, but with type-awareness. Gives you access to several type-matchers that let you make assertions about the form of a reference or generic type parameter. - -```ts -import {expectTypeOf} from 'expect-type' -import {foo, bar} from '../foo' - -// make sure `foo` has type {a: number} -expectTypeOf(foo).toEqualTypeOf<{a: number}>() - -// make sure `bar` is a function taking a string: -expectTypeOf(bar).parameter(0).toBeString() -expectTypeOf(bar).returns.not.toBeAny() -``` - -It can be used in your existing test files (and is actually [built in to vitest](https://vitest.dev/guide/testing-types)). Or it can be used in any other type-checked file you'd like - it's built into existing tooling with no dependencies. No extra build step, cli tool, IDE extension, or lint plugin is needed. Just import the function and start writing tests. Failures will be at compile time - they'll appear in your IDE and when you run `tsc`. - -See below for lots more examples. - -## Contents - -- [Contents](#contents) -- [Installation and usage](#installation-and-usage) -- [Documentation](#documentation) - - [Features](#features) - - [Why is my assertion failing?](#why-is-my-assertion-failing) - - [Why is `.toMatchTypeOf` deprecated?](#why-is-tomatchtypeof-deprecated) - - [Internal type helpers](#internal-type-helpers) - - [Error messages](#error-messages) - - [Concrete "expected" objects vs type arguments](#concrete-expected-objects-vs-type-arguments) - - [Overloaded functions](#overloaded-functions) - - [Within test frameworks](#within-test-frameworks) - - [Vitest](#vitest) - - [Jest & `eslint-plugin-jest`](#jest--eslint-plugin-jest) - - [Limitations](#limitations) -- [Similar projects](#similar-projects) - - [Comparison](#comparison) -- [TypeScript backwards-compatibility](#typescript-backwards-compatibility) -- [Contributing](#contributing) - - [Documentation of limitations through tests](#documentation-of-limitations-through-tests) - - -## Installation and usage - -```cli -npm install expect-type --save-dev -``` - -```typescript -import {expectTypeOf} from 'expect-type' -``` - -## Documentation - -The `expectTypeOf` method takes a single argument or a generic type parameter. Neither it nor the functions chained off its return value have any meaningful runtime behaviour. The assertions you write will be _compile-time_ errors if they don't hold true. - -### Features - - -Check an object's type with `.toEqualTypeOf`: - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf<{a: number}>() -``` - -`.toEqualTypeOf` can check that two concrete objects have equivalent types (note: when these assertions _fail_, the error messages can be less informative vs the generic type argument syntax above - see [error messages docs](#error-messages)): - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf({a: 1}) -``` - -`.toEqualTypeOf` succeeds for objects with different values, but the same type: - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf({a: 2}) -``` - -`.toEqualTypeOf` fails on excess properties: - -```typescript -// @ts-expect-error -expectTypeOf({a: 1, b: 1}).toEqualTypeOf<{a: number}>() -``` - -To allow for extra properties on an object type, use `.toMatchObjectType`. This is a strict check, but only on the subset of keys that are in the expected type: - -```typescript -expectTypeOf({a: 1, b: 1}).toMatchObjectType<{a: number}>() -``` - -`.toMatchObjectType` can check partial matches on deeply nested objects: - -```typescript -const user = { - email: 'a@b.com', - name: 'John Doe', - address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}, -} - -expectTypeOf(user).toMatchObjectType<{name: string; address: {city: string}}>() -``` - -To check that a type extends another type, use `.toExtend`: - -```typescript -expectTypeOf('some string').toExtend() -// @ts-expect-error -expectTypeOf({a: 1}).toExtend<{b: number}>() -``` - -`.toExtend` can be used with object types, but `.toMatchObjectType` is usually a better choice when dealing with objects, since it's stricter: - -```typescript -expectTypeOf({a: 1, b: 2}).toExtend<{a: number}>() // avoid this -expectTypeOf({a: 1, b: 2}).toMatchObjectType<{a: number}>() // prefer this -``` - -`.toEqualTypeOf`, `.toMatchObjectType`, and `.toExtend` all fail on missing properties: - -```typescript -// @ts-expect-error -expectTypeOf({a: 1}).toEqualTypeOf<{a: number; b: number}>() -// @ts-expect-error -expectTypeOf({a: 1}).toMatchObjectType<{a: number; b: number}>() -// @ts-expect-error -expectTypeOf({a: 1}).toExtend<{a: number; b: number}>() -``` - -Another example of the difference between `.toExtend`, `.toMatchObjectType`, and `.toEqualTypeOf`. `.toExtend` can be used for "is-a" relationships: - -```typescript -type Fruit = {type: 'Fruit'; edible: boolean} -type Apple = {type: 'Fruit'; name: 'Apple'; edible: true} - -expectTypeOf().toExtend() - -// @ts-expect-error - the `editable` property isn't an exact match. In `Apple`, it's `true`, which extends `boolean`, but they're not identical. -expectTypeOf().toMatchObjectType() - -// @ts-expect-error - Apple is not an identical type to Fruit, it's a subtype -expectTypeOf().toEqualTypeOf() - -// @ts-expect-error - Apple is a Fruit, but not vice versa -expectTypeOf().toExtend() -``` - -Assertions can be inverted with `.not`: - -```typescript -expectTypeOf({a: 1}).not.toExtend<{b: 1}>() -expectTypeOf({a: 1}).not.toMatchObjectType<{b: 1}>() -``` - -`.not` can be easier than relying on `// @ts-expect-error`: - -```typescript -type Fruit = {type: 'Fruit'; edible: boolean} -type Apple = {type: 'Fruit'; name: 'Apple'; edible: true} - -expectTypeOf().toExtend() - -expectTypeOf().not.toExtend() -expectTypeOf().not.toEqualTypeOf() -``` - -Catch any/unknown/never types: - -```typescript -expectTypeOf().toBeUnknown() -expectTypeOf().toBeAny() -expectTypeOf().toBeNever() - -// @ts-expect-error -expectTypeOf().toBeNumber() -``` - -`.toEqualTypeOf` distinguishes between deeply-nested `any` and `unknown` properties: - -```typescript -expectTypeOf<{deeply: {nested: any}}>().not.toEqualTypeOf<{deeply: {nested: unknown}}>() -``` - -You can test for basic JavaScript types: - -```typescript -expectTypeOf(() => 1).toBeFunction() -expectTypeOf({}).toBeObject() -expectTypeOf([]).toBeArray() -expectTypeOf('').toBeString() -expectTypeOf(1).toBeNumber() -expectTypeOf(true).toBeBoolean() -expectTypeOf(() => {}).returns.toBeVoid() -expectTypeOf(Promise.resolve(123)).resolves.toBeNumber() -expectTypeOf(Symbol(1)).toBeSymbol() -expectTypeOf(1n).toBeBigInt() -``` - -`.toBe...` methods allow for types that extend the expected type: - -```typescript -expectTypeOf().toBeNumber() -expectTypeOf<1>().toBeNumber() - -expectTypeOf().toBeArray() -expectTypeOf().toBeArray() - -expectTypeOf().toBeString() -expectTypeOf<'foo'>().toBeString() - -expectTypeOf().toBeBoolean() -expectTypeOf().toBeBoolean() - -expectTypeOf().toBeBigInt() -expectTypeOf<0n>().toBeBigInt() -``` - -`.toBe...` methods protect against `any`: - -```typescript -const goodIntParser = (s: string) => Number.parseInt(s, 10) -const badIntParser = (s: string) => JSON.parse(s) // uh-oh - works at runtime if the input is a number, but return 'any' - -expectTypeOf(goodIntParser).returns.toBeNumber() -// @ts-expect-error - if you write a test like this, `.toBeNumber()` will let you know your implementation returns `any`. -expectTypeOf(badIntParser).returns.toBeNumber() -``` - -Nullable types: - -```typescript -expectTypeOf(undefined).toBeUndefined() -expectTypeOf(undefined).toBeNullable() -expectTypeOf(undefined).not.toBeNull() - -expectTypeOf(null).toBeNull() -expectTypeOf(null).toBeNullable() -expectTypeOf(null).not.toBeUndefined() - -expectTypeOf<1 | undefined>().toBeNullable() -expectTypeOf<1 | null>().toBeNullable() -expectTypeOf<1 | undefined | null>().toBeNullable() -``` - -More `.not` examples: - -```typescript -expectTypeOf(1).not.toBeUnknown() -expectTypeOf(1).not.toBeAny() -expectTypeOf(1).not.toBeNever() -expectTypeOf(1).not.toBeNull() -expectTypeOf(1).not.toBeUndefined() -expectTypeOf(1).not.toBeNullable() -expectTypeOf(1).not.toBeBigInt() -``` - -Detect assignability of unioned types: - -```typescript -expectTypeOf().toExtend() -expectTypeOf().not.toExtend() -``` - -Use `.extract` and `.exclude` to narrow down complex union types: - -```typescript -type ResponsiveProp = T | T[] | {xs?: T; sm?: T; md?: T} -const getResponsiveProp = (_props: T): ResponsiveProp => ({}) -type CSSProperties = {margin?: string; padding?: string} - -const cssProperties: CSSProperties = {margin: '1px', padding: '2px'} - -expectTypeOf(getResponsiveProp(cssProperties)) - .exclude() - .exclude<{xs?: unknown}>() - .toEqualTypeOf() - -expectTypeOf(getResponsiveProp(cssProperties)) - .extract() - .toEqualTypeOf() - -expectTypeOf(getResponsiveProp(cssProperties)) - .extract<{xs?: any}>() - .toEqualTypeOf<{xs?: CSSProperties; sm?: CSSProperties; md?: CSSProperties}>() - -expectTypeOf>().exclude().toHaveProperty('sm') -expectTypeOf>().exclude().not.toHaveProperty('xxl') -``` - -`.extract` and `.exclude` return never if no types remain after exclusion: - -```typescript -type Person = {name: string; age: number} -type Customer = Person & {customerId: string} -type Employee = Person & {employeeId: string} - -expectTypeOf().extract<{foo: string}>().toBeNever() -expectTypeOf().exclude<{name: string}>().toBeNever() -``` - -Use `.pick` to pick a set of properties from an object: - -```typescript -type Person = {name: string; age: number} - -expectTypeOf().pick<'name'>().toEqualTypeOf<{name: string}>() -``` - -Use `.omit` to remove a set of properties from an object: - -```typescript -type Person = {name: string; age: number} - -expectTypeOf().omit<'name'>().toEqualTypeOf<{age: number}>() -``` - -Make assertions about object properties: - -```typescript -const obj = {a: 1, b: ''} - -// check that properties exist (or don't) with `.toHaveProperty` -expectTypeOf(obj).toHaveProperty('a') -expectTypeOf(obj).not.toHaveProperty('c') - -// check types of properties -expectTypeOf(obj).toHaveProperty('a').toBeNumber() -expectTypeOf(obj).toHaveProperty('b').toBeString() -expectTypeOf(obj).toHaveProperty('a').not.toBeString() -``` - -`.toEqualTypeOf` can be used to distinguish between functions: - -```typescript -type NoParam = () => void -type HasParam = (s: string) => void - -expectTypeOf().not.toEqualTypeOf() -``` - -But often it's preferable to use `.parameters` or `.returns` for more specific function assertions: - -```typescript -type NoParam = () => void -type HasParam = (s: string) => void - -expectTypeOf().parameters.toEqualTypeOf<[]>() -expectTypeOf().returns.toBeVoid() - -expectTypeOf().parameters.toEqualTypeOf<[string]>() -expectTypeOf().returns.toBeVoid() -``` - -Up to ten overloads will produce union types for `.parameters` and `.returns`: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf().parameters.not.toEqualTypeOf<[number]>() -expectTypeOf().parameters.toEqualTypeOf<[number] | [bigint]>() -expectTypeOf().returns.toEqualTypeOf() - -expectTypeOf().parameter(0).toEqualTypeOf() -``` - -Note that these aren't exactly like TypeScript's built-in Parameters<...> and ReturnType<...>: - -The TypeScript builtins simply choose a single overload (see the [Overloaded functions](#overloaded-functions) section for more information) - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -// overload using `number` is ignored! -expectTypeOf>().toEqualTypeOf<[bigint]>() -expectTypeOf>().toEqualTypeOf() -``` - -More examples of ways to work with functions - parameters using `.parameter(n)` or `.parameters`, and return values using `.returns`: - -```typescript -const f = (a: number) => [a, a] - -expectTypeOf(f).toBeFunction() - -expectTypeOf(f).toBeCallableWith(1) -expectTypeOf(f).not.toBeAny() -expectTypeOf(f).returns.not.toBeAny() -expectTypeOf(f).returns.toEqualTypeOf([1, 2]) -expectTypeOf(f).returns.toEqualTypeOf([1, 2, 3]) -expectTypeOf(f).parameter(0).not.toEqualTypeOf('1') -expectTypeOf(f).parameter(0).toEqualTypeOf(1) -expectTypeOf(1).parameter(0).toBeNever() - -const twoArgFunc = (a: number, b: string) => ({a, b}) - -expectTypeOf(twoArgFunc).parameters.toEqualTypeOf<[number, string]>() -``` - -`.toBeCallableWith` allows for overloads. You can also use it to narrow down the return type for given input parameters.: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf().toBeCallableWith(6) -expectTypeOf().toBeCallableWith(6n) -``` - -`.toBeCallableWith` returns a type that can be used to narrow down the return type for given input parameters.: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} -expectTypeOf().toBeCallableWith(6).returns.toEqualTypeOf() -expectTypeOf().toBeCallableWith(6n).returns.toEqualTypeOf() -``` - -`.toBeCallableWith` can be used to narrow down the parameters of a function: - -```typescript -type Delete = { - (path: string): void - (paths: string[], options?: {force: boolean}): void -} - -expectTypeOf().toBeCallableWith('abc').parameters.toEqualTypeOf<[string]>() -expectTypeOf() - .toBeCallableWith(['abc', 'def'], {force: true}) - .parameters.toEqualTypeOf<[string[], {force: boolean}?]>() - -expectTypeOf().toBeCallableWith('abc').parameter(0).toBeString() -expectTypeOf().toBeCallableWith('abc').parameter(1).toBeUndefined() - -expectTypeOf() - .toBeCallableWith(['abc', 'def', 'ghi']) - .parameter(0) - .toEqualTypeOf() - -expectTypeOf() - .toBeCallableWith(['abc', 'def', 'ghi']) - .parameter(1) - .toEqualTypeOf<{force: boolean} | undefined>() -``` - -You can't use `.toBeCallableWith` with `.not` - you need to use ts-expect-error:: - -```typescript -const f = (a: number) => [a, a] - -// @ts-expect-error -expectTypeOf(f).toBeCallableWith('foo') -``` - -Use `.map` to transform types: - -This can be useful for generic functions or complex types which you can't access via `.toBeCallableWith`, `.toHaveProperty` etc. The callback function isn't called at runtime, which can make this a useful way to get complex inferred types without worrying about running code. - -```typescript -const capitalize = (input: S) => - (input.slice(0, 1).toUpperCase() + input.slice(1)) as Capitalize - -expectTypeOf(capitalize) - .map(fn => fn('hello world')) - .toEqualTypeOf<'Hello world'>() -``` - -You can also check type guards & type assertions: - -```typescript -const assertNumber = (v: any): asserts v is number => { - if (typeof v !== 'number') { - throw new TypeError('Nope !') - } -} - -expectTypeOf(assertNumber).asserts.toBeNumber() - -const isString = (v: any): v is string => typeof v === 'string' - -expectTypeOf(isString).guards.toBeString() - -const isBigInt = (value: any): value is bigint => typeof value === 'bigint' - -expectTypeOf(isBigInt).guards.toBeBigInt() -``` - -Assert on constructor parameters: - -```typescript -expectTypeOf(Date).toBeConstructibleWith('1970') -expectTypeOf(Date).toBeConstructibleWith(0) -expectTypeOf(Date).toBeConstructibleWith(new Date()) -expectTypeOf(Date).toBeConstructibleWith() - -expectTypeOf(Date).constructorParameters.toEqualTypeOf< - | [] - | [value: string | number] - | [value: string | number | Date] - | [ - year: number, - monthIndex: number, - date?: number | undefined, - hours?: number | undefined, - minutes?: number | undefined, - seconds?: number | undefined, - ms?: number | undefined, - ] ->() -``` - -Constructor overloads: - -```typescript -class DBConnection { - constructor() - constructor(connectionString: string) - constructor(options: {host: string; port: number}) - constructor(..._: unknown[]) {} -} - -expectTypeOf(DBConnection).toBeConstructibleWith() -expectTypeOf(DBConnection).toBeConstructibleWith('localhost') -expectTypeOf(DBConnection).toBeConstructibleWith({host: 'localhost', port: 1234}) -// @ts-expect-error - as when calling `new DBConnection(...)` you can't actually use the `(...args: unknown[])` overlaod, it's purely for the implementation. -expectTypeOf(DBConnection).toBeConstructibleWith(1, 2) -``` - -Check function `this` parameters: - -```typescript -function greet(this: {name: string}, message: string) { - return `Hello ${this.name}, here's your message: ${message}` -} - -expectTypeOf(greet).thisParameter.toEqualTypeOf<{name: string}>() -``` - -Distinguish between functions with different `this` parameters: - -```typescript -function greetFormal(this: {title: string; name: string}, message: string) { - return `Dear ${this.title} ${this.name}, here's your message: ${message}` -} - -function greetCasual(this: {name: string}, message: string) { - return `Hi ${this.name}, here's your message: ${message}` -} - -expectTypeOf(greetFormal).not.toEqualTypeOf(greetCasual) -``` - -Class instance types: - -```typescript -expectTypeOf(Date).instance.toHaveProperty('toISOString') -``` - -Promise resolution types can be checked with `.resolves`: - -```typescript -const asyncFunc = async () => 123 - -expectTypeOf(asyncFunc).returns.resolves.toBeNumber() -``` - -Array items can be checked with `.items`: - -```typescript -expectTypeOf([1, 2, 3]).items.toBeNumber() -expectTypeOf([1, 2, 3]).items.not.toBeString() -``` - -You can also compare arrays directly: - -```typescript -expectTypeOf().not.toEqualTypeOf() -``` - -Check that functions never return: - -```typescript -const thrower = () => { - throw new Error('oh no') -} - -expectTypeOf(thrower).returns.toBeNever() -``` - -Generics can be used rather than references: - -```typescript -expectTypeOf<{a: string}>().not.toEqualTypeOf<{a: number}>() -``` - -Distinguish between missing/null/optional properties: - -```typescript -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{}>() -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{a: number}>() -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{a: number | undefined}>() -expectTypeOf<{a?: number | null}>().not.toEqualTypeOf<{a: number | null}>() -expectTypeOf<{a: {b?: number}}>().not.toEqualTypeOf<{a: {}}>() -``` - -Detect the difference between regular and `readonly` properties: - -```typescript -type A1 = {readonly a: string; b: string} -type E1 = {a: string; b: string} - -expectTypeOf().toExtend() -expectTypeOf().not.toEqualTypeOf() - -type A2 = {a: string; b: {readonly c: string}} -type E2 = {a: string; b: {c: string}} - -expectTypeOf().toExtend() -expectTypeOf().not.toEqualTypeOf() -``` - -Distinguish between classes with different constructors: - -```typescript -class A { - value: number - constructor(a: 1) { - this.value = a - } -} -class B { - value: number - constructor(b: 2) { - this.value = b - } -} - -expectTypeOf().not.toEqualTypeOf() - -class C { - value: number - constructor(c: 1) { - this.value = c - } -} - -expectTypeOf().toEqualTypeOf() -``` - -Known limitation: Intersection types can cause issues with `toEqualTypeOf`: - -```typescript -// @ts-expect-error the following line doesn't compile, even though the types are arguably the same. -// See https://github.com/mmkal/expect-type/pull/21 -expectTypeOf<{a: 1} & {b: 2}>().toEqualTypeOf<{a: 1; b: 2}>() -``` - -To workaround for simple cases, you can use a mapped type: - -```typescript -type Simplify = {[K in keyof T]: T[K]} - -expectTypeOf>().toEqualTypeOf<{a: 1; b: 2}>() -``` - -But this won't work if the nesting is deeper in the type. For these situations, you can use the `.branded` helper. Note that this comes at a performance cost, and can cause the compiler to 'give up' if used with excessively deep types, so use sparingly. This helper is under `.branded` because it deeply transforms the Actual and Expected types into a pseudo-AST: - -```typescript -// @ts-expect-error -expectTypeOf<{a: {b: 1} & {c: 1}}>().toEqualTypeOf<{a: {b: 1; c: 1}}>() - -expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.toEqualTypeOf<{a: {b: 1; c: 1}}>() -``` - -Be careful with `.branded` for very deep or complex types, though. If possible you should find a way to simplify your test to avoid needing to use it: - -```typescript -// This *should* result in an error, but the "branding" mechanism produces too large a type and TypeScript just gives up! https://github.com/microsoft/TypeScript/issues/50670 -expectTypeOf<() => () => () => () => 1>().branded.toEqualTypeOf<() => () => () => () => 2>() - -// @ts-expect-error the non-branded implementation catches the error as expected. -expectTypeOf<() => () => () => () => 1>().toEqualTypeOf<() => () => () => () => 2>() -``` - -So, if you have an extremely deep type that ALSO has an intersection in it, you're out of luck and this library won't be able to test your type properly: - -```typescript -// @ts-expect-error this fails, but it should succeed. -expectTypeOf<() => () => () => () => {a: 1} & {b: 2}>().toEqualTypeOf< - () => () => () => () => {a: 1; b: 2} ->() - -// this succeeds, but it should fail. -expectTypeOf<() => () => () => () => {a: 1} & {b: 2}>().branded.toEqualTypeOf< - () => () => () => () => {a: 1; c: 2} ->() -``` - -Another limitation: passing `this` references to `expectTypeOf` results in errors.: - -```typescript -class B { - b = 'b' - - foo() { - // @ts-expect-error - expectTypeOf(this).toEqualTypeOf(this) - } -} - -// Instead of the above, try something like this: -expectTypeOf(B).instance.toEqualTypeOf<{b: string; foo: () => void}>() -``` - - -Overloads limitation for TypeScript <5.3: Due to a [TypeScript bug fixed in 5.3](https://github.com/microsoft/TypeScript/issues/28867), overloaded functions which include an overload resembling `(...args: unknown[]) => unknown` will exclude `unknown[]` from `.parameters` and exclude `unknown` from `.returns`: - -```typescript -type Factorize = { - (...args: unknown[]): unknown - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf().parameters.toEqualTypeOf<[number] | [bigint]>() -expectTypeOf().returns.toEqualTypeOf() -``` - -This overload, however, allows any input and returns an unknown output anyway, so it's not very useful. If you are worried about this for some reason, you'll have to update TypeScript to 5.3+. - -### Why is my assertion failing? - -For complex types, an assertion might fail when it should if the `Actual` type contains a deeply-nested intersection type but the `Expected` doesn't. In these cases you can use `.branded` as described above: - -```typescript -// @ts-expect-error this unfortunately fails - a TypeScript limitation prevents making this pass without a big perf hit -expectTypeOf<{a: {b: 1} & {c: 1}}>().toEqualTypeOf<{a: {b: 1; c: 1}}>() - -expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.toEqualTypeOf<{a: {b: 1; c: 1}}>() -``` - -### Why is `.toMatchTypeOf` deprecated? - -The `.toMatchTypeOf` method is deprecated in favour of `.toMatchObjectType` (when strictly checking against an object type with a subset of keys), or `.toExtend` (when checking for "is-a" relationships). There are no foreseeable plans to remove `.toMatchTypeOf`, but there's no reason to continue using it - `.toMatchObjectType` is stricter, and `.toExtend` is identical. - -### Internal type helpers - -🚧 This library also exports some helper types for performing boolean operations on types, checking extension/equality in various ways, branding types, and checking for various special types like `never`, `any`, `unknown`. Use at your own risk! Nothing is stopping you from using these beyond this warning: - ->All internal types that are not documented here are _not_ part of the supported API surface, and may be renamed, modified, or removed, without warning or documentation in release notes. - -For a dedicated internal type library, feel free to look at the [source code](./src/index.ts) for inspiration - or better, use a library like [type-fest](https://npmjs.com/package/type-fest). - -### Error messages - -When types don't match, `.toEqualTypeOf` and `.toMatchTypeOf` use a special helper type to produce error messages that are as actionable as possible. But there's a bit of a nuance to understanding them. Since the assertions are written "fluently", the failure should be on the "expected" type, not the "actual" type (`expect().toEqualTypeOf()`). This means that type errors can be a little confusing - so this library produces a `MismatchInfo` type to try to make explicit what the expectation is. For example: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -Is an assertion that will fail, since `{a: 1}` has type `{a: number}` and not `{a: string}`. The error message in this case will read something like this: - -``` -test/test.ts:999:999 - error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: \\"Expected: string, Actual: number\\"; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type '\\"Expected: string, Actual: number\\"'. - -999 expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -Note that the type constraint reported is a human-readable messaging specifying both the "expected" and "actual" types. Rather than taking the sentence `Types of property 'a' are incompatible // Type 'string' is not assignable to type "Expected: string, Actual: number"` literally - just look at the property name (`'a'`) and the message: `Expected: string, Actual: number`. This will tell you what's wrong, in most cases. Extremely complex types will, of course, be more effort to debug, and may require some experimentation. Please [raise an issue](https://github.com/mmkal/expect-type) if the error messages are misleading. - -The `toBe...` methods (like `toBeString`, `toBeNumber`, `toBeVoid`, etc.) fail by resolving to a non-callable type when the `Actual` type under test doesn't match up. For example, the failure for an assertion like `expectTypeOf(1).toBeString()` will look something like this: - -``` -test/test.ts:999:999 - error TS2349: This expression is not callable. - Type 'ExpectString' has no call signatures. - -999 expectTypeOf(1).toBeString() - ~~~~~~~~~~ -``` - -The `This expression is not callable` part isn't all that helpful - the meaningful error is the next line, `Type 'ExpectString has no call signatures`. This essentially means you passed a number but asserted it should be a string. - -If TypeScript added support for ["throw" types](https://github.com/microsoft/TypeScript/pull/40468) these error messages could be improved. Until then they will take a certain amount of squinting. - -#### Concrete "expected" objects vs type arguments - -Error messages for an assertion like this: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf({a: ''}) -``` - -Will be less helpful than for an assertion like this: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -This is because the TypeScript compiler needs to infer the type argument for the `.toEqualTypeOf({a: ''})` style and this library can only mark it as a failure by comparing it against a generic `Mismatch` type. So, where possible, use a type argument rather than a concrete type for `.toEqualTypeOf` and `toMatchTypeOf`. If it's much more convenient to compare two concrete types, you can use `typeof`: - -```ts -const one = valueFromFunctionOne({some: {complex: inputs}}) -const two = valueFromFunctionTwo({some: {other: inputs}}) - -expectTypeOf(one).toEqualTypeof() -``` - -### Overloaded functions - -Due to a TypeScript [design limitation](https://github.com/microsoft/TypeScript/issues/32164#issuecomment-506810756), the native TypeScript `Parameters<...>` and `ReturnType<...>` helpers only return types from one variant of an overloaded function. This limitation doesn't apply to expect-type, since it is not used to author TypeScript code, only to assert on existing types. So, we use a workaround for this TypeScript behaviour to assert on _all_ overloads as a union (actually, not necessarily _all_ - we cap out at 10 overloads). - -### Within test frameworks - -### Vitest - -`expectTypeOf` is built in to [vitest](https://vitest.dev/guide/testing-types), so you can import `expectTypeOf` from the vitest library directly if you prefer. Note that there is no set release cadence, at time of writing, so vitest may not always be using the very latest version. - -```ts -import {expectTypeOf} from 'vitest' -import {mount} from './mount.js' - -test('my types work properly', () => { - expectTypeOf(mount).toBeFunction() - expectTypeOf(mount).parameter(0).toEqualTypeOf<{name: string}>() - - expectTypeOf(mount({name: 42})).toBeString() -}) -``` - -#### Jest & `eslint-plugin-jest` - -If you're using Jest along with `eslint-plugin-jest`, and you put assertions inside `test(...)` definitions, you may get warnings from the [`jest/expect-expect`](https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/expect-expect.md) rule, complaining that "Test has no assertions" for tests that only use `expectTypeOf()`. - -To remove this warning, configure the ESLint rule to consider `expectTypeOf` as an assertion: - -```json -"rules": { - // ... - "jest/expect-expect": [ - "warn", - { - "assertFunctionNames": [ - "expect", "expectTypeOf" - ] - } - ], - // ... -} -``` - -### Limitations - -A summary of some of the limitations of this library. Some of these are documented more fully elsewhere. - -1. Intersection types can result in failures when the expected and actual types are not identically defined, even when they are effectively identical. See [Why is my assertion failing](#why-is-my-assertion-failing) for details. TL;DR: use `.brand` in these cases - and accept the performance hit that it comes with. -1. `toBeCallableWith` will likely fail if you try to use it with a generic function or an overload. See [this issue](https://github.com/mmkal/expect-type/issues/50) for an example and how to work around it. -1. (For now) overloaded functions might trip up the `.parameter` and `.parameters` helpers. This matches how the built-in TypeScript helper `Parameters<...>` works. This may be improved in the future though ([see related issue](https://github.com/mmkal/expect-type/issues/30)). -1. `expectTypeOf(this).toEqualTypeOf(this)` inside class methods does not work. - -## Similar projects - -Other projects with similar goals: - -- [`tsd`](https://github.com/SamVerschueren/tsd) is a CLI that runs the TypeScript type checker over assertions -- [`ts-expect`](https://github.com/TypeStrong/ts-expect) exports several generic helper types to perform type assertions -- [`dtslint`](https://github.com/Microsoft/dtslint) does type checks via comment directives and tslint -- [`type-plus`](https://github.com/unional/type-plus) comes with various type and runtime TypeScript assertions -- [`static-type-assert`](https://github.com/ksxnodemodules/static-type-assert) type assertion functions - -### Comparison - -The key differences in this project are: - -- a fluent, jest-inspired API, making the difference between `actual` and `expected` clear. This is helpful with complex types and assertions. -- inverting assertions intuitively and easily via `expectTypeOf(...).not` -- checks generics properly and strictly ([tsd doesn't](https://github.com/SamVerschueren/tsd/issues/142)) -- first-class support for: - - `any` (as well as `unknown` and `never`) (see issues outstanding at time of writing in tsd for [never](https://github.com/SamVerschueren/tsd/issues/78) and [any](https://github.com/SamVerschueren/tsd/issues/82)). - - This can be especially useful in combination with `not`, to protect against functions returning too-permissive types. For example, `const parseFile = (filename: string) => JSON.parse(readFileSync(filename).toString())` returns `any`, which could lead to errors. After giving it a proper return-type, you can add a test for this with `expect(parseFile).returns.not.toBeAny()` - - object properties - - function parameters - - function return values - - constructor parameters - - class instances - - array item values - - nullable types -- assertions on types "matching" rather than exact type equality, for "is-a" relationships e.g. `expectTypeOf(square).toExtend()` -- built into existing tooling. No extra build step, cli tool, IDE extension, or lint plugin is needed. Just import the function and start writing tests. Failures will be at compile time - they'll appear in your IDE and when you run `tsc`. -- small implementation with no dependencies. [Take a look!](./src/index.ts) (tsd, for comparison, is [2.6MB](https://bundlephobia.com/result?p=tsd@0.13.1) because it ships a patched version of TypeScript). - -## TypeScript backwards-compatibility - -There is a CI job called `test-types` that checks whether the tests still pass with certain older TypeScript versions. To check the supported TypeScript versions, [refer to the job definition](./.github/workflows/ci.yml). - -## Contributing - -In most cases, it's worth checking existing issues or creating one to discuss a new feature or a bug fix before opening a pull request. - -Once you're ready to make a pull request: clone the repo, and install pnpm if you don't have it already with `npm install --global pnpm`. Lockfiles for `npm` and `yarn` are gitignored. - -If you're adding a feature, you should write a self-contained usage example in the form of a test, in [test/usage.test.ts](./test/usage.test.ts). This file is used to populate the bulk of this readme using [eslint-plugin-codegen](https://npmjs.com/package/eslint-plugin-codegen), and to generate an ["errors" test file](./test/errors.test.ts), which captures the error messages that are emitted for failing assertions by the TypeScript compiler. So, the test name should be written as a human-readable sentence explaining the usage example. Have a look at the existing tests for an idea of the style. - -After adding the tests, run `npm run lint -- --fix` to update the readme, and `npm test -- --updateSnapshot` to update the errors test. The generated documentation and tests should be pushed to the same branch as the source code, and submitted as a pull request. CI will test that the docs and tests are up to date if you forget to run these commands. - -### Documentation of limitations through tests - -Limitations of the library are documented through tests in `usage.test.ts`. This means that if a future TypeScript version (or library version) fixes the limitation, the test will start failing, and it will be automatically removed from the documentation once it no longer applies. diff --git a/node_modules/expect-type/SECURITY.md b/node_modules/expect-type/SECURITY.md deleted file mode 100644 index 3f988a6..0000000 --- a/node_modules/expect-type/SECURITY.md +++ /dev/null @@ -1,14 +0,0 @@ -# Security Policy - -## Supported Versions - -Version 1.0.0 will be supported with security updates. - -| Version | Supported | -| ------- | ------------------ | -| 1.x.x | :white_check_mark: | -| < 1.0 | :x: | - -## Reporting a Vulnerability - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. diff --git a/node_modules/expect-type/dist/branding.d.ts b/node_modules/expect-type/dist/branding.d.ts deleted file mode 100644 index b59cccd..0000000 --- a/node_modules/expect-type/dist/branding.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type { ConstructorOverloadParameters, NumOverloads, OverloadsInfoUnion } from './overloads'; -import type { IsNever, IsAny, IsUnknown, ReadonlyKeys, RequiredKeys, OptionalKeys, MutuallyExtends, UnionToTuple } from './utils'; -/** - * Represents a deeply branded type. - * - * Recursively walk a type and replace it with a branded type related to the - * original. This is useful for equality-checking stricter than - * `A extends B ? B extends A ? true : false : false`, because it detects the - * difference between a few edge-case types that vanilla TypeScript - * doesn't by default: - * - `any` vs `unknown` - * - `{ readonly a: string }` vs `{ a: string }` - * - `{ a?: string }` vs `{ a: string | undefined }` - * - * __Note__: not very performant for complex types - this should only be used - * when you know you need it. If doing an equality check, it's almost always - * better to use {@linkcode StrictEqualUsingTSInternalIdenticalToOperator}. - */ -export type DeepBrand = IsNever extends true ? { - type: 'never'; -} : IsAny extends true ? { - type: 'any'; -} : IsUnknown extends true ? { - type: 'unknown'; -} : T extends string | number | boolean | symbol | bigint | null | undefined | void ? { - type: 'primitive'; - value: T; -} : T extends new (...args: any[]) => any ? { - type: 'constructor'; - params: ConstructorOverloadParameters; - instance: DeepBrand any>>>; -} : T extends (...args: infer P) => infer R ? NumOverloads extends 1 ? { - type: 'function'; - params: DeepBrand

; - return: DeepBrand; - this: DeepBrand>; - props: DeepBrand>; -} : UnionToTuple> extends infer OverloadsTuple ? { - type: 'overloads'; - overloads: { - [K in keyof OverloadsTuple]: DeepBrand; - }; -} : never : T extends any[] ? { - type: 'array'; - items: { - [K in keyof T]: T[K]; - }; -} : { - type: 'object'; - properties: { - [K in keyof T]: DeepBrand; - }; - readonly: ReadonlyKeys; - required: RequiredKeys; - optional: OptionalKeys; - constructorParams: DeepBrand>; -}; -/** - * Checks if two types are strictly equal using branding. - */ -export type StrictEqualUsingBranding = MutuallyExtends, DeepBrand>; diff --git a/node_modules/expect-type/dist/branding.js b/node_modules/expect-type/dist/branding.js deleted file mode 100644 index c8ad2e5..0000000 --- a/node_modules/expect-type/dist/branding.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/expect-type/dist/index.d.ts b/node_modules/expect-type/dist/index.d.ts deleted file mode 100644 index 4098988..0000000 --- a/node_modules/expect-type/dist/index.d.ts +++ /dev/null @@ -1,897 +0,0 @@ -import type { StrictEqualUsingBranding } from './branding'; -import type { ExpectAny, ExpectArray, ExpectBigInt, ExpectBoolean, ExpectFunction, ExpectNever, ExpectNull, ExpectNullable, ExpectNumber, ExpectObject, ExpectString, ExpectSymbol, ExpectUndefined, ExpectUnknown, ExpectVoid, MismatchInfo, Scolder } from './messages'; -import type { ConstructorOverloadParameters, OverloadParameters, OverloadReturnTypes, OverloadsNarrowedByParameters } from './overloads'; -import type { AValue, DeepPickMatchingProps, Extends, IsUnion, MismatchArgs, Not, StrictEqualUsingTSInternalIdenticalToOperator } from './utils'; -export * from './branding'; -export * from './messages'; -export * from './overloads'; -export * from './utils'; -/** - * Represents the positive assertion methods available for type checking in the - * {@linkcode expectTypeOf()} utility. - */ -export interface PositiveExpectTypeOf extends BaseExpectTypeOf { - /** - * Similar to jest's `expect(...).toMatchObject(...)` but for types. - * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`. - * - * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toMatchObjectType: extends true ? 'toMatchObject does not support union types' : Not>> extends true ? 'toMatchObject only supports object types' : StrictEqualUsingTSInternalIdenticalToOperator, Expected> extends true ? unknown : MismatchInfo, Expected>>(...MISMATCH: MismatchArgs, Expected>, true>) => true; - /** - * Check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties. - * This is roughly equivalent to an `extends` constraint in a function type argument. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>() - * - * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toExtend: extends true ? unknown : MismatchInfo>(...MISMATCH: MismatchArgs, true>) => true; - toEqualTypeOf: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - extends true ? unknown : MismatchInfo>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs, true>): true; - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - extends true ? unknown : MismatchInfo>(...MISMATCH: MismatchArgs, true>): true; - }; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - */ - toMatchTypeOf: { - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - extends true ? unknown : MismatchInfo>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs, true>): true; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - extends true ? unknown : MismatchInfo>(...MISMATCH: MismatchArgs, true>): true; - }; - /** - * Checks whether an object has a given property. - * - * @example - * check that properties exist - * ```ts - * const obj = { a: 1, b: '' } - * - * expectTypeOf(obj).toHaveProperty('a') - * - * expectTypeOf(obj).not.toHaveProperty('c') - * ``` - * - * @param key - The property key to check for. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toHaveProperty: (key: KeyType, ...MISMATCH: MismatchArgs, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf : true; - /** - * Inverts the result of the following assertions. - * - * @example - * ```ts - * expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 }) - * ``` - */ - not: NegativeExpectTypeOf; - /** - * Intersection types can cause issues with - * {@linkcode toEqualTypeOf | .toEqualTypeOf()}: - * ```ts - * // ❌ The following line doesn't compile, even though the types are arguably the same. - * expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>() - * ``` - * This helper works around this problem by using - * a more permissive but less performant check. - * - * __Note__: This comes at a performance cost, and can cause the compiler - * to 'give up' if used with excessively deep types, so use sparingly. - * - * @see {@link https://github.com/mmkal/expect-type/pull/21 | Reference} - */ - branded: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toEqualTypeOf: extends true ? unknown : MismatchInfo>(...MISMATCH: MismatchArgs, true>) => true; - }; -} -/** - * Represents the negative expectation type for the {@linkcode Actual} type. - */ -export interface NegativeExpectTypeOf extends BaseExpectTypeOf { - /** - * Similar to jest's `expect(...).toMatchObject(...)` but for types. - * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`. - * - * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toMatchObjectType: (...MISMATCH: MismatchArgs, Expected>, false>) => true; - /** - * Check if your type extends the expected type - * - * A less strict version of {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties. - * This is roughly equivalent to an `extends` constraint in a function type argument. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()] - * - * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toExtend(...MISMATCH: MismatchArgs, false>): true; - toEqualTypeOf: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - (value: Expected & AValue, ...MISMATCH: MismatchArgs, false>): true; - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - (...MISMATCH: MismatchArgs, false>): true; - }; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - */ - toMatchTypeOf: { - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of - * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - (value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs, false>): true; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of - * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * Using generic type argument syntax - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * Using inferred type syntax by passing a value - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - (...MISMATCH: MismatchArgs, false>): true; - }; - /** - * Checks whether an object has a given property. - * - * @example - * check that properties exist - * ```ts - * const obj = { a: 1, b: '' } - * - * expectTypeOf(obj).toHaveProperty('a') - * - * expectTypeOf(obj).not.toHaveProperty('c') - * ``` - * - * @param key - The property key to check for. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toHaveProperty: (key: KeyType, ...MISMATCH: MismatchArgs, false>) => true; -} -/** - * Represents a conditional type that selects either - * {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based - * on the value of the `positive` property in the {@linkcode Options} type. - */ -export type ExpectTypeOf = Options['positive'] extends true ? PositiveExpectTypeOf : NegativeExpectTypeOf; -/** - * Represents the base interface for the - * {@linkcode expectTypeOf()} function. - * Provides a set of assertion methods to perform type checks on a value. - */ -export interface BaseExpectTypeOf { - /** - * Checks whether the type of the value is `any`. - */ - toBeAny: Scolder, Options>; - /** - * Checks whether the type of the value is `unknown`. - */ - toBeUnknown: Scolder, Options>; - /** - * Checks whether the type of the value is `never`. - */ - toBeNever: Scolder, Options>; - /** - * Checks whether the type of the value is `function`. - */ - toBeFunction: Scolder, Options>; - /** - * Checks whether the type of the value is `object`. - */ - toBeObject: Scolder, Options>; - /** - * Checks whether the type of the value is an {@linkcode Array}. - */ - toBeArray: Scolder, Options>; - /** - * Checks whether the type of the value is `number`. - */ - toBeNumber: Scolder, Options>; - /** - * Checks whether the type of the value is `string`. - */ - toBeString: Scolder, Options>; - /** - * Checks whether the type of the value is `boolean`. - */ - toBeBoolean: Scolder, Options>; - /** - * Checks whether the type of the value is `void`. - */ - toBeVoid: Scolder, Options>; - /** - * Checks whether the type of the value is `symbol`. - */ - toBeSymbol: Scolder, Options>; - /** - * Checks whether the type of the value is `null`. - */ - toBeNull: Scolder, Options>; - /** - * Checks whether the type of the value is `undefined`. - */ - toBeUndefined: Scolder, Options>; - /** - * Checks whether the type of the value is `null` or `undefined`. - */ - toBeNullable: Scolder, Options>; - /** - * Transform that type of the value via a callback. - * - * @param fn - A callback that transforms the input value. Note that this function is not actually called - it's only used for type inference. - * @returns A new type which can be used for further assertions. - */ - map: (fn: (value: Actual) => T) => ExpectTypeOf; - /** - * Checks whether the type of the value is **`bigint`**. - * - * @example - * #### Distinguish between **`number`** and **`bigint`** - * - * ```ts - * import { expectTypeOf } from 'expect-type' - * - * const aVeryBigInteger = 10n ** 100n - * - * expectTypeOf(aVeryBigInteger).not.toBeNumber() - * - * expectTypeOf(aVeryBigInteger).toBeBigInt() - * ``` - * - * @since 1.1.0 - */ - toBeBigInt: Scolder, Options>; - /** - * Checks whether a function is callable with the given parameters. - * - * __Note__: You cannot negate this assertion with - * {@linkcode PositiveExpectTypeOf.not | .not}, you need to use - * `ts-expect-error` instead. - * - * @example - * ```ts - * const f = (a: number) => [a, a] - * - * expectTypeOf(f).toBeCallableWith(1) - * ``` - * - * __Known Limitation__: This assertion will likely fail if you try to use it - * with a generic function or an overload. - * @see {@link https://github.com/mmkal/expect-type/issues/50 | This issue} for an example and a workaround. - * - * @param args - The arguments to check for callability. - * @returns `true`. - */ - toBeCallableWith: Options['positive'] extends true ? >(...args: Args) => ExpectTypeOf, Options> : never; - /** - * Checks whether a class is constructible with the given parameters. - * - * @example - * ```ts - * expectTypeOf(Date).toBeConstructibleWith('1970') - * - * expectTypeOf(Date).toBeConstructibleWith(0) - * - * expectTypeOf(Date).toBeConstructibleWith(new Date()) - * - * expectTypeOf(Date).toBeConstructibleWith() - * ``` - * - * @param args - The arguments to check for constructibility. - * @returns `true`. - */ - toBeConstructibleWith: Options['positive'] extends true ? >(...args: Args) => true : never; - /** - * Equivalent to the {@linkcode Extract} utility type. - * Helps narrow down complex union types. - * - * @example - * ```ts - * type ResponsiveProp = T | T[] | { xs?: T; sm?: T; md?: T } - * - * interface CSSProperties { - * margin?: string - * padding?: string - * } - * - * function getResponsiveProp(_props: T): ResponsiveProp { - * return {} - * } - * - * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' } - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .extract<{ xs?: any }>() // extracts the last type from a union - * .toEqualTypeOf<{ - * xs?: CSSProperties - * sm?: CSSProperties - * md?: CSSProperties - * }>() - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .extract() // extracts an array from a union - * .toEqualTypeOf() - * ``` - * - * __Note__: If no type is found in the union, it will return `never`. - * - * @param v - The type to extract from the union. - * @returns The type after extracting the type from the union. - */ - extract: (v?: V) => ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode Exclude} utility type. - * Removes types from a union. - * - * @example - * ```ts - * type ResponsiveProp = T | T[] | { xs?: T; sm?: T; md?: T } - * - * interface CSSProperties { - * margin?: string - * padding?: string - * } - * - * function getResponsiveProp(_props: T): ResponsiveProp { - * return {} - * } - * - * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' } - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .exclude() - * .exclude<{ xs?: unknown }>() // or just `.exclude()` - * .toEqualTypeOf() - * ``` - */ - exclude: (v?: V) => ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode Pick} utility type. - * Helps select a subset of properties from an object type. - * - * @example - * ```ts - * interface Person { - * name: string - * age: number - * } - * - * expectTypeOf() - * .pick<'name'>() - * .toEqualTypeOf<{ name: string }>() - * ``` - * - * @param keyToPick - The property key to pick. - * @returns The type after picking the property. - */ - pick: (keyToPick?: KeyToPick) => ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode Omit} utility type. - * Helps remove a subset of properties from an object type. - * - * @example - * ```ts - * interface Person { - * name: string - * age: number - * } - * - * expectTypeOf().omit<'name'>().toEqualTypeOf<{ age: number }>() - * ``` - * - * @param keyToOmit - The property key to omit. - * @returns The type after omitting the property. - */ - omit: )>(keyToOmit?: KeyToOmit) => ExpectTypeOf, Options>; - /** - * Extracts a certain function argument with `.parameter(number)` call to - * perform other assertions on it. - * - * @example - * ```ts - * function foo(a: number, b: string) { - * return [a, b] - * } - * - * expectTypeOf(foo).parameter(0).toBeNumber() - * - * expectTypeOf(foo).parameter(1).toBeString() - * ``` - * - * @param index - The index of the parameter to extract. - * @returns The extracted parameter type. - */ - parameter: (index: Index) => ExpectTypeOf[Index], Options>; - /** - * Equivalent to the {@linkcode Parameters} utility type. - * Extracts function parameters to perform assertions on its value. - * Parameters are returned as an array. - * - * @example - * ```ts - * function noParam() {} - * - * function hasParam(s: string) {} - * - * expectTypeOf(noParam).parameters.toEqualTypeOf<[]>() - * - * expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>() - * ``` - */ - parameters: ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode ConstructorParameters} utility type. - * Extracts constructor parameters as an array of values and - * perform assertions on them with this method. - * - * For overloaded constructors it will return a union of all possible parameter-tuples. - * - * @example - * ```ts - * expectTypeOf(Date).constructorParameters.toEqualTypeOf< - * [] | [string | number | Date] - * >() - * ``` - */ - constructorParameters: ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode ThisParameterType} utility type. - * Extracts the `this` parameter of a function to - * perform assertions on its value. - * - * @example - * ```ts - * function greet(this: { name: string }, message: string) { - * return `Hello ${this.name}, here's your message: ${message}` - * } - * - * expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>() - * ``` - */ - thisParameter: ExpectTypeOf, Options>; - /** - * Equivalent to the {@linkcode InstanceType} utility type. - * Extracts the instance type of a class to perform assertions on. - * - * @example - * ```ts - * expectTypeOf(Date).instance.toHaveProperty('toISOString') - * ``` - */ - instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf : never; - /** - * Equivalent to the {@linkcode ReturnType} utility type. - * Extracts the return type of a function. - * - * @example - * ```ts - * expectTypeOf(() => {}).returns.toBeVoid() - * - * expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2]) - * ``` - */ - returns: Actual extends Function ? ExpectTypeOf, Options> : never; - /** - * Extracts resolved value of a Promise, - * so you can perform other assertions on it. - * - * @example - * ```ts - * async function asyncFunc() { - * return 123 - * } - * - * expectTypeOf(asyncFunc).returns.resolves.toBeNumber() - * - * expectTypeOf(Promise.resolve('string')).resolves.toBeString() - * ``` - * - * Type Equivalent: - * ```ts - * type Resolves = PromiseType extends PromiseLike - * ? ResolvedType - * : never - * ``` - */ - resolves: Actual extends PromiseLike ? ExpectTypeOf : never; - /** - * Extracts array item type to perform assertions on. - * - * @example - * ```ts - * expectTypeOf([1, 2, 3]).items.toEqualTypeOf() - * - * expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf() - * ``` - * - * __Type Equivalent__: - * ```ts - * type Items = ArrayType extends ArrayLike - * ? ItemType - * : never - * ``` - */ - items: Actual extends ArrayLike ? ExpectTypeOf : never; - /** - * Extracts the type guarded by a function to perform assertions on. - * - * @example - * ```ts - * function isString(v: any): v is string { - * return typeof v === 'string' - * } - * - * expectTypeOf(isString).guards.toBeString() - * ``` - */ - guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf : never; - /** - * Extracts the type asserted by a function to perform assertions on. - * - * @example - * ```ts - * function assertNumber(v: any): asserts v is number { - * if (typeof v !== 'number') - * throw new TypeError('Nope !') - * } - * - * expectTypeOf(assertNumber).asserts.toBeNumber() - * ``` - */ - asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf : never; -} -/** - * Represents a function that allows asserting the expected type of a value. - */ -export type _ExpectTypeOf = { - /** - * Asserts the expected type of a value. - * - * @param actual - The actual value being asserted. - * @returns An object representing the expected type assertion. - */ - (actual: Actual): ExpectTypeOf; - /** - * Asserts the expected type of a value without providing an actual value. - * - * @returns An object representing the expected type assertion. - */ - (): ExpectTypeOf; -}; -/** - * Similar to Jest's `expect`, but with type-awareness. - * Gives you access to a number of type-matchers that let you make assertions about the - * form of a reference or generic type parameter. - * - * @example - * ```ts - * import { foo, bar } from '../foo' - * import { expectTypeOf } from 'expect-type' - * - * test('foo types', () => { - * // make sure `foo` has type { a: number } - * expectTypeOf(foo).toMatchTypeOf({ a: 1 }) - * expectTypeOf(foo).toHaveProperty('a').toBeNumber() - * - * // make sure `bar` is a function taking a string: - * expectTypeOf(bar).parameter(0).toBeString() - * expectTypeOf(bar).returns.not.toBeAny() - * }) - * ``` - * - * @description - * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples. - */ -export declare const expectTypeOf: _ExpectTypeOf; diff --git a/node_modules/expect-type/dist/index.js b/node_modules/expect-type/dist/index.js deleted file mode 100644 index 55e299e..0000000 --- a/node_modules/expect-type/dist/index.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.expectTypeOf = void 0; -__exportStar(require("./branding"), exports); // backcompat, consider removing in next major version -__exportStar(require("./messages"), exports); // backcompat, consider removing in next major version -__exportStar(require("./overloads"), exports); -__exportStar(require("./utils"), exports); // backcompat, consider removing in next major version -const fn = () => true; -/** - * Similar to Jest's `expect`, but with type-awareness. - * Gives you access to a number of type-matchers that let you make assertions about the - * form of a reference or generic type parameter. - * - * @example - * ```ts - * import { foo, bar } from '../foo' - * import { expectTypeOf } from 'expect-type' - * - * test('foo types', () => { - * // make sure `foo` has type { a: number } - * expectTypeOf(foo).toMatchTypeOf({ a: 1 }) - * expectTypeOf(foo).toHaveProperty('a').toBeNumber() - * - * // make sure `bar` is a function taking a string: - * expectTypeOf(bar).parameter(0).toBeString() - * expectTypeOf(bar).returns.not.toBeAny() - * }) - * ``` - * - * @description - * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples. - */ -const expectTypeOf = (_actual) => { - const nonFunctionProperties = [ - 'parameters', - 'returns', - 'resolves', - 'not', - 'items', - 'constructorParameters', - 'thisParameter', - 'instance', - 'guards', - 'asserts', - 'branded', - ]; - const obj = { - /* eslint-disable @typescript-eslint/no-unsafe-assignment */ - toBeAny: fn, - toBeUnknown: fn, - toBeNever: fn, - toBeFunction: fn, - toBeObject: fn, - toBeArray: fn, - toBeString: fn, - toBeNumber: fn, - toBeBoolean: fn, - toBeVoid: fn, - toBeSymbol: fn, - toBeNull: fn, - toBeUndefined: fn, - toBeNullable: fn, - toBeBigInt: fn, - toMatchTypeOf: fn, - toEqualTypeOf: fn, - toBeConstructibleWith: fn, - toMatchObjectType: fn, - toExtend: fn, - map: exports.expectTypeOf, - toBeCallableWith: exports.expectTypeOf, - extract: exports.expectTypeOf, - exclude: exports.expectTypeOf, - pick: exports.expectTypeOf, - omit: exports.expectTypeOf, - toHaveProperty: exports.expectTypeOf, - parameter: exports.expectTypeOf, - }; - const getterProperties = nonFunctionProperties; - getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) })); - return obj; -}; -exports.expectTypeOf = expectTypeOf; diff --git a/node_modules/expect-type/dist/messages.d.ts b/node_modules/expect-type/dist/messages.d.ts deleted file mode 100644 index d8de9be..0000000 --- a/node_modules/expect-type/dist/messages.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -import type { StrictEqualUsingBranding } from './branding'; -import type { And, Extends, ExtendsExcludingAnyOrNever, IsAny, IsNever, IsUnknown, Not, OptionalKeys, UsefulKeys } from './utils'; -/** - * Determines the printable type representation for a given type. - */ -export type PrintType = IsUnknown extends true ? 'unknown' : IsNever extends true ? 'never' : IsAny extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...'; -/** - * Helper for showing end-user a hint why their type assertion is failing. - * This swaps "leaf" types with a literal message about what the actual and - * expected types are. Needs to check for `Not>` because - * otherwise `LeafTypeOf` returns `never`, which extends everything 🤔 - */ -export type MismatchInfo = And<[Extends, '...'>, Not>]> extends true ? And<[Extends, Extends]> extends true ? Array[number], Extract[number]>> : Optionalify<{ - [K in UsefulKeys | UsefulKeys]: MismatchInfo; -}, OptionalKeys> : StrictEqualUsingBranding extends true ? Actual : `Expected: ${PrintType}, Actual: ${PrintType>}`; -/** - * Helper for making some keys of a type optional. Only useful so far for `MismatchInfo` - it makes sure we - * don't get bogus errors about optional properties mismatching, when actually it's something else that's wrong. - * - * - Note: this helper is a no-op if there are no optional keys in the type. - */ -export type Optionalify = [TOptionalKeys] extends [never] ? T : ({ - [K in Exclude]: T[K]; -} & { - [K in Extract]?: T[K]; -}) extends infer X ? { - [K in keyof X]: X[K]; -} : never; -/** - * @internal - */ -declare const inverted: unique symbol; -/** - * @internal - */ -type Inverted = { - [inverted]: T; -}; -/** - * @internal - */ -declare const expectNull: unique symbol; -export type ExpectNull = { - [expectNull]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectUndefined: unique symbol; -export type ExpectUndefined = { - [expectUndefined]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectNumber: unique symbol; -export type ExpectNumber = { - [expectNumber]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectString: unique symbol; -export type ExpectString = { - [expectString]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectBoolean: unique symbol; -export type ExpectBoolean = { - [expectBoolean]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectVoid: unique symbol; -export type ExpectVoid = { - [expectVoid]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectFunction: unique symbol; -export type ExpectFunction = { - [expectFunction]: T; - result: ExtendsExcludingAnyOrNever any>; -}; -/** - * @internal - */ -declare const expectObject: unique symbol; -export type ExpectObject = { - [expectObject]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectArray: unique symbol; -export type ExpectArray = { - [expectArray]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectSymbol: unique symbol; -export type ExpectSymbol = { - [expectSymbol]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * @internal - */ -declare const expectAny: unique symbol; -export type ExpectAny = { - [expectAny]: T; - result: IsAny; -}; -/** - * @internal - */ -declare const expectUnknown: unique symbol; -export type ExpectUnknown = { - [expectUnknown]: T; - result: IsUnknown; -}; -/** - * @internal - */ -declare const expectNever: unique symbol; -export type ExpectNever = { - [expectNever]: T; - result: IsNever; -}; -/** - * @internal - */ -declare const expectNullable: unique symbol; -export type ExpectNullable = { - [expectNullable]: T; - result: Not>>; -}; -/** - * @internal - */ -declare const expectBigInt: unique symbol; -export type ExpectBigInt = { - [expectBigInt]: T; - result: ExtendsExcludingAnyOrNever; -}; -/** - * Checks if the result of an expecter matches the specified options, and - * resolves to a fairly readable error message if not. - */ -export type Scolder = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted; -export {}; diff --git a/node_modules/expect-type/dist/messages.js b/node_modules/expect-type/dist/messages.js deleted file mode 100644 index ff4e0ae..0000000 --- a/node_modules/expect-type/dist/messages.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @internal - */ -const inverted = Symbol('inverted'); -/** - * @internal - */ -const expectNull = Symbol('expectNull'); -/** - * @internal - */ -const expectUndefined = Symbol('expectUndefined'); -/** - * @internal - */ -const expectNumber = Symbol('expectNumber'); -/** - * @internal - */ -const expectString = Symbol('expectString'); -/** - * @internal - */ -const expectBoolean = Symbol('expectBoolean'); -/** - * @internal - */ -const expectVoid = Symbol('expectVoid'); -/** - * @internal - */ -const expectFunction = Symbol('expectFunction'); -/** - * @internal - */ -const expectObject = Symbol('expectObject'); -/** - * @internal - */ -const expectArray = Symbol('expectArray'); -/** - * @internal - */ -const expectSymbol = Symbol('expectSymbol'); -/** - * @internal - */ -const expectAny = Symbol('expectAny'); -/** - * @internal - */ -const expectUnknown = Symbol('expectUnknown'); -/** - * @internal - */ -const expectNever = Symbol('expectNever'); -/** - * @internal - */ -const expectNullable = Symbol('expectNullable'); -/** - * @internal - */ -const expectBigInt = Symbol('expectBigInt'); diff --git a/node_modules/expect-type/dist/overloads.d.ts b/node_modules/expect-type/dist/overloads.d.ts deleted file mode 100644 index ab0e22e..0000000 --- a/node_modules/expect-type/dist/overloads.d.ts +++ /dev/null @@ -1,288 +0,0 @@ -import type { StrictEqualUsingTSInternalIdenticalToOperator, IsNever, UnionToIntersection, UnionToTuple } from './utils'; -/** - * The simple(ish) way to get overload info from a function - * {@linkcode FunctionType}. Recent versions of TypeScript will match any - * function against a generic 10-overload type, filling in slots with - * duplicates of the function. So, we can just match against a single type - * and get all the overloads. - * - * For older versions of TypeScript, we'll need to painstakingly do - * ten separate matches. - */ -export type TSPost53OverloadsInfoUnion = FunctionType extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; - (...args: infer A10): infer R10; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : never; -/** - * A function with `unknown` parameters and return type. - */ -export type UnknownFunction = (...args: unknown[]) => unknown; -/** - * `true` iff {@linkcode FunctionType} is - * equivalent to `(...args: unknown[]) => unknown`, - * which is what an overload variant looks like for a non-existent overload. - * This is useful because older versions of TypeScript end up with - * 9 "useless" overloads and one real one for parameterless/generic functions. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type IsUselessOverloadInfo = StrictEqualUsingTSInternalIdenticalToOperator; -/** - * Old versions of TypeScript can sometimes seem to refuse to separate out - * union members unless you put them each in a pointless tuple and add an - * extra `infer X` expression. There may be a better way to work around this - * problem, but since it's not a problem in newer versions of TypeScript, - * it's not a priority right now. - */ -export type Tuplify = Union extends infer X ? [X] : never; -/** - * For older versions of TypeScript, we need two separate workarounds - * to get overload info. First, we need need to use - * {@linkcode DecreasingOverloadsInfoUnion} to get the overload info for - * functions with 1-10 overloads. Then, we need to filter out the - * "useless" overloads that are present in older versions of TypeScript, - * for parameterless functions. To do this we use - * {@linkcode IsUselessOverloadInfo} to remove useless overloads. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type TSPre53OverloadsInfoUnion = Tuplify> extends infer Tup ? Tup extends [infer Fn] ? IsUselessOverloadInfo extends true ? never : Fn : never : never; -/** - * For versions of TypeScript below 5.3, we need to check for 10 overloads, - * then 9, then 8, etc., to get a union of the overload variants. - */ -export type DecreasingOverloadsInfoUnion = F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; - (...args: infer A10): infer R10; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) : F extends (...args: infer A1) => infer R1 ? ((...p: A1) => R1) : never; -/** - * Get a union of overload variants for a function {@linkcode FunctionType}. - * Does a check for whether we can do the one-shot - * 10-overload matcher (which works for ts\>5.3), and if not, - * falls back to the more complicated utility. - */ -export type OverloadsInfoUnion = IsNever 2>> extends true ? TSPre53OverloadsInfoUnion : TSPost53OverloadsInfoUnion; -/** - * Allows inferring any function using the `infer` keyword. - */ -export type InferFunctionType any> = FunctionType; -/** - * A union type of the parameters allowed for any - * overload of function {@linkcode FunctionType}. - */ -export type OverloadParameters = OverloadsInfoUnion extends InferFunctionType ? Parameters : never; -/** - * A union type of the return types for any overload of - * function {@linkcode FunctionType}. - */ -export type OverloadReturnTypes = OverloadsInfoUnion extends InferFunctionType ? ReturnType : never; -/** - * Takes an overload variants {@linkcode Union}, - * produced from {@linkcode OverloadsInfoUnion} and rejects - * the ones incompatible with parameters {@linkcode Args}. - */ -export type SelectOverloadsInfo = Union extends InferFunctionType ? (Args extends Parameters ? Fn : never) : never; -/** - * Creates a new overload (an intersection type) from an existing one, - * which only includes variant(s) which can accept - * {@linkcode Args} as parameters. - */ -export type OverloadsNarrowedByParameters> = UnionToIntersection, Args>>; -/** - * The simple(ish) way to get overload info from a constructor - * {@linkcode ConstructorType}. Recent versions of TypeScript will match any - * constructor against a generic 10-overload type, filling in slots with - * duplicates of the constructor. So, we can just match against a single type - * and get all the overloads. - * - * For older versions of TypeScript, - * we'll need to painstakingly do ten separate matches. - */ -export type TSPost53ConstructorOverloadsInfoUnion = ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; - new (...args: infer A10): infer R10; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : never; -/** - * A constructor function with `unknown` parameters and return type. - */ -export type UnknownConstructor = new (...args: unknown[]) => unknown; -/** - * Same as {@linkcode IsUselessOverloadInfo}, but for constructors. - */ -export type IsUselessConstructorOverloadInfo = StrictEqualUsingTSInternalIdenticalToOperator; -/** - * For older versions of TypeScript, we need two separate workarounds to - * get constructor overload info. First, we need need to use - * {@linkcode DecreasingConstructorOverloadsInfoUnion} to get the overload - * info for constructors with 1-10 overloads. Then, we need to filter out the - * "useless" overloads that are present in older versions of TypeScript, - * for parameterless constructors. To do this we use - * {@linkcode IsUselessConstructorOverloadInfo} to remove useless overloads. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type TSPre53ConstructorOverloadsInfoUnion = Tuplify> extends infer Tup ? Tup extends [infer Ctor] ? IsUselessConstructorOverloadInfo extends true ? never : Ctor : never : never; -/** - * For versions of TypeScript below 5.3, we need to check for 10 overloads, - * then 9, then 8, etc., to get a union of the overload variants. - */ -export type DecreasingConstructorOverloadsInfoUnion = ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; - new (...args: infer A10): infer R10; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) : ConstructorType extends new (...args: infer A1) => infer R1 ? (new (...p: A1) => R1) : never; -/** - * Get a union of overload variants for a constructor - * {@linkcode ConstructorType}. Does a check for whether we can do the - * one-shot 10-overload matcher (which works for ts\>5.3), and if not, - * falls back to the more complicated utility. - */ -export type ConstructorOverloadsUnion = IsNever any>> extends true ? TSPre53ConstructorOverloadsInfoUnion : TSPost53ConstructorOverloadsInfoUnion; -/** - * Allows inferring any constructor using the `infer` keyword. - */ -export type InferConstructor any> = ConstructorType; -/** - * A union type of the parameters allowed for any overload - * of constructor {@linkcode ConstructorType}. - */ -export type ConstructorOverloadParameters = ConstructorOverloadsUnion extends InferConstructor ? ConstructorParameters : never; -/** - * Calculates the number of overloads for a given function type. - */ -export type NumOverloads = UnionToTuple>['length']; diff --git a/node_modules/expect-type/dist/overloads.js b/node_modules/expect-type/dist/overloads.js deleted file mode 100644 index c8ad2e5..0000000 --- a/node_modules/expect-type/dist/overloads.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/node_modules/expect-type/dist/utils.d.ts b/node_modules/expect-type/dist/utils.d.ts deleted file mode 100644 index 255624b..0000000 --- a/node_modules/expect-type/dist/utils.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Negates a boolean type. - */ -export type Not = T extends true ? false : true; -/** - * Returns `true` if at least one of the types in the - * {@linkcode Types} array is `true`, otherwise returns `false`. - */ -export type Or = Types[number] extends false ? false : true; -/** - * Checks if all the boolean types in the {@linkcode Types} array are `true`. - */ -export type And = Types[number] extends true ? true : false; -/** - * Represents an equality type that returns {@linkcode Right} if - * {@linkcode Left} is `true`, - * otherwise returns the negation of {@linkcode Right}. - */ -export type Eq = Left extends true ? Right : Not; -/** - * Represents the exclusive OR operation on a tuple of boolean types. - * Returns `true` if exactly one of the boolean types is `true`, - * otherwise returns `false`. - */ -export type Xor = Not>; -/** - * @internal - */ -declare const secret: unique symbol; -/** - * @internal - */ -type Secret = typeof secret; -/** - * Checks if the given type is `never`. - */ -export type IsNever = [T] extends [never] ? true : false; -/** - * Checks if the given type is `any`. - */ -export type IsAny = [T] extends [Secret] ? Not> : false; -/** - * Determines if the given type is `unknown`. - */ -export type IsUnknown = [unknown] extends [T] ? Not> : false; -/** - * Determines if a type is either `never` or `any`. - */ -export type IsNeverOrAny = Or<[IsNever, IsAny]>; -/** - * Subjective "useful" keys from a type. For objects it's just `keyof` but for - * tuples/arrays it's the number keys. - * - * @example - * ```ts - * UsefulKeys<{ a: 1; b: 2 }> // 'a' | 'b' - * - * UsefulKeys<['a', 'b']> // '0' | '1' - * - * UsefulKeys // number - * ``` - */ -export type UsefulKeys = T extends any[] ? { - [K in keyof T]: K; -}[number] : keyof T; -/** - * Extracts the keys from a type that are required (not optional). - */ -export type RequiredKeys = Extract<{ - [K in keyof T]-?: {} extends Pick ? never : K; -}[keyof T], keyof T>; -/** - * Gets the keys of an object type that are optional. - */ -export type OptionalKeys = Exclude>; -/** - * Extracts the keys from a type that are not `readonly`. - */ -export type ReadonlyKeys = Extract<{ - [K in keyof T]-?: ReadonlyEquivalent<{ - [_K in K]: T[K]; - }, { - -readonly [_K in K]: T[K]; - }> extends true ? never : K; -}[keyof T], keyof T>; -/** - * Determines if two types, are equivalent in a `readonly` manner. - * - * @internal - */ -type ReadonlyEquivalent = Extends<(() => T extends X ? true : false), (() => T extends Y ? true : false)>; -/** - * Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because: - * 1. If either type is `never`, the result is `true` iff the other type is also `never`. - * 2. Types are wrapped in a 1-tuple so that union types are not distributed - instead we consider `string | number` to _not_ extend `number`. If we used `Left extends Right` directly you would get `Extends` => `false | true` => `boolean`. - */ -export type Extends = IsNever extends true ? IsNever : [Left] extends [Right] ? true : false; -/** - * Checks if the {@linkcode Left} type extends the {@linkcode Right} type, - * excluding `any` or `never`. - */ -export type ExtendsExcludingAnyOrNever = IsAny extends true ? IsAny : Extends; -/** - * Checks if two types are strictly equal using - * the TypeScript internal identical-to operator. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/55188#issuecomment-1656328122 | much history} - */ -export type StrictEqualUsingTSInternalIdenticalToOperator = (() => T extends (L & T) | T ? true : false) extends () => T extends (R & T) | T ? true : false ? IsNever extends IsNever ? true : false : false; -/** - * Checks that {@linkcode Left} and {@linkcode Right} extend each other. - * Not quite the same as an equality check since `any` can make it resolve - * to `true`. So should only be used when {@linkcode Left} and - * {@linkcode Right} are known to avoid `any`. - */ -export type MutuallyExtends = And<[Extends, Extends]>; -/** - * @internal - */ -declare const mismatch: unique symbol; -/** - * @internal - */ -type Mismatch = { - [mismatch]: 'mismatch'; -}; -/** - * A type which should match anything passed as a value but *doesn't* - * match {@linkcode Mismatch}. It helps TypeScript select the right overload - * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and - * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}. - * - * @internal - */ -declare const avalue: unique symbol; -/** - * Represents a value that can be of various types. - */ -export type AValue = { - [avalue]?: undefined; -} | string | number | boolean | symbol | bigint | null | undefined | void; -/** - * Represents the type of mismatched arguments between - * the actual result and the expected result. - * - * If {@linkcode ActualResult} and {@linkcode ExpectedResult} are equivalent, - * the type resolves to an empty tuple `[]`, indicating no mismatch. - * If they are not equivalent, it resolves to a tuple containing the element - * {@linkcode Mismatch}, signifying a discrepancy between - * the expected and actual results. - */ -export type MismatchArgs = Eq extends true ? [] : [Mismatch]; -/** - * Represents the options for the {@linkcode ExpectTypeOf} function. - */ -export interface ExpectTypeOfOptions { - positive: boolean; - branded: boolean; -} -/** - * Convert a union to an intersection. - * `A | B | C` -\> `A & B & C` - */ -export type UnionToIntersection = (Union extends any ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? Intersection : never; -/** - * Get the last element of a union. - * First, converts to a union of `() => T` functions, - * then uses {@linkcode UnionToIntersection} to get the last one. - */ -export type LastOf = UnionToIntersection Union : never> extends () => infer R ? R : never; -/** - * Intermediate type for {@linkcode UnionToTuple} which pushes the - * "last" union member to the end of a tuple, and recursively prepends - * the remainder of the union. - */ -export type TuplifyUnion> = IsNever extends true ? [] : [...TuplifyUnion>, LastElement]; -/** - * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`. - */ -export type UnionToTuple = TuplifyUnion; -export type IsTuple = Or<[Extends, Extends]>; -export type IsUnion = Not['length'], 1>>; -/** - * A recursive version of `Pick` that selects properties from the left type that are present in the right type. - * The "leaf" types from `Left` are used - only the keys of `Right` are considered. - * - * @example - * ```ts - * const user = {email: 'a@b.com', name: 'John Doe', address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}} - * - * type Result = DeepPickMatchingProps // {name: string, address: {city: string}} - * ``` - */ -export type DeepPickMatchingProps = Left extends Record ? Pick<{ - [K in keyof Left]: K extends keyof Right ? DeepPickMatchingProps : never; -}, Extract> : Left; -export {}; diff --git a/node_modules/expect-type/dist/utils.js b/node_modules/expect-type/dist/utils.js deleted file mode 100644 index 43407cf..0000000 --- a/node_modules/expect-type/dist/utils.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @internal - */ -const secret = Symbol('secret'); -/** - * @internal - */ -const mismatch = Symbol('mismatch'); -/** - * A type which should match anything passed as a value but *doesn't* - * match {@linkcode Mismatch}. It helps TypeScript select the right overload - * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and - * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}. - * - * @internal - */ -const avalue = Symbol('avalue'); diff --git a/node_modules/expect-type/package.json b/node_modules/expect-type/package.json deleted file mode 100644 index 8cc48b4..0000000 --- a/node_modules/expect-type/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "expect-type", - "version": "1.3.0", - "engines": { - "node": ">=12.0.0" - }, - "keywords": [ - "typescript", - "type-check", - "assert", - "types", - "typings", - "test", - "testing" - ], - "homepage": "https://github.com/mmkal/expect-type#readme", - "repository": { - "type": "git", - "url": "https://github.com/mmkal/expect-type.git" - }, - "license": "Apache-2.0", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist", - "*.md" - ], - "devDependencies": { - "@arethetypeswrong/cli": "0.17.3", - "@types/node": "^22.0.0", - "@typescript/native-preview": "7.0.0-dev.20250527.1", - "@vitest/ui": "^3.0.0", - "eslint": "^8.57.0", - "eslint-plugin-mmkal": "0.9.0", - "np": "^10.2.0", - "pkg-pr-new": "0.0.39", - "strip-ansi": "7.1.0", - "ts-morph": "23.0.0", - "typescript": "5.9.2", - "vitest": "^3.0.0" - }, - "scripts": { - "eslint": "eslint --max-warnings 0", - "lint": "tsc && pnpm eslint .", - "type-check": "tsc", - "build": "tsc -p tsconfig.lib.json", - "arethetypeswrong": "attw --pack", - "test": "vitest run" - } -} \ No newline at end of file diff --git a/node_modules/fdir/LICENSE b/node_modules/fdir/LICENSE deleted file mode 100644 index bb7fdee..0000000 --- a/node_modules/fdir/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2023 Abdullah Atta - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/fdir/README.md b/node_modules/fdir/README.md deleted file mode 100644 index 5c70530..0000000 --- a/node_modules/fdir/README.md +++ /dev/null @@ -1,91 +0,0 @@ -

- - -

The Fastest Directory Crawler & Globber for NodeJS

-

- - - - - - - - -

-

- -⚡ **The Fastest:** Nothing similar (in the NodeJS world) beats `fdir` in speed. It can easily crawl a directory containing **1 million files in < 1 second.** - -💡 **Stupidly Easy:** `fdir` uses expressive Builder pattern to build the crawler increasing code readability. - -🤖 **Zero Dependencies\*:** `fdir` only uses NodeJS `fs` & `path` modules. - -🕺 **Astonishingly Small:** < 2KB in size gzipped & minified. - -🖮 **Hackable:** Extending `fdir` is extremely simple now that the new Builder API is here. Feel free to experiment around. - -_\* `picomatch` must be installed manually by the user to support globbing._ - -## 🚄 Quickstart - -### Installation - -You can install using `npm`: - -```sh -$ npm i fdir -``` - -or Yarn: - -```sh -$ yarn add fdir -``` - -### Usage - -```ts -import { fdir } from "fdir"; - -// create the builder -const api = new fdir().withFullPaths().crawl("path/to/dir"); - -// get all files in a directory synchronously -const files = api.sync(); - -// or asynchronously -api.withPromise().then((files) => { - // do something with the result here. -}); -``` - -## Documentation: - -Documentation for all methods is available [here](/documentation.md). - -## 📊 Benchmarks: - -Please check the benchmark against the latest version [here](/BENCHMARKS.md). - -## 🙏Used by: - -`fdir` is downloaded over 200k+ times a week by projects around the world. Here's a list of some notable projects using `fdir` in production: - -> Note: if you think your project should be here, feel free to open an issue. Notable is anything with a considerable amount of GitHub stars. - -1. [rollup/plugins](https://github.com/rollup/plugins) -2. [SuperchupuDev/tinyglobby](https://github.com/SuperchupuDev/tinyglobby) -3. [pulumi/pulumi](https://github.com/pulumi/pulumi) -4. [dotenvx/dotenvx](https://github.com/dotenvx/dotenvx) -5. [mdn/yari](https://github.com/mdn/yari) -6. [streetwriters/notesnook](https://github.com/streetwriters/notesnook) -7. [imba/imba](https://github.com/imba/imba) -8. [moroshko/react-scanner](https://github.com/moroshko/react-scanner) -9. [netlify/build](https://github.com/netlify/build) -10. [yassinedoghri/astro-i18next](https://github.com/yassinedoghri/astro-i18next) -11. [selfrefactor/rambda](https://github.com/selfrefactor/rambda) -12. [whyboris/Video-Hub-App](https://github.com/whyboris/Video-Hub-App) - -## 🦮 LICENSE - -Copyright © 2024 Abdullah Atta under MIT. [Read full text here.](https://github.com/thecodrr/fdir/raw/master/LICENSE) diff --git a/node_modules/fdir/dist/index.cjs b/node_modules/fdir/dist/index.cjs deleted file mode 100644 index 4868ffb..0000000 --- a/node_modules/fdir/dist/index.cjs +++ /dev/null @@ -1,588 +0,0 @@ -//#region rolldown:runtime -var __create = Object.create; -var __defProp = Object.defineProperty; -var __getOwnPropDesc = Object.getOwnPropertyDescriptor; -var __getOwnPropNames = Object.getOwnPropertyNames; -var __getProtoOf = Object.getPrototypeOf; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) { - key = keys[i]; - if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { - get: ((k) => from[k]).bind(null, key), - enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable - }); - } - return to; -}; -var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { - value: mod, - enumerable: true -}) : target, mod)); - -//#endregion -const path = __toESM(require("path")); -const fs = __toESM(require("fs")); - -//#region src/utils.ts -function cleanPath(path$1) { - let normalized = (0, path.normalize)(path$1); - if (normalized.length > 1 && normalized[normalized.length - 1] === path.sep) normalized = normalized.substring(0, normalized.length - 1); - return normalized; -} -const SLASHES_REGEX = /[\\/]/g; -function convertSlashes(path$1, separator) { - return path$1.replace(SLASHES_REGEX, separator); -} -const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i; -function isRootDirectory(path$1) { - return path$1 === "/" || WINDOWS_ROOT_DIR_REGEX.test(path$1); -} -function normalizePath(path$1, options) { - const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options; - const pathNeedsCleaning = process.platform === "win32" && path$1.includes("/") || path$1.startsWith("."); - if (resolvePaths) path$1 = (0, path.resolve)(path$1); - if (normalizePath$1 || pathNeedsCleaning) path$1 = cleanPath(path$1); - if (path$1 === ".") return ""; - const needsSeperator = path$1[path$1.length - 1] !== pathSeparator; - return convertSlashes(needsSeperator ? path$1 + pathSeparator : path$1, pathSeparator); -} - -//#endregion -//#region src/api/functions/join-path.ts -function joinPathWithBasePath(filename, directoryPath) { - return directoryPath + filename; -} -function joinPathWithRelativePath(root, options) { - return function(filename, directoryPath) { - const sameRoot = directoryPath.startsWith(root); - if (sameRoot) return directoryPath.slice(root.length) + filename; - else return convertSlashes((0, path.relative)(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename; - }; -} -function joinPath(filename) { - return filename; -} -function joinDirectoryPath(filename, directoryPath, separator) { - return directoryPath + filename + separator; -} -function build$7(root, options) { - const { relativePaths, includeBasePath } = options; - return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath; -} - -//#endregion -//#region src/api/functions/push-directory.ts -function pushDirectoryWithRelativePath(root) { - return function(directoryPath, paths) { - paths.push(directoryPath.substring(root.length) || "."); - }; -} -function pushDirectoryFilterWithRelativePath(root) { - return function(directoryPath, paths, filters) { - const relativePath = directoryPath.substring(root.length) || "."; - if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath); - }; -} -const pushDirectory = (directoryPath, paths) => { - paths.push(directoryPath || "."); -}; -const pushDirectoryFilter = (directoryPath, paths, filters) => { - const path$1 = directoryPath || "."; - if (filters.every((filter) => filter(path$1, true))) paths.push(path$1); -}; -const empty$2 = () => {}; -function build$6(root, options) { - const { includeDirs, filters, relativePaths } = options; - if (!includeDirs) return empty$2; - if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root); - return filters && filters.length ? pushDirectoryFilter : pushDirectory; -} - -//#endregion -//#region src/api/functions/push-file.ts -const pushFileFilterAndCount = (filename, _paths, counts, filters) => { - if (filters.every((filter) => filter(filename, false))) counts.files++; -}; -const pushFileFilter = (filename, paths, _counts, filters) => { - if (filters.every((filter) => filter(filename, false))) paths.push(filename); -}; -const pushFileCount = (_filename, _paths, counts, _filters) => { - counts.files++; -}; -const pushFile = (filename, paths) => { - paths.push(filename); -}; -const empty$1 = () => {}; -function build$5(options) { - const { excludeFiles, filters, onlyCounts } = options; - if (excludeFiles) return empty$1; - if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter; - else if (onlyCounts) return pushFileCount; - else return pushFile; -} - -//#endregion -//#region src/api/functions/get-array.ts -const getArray = (paths) => { - return paths; -}; -const getArrayGroup = () => { - return [""].slice(0, 0); -}; -function build$4(options) { - return options.group ? getArrayGroup : getArray; -} - -//#endregion -//#region src/api/functions/group-files.ts -const groupFiles = (groups, directory, files) => { - groups.push({ - directory, - files, - dir: directory - }); -}; -const empty = () => {}; -function build$3(options) { - return options.group ? groupFiles : empty; -} - -//#endregion -//#region src/api/functions/resolve-symlink.ts -const resolveSymlinksAsync = function(path$1, state, callback$1) { - const { queue, fs: fs$1, options: { suppressErrors } } = state; - queue.enqueue(); - fs$1.realpath(path$1, (error, resolvedPath) => { - if (error) return queue.dequeue(suppressErrors ? null : error, state); - fs$1.stat(resolvedPath, (error$1, stat) => { - if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state); - if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return queue.dequeue(null, state); - callback$1(stat, resolvedPath); - queue.dequeue(null, state); - }); - }); -}; -const resolveSymlinks = function(path$1, state, callback$1) { - const { queue, fs: fs$1, options: { suppressErrors } } = state; - queue.enqueue(); - try { - const resolvedPath = fs$1.realpathSync(path$1); - const stat = fs$1.statSync(resolvedPath); - if (stat.isDirectory() && isRecursive(path$1, resolvedPath, state)) return; - callback$1(stat, resolvedPath); - } catch (e) { - if (!suppressErrors) throw e; - } -}; -function build$2(options, isSynchronous) { - if (!options.resolveSymlinks || options.excludeSymlinks) return null; - return isSynchronous ? resolveSymlinks : resolveSymlinksAsync; -} -function isRecursive(path$1, resolved, state) { - if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state); - let parent = (0, path.dirname)(path$1); - let depth = 1; - while (parent !== state.root && depth < 2) { - const resolvedPath = state.symlinks.get(parent); - const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)); - if (isSameRoot) depth++; - else parent = (0, path.dirname)(parent); - } - state.symlinks.set(path$1, resolved); - return depth > 1; -} -function isRecursiveUsingRealPaths(resolved, state) { - return state.visited.includes(resolved + state.options.pathSeparator); -} - -//#endregion -//#region src/api/functions/invoke-callback.ts -const onlyCountsSync = (state) => { - return state.counts; -}; -const groupsSync = (state) => { - return state.groups; -}; -const defaultSync = (state) => { - return state.paths; -}; -const limitFilesSync = (state) => { - return state.paths.slice(0, state.options.maxFiles); -}; -const onlyCountsAsync = (state, error, callback$1) => { - report(error, callback$1, state.counts, state.options.suppressErrors); - return null; -}; -const defaultAsync = (state, error, callback$1) => { - report(error, callback$1, state.paths, state.options.suppressErrors); - return null; -}; -const limitFilesAsync = (state, error, callback$1) => { - report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors); - return null; -}; -const groupsAsync = (state, error, callback$1) => { - report(error, callback$1, state.groups, state.options.suppressErrors); - return null; -}; -function report(error, callback$1, output, suppressErrors) { - if (error && !suppressErrors) callback$1(error, output); - else callback$1(null, output); -} -function build$1(options, isSynchronous) { - const { onlyCounts, group, maxFiles } = options; - if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync; - else if (group) return isSynchronous ? groupsSync : groupsAsync; - else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync; - else return isSynchronous ? defaultSync : defaultAsync; -} - -//#endregion -//#region src/api/functions/walk-directory.ts -const readdirOpts = { withFileTypes: true }; -const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { - state.queue.enqueue(); - if (currentDepth < 0) return state.queue.dequeue(null, state); - const { fs: fs$1 } = state; - state.visited.push(crawlPath); - state.counts.directories++; - fs$1.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => { - callback$1(entries, directoryPath, currentDepth); - state.queue.dequeue(state.options.suppressErrors ? null : error, state); - }); -}; -const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { - const { fs: fs$1 } = state; - if (currentDepth < 0) return; - state.visited.push(crawlPath); - state.counts.directories++; - let entries = []; - try { - entries = fs$1.readdirSync(crawlPath || ".", readdirOpts); - } catch (e) { - if (!state.options.suppressErrors) throw e; - } - callback$1(entries, directoryPath, currentDepth); -}; -function build(isSynchronous) { - return isSynchronous ? walkSync : walkAsync; -} - -//#endregion -//#region src/api/queue.ts -/** -* This is a custom stateless queue to track concurrent async fs calls. -* It increments a counter whenever a call is queued and decrements it -* as soon as it completes. When the counter hits 0, it calls onQueueEmpty. -*/ -var Queue = class { - count = 0; - constructor(onQueueEmpty) { - this.onQueueEmpty = onQueueEmpty; - } - enqueue() { - this.count++; - return this.count; - } - dequeue(error, output) { - if (this.onQueueEmpty && (--this.count <= 0 || error)) { - this.onQueueEmpty(error, output); - if (error) { - output.controller.abort(); - this.onQueueEmpty = void 0; - } - } - } -}; - -//#endregion -//#region src/api/counter.ts -var Counter = class { - _files = 0; - _directories = 0; - set files(num) { - this._files = num; - } - get files() { - return this._files; - } - set directories(num) { - this._directories = num; - } - get directories() { - return this._directories; - } - /** - * @deprecated use `directories` instead - */ - /* c8 ignore next 3 */ - get dirs() { - return this._directories; - } -}; - -//#endregion -//#region src/api/aborter.ts -/** -* AbortController is not supported on Node 14 so we use this until we can drop -* support for Node 14. -*/ -var Aborter = class { - aborted = false; - abort() { - this.aborted = true; - } -}; - -//#endregion -//#region src/api/walker.ts -var Walker = class { - root; - isSynchronous; - state; - joinPath; - pushDirectory; - pushFile; - getArray; - groupFiles; - resolveSymlink; - walkDirectory; - callbackInvoker; - constructor(root, options, callback$1) { - this.isSynchronous = !callback$1; - this.callbackInvoker = build$1(options, this.isSynchronous); - this.root = normalizePath(root, options); - this.state = { - root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1), - paths: [""].slice(0, 0), - groups: [], - counts: new Counter(), - options, - queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)), - symlinks: /* @__PURE__ */ new Map(), - visited: [""].slice(0, 0), - controller: new Aborter(), - fs: options.fs || fs - }; - this.joinPath = build$7(this.root, options); - this.pushDirectory = build$6(this.root, options); - this.pushFile = build$5(options); - this.getArray = build$4(options); - this.groupFiles = build$3(options); - this.resolveSymlink = build$2(options, this.isSynchronous); - this.walkDirectory = build(this.isSynchronous); - } - start() { - this.pushDirectory(this.root, this.state.paths, this.state.options.filters); - this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk); - return this.isSynchronous ? this.callbackInvoker(this.state, null) : null; - } - walk = (entries, directoryPath, depth) => { - const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state; - if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return; - const files = this.getArray(this.state.paths); - for (let i = 0; i < entries.length; ++i) { - const entry = entries[i]; - if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) { - const filename = this.joinPath(entry.name, directoryPath); - this.pushFile(filename, files, this.state.counts, filters); - } else if (entry.isDirectory()) { - let path$1 = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator); - if (exclude && exclude(entry.name, path$1)) continue; - this.pushDirectory(path$1, paths, filters); - this.walkDirectory(this.state, path$1, path$1, depth - 1, this.walk); - } else if (this.resolveSymlink && entry.isSymbolicLink()) { - let path$1 = joinPathWithBasePath(entry.name, directoryPath); - this.resolveSymlink(path$1, this.state, (stat, resolvedPath) => { - if (stat.isDirectory()) { - resolvedPath = normalizePath(resolvedPath, this.state.options); - if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path$1 + pathSeparator)) return; - this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path$1 + pathSeparator, depth - 1, this.walk); - } else { - resolvedPath = useRealPaths ? resolvedPath : path$1; - const filename = (0, path.basename)(resolvedPath); - const directoryPath$1 = normalizePath((0, path.dirname)(resolvedPath), this.state.options); - resolvedPath = this.joinPath(filename, directoryPath$1); - this.pushFile(resolvedPath, files, this.state.counts, filters); - } - }); - } - } - this.groupFiles(this.state.groups, directoryPath, files); - }; -}; - -//#endregion -//#region src/api/async.ts -function promise(root, options) { - return new Promise((resolve$1, reject) => { - callback(root, options, (err, output) => { - if (err) return reject(err); - resolve$1(output); - }); - }); -} -function callback(root, options, callback$1) { - let walker = new Walker(root, options, callback$1); - walker.start(); -} - -//#endregion -//#region src/api/sync.ts -function sync(root, options) { - const walker = new Walker(root, options); - return walker.start(); -} - -//#endregion -//#region src/builder/api-builder.ts -var APIBuilder = class { - constructor(root, options) { - this.root = root; - this.options = options; - } - withPromise() { - return promise(this.root, this.options); - } - withCallback(cb) { - callback(this.root, this.options, cb); - } - sync() { - return sync(this.root, this.options); - } -}; - -//#endregion -//#region src/builder/index.ts -let pm = null; -/* c8 ignore next 6 */ -try { - require.resolve("picomatch"); - pm = require("picomatch"); -} catch {} -var Builder = class { - globCache = {}; - options = { - maxDepth: Infinity, - suppressErrors: true, - pathSeparator: path.sep, - filters: [] - }; - globFunction; - constructor(options) { - this.options = { - ...this.options, - ...options - }; - this.globFunction = this.options.globFunction; - } - group() { - this.options.group = true; - return this; - } - withPathSeparator(separator) { - this.options.pathSeparator = separator; - return this; - } - withBasePath() { - this.options.includeBasePath = true; - return this; - } - withRelativePaths() { - this.options.relativePaths = true; - return this; - } - withDirs() { - this.options.includeDirs = true; - return this; - } - withMaxDepth(depth) { - this.options.maxDepth = depth; - return this; - } - withMaxFiles(limit) { - this.options.maxFiles = limit; - return this; - } - withFullPaths() { - this.options.resolvePaths = true; - this.options.includeBasePath = true; - return this; - } - withErrors() { - this.options.suppressErrors = false; - return this; - } - withSymlinks({ resolvePaths = true } = {}) { - this.options.resolveSymlinks = true; - this.options.useRealPaths = resolvePaths; - return this.withFullPaths(); - } - withAbortSignal(signal) { - this.options.signal = signal; - return this; - } - normalize() { - this.options.normalizePath = true; - return this; - } - filter(predicate) { - this.options.filters.push(predicate); - return this; - } - onlyDirs() { - this.options.excludeFiles = true; - this.options.includeDirs = true; - return this; - } - exclude(predicate) { - this.options.exclude = predicate; - return this; - } - onlyCounts() { - this.options.onlyCounts = true; - return this; - } - crawl(root) { - return new APIBuilder(root || ".", this.options); - } - withGlobFunction(fn) { - this.globFunction = fn; - return this; - } - /** - * @deprecated Pass options using the constructor instead: - * ```ts - * new fdir(options).crawl("/path/to/root"); - * ``` - * This method will be removed in v7.0 - */ - /* c8 ignore next 4 */ - crawlWithOptions(root, options) { - this.options = { - ...this.options, - ...options - }; - return new APIBuilder(root || ".", this.options); - } - glob(...patterns) { - if (this.globFunction) return this.globWithOptions(patterns); - return this.globWithOptions(patterns, ...[{ dot: true }]); - } - globWithOptions(patterns, ...options) { - const globFn = this.globFunction || pm; - /* c8 ignore next 5 */ - if (!globFn) throw new Error("Please specify a glob function to use glob matching."); - var isMatch = this.globCache[patterns.join("\0")]; - if (!isMatch) { - isMatch = globFn(patterns, ...options); - this.globCache[patterns.join("\0")] = isMatch; - } - this.options.filters.push((path$1) => isMatch(path$1)); - return this; - } -}; - -//#endregion -exports.fdir = Builder; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.d.cts b/node_modules/fdir/dist/index.d.cts deleted file mode 100644 index f448ef5..0000000 --- a/node_modules/fdir/dist/index.d.cts +++ /dev/null @@ -1,155 +0,0 @@ -/// -import * as nativeFs from "fs"; -import picomatch from "picomatch"; - -//#region src/api/aborter.d.ts -/** - * AbortController is not supported on Node 14 so we use this until we can drop - * support for Node 14. - */ -declare class Aborter { - aborted: boolean; - abort(): void; -} -//#endregion -//#region src/api/queue.d.ts -type OnQueueEmptyCallback = (error: Error | null, output: WalkerState) => void; -/** - * This is a custom stateless queue to track concurrent async fs calls. - * It increments a counter whenever a call is queued and decrements it - * as soon as it completes. When the counter hits 0, it calls onQueueEmpty. - */ -declare class Queue { - private onQueueEmpty?; - count: number; - constructor(onQueueEmpty?: OnQueueEmptyCallback | undefined); - enqueue(): number; - dequeue(error: Error | null, output: WalkerState): void; -} -//#endregion -//#region src/types.d.ts -type Counts = { - files: number; - directories: number; - /** - * @deprecated use `directories` instead. Will be removed in v7.0. - */ - dirs: number; -}; -type Group = { - directory: string; - files: string[]; - /** - * @deprecated use `directory` instead. Will be removed in v7.0. - */ - dir: string; -}; -type GroupOutput = Group[]; -type OnlyCountsOutput = Counts; -type PathsOutput = string[]; -type Output = OnlyCountsOutput | PathsOutput | GroupOutput; -type FSLike = { - readdir: typeof nativeFs.readdir; - readdirSync: typeof nativeFs.readdirSync; - realpath: typeof nativeFs.realpath; - realpathSync: typeof nativeFs.realpathSync; - stat: typeof nativeFs.stat; - statSync: typeof nativeFs.statSync; -}; -type WalkerState = { - root: string; - paths: string[]; - groups: Group[]; - counts: Counts; - options: Options; - queue: Queue; - controller: Aborter; - fs: FSLike; - symlinks: Map; - visited: string[]; -}; -type ResultCallback = (error: Error | null, output: TOutput) => void; -type FilterPredicate = (path: string, isDirectory: boolean) => boolean; -type ExcludePredicate = (dirName: string, dirPath: string) => boolean; -type PathSeparator = "/" | "\\"; -type Options = { - includeBasePath?: boolean; - includeDirs?: boolean; - normalizePath?: boolean; - maxDepth: number; - maxFiles?: number; - resolvePaths?: boolean; - suppressErrors: boolean; - group?: boolean; - onlyCounts?: boolean; - filters: FilterPredicate[]; - resolveSymlinks?: boolean; - useRealPaths?: boolean; - excludeFiles?: boolean; - excludeSymlinks?: boolean; - exclude?: ExcludePredicate; - relativePaths?: boolean; - pathSeparator: PathSeparator; - signal?: AbortSignal; - globFunction?: TGlobFunction; - fs?: FSLike; -}; -type GlobMatcher = (test: string) => boolean; -type GlobFunction = (glob: string | string[], ...params: unknown[]) => GlobMatcher; -type GlobParams = T extends ((globs: string | string[], ...params: infer TParams extends unknown[]) => GlobMatcher) ? TParams : []; -//#endregion -//#region src/builder/api-builder.d.ts -declare class APIBuilder { - private readonly root; - private readonly options; - constructor(root: string, options: Options); - withPromise(): Promise; - withCallback(cb: ResultCallback): void; - sync(): TReturnType; -} -//#endregion -//#region src/builder/index.d.ts -declare class Builder { - private readonly globCache; - private options; - private globFunction?; - constructor(options?: Partial>); - group(): Builder; - withPathSeparator(separator: "/" | "\\"): this; - withBasePath(): this; - withRelativePaths(): this; - withDirs(): this; - withMaxDepth(depth: number): this; - withMaxFiles(limit: number): this; - withFullPaths(): this; - withErrors(): this; - withSymlinks({ - resolvePaths - }?: { - resolvePaths?: boolean | undefined; - }): this; - withAbortSignal(signal: AbortSignal): this; - normalize(): this; - filter(predicate: FilterPredicate): this; - onlyDirs(): this; - exclude(predicate: ExcludePredicate): this; - onlyCounts(): Builder; - crawl(root?: string): APIBuilder; - withGlobFunction(fn: TFunc): Builder; - /** - * @deprecated Pass options using the constructor instead: - * ```ts - * new fdir(options).crawl("/path/to/root"); - * ``` - * This method will be removed in v7.0 - */ - crawlWithOptions(root: string, options: Partial>): APIBuilder; - glob(...patterns: string[]): Builder; - globWithOptions(patterns: string[]): Builder; - globWithOptions(patterns: string[], ...options: GlobParams): Builder; -} -//#endregion -//#region src/index.d.ts -type Fdir = typeof Builder; -//#endregion -export { Counts, ExcludePredicate, FSLike, Fdir, FilterPredicate, GlobFunction, GlobMatcher, GlobParams, Group, GroupOutput, OnlyCountsOutput, Options, Output, PathSeparator, PathsOutput, ResultCallback, WalkerState, Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.d.mts b/node_modules/fdir/dist/index.d.mts deleted file mode 100644 index f448ef5..0000000 --- a/node_modules/fdir/dist/index.d.mts +++ /dev/null @@ -1,155 +0,0 @@ -/// -import * as nativeFs from "fs"; -import picomatch from "picomatch"; - -//#region src/api/aborter.d.ts -/** - * AbortController is not supported on Node 14 so we use this until we can drop - * support for Node 14. - */ -declare class Aborter { - aborted: boolean; - abort(): void; -} -//#endregion -//#region src/api/queue.d.ts -type OnQueueEmptyCallback = (error: Error | null, output: WalkerState) => void; -/** - * This is a custom stateless queue to track concurrent async fs calls. - * It increments a counter whenever a call is queued and decrements it - * as soon as it completes. When the counter hits 0, it calls onQueueEmpty. - */ -declare class Queue { - private onQueueEmpty?; - count: number; - constructor(onQueueEmpty?: OnQueueEmptyCallback | undefined); - enqueue(): number; - dequeue(error: Error | null, output: WalkerState): void; -} -//#endregion -//#region src/types.d.ts -type Counts = { - files: number; - directories: number; - /** - * @deprecated use `directories` instead. Will be removed in v7.0. - */ - dirs: number; -}; -type Group = { - directory: string; - files: string[]; - /** - * @deprecated use `directory` instead. Will be removed in v7.0. - */ - dir: string; -}; -type GroupOutput = Group[]; -type OnlyCountsOutput = Counts; -type PathsOutput = string[]; -type Output = OnlyCountsOutput | PathsOutput | GroupOutput; -type FSLike = { - readdir: typeof nativeFs.readdir; - readdirSync: typeof nativeFs.readdirSync; - realpath: typeof nativeFs.realpath; - realpathSync: typeof nativeFs.realpathSync; - stat: typeof nativeFs.stat; - statSync: typeof nativeFs.statSync; -}; -type WalkerState = { - root: string; - paths: string[]; - groups: Group[]; - counts: Counts; - options: Options; - queue: Queue; - controller: Aborter; - fs: FSLike; - symlinks: Map; - visited: string[]; -}; -type ResultCallback = (error: Error | null, output: TOutput) => void; -type FilterPredicate = (path: string, isDirectory: boolean) => boolean; -type ExcludePredicate = (dirName: string, dirPath: string) => boolean; -type PathSeparator = "/" | "\\"; -type Options = { - includeBasePath?: boolean; - includeDirs?: boolean; - normalizePath?: boolean; - maxDepth: number; - maxFiles?: number; - resolvePaths?: boolean; - suppressErrors: boolean; - group?: boolean; - onlyCounts?: boolean; - filters: FilterPredicate[]; - resolveSymlinks?: boolean; - useRealPaths?: boolean; - excludeFiles?: boolean; - excludeSymlinks?: boolean; - exclude?: ExcludePredicate; - relativePaths?: boolean; - pathSeparator: PathSeparator; - signal?: AbortSignal; - globFunction?: TGlobFunction; - fs?: FSLike; -}; -type GlobMatcher = (test: string) => boolean; -type GlobFunction = (glob: string | string[], ...params: unknown[]) => GlobMatcher; -type GlobParams = T extends ((globs: string | string[], ...params: infer TParams extends unknown[]) => GlobMatcher) ? TParams : []; -//#endregion -//#region src/builder/api-builder.d.ts -declare class APIBuilder { - private readonly root; - private readonly options; - constructor(root: string, options: Options); - withPromise(): Promise; - withCallback(cb: ResultCallback): void; - sync(): TReturnType; -} -//#endregion -//#region src/builder/index.d.ts -declare class Builder { - private readonly globCache; - private options; - private globFunction?; - constructor(options?: Partial>); - group(): Builder; - withPathSeparator(separator: "/" | "\\"): this; - withBasePath(): this; - withRelativePaths(): this; - withDirs(): this; - withMaxDepth(depth: number): this; - withMaxFiles(limit: number): this; - withFullPaths(): this; - withErrors(): this; - withSymlinks({ - resolvePaths - }?: { - resolvePaths?: boolean | undefined; - }): this; - withAbortSignal(signal: AbortSignal): this; - normalize(): this; - filter(predicate: FilterPredicate): this; - onlyDirs(): this; - exclude(predicate: ExcludePredicate): this; - onlyCounts(): Builder; - crawl(root?: string): APIBuilder; - withGlobFunction(fn: TFunc): Builder; - /** - * @deprecated Pass options using the constructor instead: - * ```ts - * new fdir(options).crawl("/path/to/root"); - * ``` - * This method will be removed in v7.0 - */ - crawlWithOptions(root: string, options: Partial>): APIBuilder; - glob(...patterns: string[]): Builder; - globWithOptions(patterns: string[]): Builder; - globWithOptions(patterns: string[], ...options: GlobParams): Builder; -} -//#endregion -//#region src/index.d.ts -type Fdir = typeof Builder; -//#endregion -export { Counts, ExcludePredicate, FSLike, Fdir, FilterPredicate, GlobFunction, GlobMatcher, GlobParams, Group, GroupOutput, OnlyCountsOutput, Options, Output, PathSeparator, PathsOutput, ResultCallback, WalkerState, Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/dist/index.mjs b/node_modules/fdir/dist/index.mjs deleted file mode 100644 index 5c37e09..0000000 --- a/node_modules/fdir/dist/index.mjs +++ /dev/null @@ -1,570 +0,0 @@ -import { createRequire } from "module"; -import { basename, dirname, normalize, relative, resolve, sep } from "path"; -import * as nativeFs from "fs"; - -//#region rolldown:runtime -var __require = /* @__PURE__ */ createRequire(import.meta.url); - -//#endregion -//#region src/utils.ts -function cleanPath(path) { - let normalized = normalize(path); - if (normalized.length > 1 && normalized[normalized.length - 1] === sep) normalized = normalized.substring(0, normalized.length - 1); - return normalized; -} -const SLASHES_REGEX = /[\\/]/g; -function convertSlashes(path, separator) { - return path.replace(SLASHES_REGEX, separator); -} -const WINDOWS_ROOT_DIR_REGEX = /^[a-z]:[\\/]$/i; -function isRootDirectory(path) { - return path === "/" || WINDOWS_ROOT_DIR_REGEX.test(path); -} -function normalizePath(path, options) { - const { resolvePaths, normalizePath: normalizePath$1, pathSeparator } = options; - const pathNeedsCleaning = process.platform === "win32" && path.includes("/") || path.startsWith("."); - if (resolvePaths) path = resolve(path); - if (normalizePath$1 || pathNeedsCleaning) path = cleanPath(path); - if (path === ".") return ""; - const needsSeperator = path[path.length - 1] !== pathSeparator; - return convertSlashes(needsSeperator ? path + pathSeparator : path, pathSeparator); -} - -//#endregion -//#region src/api/functions/join-path.ts -function joinPathWithBasePath(filename, directoryPath) { - return directoryPath + filename; -} -function joinPathWithRelativePath(root, options) { - return function(filename, directoryPath) { - const sameRoot = directoryPath.startsWith(root); - if (sameRoot) return directoryPath.slice(root.length) + filename; - else return convertSlashes(relative(root, directoryPath), options.pathSeparator) + options.pathSeparator + filename; - }; -} -function joinPath(filename) { - return filename; -} -function joinDirectoryPath(filename, directoryPath, separator) { - return directoryPath + filename + separator; -} -function build$7(root, options) { - const { relativePaths, includeBasePath } = options; - return relativePaths && root ? joinPathWithRelativePath(root, options) : includeBasePath ? joinPathWithBasePath : joinPath; -} - -//#endregion -//#region src/api/functions/push-directory.ts -function pushDirectoryWithRelativePath(root) { - return function(directoryPath, paths) { - paths.push(directoryPath.substring(root.length) || "."); - }; -} -function pushDirectoryFilterWithRelativePath(root) { - return function(directoryPath, paths, filters) { - const relativePath = directoryPath.substring(root.length) || "."; - if (filters.every((filter) => filter(relativePath, true))) paths.push(relativePath); - }; -} -const pushDirectory = (directoryPath, paths) => { - paths.push(directoryPath || "."); -}; -const pushDirectoryFilter = (directoryPath, paths, filters) => { - const path = directoryPath || "."; - if (filters.every((filter) => filter(path, true))) paths.push(path); -}; -const empty$2 = () => {}; -function build$6(root, options) { - const { includeDirs, filters, relativePaths } = options; - if (!includeDirs) return empty$2; - if (relativePaths) return filters && filters.length ? pushDirectoryFilterWithRelativePath(root) : pushDirectoryWithRelativePath(root); - return filters && filters.length ? pushDirectoryFilter : pushDirectory; -} - -//#endregion -//#region src/api/functions/push-file.ts -const pushFileFilterAndCount = (filename, _paths, counts, filters) => { - if (filters.every((filter) => filter(filename, false))) counts.files++; -}; -const pushFileFilter = (filename, paths, _counts, filters) => { - if (filters.every((filter) => filter(filename, false))) paths.push(filename); -}; -const pushFileCount = (_filename, _paths, counts, _filters) => { - counts.files++; -}; -const pushFile = (filename, paths) => { - paths.push(filename); -}; -const empty$1 = () => {}; -function build$5(options) { - const { excludeFiles, filters, onlyCounts } = options; - if (excludeFiles) return empty$1; - if (filters && filters.length) return onlyCounts ? pushFileFilterAndCount : pushFileFilter; - else if (onlyCounts) return pushFileCount; - else return pushFile; -} - -//#endregion -//#region src/api/functions/get-array.ts -const getArray = (paths) => { - return paths; -}; -const getArrayGroup = () => { - return [""].slice(0, 0); -}; -function build$4(options) { - return options.group ? getArrayGroup : getArray; -} - -//#endregion -//#region src/api/functions/group-files.ts -const groupFiles = (groups, directory, files) => { - groups.push({ - directory, - files, - dir: directory - }); -}; -const empty = () => {}; -function build$3(options) { - return options.group ? groupFiles : empty; -} - -//#endregion -//#region src/api/functions/resolve-symlink.ts -const resolveSymlinksAsync = function(path, state, callback$1) { - const { queue, fs, options: { suppressErrors } } = state; - queue.enqueue(); - fs.realpath(path, (error, resolvedPath) => { - if (error) return queue.dequeue(suppressErrors ? null : error, state); - fs.stat(resolvedPath, (error$1, stat) => { - if (error$1) return queue.dequeue(suppressErrors ? null : error$1, state); - if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return queue.dequeue(null, state); - callback$1(stat, resolvedPath); - queue.dequeue(null, state); - }); - }); -}; -const resolveSymlinks = function(path, state, callback$1) { - const { queue, fs, options: { suppressErrors } } = state; - queue.enqueue(); - try { - const resolvedPath = fs.realpathSync(path); - const stat = fs.statSync(resolvedPath); - if (stat.isDirectory() && isRecursive(path, resolvedPath, state)) return; - callback$1(stat, resolvedPath); - } catch (e) { - if (!suppressErrors) throw e; - } -}; -function build$2(options, isSynchronous) { - if (!options.resolveSymlinks || options.excludeSymlinks) return null; - return isSynchronous ? resolveSymlinks : resolveSymlinksAsync; -} -function isRecursive(path, resolved, state) { - if (state.options.useRealPaths) return isRecursiveUsingRealPaths(resolved, state); - let parent = dirname(path); - let depth = 1; - while (parent !== state.root && depth < 2) { - const resolvedPath = state.symlinks.get(parent); - const isSameRoot = !!resolvedPath && (resolvedPath === resolved || resolvedPath.startsWith(resolved) || resolved.startsWith(resolvedPath)); - if (isSameRoot) depth++; - else parent = dirname(parent); - } - state.symlinks.set(path, resolved); - return depth > 1; -} -function isRecursiveUsingRealPaths(resolved, state) { - return state.visited.includes(resolved + state.options.pathSeparator); -} - -//#endregion -//#region src/api/functions/invoke-callback.ts -const onlyCountsSync = (state) => { - return state.counts; -}; -const groupsSync = (state) => { - return state.groups; -}; -const defaultSync = (state) => { - return state.paths; -}; -const limitFilesSync = (state) => { - return state.paths.slice(0, state.options.maxFiles); -}; -const onlyCountsAsync = (state, error, callback$1) => { - report(error, callback$1, state.counts, state.options.suppressErrors); - return null; -}; -const defaultAsync = (state, error, callback$1) => { - report(error, callback$1, state.paths, state.options.suppressErrors); - return null; -}; -const limitFilesAsync = (state, error, callback$1) => { - report(error, callback$1, state.paths.slice(0, state.options.maxFiles), state.options.suppressErrors); - return null; -}; -const groupsAsync = (state, error, callback$1) => { - report(error, callback$1, state.groups, state.options.suppressErrors); - return null; -}; -function report(error, callback$1, output, suppressErrors) { - if (error && !suppressErrors) callback$1(error, output); - else callback$1(null, output); -} -function build$1(options, isSynchronous) { - const { onlyCounts, group, maxFiles } = options; - if (onlyCounts) return isSynchronous ? onlyCountsSync : onlyCountsAsync; - else if (group) return isSynchronous ? groupsSync : groupsAsync; - else if (maxFiles) return isSynchronous ? limitFilesSync : limitFilesAsync; - else return isSynchronous ? defaultSync : defaultAsync; -} - -//#endregion -//#region src/api/functions/walk-directory.ts -const readdirOpts = { withFileTypes: true }; -const walkAsync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { - state.queue.enqueue(); - if (currentDepth < 0) return state.queue.dequeue(null, state); - const { fs } = state; - state.visited.push(crawlPath); - state.counts.directories++; - fs.readdir(crawlPath || ".", readdirOpts, (error, entries = []) => { - callback$1(entries, directoryPath, currentDepth); - state.queue.dequeue(state.options.suppressErrors ? null : error, state); - }); -}; -const walkSync = (state, crawlPath, directoryPath, currentDepth, callback$1) => { - const { fs } = state; - if (currentDepth < 0) return; - state.visited.push(crawlPath); - state.counts.directories++; - let entries = []; - try { - entries = fs.readdirSync(crawlPath || ".", readdirOpts); - } catch (e) { - if (!state.options.suppressErrors) throw e; - } - callback$1(entries, directoryPath, currentDepth); -}; -function build(isSynchronous) { - return isSynchronous ? walkSync : walkAsync; -} - -//#endregion -//#region src/api/queue.ts -/** -* This is a custom stateless queue to track concurrent async fs calls. -* It increments a counter whenever a call is queued and decrements it -* as soon as it completes. When the counter hits 0, it calls onQueueEmpty. -*/ -var Queue = class { - count = 0; - constructor(onQueueEmpty) { - this.onQueueEmpty = onQueueEmpty; - } - enqueue() { - this.count++; - return this.count; - } - dequeue(error, output) { - if (this.onQueueEmpty && (--this.count <= 0 || error)) { - this.onQueueEmpty(error, output); - if (error) { - output.controller.abort(); - this.onQueueEmpty = void 0; - } - } - } -}; - -//#endregion -//#region src/api/counter.ts -var Counter = class { - _files = 0; - _directories = 0; - set files(num) { - this._files = num; - } - get files() { - return this._files; - } - set directories(num) { - this._directories = num; - } - get directories() { - return this._directories; - } - /** - * @deprecated use `directories` instead - */ - /* c8 ignore next 3 */ - get dirs() { - return this._directories; - } -}; - -//#endregion -//#region src/api/aborter.ts -/** -* AbortController is not supported on Node 14 so we use this until we can drop -* support for Node 14. -*/ -var Aborter = class { - aborted = false; - abort() { - this.aborted = true; - } -}; - -//#endregion -//#region src/api/walker.ts -var Walker = class { - root; - isSynchronous; - state; - joinPath; - pushDirectory; - pushFile; - getArray; - groupFiles; - resolveSymlink; - walkDirectory; - callbackInvoker; - constructor(root, options, callback$1) { - this.isSynchronous = !callback$1; - this.callbackInvoker = build$1(options, this.isSynchronous); - this.root = normalizePath(root, options); - this.state = { - root: isRootDirectory(this.root) ? this.root : this.root.slice(0, -1), - paths: [""].slice(0, 0), - groups: [], - counts: new Counter(), - options, - queue: new Queue((error, state) => this.callbackInvoker(state, error, callback$1)), - symlinks: /* @__PURE__ */ new Map(), - visited: [""].slice(0, 0), - controller: new Aborter(), - fs: options.fs || nativeFs - }; - this.joinPath = build$7(this.root, options); - this.pushDirectory = build$6(this.root, options); - this.pushFile = build$5(options); - this.getArray = build$4(options); - this.groupFiles = build$3(options); - this.resolveSymlink = build$2(options, this.isSynchronous); - this.walkDirectory = build(this.isSynchronous); - } - start() { - this.pushDirectory(this.root, this.state.paths, this.state.options.filters); - this.walkDirectory(this.state, this.root, this.root, this.state.options.maxDepth, this.walk); - return this.isSynchronous ? this.callbackInvoker(this.state, null) : null; - } - walk = (entries, directoryPath, depth) => { - const { paths, options: { filters, resolveSymlinks: resolveSymlinks$1, excludeSymlinks, exclude, maxFiles, signal, useRealPaths, pathSeparator }, controller } = this.state; - if (controller.aborted || signal && signal.aborted || maxFiles && paths.length > maxFiles) return; - const files = this.getArray(this.state.paths); - for (let i = 0; i < entries.length; ++i) { - const entry = entries[i]; - if (entry.isFile() || entry.isSymbolicLink() && !resolveSymlinks$1 && !excludeSymlinks) { - const filename = this.joinPath(entry.name, directoryPath); - this.pushFile(filename, files, this.state.counts, filters); - } else if (entry.isDirectory()) { - let path = joinDirectoryPath(entry.name, directoryPath, this.state.options.pathSeparator); - if (exclude && exclude(entry.name, path)) continue; - this.pushDirectory(path, paths, filters); - this.walkDirectory(this.state, path, path, depth - 1, this.walk); - } else if (this.resolveSymlink && entry.isSymbolicLink()) { - let path = joinPathWithBasePath(entry.name, directoryPath); - this.resolveSymlink(path, this.state, (stat, resolvedPath) => { - if (stat.isDirectory()) { - resolvedPath = normalizePath(resolvedPath, this.state.options); - if (exclude && exclude(entry.name, useRealPaths ? resolvedPath : path + pathSeparator)) return; - this.walkDirectory(this.state, resolvedPath, useRealPaths ? resolvedPath : path + pathSeparator, depth - 1, this.walk); - } else { - resolvedPath = useRealPaths ? resolvedPath : path; - const filename = basename(resolvedPath); - const directoryPath$1 = normalizePath(dirname(resolvedPath), this.state.options); - resolvedPath = this.joinPath(filename, directoryPath$1); - this.pushFile(resolvedPath, files, this.state.counts, filters); - } - }); - } - } - this.groupFiles(this.state.groups, directoryPath, files); - }; -}; - -//#endregion -//#region src/api/async.ts -function promise(root, options) { - return new Promise((resolve$1, reject) => { - callback(root, options, (err, output) => { - if (err) return reject(err); - resolve$1(output); - }); - }); -} -function callback(root, options, callback$1) { - let walker = new Walker(root, options, callback$1); - walker.start(); -} - -//#endregion -//#region src/api/sync.ts -function sync(root, options) { - const walker = new Walker(root, options); - return walker.start(); -} - -//#endregion -//#region src/builder/api-builder.ts -var APIBuilder = class { - constructor(root, options) { - this.root = root; - this.options = options; - } - withPromise() { - return promise(this.root, this.options); - } - withCallback(cb) { - callback(this.root, this.options, cb); - } - sync() { - return sync(this.root, this.options); - } -}; - -//#endregion -//#region src/builder/index.ts -let pm = null; -/* c8 ignore next 6 */ -try { - __require.resolve("picomatch"); - pm = __require("picomatch"); -} catch {} -var Builder = class { - globCache = {}; - options = { - maxDepth: Infinity, - suppressErrors: true, - pathSeparator: sep, - filters: [] - }; - globFunction; - constructor(options) { - this.options = { - ...this.options, - ...options - }; - this.globFunction = this.options.globFunction; - } - group() { - this.options.group = true; - return this; - } - withPathSeparator(separator) { - this.options.pathSeparator = separator; - return this; - } - withBasePath() { - this.options.includeBasePath = true; - return this; - } - withRelativePaths() { - this.options.relativePaths = true; - return this; - } - withDirs() { - this.options.includeDirs = true; - return this; - } - withMaxDepth(depth) { - this.options.maxDepth = depth; - return this; - } - withMaxFiles(limit) { - this.options.maxFiles = limit; - return this; - } - withFullPaths() { - this.options.resolvePaths = true; - this.options.includeBasePath = true; - return this; - } - withErrors() { - this.options.suppressErrors = false; - return this; - } - withSymlinks({ resolvePaths = true } = {}) { - this.options.resolveSymlinks = true; - this.options.useRealPaths = resolvePaths; - return this.withFullPaths(); - } - withAbortSignal(signal) { - this.options.signal = signal; - return this; - } - normalize() { - this.options.normalizePath = true; - return this; - } - filter(predicate) { - this.options.filters.push(predicate); - return this; - } - onlyDirs() { - this.options.excludeFiles = true; - this.options.includeDirs = true; - return this; - } - exclude(predicate) { - this.options.exclude = predicate; - return this; - } - onlyCounts() { - this.options.onlyCounts = true; - return this; - } - crawl(root) { - return new APIBuilder(root || ".", this.options); - } - withGlobFunction(fn) { - this.globFunction = fn; - return this; - } - /** - * @deprecated Pass options using the constructor instead: - * ```ts - * new fdir(options).crawl("/path/to/root"); - * ``` - * This method will be removed in v7.0 - */ - /* c8 ignore next 4 */ - crawlWithOptions(root, options) { - this.options = { - ...this.options, - ...options - }; - return new APIBuilder(root || ".", this.options); - } - glob(...patterns) { - if (this.globFunction) return this.globWithOptions(patterns); - return this.globWithOptions(patterns, ...[{ dot: true }]); - } - globWithOptions(patterns, ...options) { - const globFn = this.globFunction || pm; - /* c8 ignore next 5 */ - if (!globFn) throw new Error("Please specify a glob function to use glob matching."); - var isMatch = this.globCache[patterns.join("\0")]; - if (!isMatch) { - isMatch = globFn(patterns, ...options); - this.globCache[patterns.join("\0")] = isMatch; - } - this.options.filters.push((path) => isMatch(path)); - return this; - } -}; - -//#endregion -export { Builder as fdir }; \ No newline at end of file diff --git a/node_modules/fdir/package.json b/node_modules/fdir/package.json deleted file mode 100644 index e229dff..0000000 --- a/node_modules/fdir/package.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "name": "fdir", - "version": "6.5.0", - "description": "The fastest directory crawler & globbing alternative to glob, fast-glob, & tiny-glob. Crawls 1m files in < 1s", - "main": "./dist/index.cjs", - "types": "./dist/index.d.cts", - "type": "module", - "scripts": { - "prepublishOnly": "npm run test && npm run build", - "build": "tsdown", - "format": "prettier --write src __tests__ benchmarks", - "test": "vitest run __tests__/", - "test:coverage": "vitest run --coverage __tests__/", - "test:watch": "vitest __tests__/", - "bench": "ts-node benchmarks/benchmark.js", - "bench:glob": "ts-node benchmarks/glob-benchmark.ts", - "bench:fdir": "ts-node benchmarks/fdir-benchmark.ts", - "release": "./scripts/release.sh" - }, - "engines": { - "node": ">=12.0.0" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/thecodrr/fdir.git" - }, - "keywords": [ - "util", - "os", - "sys", - "fs", - "walk", - "crawler", - "directory", - "files", - "io", - "tiny-glob", - "glob", - "fast-glob", - "speed", - "javascript", - "nodejs" - ], - "author": "thecodrr ", - "license": "MIT", - "bugs": { - "url": "https://github.com/thecodrr/fdir/issues" - }, - "homepage": "https://github.com/thecodrr/fdir#readme", - "devDependencies": { - "@types/glob": "^8.1.0", - "@types/mock-fs": "^4.13.4", - "@types/node": "^20.9.4", - "@types/picomatch": "^4.0.0", - "@types/tap": "^15.0.11", - "@vitest/coverage-v8": "^0.34.6", - "all-files-in-tree": "^1.1.2", - "benny": "^3.7.1", - "csv-to-markdown-table": "^1.3.1", - "expect": "^29.7.0", - "fast-glob": "^3.3.2", - "fdir1": "npm:fdir@1.2.0", - "fdir2": "npm:fdir@2.1.0", - "fdir3": "npm:fdir@3.4.2", - "fdir4": "npm:fdir@4.1.0", - "fdir5": "npm:fdir@5.0.0", - "fs-readdir-recursive": "^1.1.0", - "get-all-files": "^4.1.0", - "glob": "^10.3.10", - "klaw-sync": "^6.0.0", - "mock-fs": "^5.2.0", - "picomatch": "^4.0.2", - "prettier": "^3.5.3", - "recur-readdir": "0.0.1", - "recursive-files": "^1.0.2", - "recursive-fs": "^2.1.0", - "recursive-readdir": "^2.2.3", - "rrdir": "^12.1.0", - "systeminformation": "^5.21.17", - "tiny-glob": "^0.2.9", - "ts-node": "^10.9.1", - "tsdown": "^0.12.5", - "typescript": "^5.3.2", - "vitest": "^0.34.6", - "walk-sync": "^3.0.0" - }, - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - }, - "module": "./dist/index.mjs", - "exports": { - ".": { - "import": "./dist/index.mjs", - "require": "./dist/index.cjs" - }, - "./package.json": "./package.json" - } -} diff --git a/node_modules/magic-string/LICENSE b/node_modules/magic-string/LICENSE deleted file mode 100644 index 667e8b4..0000000 --- a/node_modules/magic-string/LICENSE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright 2018 Rich Harris - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/magic-string/README.md b/node_modules/magic-string/README.md deleted file mode 100644 index 2dc316c..0000000 --- a/node_modules/magic-string/README.md +++ /dev/null @@ -1,325 +0,0 @@ -# magic-string - - - build status - - - npm version - - - license - - -Suppose you have some source code. You want to make some light modifications to it - replacing a few characters here and there, wrapping it with a header and footer, etc - and ideally you'd like to generate a [source map](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/) at the end of it. You've thought about using something like [recast](https://github.com/benjamn/recast) (which allows you to generate an AST from some JavaScript, manipulate it, and reprint it with a sourcemap without losing your comments and formatting), but it seems like overkill for your needs (or maybe the source code isn't JavaScript). - -Your requirements are, frankly, rather niche. But they're requirements that I also have, and for which I made magic-string. It's a small, fast utility for manipulating strings and generating sourcemaps. - -## Installation - -magic-string works in both node.js and browser environments. For node, install with npm: - -```bash -npm i magic-string -``` - -To use in browser, grab the [magic-string.umd.js](https://unpkg.com/magic-string/dist/magic-string.umd.js) file and add it to your page: - -```html - -``` - -(It also works with various module systems, if you prefer that sort of thing - it has a dependency on [vlq](https://github.com/Rich-Harris/vlq).) - -## Usage - -These examples assume you're in node.js, or something similar: - -```js -import MagicString from 'magic-string'; -import fs from 'fs'; - -const s = new MagicString('problems = 99'); - -s.update(0, 8, 'answer'); -s.toString(); // 'answer = 99' - -s.update(11, 13, '42'); // character indices always refer to the original string -s.toString(); // 'answer = 42' - -s.prepend('var ').append(';'); // most methods are chainable -s.toString(); // 'var answer = 42;' - -const map = s.generateMap({ - source: 'source.js', - file: 'converted.js.map', - includeContent: true, -}); // generates a v3 sourcemap - -fs.writeFileSync('converted.js', s.toString()); -fs.writeFileSync('converted.js.map', map.toString()); -``` - -You can pass an options argument: - -```js -const s = new MagicString(someCode, { - // these options will be used if you later call `bundle.addSource( s )` - see below - filename: 'foo.js', - indentExclusionRanges: [ - /*...*/ - ], - // mark source as ignore in DevTools, see below #Bundling - ignoreList: false, - // adjust the incoming position - see below - offset: 0, -}); -``` - -## Properties - -### s.offset - -Sets the offset property to adjust the incoming position for the following APIs: `slice`, `update`, `overwrite`, `appendLeft`, `prependLeft`, `appendRight`, `prependRight`, `move`, `reset`, and `remove`. - -Example usage: - -```ts -const s = new MagicString('hello world', { offset: 0 }); -s.offset = 6; -s.slice() === 'world'; -``` - -## Methods - -### s.addSourcemapLocation( index ) - -Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is `false` (see below). - -### s.append( content ) - -Appends the specified content to the end of the string. Returns `this`. - -### s.appendLeft( index, content ) - -Appends the specified `content` at the `index` in the original string. If a range _ending_ with `index` is subsequently moved, the insert will be moved with it. Returns `this`. See also `s.prependLeft(...)`. - -### s.appendRight( index, content ) - -Appends the specified `content` at the `index` in the original string. If a range _starting_ with `index` is subsequently moved, the insert will be moved with it. Returns `this`. See also `s.prependRight(...)`. - -### s.clone() - -Does what you'd expect. - -### s.generateDecodedMap( options ) - -Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. See `generateMap` documentation below for options details. Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead. - -### s.generateMap( options ) - -Generates a [version 3 sourcemap](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit). All options are, well, optional: - -- `file` - the filename where you plan to write the sourcemap -- `source` - the filename of the file containing the original source -- `includeContent` - whether to include the original content in the map's `sourcesContent` array -- `hires` - whether the mapping should be high-resolution. Hi-res mappings map every single character, meaning (for example) your devtools will always be able to pinpoint the exact location of function calls and so on. With lo-res mappings, devtools may only be able to identify the correct line - but they're quicker to generate and less bulky. You can also set `"boundary"` to generate a semi-hi-res mappings segmented per word boundary instead of per character, suitable for string semantics that are separated by words. If sourcemap locations have been specified with `s.addSourcemapLocation()`, they will be used here. - -The returned sourcemap has two (non-enumerable) methods attached for convenience: - -- `toString` - returns the equivalent of `JSON.stringify(map)` -- `toUrl` - returns a DataURI containing the sourcemap. Useful for doing this sort of thing: - -```js -code += '\n//# sourceMappingURL=' + map.toUrl(); -``` - -### s.hasChanged() - -Indicates if the string has been changed. - -### s.indent( prefix[, options] ) - -Prefixes each line of the string with `prefix`. If `prefix` is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. Returns `this`. - -The `options` argument can have an `exclude` property, which is an array of `[start, end]` character ranges. These ranges will be excluded from the indentation - useful for (e.g.) multiline strings. - -### s.insertLeft( index, content ) - -**DEPRECATED** since 0.17 – use `s.appendLeft(...)` instead - -### s.insertRight( index, content ) - -**DEPRECATED** since 0.17 – use `s.prependRight(...)` instead - -### s.isEmpty() - -Returns true if the resulting source is empty (disregarding white space). - -### s.locate( index ) - -**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30) - -### s.locateOrigin( index ) - -**DEPRECATED** since 0.10 – see [#30](https://github.com/Rich-Harris/magic-string/pull/30) - -### s.move( start, end, index ) - -Moves the characters from `start` and `end` to `index`. Returns `this`. - -### s.overwrite( start, end, content[, options] ) - -Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in that range. The same restrictions as `s.remove()` apply. Returns `this`. - -The fourth argument is optional. It can have a `storeName` property — if `true`, the original name will be stored for later inclusion in a sourcemap's `names` array — and a `contentOnly` property which determines whether only the content is overwritten, or anything that was appended/prepended to the range as well. - -It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content. - -### s.prepend( content ) - -Prepends the string with the specified content. Returns `this`. - -### s.prependLeft ( index, content ) - -Same as `s.appendLeft(...)`, except that the inserted content will go _before_ any previous appends or prepends at `index` - -### s.prependRight ( index, content ) - -Same as `s.appendRight(...)`, except that the inserted content will go _before_ any previous appends or prepends at `index` - -### s.replace( regexpOrString, substitution ) - -String replacement with RegExp or string. The `substitution` parameter supports strings and functions. Returns `this`. - -```ts -import MagicString from 'magic-string'; - -const s = new MagicString(source); - -s.replace('foo', 'bar'); -s.replace('foo', (str, index, s) => str + '-' + index); -s.replace(/foo/g, 'bar'); -s.replace(/(\w)(\d+)/g, (_, $1, $2) => $1.toUpperCase() + $2); -``` - -The differences from [`String.replace`](<(https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)>): - -- It will always match against the **original string** -- It mutates the magic string state (use `.clone()` to be immutable) - -### s.replaceAll( regexpOrString, substitution ) - -Same as `s.replace`, but replace all matched strings instead of just one. -If `regexpOrString` is a regex, then it must have the global (`g`) flag set, or a `TypeError` is thrown. Matches the behavior of the builtin [`String.property.replaceAll`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll). Returns `this`. - -### s.remove( start, end ) - -Removes the characters from `start` to `end` (of the original string, **not** the generated string). Removing the same content twice, or making removals that partially overlap, will cause an error. Returns `this`. - -### s.reset( start, end ) - -Resets the characters from `start` to `end` (of the original string, **not** the generated string). -It can be used to restore previously removed characters and discard unwanted changes. - -### s.slice( start, end ) - -Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string. Throws error if the indices are for characters that were already removed. - -### s.snip( start, end ) - -Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed. - -### s.toString() - -Returns the generated string. - -### s.trim([ charType ]) - -Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end. Returns `this`. - -### s.trimStart([ charType ]) - -Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. Returns `this`. - -### s.trimEnd([ charType ]) - -Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end. Returns `this`. - -### s.trimLines() - -Removes empty lines from the start and end. Returns `this`. - -### s.update( start, end, content[, options] ) - -Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply. Returns `this`. - -The fourth argument is optional. It can have a `storeName` property — if `true`, the original name will be stored for later inclusion in a sourcemap's `names` array — and an `overwrite` property which defaults to `false` and determines whether anything that was appended/prepended to the range will be overwritten along with the original content. - -`s.update(start, end, content)` is equivalent to `s.overwrite(start, end, content, { contentOnly: true })`. - -## Bundling - -To concatenate several sources, use `MagicString.Bundle`: - -```js -const bundle = new MagicString.Bundle(); - -bundle.addSource({ - filename: 'foo.js', - content: new MagicString('var answer = 42;'), -}); - -bundle.addSource({ - filename: 'bar.js', - content: new MagicString('console.log( answer )'), -}); - -// Sources can be marked as ignore-listed, which provides a hint to debuggers -// to not step into this code and also don't show the source files depending -// on user preferences. -bundle.addSource({ - filename: 'some-3rdparty-library.js', - content: new MagicString('function myLib(){}'), - ignoreList: false, // <-- -}); - -// Advanced: a source can include an `indentExclusionRanges` property -// alongside `filename` and `content`. This will be passed to `s.indent()` -// - see documentation above - -bundle - .indent() // optionally, pass an indent string, otherwise it will be guessed - .prepend('(function () {\n') - .append('}());'); - -bundle.toString(); -// (function () { -// var answer = 42; -// console.log( answer ); -// }()); - -// options are as per `s.generateMap()` above -const map = bundle.generateMap({ - file: 'bundle.js', - includeContent: true, - hires: true, -}); -``` - -As an alternative syntax, if you a) don't have `filename` or `indentExclusionRanges` options, or b) passed those in when you used `new MagicString(...)`, you can simply pass the `MagicString` instance itself: - -```js -const bundle = new MagicString.Bundle(); -const source = new MagicString(someCode, { - filename: 'foo.js', -}); - -bundle.addSource(source); -``` - -## License - -MIT diff --git a/node_modules/magic-string/dist/magic-string.cjs.d.ts b/node_modules/magic-string/dist/magic-string.cjs.d.ts deleted file mode 100644 index 76cc537..0000000 --- a/node_modules/magic-string/dist/magic-string.cjs.d.ts +++ /dev/null @@ -1,289 +0,0 @@ -export interface BundleOptions { - intro?: string; - separator?: string; -} - -export interface SourceMapOptions { - /** - * Whether the mapping should be high-resolution. - * Hi-res mappings map every single character, meaning (for example) your devtools will always - * be able to pinpoint the exact location of function calls and so on. - * With lo-res mappings, devtools may only be able to identify the correct - * line - but they're quicker to generate and less bulky. - * You can also set `"boundary"` to generate a semi-hi-res mappings segmented per word boundary - * instead of per character, suitable for string semantics that are separated by words. - * If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here. - */ - hires?: boolean | 'boundary'; - /** - * The filename where you plan to write the sourcemap. - */ - file?: string; - /** - * The filename of the file containing the original source. - */ - source?: string; - /** - * Whether to include the original content in the map's sourcesContent array. - */ - includeContent?: boolean; -} - -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; - -export interface DecodedSourceMap { - file: string; - sources: string[]; - sourcesContent?: string[]; - names: string[]; - mappings: SourceMapSegment[][]; - x_google_ignoreList?: number[]; -} - -export class SourceMap { - constructor(properties: DecodedSourceMap); - - version: number; - file: string; - sources: string[]; - sourcesContent?: string[]; - names: string[]; - mappings: string; - x_google_ignoreList?: number[]; - debugId?: string; - - /** - * Returns the equivalent of `JSON.stringify(map)` - */ - toString(): string; - /** - * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing: - * `generateMap(options?: SourceMapOptions): SourceMap;` - */ - toUrl(): string; -} - -export class Bundle { - constructor(options?: BundleOptions); - /** - * Adds the specified source to the bundle, which can either be a `MagicString` object directly, - * or an options object that holds a magic string `content` property and optionally provides - * a `filename` for the source within the bundle, as well as an optional `ignoreList` hint - * (which defaults to `false`). The `filename` is used when constructing the source map for the - * bundle, to identify this `source` in the source map's `sources` field. The `ignoreList` hint - * is used to populate the `x_google_ignoreList` extension field in the source map, which is a - * mechanism for tools to signal to debuggers that certain sources should be ignored by default - * (depending on user preferences). - */ - addSource( - source: MagicString | { filename?: string; content: MagicString; ignoreList?: boolean }, - ): this; - append(str: string, options?: BundleOptions): this; - clone(): this; - generateMap( - options?: SourceMapOptions, - ): Omit & { sourcesContent: Array }; - generateDecodedMap( - options?: SourceMapOptions, - ): Omit & { sourcesContent: Array }; - getIndentString(): string; - indent(indentStr?: string): this; - indentExclusionRanges: ExclusionRange | Array; - prepend(str: string): this; - toString(): string; - trimLines(): this; - trim(charType?: string): this; - trimStart(charType?: string): this; - trimEnd(charType?: string): this; - isEmpty(): boolean; - length(): number; -} - -export type ExclusionRange = [number, number]; - -export interface MagicStringOptions { - filename?: string; - indentExclusionRanges?: ExclusionRange | Array; - offset?: number; -} - -export interface IndentOptions { - exclude?: ExclusionRange | Array; - indentStart?: boolean; -} - -export interface OverwriteOptions { - storeName?: boolean; - contentOnly?: boolean; -} - -export interface UpdateOptions { - storeName?: boolean; - overwrite?: boolean; -} - -export default class MagicString { - constructor(str: string, options?: MagicStringOptions); - /** - * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false. - */ - addSourcemapLocation(char: number): void; - /** - * Appends the specified content to the end of the string. - */ - append(content: string): this; - /** - * Appends the specified content at the index in the original string. - * If a range *ending* with index is subsequently moved, the insert will be moved with it. - * See also `s.prependLeft(...)`. - */ - appendLeft(index: number, content: string): this; - /** - * Appends the specified content at the index in the original string. - * If a range *starting* with index is subsequently moved, the insert will be moved with it. - * See also `s.prependRight(...)`. - */ - appendRight(index: number, content: string): this; - /** - * Does what you'd expect. - */ - clone(): this; - /** - * Generates a version 3 sourcemap. - */ - generateMap(options?: SourceMapOptions): SourceMap; - /** - * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. - * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead. - */ - generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap; - getIndentString(): string; - - /** - * Prefixes each line of the string with prefix. - * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. - */ - indent(options?: IndentOptions): this; - /** - * Prefixes each line of the string with prefix. - * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. - * - * The options argument can have an exclude property, which is an array of [start, end] character ranges. - * These ranges will be excluded from the indentation - useful for (e.g.) multiline strings. - */ - indent(indentStr?: string, options?: IndentOptions): this; - indentExclusionRanges: ExclusionRange | Array; - - /** - * Moves the characters from `start` and `end` to `index`. - */ - move(start: number, end: number, index: number): this; - /** - * Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in - * that range. The same restrictions as `s.remove()` apply. - * - * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored - * for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only - * the content is overwritten, or anything that was appended/prepended to the range as well. - * - * It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content. - */ - overwrite( - start: number, - end: number, - content: string, - options?: boolean | OverwriteOptions, - ): this; - /** - * Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply. - * - * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored - * for later inclusion in a sourcemap's names array — and an overwrite property which determines whether only - * the content is overwritten, or anything that was appended/prepended to the range as well. - */ - update(start: number, end: number, content: string, options?: boolean | UpdateOptions): this; - /** - * Prepends the string with the specified content. - */ - prepend(content: string): this; - /** - * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index - */ - prependLeft(index: number, content: string): this; - /** - * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` - */ - prependRight(index: number, content: string): this; - /** - * Removes the characters from `start` to `end` (of the original string, **not** the generated string). - * Removing the same content twice, or making removals that partially overlap, will cause an error. - */ - remove(start: number, end: number): this; - /** - * Reset the modified characters from `start` to `end` (of the original string, **not** the generated string). - */ - reset(start: number, end: number): this; - /** - * Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string. - * Throws error if the indices are for characters that were already removed. - */ - slice(start: number, end: number): string; - /** - * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed. - */ - snip(start: number, end: number): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end. - */ - trim(charType?: string): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. - */ - trimStart(charType?: string): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end. - */ - trimEnd(charType?: string): this; - /** - * Removes empty lines from the start and end. - */ - trimLines(): this; - /** - * String replacement with RegExp or string. - */ - replace( - regex: RegExp | string, - replacement: string | ((substring: string, ...args: any[]) => string), - ): this; - /** - * Same as `s.replace`, but replace all matched strings instead of just one. - */ - replaceAll( - regex: RegExp | string, - replacement: string | ((substring: string, ...args: any[]) => string), - ): this; - - lastChar(): string; - lastLine(): string; - /** - * Returns true if the resulting source is empty (disregarding white space). - */ - isEmpty(): boolean; - length(): number; - - /** - * Indicates if the string has been changed. - */ - hasChanged(): boolean; - - original: string; - /** - * Returns the generated string. - */ - toString(): string; - - offset: number; -} diff --git a/node_modules/magic-string/dist/magic-string.cjs.js b/node_modules/magic-string/dist/magic-string.cjs.js deleted file mode 100644 index bf3cd1d..0000000 --- a/node_modules/magic-string/dist/magic-string.cjs.js +++ /dev/null @@ -1,1594 +0,0 @@ -'use strict'; - -var sourcemapCodec = require('@jridgewell/sourcemap-codec'); - -class BitSet { - constructor(arg) { - this.bits = arg instanceof BitSet ? arg.bits.slice() : []; - } - - add(n) { - this.bits[n >> 5] |= 1 << (n & 31); - } - - has(n) { - return !!(this.bits[n >> 5] & (1 << (n & 31))); - } -} - -class Chunk { - constructor(start, end, content) { - this.start = start; - this.end = end; - this.original = content; - - this.intro = ''; - this.outro = ''; - - this.content = content; - this.storeName = false; - this.edited = false; - - { - this.previous = null; - this.next = null; - } - } - - appendLeft(content) { - this.outro += content; - } - - appendRight(content) { - this.intro = this.intro + content; - } - - clone() { - const chunk = new Chunk(this.start, this.end, this.original); - - chunk.intro = this.intro; - chunk.outro = this.outro; - chunk.content = this.content; - chunk.storeName = this.storeName; - chunk.edited = this.edited; - - return chunk; - } - - contains(index) { - return this.start < index && index < this.end; - } - - eachNext(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.next; - } - } - - eachPrevious(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.previous; - } - } - - edit(content, storeName, contentOnly) { - this.content = content; - if (!contentOnly) { - this.intro = ''; - this.outro = ''; - } - this.storeName = storeName; - - this.edited = true; - - return this; - } - - prependLeft(content) { - this.outro = content + this.outro; - } - - prependRight(content) { - this.intro = content + this.intro; - } - - reset() { - this.intro = ''; - this.outro = ''; - if (this.edited) { - this.content = this.original; - this.storeName = false; - this.edited = false; - } - } - - split(index) { - const sliceIndex = index - this.start; - - const originalBefore = this.original.slice(0, sliceIndex); - const originalAfter = this.original.slice(sliceIndex); - - this.original = originalBefore; - - const newChunk = new Chunk(index, this.end, originalAfter); - newChunk.outro = this.outro; - this.outro = ''; - - this.end = index; - - if (this.edited) { - // after split we should save the edit content record into the correct chunk - // to make sure sourcemap correct - // For example: - // ' test'.trim() - // split -> ' ' + 'test' - // ✔️ edit -> '' + 'test' - // ✖️ edit -> 'test' + '' - // TODO is this block necessary?... - newChunk.edit('', false); - this.content = ''; - } else { - this.content = originalBefore; - } - - newChunk.next = this.next; - if (newChunk.next) newChunk.next.previous = newChunk; - newChunk.previous = this; - this.next = newChunk; - - return newChunk; - } - - toString() { - return this.intro + this.content + this.outro; - } - - trimEnd(rx) { - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - this.split(this.start + trimmed.length).edit('', undefined, true); - if (this.edited) { - // save the change, if it has been edited - this.edit(trimmed, this.storeName, true); - } - } - return true; - } else { - this.edit('', undefined, true); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - } - } - - trimStart(rx) { - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - const newChunk = this.split(this.end - trimmed.length); - if (this.edited) { - // save the change, if it has been edited - newChunk.edit(trimmed, this.storeName, true); - } - this.edit('', undefined, true); - } - return true; - } else { - this.edit('', undefined, true); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - } - } -} - -function getBtoa() { - if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') { - return (str) => globalThis.btoa(unescape(encodeURIComponent(str))); - } else if (typeof Buffer === 'function') { - return (str) => Buffer.from(str, 'utf-8').toString('base64'); - } else { - return () => { - throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); - }; - } -} - -const btoa = /*#__PURE__*/ getBtoa(); - -class SourceMap { - constructor(properties) { - this.version = 3; - this.file = properties.file; - this.sources = properties.sources; - this.sourcesContent = properties.sourcesContent; - this.names = properties.names; - this.mappings = sourcemapCodec.encode(properties.mappings); - if (typeof properties.x_google_ignoreList !== 'undefined') { - this.x_google_ignoreList = properties.x_google_ignoreList; - } - if (typeof properties.debugId !== 'undefined') { - this.debugId = properties.debugId; - } - } - - toString() { - return JSON.stringify(this); - } - - toUrl() { - return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); - } -} - -function guessIndent(code) { - const lines = code.split('\n'); - - const tabbed = lines.filter((line) => /^\t+/.test(line)); - const spaced = lines.filter((line) => /^ {2,}/.test(line)); - - if (tabbed.length === 0 && spaced.length === 0) { - return null; - } - - // More lines tabbed than spaced? Assume tabs, and - // default to tabs in the case of a tie (or nothing - // to go on) - if (tabbed.length >= spaced.length) { - return '\t'; - } - - // Otherwise, we need to guess the multiple - const min = spaced.reduce((previous, current) => { - const numSpaces = /^ +/.exec(current)[0].length; - return Math.min(numSpaces, previous); - }, Infinity); - - return new Array(min + 1).join(' '); -} - -function getRelativePath(from, to) { - const fromParts = from.split(/[/\\]/); - const toParts = to.split(/[/\\]/); - - fromParts.pop(); // get dirname - - while (fromParts[0] === toParts[0]) { - fromParts.shift(); - toParts.shift(); - } - - if (fromParts.length) { - let i = fromParts.length; - while (i--) fromParts[i] = '..'; - } - - return fromParts.concat(toParts).join('/'); -} - -const toString = Object.prototype.toString; - -function isObject(thing) { - return toString.call(thing) === '[object Object]'; -} - -function getLocator(source) { - const originalLines = source.split('\n'); - const lineOffsets = []; - - for (let i = 0, pos = 0; i < originalLines.length; i++) { - lineOffsets.push(pos); - pos += originalLines[i].length + 1; - } - - return function locate(index) { - let i = 0; - let j = lineOffsets.length; - while (i < j) { - const m = (i + j) >> 1; - if (index < lineOffsets[m]) { - j = m; - } else { - i = m + 1; - } - } - const line = i - 1; - const column = index - lineOffsets[line]; - return { line, column }; - }; -} - -const wordRegex = /\w/; - -class Mappings { - constructor(hires) { - this.hires = hires; - this.generatedCodeLine = 0; - this.generatedCodeColumn = 0; - this.raw = []; - this.rawSegments = this.raw[this.generatedCodeLine] = []; - this.pending = null; - } - - addEdit(sourceIndex, content, loc, nameIndex) { - if (content.length) { - const contentLengthMinusOne = content.length - 1; - let contentLineEnd = content.indexOf('\n', 0); - let previousContentLineEnd = -1; - // Loop through each line in the content and add a segment, but stop if the last line is empty, - // else code afterwards would fill one line too many - while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - - previousContentLineEnd = contentLineEnd; - contentLineEnd = content.indexOf('\n', contentLineEnd + 1); - } - - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.advance(content.slice(previousContentLineEnd + 1)); - } else if (this.pending) { - this.rawSegments.push(this.pending); - this.advance(content); - } - - this.pending = null; - } - - addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) { - let originalCharIndex = chunk.start; - let first = true; - // when iterating each char, check if it's in a word boundary - let charInHiresBoundary = false; - - while (originalCharIndex < chunk.end) { - if (original[originalCharIndex] === '\n') { - loc.line += 1; - loc.column = 0; - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - first = true; - charInHiresBoundary = false; - } else { - if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - - if (this.hires === 'boundary') { - // in hires "boundary", group segments per word boundary than per char - if (wordRegex.test(original[originalCharIndex])) { - // for first char in the boundary found, start the boundary by pushing a segment - if (!charInHiresBoundary) { - this.rawSegments.push(segment); - charInHiresBoundary = true; - } - } else { - // for non-word char, end the boundary by pushing a segment - this.rawSegments.push(segment); - charInHiresBoundary = false; - } - } else { - this.rawSegments.push(segment); - } - } - - loc.column += 1; - this.generatedCodeColumn += 1; - first = false; - } - - originalCharIndex += 1; - } - - this.pending = null; - } - - advance(str) { - if (!str) return; - - const lines = str.split('\n'); - - if (lines.length > 1) { - for (let i = 0; i < lines.length - 1; i++) { - this.generatedCodeLine++; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - } - this.generatedCodeColumn = 0; - } - - this.generatedCodeColumn += lines[lines.length - 1].length; - } -} - -const n = '\n'; - -const warned = { - insertLeft: false, - insertRight: false, - storeName: false, -}; - -class MagicString { - constructor(string, options = {}) { - const chunk = new Chunk(0, string.length, string); - - Object.defineProperties(this, { - original: { writable: true, value: string }, - outro: { writable: true, value: '' }, - intro: { writable: true, value: '' }, - firstChunk: { writable: true, value: chunk }, - lastChunk: { writable: true, value: chunk }, - lastSearchedChunk: { writable: true, value: chunk }, - byStart: { writable: true, value: {} }, - byEnd: { writable: true, value: {} }, - filename: { writable: true, value: options.filename }, - indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, - sourcemapLocations: { writable: true, value: new BitSet() }, - storedNames: { writable: true, value: {} }, - indentStr: { writable: true, value: undefined }, - ignoreList: { writable: true, value: options.ignoreList }, - offset: { writable: true, value: options.offset || 0 }, - }); - - this.byStart[0] = chunk; - this.byEnd[string.length] = chunk; - } - - addSourcemapLocation(char) { - this.sourcemapLocations.add(char); - } - - append(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.outro += content; - return this; - } - - appendLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.appendLeft(content); - } else { - this.intro += content; - } - return this; - } - - appendRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.appendRight(content); - } else { - this.outro += content; - } - return this; - } - - clone() { - const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset }); - - let originalChunk = this.firstChunk; - let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); - - while (originalChunk) { - cloned.byStart[clonedChunk.start] = clonedChunk; - cloned.byEnd[clonedChunk.end] = clonedChunk; - - const nextOriginalChunk = originalChunk.next; - const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); - - if (nextClonedChunk) { - clonedChunk.next = nextClonedChunk; - nextClonedChunk.previous = clonedChunk; - - clonedChunk = nextClonedChunk; - } - - originalChunk = nextOriginalChunk; - } - - cloned.lastChunk = clonedChunk; - - if (this.indentExclusionRanges) { - cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); - } - - cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); - - cloned.intro = this.intro; - cloned.outro = this.outro; - - return cloned; - } - - generateDecodedMap(options) { - options = options || {}; - - const sourceIndex = 0; - const names = Object.keys(this.storedNames); - const mappings = new Mappings(options.hires); - - const locate = getLocator(this.original); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (this.outro) { - mappings.advance(this.outro); - } - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: [ - options.source ? getRelativePath(options.file || '', options.source) : options.file || '', - ], - sourcesContent: options.includeContent ? [this.original] : undefined, - names, - mappings: mappings.raw, - x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - _ensureindentStr() { - if (this.indentStr === undefined) { - this.indentStr = guessIndent(this.original); - } - } - - _getRawIndentString() { - this._ensureindentStr(); - return this.indentStr; - } - - getIndentString() { - this._ensureindentStr(); - return this.indentStr === null ? '\t' : this.indentStr; - } - - indent(indentStr, options) { - const pattern = /^[^\r\n]/gm; - - if (isObject(indentStr)) { - options = indentStr; - indentStr = undefined; - } - - if (indentStr === undefined) { - this._ensureindentStr(); - indentStr = this.indentStr || '\t'; - } - - if (indentStr === '') return this; // noop - - options = options || {}; - - // Process exclusion ranges - const isExcluded = {}; - - if (options.exclude) { - const exclusions = - typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; - exclusions.forEach((exclusion) => { - for (let i = exclusion[0]; i < exclusion[1]; i += 1) { - isExcluded[i] = true; - } - }); - } - - let shouldIndentNextCharacter = options.indentStart !== false; - const replacer = (match) => { - if (shouldIndentNextCharacter) return `${indentStr}${match}`; - shouldIndentNextCharacter = true; - return match; - }; - - this.intro = this.intro.replace(pattern, replacer); - - let charIndex = 0; - let chunk = this.firstChunk; - - while (chunk) { - const end = chunk.end; - - if (chunk.edited) { - if (!isExcluded[charIndex]) { - chunk.content = chunk.content.replace(pattern, replacer); - - if (chunk.content.length) { - shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; - } - } - } else { - charIndex = chunk.start; - - while (charIndex < end) { - if (!isExcluded[charIndex]) { - const char = this.original[charIndex]; - - if (char === '\n') { - shouldIndentNextCharacter = true; - } else if (char !== '\r' && shouldIndentNextCharacter) { - shouldIndentNextCharacter = false; - - if (charIndex === chunk.start) { - chunk.prependRight(indentStr); - } else { - this._splitChunk(chunk, charIndex); - chunk = chunk.next; - chunk.prependRight(indentStr); - } - } - } - - charIndex += 1; - } - } - - charIndex = chunk.end; - chunk = chunk.next; - } - - this.outro = this.outro.replace(pattern, replacer); - - return this; - } - - insert() { - throw new Error( - 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)', - ); - } - - insertLeft(index, content) { - if (!warned.insertLeft) { - console.warn( - 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead', - ); - warned.insertLeft = true; - } - - return this.appendLeft(index, content); - } - - insertRight(index, content) { - if (!warned.insertRight) { - console.warn( - 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead', - ); - warned.insertRight = true; - } - - return this.prependRight(index, content); - } - - move(start, end, index) { - start = start + this.offset; - end = end + this.offset; - index = index + this.offset; - - if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself'); - - this._split(start); - this._split(end); - this._split(index); - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - const oldLeft = first.previous; - const oldRight = last.next; - - const newRight = this.byStart[index]; - if (!newRight && last === this.lastChunk) return this; - const newLeft = newRight ? newRight.previous : this.lastChunk; - - if (oldLeft) oldLeft.next = oldRight; - if (oldRight) oldRight.previous = oldLeft; - - if (newLeft) newLeft.next = first; - if (newRight) newRight.previous = last; - - if (!first.previous) this.firstChunk = last.next; - if (!last.next) { - this.lastChunk = first.previous; - this.lastChunk.next = null; - } - - first.previous = newLeft; - last.next = newRight || null; - - if (!newLeft) this.firstChunk = first; - if (!newRight) this.lastChunk = last; - return this; - } - - overwrite(start, end, content, options) { - options = options || {}; - return this.update(start, end, content, { ...options, overwrite: !options.contentOnly }); - } - - update(start, end, content, options) { - start = start + this.offset; - end = end + this.offset; - - if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (end > this.original.length) throw new Error('end is out of bounds'); - if (start === end) - throw new Error( - 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead', - ); - - this._split(start); - this._split(end); - - if (options === true) { - if (!warned.storeName) { - console.warn( - 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', - ); - warned.storeName = true; - } - - options = { storeName: true }; - } - const storeName = options !== undefined ? options.storeName : false; - const overwrite = options !== undefined ? options.overwrite : false; - - if (storeName) { - const original = this.original.slice(start, end); - Object.defineProperty(this.storedNames, original, { - writable: true, - value: true, - enumerable: true, - }); - } - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - if (first) { - let chunk = first; - while (chunk !== last) { - if (chunk.next !== this.byStart[chunk.end]) { - throw new Error('Cannot overwrite across a split point'); - } - chunk = chunk.next; - chunk.edit('', false); - } - - first.edit(content, storeName, !overwrite); - } else { - // must be inserting at the end - const newChunk = new Chunk(start, end, '').edit(content, storeName); - - // TODO last chunk in the array may not be the last chunk, if it's moved... - last.next = newChunk; - newChunk.previous = last; - } - return this; - } - - prepend(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.intro = content + this.intro; - return this; - } - - prependLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.prependLeft(content); - } else { - this.intro = content + this.intro; - } - return this; - } - - prependRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.prependRight(content); - } else { - this.outro = content + this.outro; - } - return this; - } - - remove(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.intro = ''; - chunk.outro = ''; - chunk.edit(''); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - reset(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.reset(); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - lastChar() { - if (this.outro.length) return this.outro[this.outro.length - 1]; - let chunk = this.lastChunk; - do { - if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1]; - if (chunk.content.length) return chunk.content[chunk.content.length - 1]; - if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1]; - } while ((chunk = chunk.previous)); - if (this.intro.length) return this.intro[this.intro.length - 1]; - return ''; - } - - lastLine() { - let lineIndex = this.outro.lastIndexOf(n); - if (lineIndex !== -1) return this.outro.substr(lineIndex + 1); - let lineStr = this.outro; - let chunk = this.lastChunk; - do { - if (chunk.outro.length > 0) { - lineIndex = chunk.outro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.outro + lineStr; - } - - if (chunk.content.length > 0) { - lineIndex = chunk.content.lastIndexOf(n); - if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr; - lineStr = chunk.content + lineStr; - } - - if (chunk.intro.length > 0) { - lineIndex = chunk.intro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.intro + lineStr; - } - } while ((chunk = chunk.previous)); - lineIndex = this.intro.lastIndexOf(n); - if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr; - return this.intro + lineStr; - } - - slice(start = 0, end = this.original.length - this.offset) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - let result = ''; - - // find start chunk - let chunk = this.firstChunk; - while (chunk && (chunk.start > start || chunk.end <= start)) { - // found end chunk before start - if (chunk.start < end && chunk.end >= end) { - return result; - } - - chunk = chunk.next; - } - - if (chunk && chunk.edited && chunk.start !== start) - throw new Error(`Cannot use replaced character ${start} as slice start anchor.`); - - const startChunk = chunk; - while (chunk) { - if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { - result += chunk.intro; - } - - const containsEnd = chunk.start < end && chunk.end >= end; - if (containsEnd && chunk.edited && chunk.end !== end) - throw new Error(`Cannot use replaced character ${end} as slice end anchor.`); - - const sliceStart = startChunk === chunk ? start - chunk.start : 0; - const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; - - result += chunk.content.slice(sliceStart, sliceEnd); - - if (chunk.outro && (!containsEnd || chunk.end === end)) { - result += chunk.outro; - } - - if (containsEnd) { - break; - } - - chunk = chunk.next; - } - - return result; - } - - // TODO deprecate this? not really very useful - snip(start, end) { - const clone = this.clone(); - clone.remove(0, start); - clone.remove(end, clone.original.length); - - return clone; - } - - _split(index) { - if (this.byStart[index] || this.byEnd[index]) return; - - let chunk = this.lastSearchedChunk; - let previousChunk = chunk; - const searchForward = index > chunk.end; - - while (chunk) { - if (chunk.contains(index)) return this._splitChunk(chunk, index); - - chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; - - // Prevent infinite loop (e.g. via empty chunks, where start === end) - if (chunk === previousChunk) return; - - previousChunk = chunk; - } - } - - _splitChunk(chunk, index) { - if (chunk.edited && chunk.content.length) { - // zero-length edited chunks are a special case (overlapping replacements) - const loc = getLocator(this.original)(index); - throw new Error( - `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, - ); - } - - const newChunk = chunk.split(index); - - this.byEnd[index] = chunk; - this.byStart[index] = newChunk; - this.byEnd[newChunk.end] = newChunk; - - if (chunk === this.lastChunk) this.lastChunk = newChunk; - - this.lastSearchedChunk = chunk; - return true; - } - - toString() { - let str = this.intro; - - let chunk = this.firstChunk; - while (chunk) { - str += chunk.toString(); - chunk = chunk.next; - } - - return str + this.outro; - } - - isEmpty() { - let chunk = this.firstChunk; - do { - if ( - (chunk.intro.length && chunk.intro.trim()) || - (chunk.content.length && chunk.content.trim()) || - (chunk.outro.length && chunk.outro.trim()) - ) - return false; - } while ((chunk = chunk.next)); - return true; - } - - length() { - let chunk = this.firstChunk; - let length = 0; - do { - length += chunk.intro.length + chunk.content.length + chunk.outro.length; - } while ((chunk = chunk.next)); - return length; - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimEndAborted(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - let chunk = this.lastChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimEnd(rx); - - // if chunk was trimmed, we have a new lastChunk - if (chunk.end !== end) { - if (this.lastChunk === chunk) { - this.lastChunk = chunk.next; - } - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.previous; - } while (chunk); - - return false; - } - - trimEnd(charType) { - this.trimEndAborted(charType); - return this; - } - trimStartAborted(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - let chunk = this.firstChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimStart(rx); - - if (chunk.end !== end) { - // special case... - if (chunk === this.lastChunk) this.lastChunk = chunk.next; - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.next; - } while (chunk); - - return false; - } - - trimStart(charType) { - this.trimStartAborted(charType); - return this; - } - - hasChanged() { - return this.original !== this.toString(); - } - - _replaceRegexp(searchValue, replacement) { - function getReplacement(match, str) { - if (typeof replacement === 'string') { - return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter - if (i === '$') return '$'; - if (i === '&') return match[0]; - const num = +i; - if (num < match.length) return match[+i]; - return `$${i}`; - }); - } else { - return replacement(...match, match.index, str, match.groups); - } - } - function matchAll(re, str) { - let match; - const matches = []; - while ((match = re.exec(str))) { - matches.push(match); - } - return matches; - } - if (searchValue.global) { - const matches = matchAll(searchValue, this.original); - matches.forEach((match) => { - if (match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - }); - } else { - const match = this.original.match(searchValue); - if (match && match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - } - return this; - } - - _replaceString(string, replacement) { - const { original } = this; - const index = original.indexOf(string); - - if (index !== -1) { - if (typeof replacement === 'function') { - replacement = replacement(string, index, original); - } - if (string !== replacement) { - this.overwrite(index, index + string.length, replacement); - } - } - - return this; - } - - replace(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceString(searchValue, replacement); - } - - return this._replaceRegexp(searchValue, replacement); - } - - _replaceAllString(string, replacement) { - const { original } = this; - const stringLength = string.length; - for ( - let index = original.indexOf(string); - index !== -1; - index = original.indexOf(string, index + stringLength) - ) { - const previous = original.slice(index, index + stringLength); - let _replacement = replacement; - if (typeof replacement === 'function') { - _replacement = replacement(previous, index, original); - } - if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement); - } - - return this; - } - - replaceAll(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceAllString(searchValue, replacement); - } - - if (!searchValue.global) { - throw new TypeError( - 'MagicString.prototype.replaceAll called with a non-global RegExp argument', - ); - } - - return this._replaceRegexp(searchValue, replacement); - } -} - -const hasOwnProp = Object.prototype.hasOwnProperty; - -class Bundle { - constructor(options = {}) { - this.intro = options.intro || ''; - this.separator = options.separator !== undefined ? options.separator : '\n'; - this.sources = []; - this.uniqueSources = []; - this.uniqueSourceIndexByFilename = {}; - } - - addSource(source) { - if (source instanceof MagicString) { - return this.addSource({ - content: source, - filename: source.filename, - separator: this.separator, - }); - } - - if (!isObject(source) || !source.content) { - throw new Error( - 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`', - ); - } - - ['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => { - if (!hasOwnProp.call(source, option)) source[option] = source.content[option]; - }); - - if (source.separator === undefined) { - // TODO there's a bunch of this sort of thing, needs cleaning up - source.separator = this.separator; - } - - if (source.filename) { - if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) { - this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length; - this.uniqueSources.push({ filename: source.filename, content: source.content.original }); - } else { - const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]]; - if (source.content.original !== uniqueSource.content) { - throw new Error(`Illegal source: same filename (${source.filename}), different contents`); - } - } - } - - this.sources.push(source); - return this; - } - - append(str, options) { - this.addSource({ - content: new MagicString(str), - separator: (options && options.separator) || '', - }); - - return this; - } - - clone() { - const bundle = new Bundle({ - intro: this.intro, - separator: this.separator, - }); - - this.sources.forEach((source) => { - bundle.addSource({ - filename: source.filename, - content: source.content.clone(), - separator: source.separator, - }); - }); - - return bundle; - } - - generateDecodedMap(options = {}) { - const names = []; - let x_google_ignoreList = undefined; - this.sources.forEach((source) => { - Object.keys(source.content.storedNames).forEach((name) => { - if (!~names.indexOf(name)) names.push(name); - }); - }); - - const mappings = new Mappings(options.hires); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.sources.forEach((source, i) => { - if (i > 0) { - mappings.advance(this.separator); - } - - const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1; - const magicString = source.content; - const locate = getLocator(magicString.original); - - if (magicString.intro) { - mappings.advance(magicString.intro); - } - - magicString.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (source.filename) { - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk( - sourceIndex, - chunk, - magicString.original, - loc, - magicString.sourcemapLocations, - ); - } - } else { - mappings.advance(chunk.content); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (magicString.outro) { - mappings.advance(magicString.outro); - } - - if (source.ignoreList && sourceIndex !== -1) { - if (x_google_ignoreList === undefined) { - x_google_ignoreList = []; - } - x_google_ignoreList.push(sourceIndex); - } - }); - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: this.uniqueSources.map((source) => { - return options.file ? getRelativePath(options.file, source.filename) : source.filename; - }), - sourcesContent: this.uniqueSources.map((source) => { - return options.includeContent ? source.content : null; - }), - names, - mappings: mappings.raw, - x_google_ignoreList, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - getIndentString() { - const indentStringCounts = {}; - - this.sources.forEach((source) => { - const indentStr = source.content._getRawIndentString(); - - if (indentStr === null) return; - - if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0; - indentStringCounts[indentStr] += 1; - }); - - return ( - Object.keys(indentStringCounts).sort((a, b) => { - return indentStringCounts[a] - indentStringCounts[b]; - })[0] || '\t' - ); - } - - indent(indentStr) { - if (!arguments.length) { - indentStr = this.getIndentString(); - } - - if (indentStr === '') return this; // noop - - let trailingNewline = !this.intro || this.intro.slice(-1) === '\n'; - - this.sources.forEach((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator)); - - source.content.indent(indentStr, { - exclude: source.indentExclusionRanges, - indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator ) - }); - - trailingNewline = source.content.lastChar() === '\n'; - }); - - if (this.intro) { - this.intro = - indentStr + - this.intro.replace(/^[^\n]/gm, (match, index) => { - return index > 0 ? indentStr + match : match; - }); - } - - return this; - } - - prepend(str) { - this.intro = str + this.intro; - return this; - } - - toString() { - const body = this.sources - .map((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const str = (i > 0 ? separator : '') + source.content.toString(); - - return str; - }) - .join(''); - - return this.intro + body; - } - - isEmpty() { - if (this.intro.length && this.intro.trim()) return false; - if (this.sources.some((source) => !source.content.isEmpty())) return false; - return true; - } - - length() { - return this.sources.reduce( - (length, source) => length + source.content.length(), - this.intro.length, - ); - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimStart(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - this.intro = this.intro.replace(rx, ''); - - if (!this.intro) { - let source; - let i = 0; - - do { - source = this.sources[i++]; - if (!source) { - break; - } - } while (!source.content.trimStartAborted(charType)); - } - - return this; - } - - trimEnd(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - let source; - let i = this.sources.length - 1; - - do { - source = this.sources[i--]; - if (!source) { - this.intro = this.intro.replace(rx, ''); - break; - } - } while (!source.content.trimEndAborted(charType)); - - return this; - } -} - -MagicString.Bundle = Bundle; -MagicString.SourceMap = SourceMap; -MagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121 - -module.exports = MagicString; -//# sourceMappingURL=magic-string.cjs.js.map diff --git a/node_modules/magic-string/dist/magic-string.cjs.js.map b/node_modules/magic-string/dist/magic-string.cjs.js.map deleted file mode 100644 index 685274f..0000000 --- a/node_modules/magic-string/dist/magic-string.cjs.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"magic-string.cjs.js","sources":["../src/BitSet.js","../src/Chunk.js","../src/SourceMap.js","../src/utils/guessIndent.js","../src/utils/getRelativePath.js","../src/utils/isObject.js","../src/utils/getLocator.js","../src/utils/Mappings.js","../src/MagicString.js","../src/Bundle.js","../src/index-legacy.js"],"sourcesContent":["export default class BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & (1 << (n & 31)));\n\t}\n}\n","export default class Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\n\t\tif (DEBUG) {\n\t\t\t// we make these non-enumerable, for sanity while debugging\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tprevious: { writable: true, value: null },\n\t\t\t\tnext: { writable: true, value: null },\n\t\t\t});\n\t\t} else {\n\t\t\tthis.previous = null;\n\t\t\tthis.next = null;\n\t\t}\n\t}\n\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t}\n\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\n\teachNext(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\n\teachPrevious(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = '';\n\t\t\tthis.outro = '';\n\t\t}\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t}\n\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\n\treset() {\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\n\t\tthis.original = originalBefore;\n\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif (this.edited) {\n\t\t\t// after split we should save the edit content record into the correct chunk\n\t\t\t// to make sure sourcemap correct\n\t\t\t// For example:\n\t\t\t// ' test'.trim()\n\t\t\t// split -> ' ' + 'test'\n\t\t\t// ✔️ edit -> '' + 'test'\n\t\t\t// ✖️ edit -> 'test' + ''\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit('', false);\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t}\n\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tthis.split(this.start + trimmed.length).edit('', undefined, true);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tthis.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tconst newChunk = this.split(this.end - trimmed.length);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tnewChunk.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t\tthis.edit('', undefined, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.outro = this.outro.replace(rx, '');\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n}\n","import { encode } from '@jridgewell/sourcemap-codec';\n\nfunction getBtoa() {\n\tif (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n\t\treturn (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\t} else if (typeof Buffer === 'function') {\n\t\treturn (str) => Buffer.from(str, 'utf-8').toString('base64');\n\t} else {\n\t\treturn () => {\n\t\t\tthrow new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');\n\t\t};\n\t}\n}\n\nconst btoa = /*#__PURE__*/ getBtoa();\n\nexport default class SourceMap {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== 'undefined') {\n\t\t\tthis.x_google_ignoreList = properties.x_google_ignoreList;\n\t\t}\n\t\tif (typeof properties.debugId !== 'undefined') {\n\t\t\tthis.debugId = properties.debugId;\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\n\ttoUrl() {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());\n\t}\n}\n","export default function guessIndent(code) {\n\tconst lines = code.split('\\n');\n\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\n\tif (tabbed.length === 0 && spaced.length === 0) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif (tabbed.length >= spaced.length) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\n\treturn new Array(min + 1).join(' ');\n}\n","export default function getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\n\tfromParts.pop(); // get dirname\n\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat(toParts).join('/');\n}\n","const toString = Object.prototype.toString;\n\nexport default function isObject(thing) {\n\treturn toString.call(thing) === '[object Object]';\n}\n","export default function getLocator(source) {\n\tconst originalLines = source.split('\\n');\n\tconst lineOffsets = [];\n\n\tfor (let i = 0, pos = 0; i < originalLines.length; i++) {\n\t\tlineOffsets.push(pos);\n\t\tpos += originalLines[i].length + 1;\n\t}\n\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = (i + j) >> 1;\n\t\t\tif (index < lineOffsets[m]) {\n\t\t\t\tj = m;\n\t\t\t} else {\n\t\t\t\ti = m + 1;\n\t\t\t}\n\t\t}\n\t\tconst line = i - 1;\n\t\tconst column = index - lineOffsets[line];\n\t\treturn { line, column };\n\t};\n}\n","const wordRegex = /\\w/;\n\nexport default class Mappings {\n\tconstructor(hires) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.pending = null;\n\t}\n\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf('\\n', 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\t// Loop through each line in the content and add a segment, but stop if the last line is empty,\n\t\t\t// else code afterwards would fill one line too many\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\t\tif (nameIndex >= 0) {\n\t\t\t\t\tsegment.push(nameIndex);\n\t\t\t\t}\n\t\t\t\tthis.rawSegments.push(segment);\n\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf('\\n', contentLineEnd + 1);\n\t\t\t}\n\n\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\tif (nameIndex >= 0) {\n\t\t\t\tsegment.push(nameIndex);\n\t\t\t}\n\t\t\tthis.rawSegments.push(segment);\n\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t} else if (this.pending) {\n\t\t\tthis.rawSegments.push(this.pending);\n\t\t\tthis.advance(content);\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tlet originalCharIndex = chunk.start;\n\t\tlet first = true;\n\t\t// when iterating each char, check if it's in a word boundary\n\t\tlet charInHiresBoundary = false;\n\n\t\twhile (originalCharIndex < chunk.end) {\n\t\t\tif (original[originalCharIndex] === '\\n') {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\t\t\t\tfirst = true;\n\t\t\t\tcharInHiresBoundary = false;\n\t\t\t} else {\n\t\t\t\tif (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n\t\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\n\t\t\t\t\tif (this.hires === 'boundary') {\n\t\t\t\t\t\t// in hires \"boundary\", group segments per word boundary than per char\n\t\t\t\t\t\tif (wordRegex.test(original[originalCharIndex])) {\n\t\t\t\t\t\t\t// for first char in the boundary found, start the boundary by pushing a segment\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// for non-word char, end the boundary by pushing a segment\n\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tloc.column += 1;\n\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\tfirst = false;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\tadvance(str) {\n\t\tif (!str) return;\n\n\t\tconst lines = str.split('\\n');\n\n\t\tif (lines.length > 1) {\n\t\t\tfor (let i = 0; i < lines.length - 1; i++) {\n\t\t\t\tthis.generatedCodeLine++;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t}\n\t\t\tthis.generatedCodeColumn = 0;\n\t\t}\n\n\t\tthis.generatedCodeColumn += lines[lines.length - 1].length;\n\t}\n}\n","import BitSet from './BitSet.js';\nimport Chunk from './Chunk.js';\nimport SourceMap from './SourceMap.js';\nimport guessIndent from './utils/guessIndent.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\nimport Stats from './utils/Stats.js';\n\nconst n = '\\n';\n\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false,\n};\n\nexport default class MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: { writable: true, value: string },\n\t\t\toutro: { writable: true, value: '' },\n\t\t\tintro: { writable: true, value: '' },\n\t\t\tfirstChunk: { writable: true, value: chunk },\n\t\t\tlastChunk: { writable: true, value: chunk },\n\t\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\t\tbyStart: { writable: true, value: {} },\n\t\t\tbyEnd: { writable: true, value: {} },\n\t\t\tfilename: { writable: true, value: options.filename },\n\t\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\t\tsourcemapLocations: { writable: true, value: new BitSet() },\n\t\t\tstoredNames: { writable: true, value: {} },\n\t\t\tindentStr: { writable: true, value: undefined },\n\t\t\tignoreList: { writable: true, value: options.ignoreList },\n\t\t\toffset: { writable: true, value: options.offset || 0 },\n\t\t});\n\n\t\tif (DEBUG) {\n\t\t\tObject.defineProperty(this, 'stats', { value: new Stats() });\n\t\t}\n\n\t\tthis.byStart[0] = chunk;\n\t\tthis.byEnd[string.length] = chunk;\n\t}\n\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\n\tappend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendLeft');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendLeft(content);\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendLeft');\n\t\treturn this;\n\t}\n\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendRight(content);\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendRight');\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });\n\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());\n\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart[clonedChunk.start] = clonedChunk;\n\t\t\tcloned.byEnd[clonedChunk.end] = clonedChunk;\n\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif (this.indentExclusionRanges) {\n\t\t\tcloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\t}\n\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\n\t\treturn cloned;\n\t}\n\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tconst locate = getLocator(this.original);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tmappings.addEdit(\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tchunk.content,\n\t\t\t\t\tloc,\n\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\t}\n\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\n\t\tif (this.outro) {\n\t\t\tmappings.advance(this.outro);\n\t\t}\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: [\n\t\t\t\toptions.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n\t\t\t],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : undefined,\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\t_ensureindentStr() {\n\t\tif (this.indentStr === undefined) {\n\t\t\tthis.indentStr = guessIndent(this.original);\n\t\t}\n\t}\n\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t}\n\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tif (indentStr === undefined) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || '\\t';\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tconst isExcluded = {};\n\n\t\tif (options.exclude) {\n\t\t\tconst exclusions =\n\t\t\t\ttypeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;\n\t\t\texclusions.forEach((exclusion) => {\n\t\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst replacer = (match) => {\n\t\t\tif (shouldIndentNextCharacter) return `${indentStr}${match}`;\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace(pattern, replacer);\n\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\tchunk.content = chunk.content.replace(pattern, replacer);\n\n\t\t\t\t\tif (chunk.content.length) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original[charIndex];\n\n\t\t\t\t\t\tif (char === '\\n') {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if (char !== '\\r' && shouldIndentNextCharacter) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif (charIndex === chunk.start) {\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._splitChunk(chunk, charIndex);\n\t\t\t\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace(pattern, replacer);\n\n\t\treturn this;\n\t}\n\n\tinsert() {\n\t\tthrow new Error(\n\t\t\t'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n\t\t);\n\t}\n\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n\t\t\t);\n\t\t\twarned.insertLeft = true;\n\t\t}\n\n\t\treturn this.appendLeft(index, content);\n\t}\n\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n\t\t\t);\n\t\t\twarned.insertRight = true;\n\t\t}\n\n\t\treturn this.prependRight(index, content);\n\t}\n\n\tmove(start, end, index) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\n\t\tif (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');\n\n\t\tif (DEBUG) this.stats.time('move');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\n\t\tconst newRight = this.byStart[index];\n\t\tif (!newRight && last === this.lastChunk) return this;\n\t\tconst newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\n\t\tif (DEBUG) this.stats.timeEnd('move');\n\t\treturn this;\n\t}\n\n\toverwrite(start, end, content, options) {\n\t\toptions = options || {};\n\t\treturn this.update(start, end, content, { ...options, overwrite: !options.contentOnly });\n\t}\n\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('replacement content must be a string');\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (end > this.original.length) throw new Error('end is out of bounds');\n\t\tif (start === end)\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n\t\t\t);\n\n\t\tif (DEBUG) this.stats.time('overwrite');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n\t\t\t\t);\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst storeName = options !== undefined ? options.storeName : false;\n\t\tconst overwrite = options !== undefined ? options.overwrite : false;\n\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart[chunk.end]) {\n\t\t\t\t\tthrow new Error('Cannot overwrite across a split point');\n\t\t\t\t}\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit('', false);\n\t\t\t}\n\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\t// must be inserting at the end\n\t\t\tconst newChunk = new Chunk(start, end, '').edit(content, storeName);\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('overwrite');\n\t\treturn this;\n\t}\n\n\tprepend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependLeft(content);\n\t\t} else {\n\t\t\tthis.intro = content + this.intro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependRight(content);\n\t\t} else {\n\t\t\tthis.outro = content + this.outro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('remove');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.intro = '';\n\t\t\tchunk.outro = '';\n\t\t\tchunk.edit('');\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('remove');\n\t\treturn this;\n\t}\n\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('reset');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('reset');\n\t\treturn this;\n\t}\n\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t} while ((chunk = chunk.previous));\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn '';\n\t}\n\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t} while ((chunk = chunk.previous));\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tlet result = '';\n\n\t\t// find start chunk\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\t// found end chunk before start\n\t\t\tif (chunk.start < end && chunk.end >= end) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif (chunk && chunk.edited && chunk.start !== start)\n\t\t\tthrow new Error(`Cannot use replaced character ${start} as slice start anchor.`);\n\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end)\n\t\t\t\tthrow new Error(`Cannot use replaced character ${end} as slice end anchor.`);\n\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif (containsEnd) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// TODO deprecate this? not really very useful\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\n\t\treturn clone;\n\t}\n\n\t_split(index) {\n\t\tif (this.byStart[index] || this.byEnd[index]) return;\n\n\t\tif (DEBUG) this.stats.time('_split');\n\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\n\t\t\tchunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];\n\n\t\t\t// Prevent infinite loop (e.g. via empty chunks, where start === end)\n\t\t\tif (chunk === previousChunk) return;\n\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\t// zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n\t\t\t);\n\t\t}\n\n\t\tconst newChunk = chunk.split(index);\n\n\t\tthis.byEnd[index] = chunk;\n\t\tthis.byStart[index] = newChunk;\n\t\tthis.byEnd[newChunk.end] = newChunk;\n\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\tif (DEBUG) this.stats.timeEnd('_split');\n\t\treturn true;\n\t}\n\n\ttoString() {\n\t\tlet str = this.intro;\n\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t}\n\n\tisEmpty() {\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tif (\n\t\t\t\t(chunk.intro.length && chunk.intro.trim()) ||\n\t\t\t\t(chunk.content.length && chunk.content.trim()) ||\n\t\t\t\t(chunk.outro.length && chunk.outro.trim())\n\t\t\t)\n\t\t\t\treturn false;\n\t\t} while ((chunk = chunk.next));\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\tdo {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t} while ((chunk = chunk.next));\n\t\treturn length;\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tlet chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) {\n\t\t\t\t\tthis.lastChunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tlet chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\n\t\t\tif (chunk.end !== end) {\n\t\t\t\t// special case...\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\n\thasChanged() {\n\t\treturn this.original !== this.toString();\n\t}\n\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === 'string') {\n\t\t\t\treturn replacement.replace(/\\$(\\$|&|\\d+)/g, (_, i) => {\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n\t\t\t\t\tif (i === '$') return '$';\n\t\t\t\t\tif (i === '&') return match[0];\n\t\t\t\t\tconst num = +i;\n\t\t\t\t\tif (num < match.length) return match[+i];\n\t\t\t\t\treturn `$${i}`;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn replacement(...match, match.index, str, match.groups);\n\t\t\t}\n\t\t}\n\t\tfunction matchAll(re, str) {\n\t\t\tlet match;\n\t\t\tconst matches = [];\n\t\t\twhile ((match = re.exec(str))) {\n\t\t\t\tmatches.push(match);\n\t\t\t}\n\t\t\treturn matches;\n\t\t}\n\t\tif (searchValue.global) {\n\t\t\tconst matches = matchAll(searchValue, this.original);\n\t\t\tmatches.forEach((match) => {\n\t\t\t\tif (match.index != null) {\n\t\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && match.index != null) {\n\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst index = original.indexOf(string);\n\n\t\tif (index !== -1) {\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\treplacement = replacement(string, index, original);\n\t\t\t}\n\t\t\tif (string !== replacement) {\n\t\t\t\tthis.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceString(searchValue, replacement);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tfor (\n\t\t\tlet index = original.indexOf(string);\n\t\t\tindex !== -1;\n\t\t\tindex = original.indexOf(string, index + stringLength)\n\t\t) {\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tlet _replacement = replacement;\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\t_replacement = replacement(previous, index, original);\n\t\t\t}\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceAllString(searchValue, replacement);\n\t\t}\n\n\t\tif (!searchValue.global) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n\t\t\t);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n}\n","import MagicString from './MagicString.js';\nimport SourceMap from './SourceMap.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\n\nconst hasOwnProp = Object.prototype.hasOwnProperty;\n\nexport default class Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || '';\n\t\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\n\taddSource(source) {\n\t\tif (source instanceof MagicString) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator,\n\t\t\t});\n\t\t}\n\n\t\tif (!isObject(source) || !source.content) {\n\t\t\tthrow new Error(\n\t\t\t\t'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n\t\t\t);\n\t\t}\n\n\t\t['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\n\t\tif (source.separator === undefined) {\n\t\t\t// TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) {\n\t\t\t\t\tthrow new Error(`Illegal source: same filename (${source.filename}), different contents`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: (options && options.separator) || '',\n\t\t});\n\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator,\n\t\t});\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator,\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t}\n\n\tgenerateDecodedMap(options = {}) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList = undefined;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!~names.indexOf(name)) names.push(name);\n\t\t\t});\n\t\t});\n\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0) {\n\t\t\t\tmappings.advance(this.separator);\n\t\t\t}\n\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\n\t\t\tif (magicString.intro) {\n\t\t\t\tmappings.advance(magicString.intro);\n\t\t\t}\n\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) {\n\t\t\t\t\t\tmappings.addEdit(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk.content,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.addUneditedChunk(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk,\n\t\t\t\t\t\t\tmagicString.original,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tmagicString.sourcemapLocations,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmappings.advance(chunk.content);\n\t\t\t\t}\n\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\n\t\t\tif (magicString.outro) {\n\t\t\t\tmappings.advance(magicString.outro);\n\t\t\t}\n\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === undefined) {\n\t\t\t\t\tx_google_ignoreList = [];\n\t\t\t\t}\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\n\t\t\tif (indentStr === null) return;\n\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\n\t\treturn (\n\t\t\tObject.keys(indentStringCounts).sort((a, b) => {\n\t\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t\t})[0] || '\\t'\n\t\t);\n\t}\n\n\tindent(indentStr) {\n\t\tif (!arguments.length) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === '\\n';\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator));\n\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart, //: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\ttrailingNewline = source.content.lastChar() === '\\n';\n\t\t});\n\n\t\tif (this.intro) {\n\t\t\tthis.intro =\n\t\t\t\tindentStr +\n\t\t\t\tthis.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\n\ttoString() {\n\t\tconst body = this.sources\n\t\t\t.map((source, i) => {\n\t\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\t\tconst str = (i > 0 ? separator : '') + source.content.toString();\n\n\t\t\t\treturn str;\n\t\t\t})\n\t\t\t.join('');\n\n\t\treturn this.intro + body;\n\t}\n\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source) => !source.content.isEmpty())) return false;\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\treturn this.sources.reduce(\n\t\t\t(length, source) => length + source.content.length(),\n\t\t\tthis.intro.length,\n\t\t);\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\t\tthis.intro = this.intro.replace(rx, '');\n\n\t\tif (!this.intro) {\n\t\t\tlet source;\n\t\t\tlet i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this.sources[i++];\n\t\t\t\tif (!source) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (!source.content.trimStartAborted(charType));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tlet source;\n\t\tlet i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this.sources[i--];\n\t\t\tif (!source) {\n\t\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (!source.content.trimEndAborted(charType));\n\n\t\treturn this;\n\t}\n}\n","import MagicString from './MagicString.js';\nimport Bundle from './Bundle.js';\nimport SourceMap from './SourceMap.js';\n\nMagicString.Bundle = Bundle;\nMagicString.SourceMap = SourceMap;\nMagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121\n\nexport default MagicString;\n"],"names":["encode"],"mappings":";;;;AAAe,MAAM,MAAM,CAAC;AAC5B,CAAC,WAAW,CAAC,GAAG,EAAE;AAClB,EAAE,IAAI,CAAC,IAAI,GAAG,GAAG,YAAY,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;AAC3D,CAAC;;AAED,CAAC,GAAG,CAAC,CAAC,EAAE;AACR,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;AACpC,CAAC;;AAED,CAAC,GAAG,CAAC,CAAC,EAAE;AACR,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;AAChD,CAAC;AACD;;ACZe,MAAM,KAAK,CAAC;AAC3B,CAAC,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE;AAClC,EAAE,IAAI,CAAC,KAAK,GAAG,KAAK;AACpB,EAAE,IAAI,CAAC,GAAG,GAAG,GAAG;AAChB,EAAE,IAAI,CAAC,QAAQ,GAAG,OAAO;;AAEzB,EAAE,IAAI,CAAC,KAAK,GAAG,EAAE;AACjB,EAAE,IAAI,CAAC,KAAK,GAAG,EAAE;;AAEjB,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CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC;;AAEnD,EAAE,OAAO,IAAI;AACb,CAAC;AACD;;ACpSA,WAAW,CAAC,MAAM,GAAG,MAAM;AAC3B,WAAW,CAAC,SAAS,GAAG,SAAS;AACjC,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC;;;;"} \ No newline at end of file diff --git a/node_modules/magic-string/dist/magic-string.es.d.mts b/node_modules/magic-string/dist/magic-string.es.d.mts deleted file mode 100644 index 76cc537..0000000 --- a/node_modules/magic-string/dist/magic-string.es.d.mts +++ /dev/null @@ -1,289 +0,0 @@ -export interface BundleOptions { - intro?: string; - separator?: string; -} - -export interface SourceMapOptions { - /** - * Whether the mapping should be high-resolution. - * Hi-res mappings map every single character, meaning (for example) your devtools will always - * be able to pinpoint the exact location of function calls and so on. - * With lo-res mappings, devtools may only be able to identify the correct - * line - but they're quicker to generate and less bulky. - * You can also set `"boundary"` to generate a semi-hi-res mappings segmented per word boundary - * instead of per character, suitable for string semantics that are separated by words. - * If sourcemap locations have been specified with s.addSourceMapLocation(), they will be used here. - */ - hires?: boolean | 'boundary'; - /** - * The filename where you plan to write the sourcemap. - */ - file?: string; - /** - * The filename of the file containing the original source. - */ - source?: string; - /** - * Whether to include the original content in the map's sourcesContent array. - */ - includeContent?: boolean; -} - -export type SourceMapSegment = - | [number] - | [number, number, number, number] - | [number, number, number, number, number]; - -export interface DecodedSourceMap { - file: string; - sources: string[]; - sourcesContent?: string[]; - names: string[]; - mappings: SourceMapSegment[][]; - x_google_ignoreList?: number[]; -} - -export class SourceMap { - constructor(properties: DecodedSourceMap); - - version: number; - file: string; - sources: string[]; - sourcesContent?: string[]; - names: string[]; - mappings: string; - x_google_ignoreList?: number[]; - debugId?: string; - - /** - * Returns the equivalent of `JSON.stringify(map)` - */ - toString(): string; - /** - * Returns a DataURI containing the sourcemap. Useful for doing this sort of thing: - * `generateMap(options?: SourceMapOptions): SourceMap;` - */ - toUrl(): string; -} - -export class Bundle { - constructor(options?: BundleOptions); - /** - * Adds the specified source to the bundle, which can either be a `MagicString` object directly, - * or an options object that holds a magic string `content` property and optionally provides - * a `filename` for the source within the bundle, as well as an optional `ignoreList` hint - * (which defaults to `false`). The `filename` is used when constructing the source map for the - * bundle, to identify this `source` in the source map's `sources` field. The `ignoreList` hint - * is used to populate the `x_google_ignoreList` extension field in the source map, which is a - * mechanism for tools to signal to debuggers that certain sources should be ignored by default - * (depending on user preferences). - */ - addSource( - source: MagicString | { filename?: string; content: MagicString; ignoreList?: boolean }, - ): this; - append(str: string, options?: BundleOptions): this; - clone(): this; - generateMap( - options?: SourceMapOptions, - ): Omit & { sourcesContent: Array }; - generateDecodedMap( - options?: SourceMapOptions, - ): Omit & { sourcesContent: Array }; - getIndentString(): string; - indent(indentStr?: string): this; - indentExclusionRanges: ExclusionRange | Array; - prepend(str: string): this; - toString(): string; - trimLines(): this; - trim(charType?: string): this; - trimStart(charType?: string): this; - trimEnd(charType?: string): this; - isEmpty(): boolean; - length(): number; -} - -export type ExclusionRange = [number, number]; - -export interface MagicStringOptions { - filename?: string; - indentExclusionRanges?: ExclusionRange | Array; - offset?: number; -} - -export interface IndentOptions { - exclude?: ExclusionRange | Array; - indentStart?: boolean; -} - -export interface OverwriteOptions { - storeName?: boolean; - contentOnly?: boolean; -} - -export interface UpdateOptions { - storeName?: boolean; - overwrite?: boolean; -} - -export default class MagicString { - constructor(str: string, options?: MagicStringOptions); - /** - * Adds the specified character index (with respect to the original string) to sourcemap mappings, if `hires` is false. - */ - addSourcemapLocation(char: number): void; - /** - * Appends the specified content to the end of the string. - */ - append(content: string): this; - /** - * Appends the specified content at the index in the original string. - * If a range *ending* with index is subsequently moved, the insert will be moved with it. - * See also `s.prependLeft(...)`. - */ - appendLeft(index: number, content: string): this; - /** - * Appends the specified content at the index in the original string. - * If a range *starting* with index is subsequently moved, the insert will be moved with it. - * See also `s.prependRight(...)`. - */ - appendRight(index: number, content: string): this; - /** - * Does what you'd expect. - */ - clone(): this; - /** - * Generates a version 3 sourcemap. - */ - generateMap(options?: SourceMapOptions): SourceMap; - /** - * Generates a sourcemap object with raw mappings in array form, rather than encoded as a string. - * Useful if you need to manipulate the sourcemap further, but most of the time you will use `generateMap` instead. - */ - generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap; - getIndentString(): string; - - /** - * Prefixes each line of the string with prefix. - * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. - */ - indent(options?: IndentOptions): this; - /** - * Prefixes each line of the string with prefix. - * If prefix is not supplied, the indentation will be guessed from the original content, falling back to a single tab character. - * - * The options argument can have an exclude property, which is an array of [start, end] character ranges. - * These ranges will be excluded from the indentation - useful for (e.g.) multiline strings. - */ - indent(indentStr?: string, options?: IndentOptions): this; - indentExclusionRanges: ExclusionRange | Array; - - /** - * Moves the characters from `start` and `end` to `index`. - */ - move(start: number, end: number, index: number): this; - /** - * Replaces the characters from `start` to `end` with `content`, along with the appended/prepended content in - * that range. The same restrictions as `s.remove()` apply. - * - * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored - * for later inclusion in a sourcemap's names array — and a contentOnly property which determines whether only - * the content is overwritten, or anything that was appended/prepended to the range as well. - * - * It may be preferred to use `s.update(...)` instead if you wish to avoid overwriting the appended/prepended content. - */ - overwrite( - start: number, - end: number, - content: string, - options?: boolean | OverwriteOptions, - ): this; - /** - * Replaces the characters from `start` to `end` with `content`. The same restrictions as `s.remove()` apply. - * - * The fourth argument is optional. It can have a storeName property — if true, the original name will be stored - * for later inclusion in a sourcemap's names array — and an overwrite property which determines whether only - * the content is overwritten, or anything that was appended/prepended to the range as well. - */ - update(start: number, end: number, content: string, options?: boolean | UpdateOptions): this; - /** - * Prepends the string with the specified content. - */ - prepend(content: string): this; - /** - * Same as `s.appendLeft(...)`, except that the inserted content will go *before* any previous appends or prepends at index - */ - prependLeft(index: number, content: string): this; - /** - * Same as `s.appendRight(...)`, except that the inserted content will go *before* any previous appends or prepends at `index` - */ - prependRight(index: number, content: string): this; - /** - * Removes the characters from `start` to `end` (of the original string, **not** the generated string). - * Removing the same content twice, or making removals that partially overlap, will cause an error. - */ - remove(start: number, end: number): this; - /** - * Reset the modified characters from `start` to `end` (of the original string, **not** the generated string). - */ - reset(start: number, end: number): this; - /** - * Returns the content of the generated string that corresponds to the slice between `start` and `end` of the original string. - * Throws error if the indices are for characters that were already removed. - */ - slice(start: number, end: number): string; - /** - * Returns a clone of `s`, with all content before the `start` and `end` characters of the original string removed. - */ - snip(start: number, end: number): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start and end. - */ - trim(charType?: string): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the start. - */ - trimStart(charType?: string): this; - /** - * Trims content matching `charType` (defaults to `\s`, i.e. whitespace) from the end. - */ - trimEnd(charType?: string): this; - /** - * Removes empty lines from the start and end. - */ - trimLines(): this; - /** - * String replacement with RegExp or string. - */ - replace( - regex: RegExp | string, - replacement: string | ((substring: string, ...args: any[]) => string), - ): this; - /** - * Same as `s.replace`, but replace all matched strings instead of just one. - */ - replaceAll( - regex: RegExp | string, - replacement: string | ((substring: string, ...args: any[]) => string), - ): this; - - lastChar(): string; - lastLine(): string; - /** - * Returns true if the resulting source is empty (disregarding white space). - */ - isEmpty(): boolean; - length(): number; - - /** - * Indicates if the string has been changed. - */ - hasChanged(): boolean; - - original: string; - /** - * Returns the generated string. - */ - toString(): string; - - offset: number; -} diff --git a/node_modules/magic-string/dist/magic-string.es.mjs b/node_modules/magic-string/dist/magic-string.es.mjs deleted file mode 100644 index c7999fc..0000000 --- a/node_modules/magic-string/dist/magic-string.es.mjs +++ /dev/null @@ -1,1588 +0,0 @@ -import { encode } from '@jridgewell/sourcemap-codec'; - -class BitSet { - constructor(arg) { - this.bits = arg instanceof BitSet ? arg.bits.slice() : []; - } - - add(n) { - this.bits[n >> 5] |= 1 << (n & 31); - } - - has(n) { - return !!(this.bits[n >> 5] & (1 << (n & 31))); - } -} - -class Chunk { - constructor(start, end, content) { - this.start = start; - this.end = end; - this.original = content; - - this.intro = ''; - this.outro = ''; - - this.content = content; - this.storeName = false; - this.edited = false; - - { - this.previous = null; - this.next = null; - } - } - - appendLeft(content) { - this.outro += content; - } - - appendRight(content) { - this.intro = this.intro + content; - } - - clone() { - const chunk = new Chunk(this.start, this.end, this.original); - - chunk.intro = this.intro; - chunk.outro = this.outro; - chunk.content = this.content; - chunk.storeName = this.storeName; - chunk.edited = this.edited; - - return chunk; - } - - contains(index) { - return this.start < index && index < this.end; - } - - eachNext(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.next; - } - } - - eachPrevious(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.previous; - } - } - - edit(content, storeName, contentOnly) { - this.content = content; - if (!contentOnly) { - this.intro = ''; - this.outro = ''; - } - this.storeName = storeName; - - this.edited = true; - - return this; - } - - prependLeft(content) { - this.outro = content + this.outro; - } - - prependRight(content) { - this.intro = content + this.intro; - } - - reset() { - this.intro = ''; - this.outro = ''; - if (this.edited) { - this.content = this.original; - this.storeName = false; - this.edited = false; - } - } - - split(index) { - const sliceIndex = index - this.start; - - const originalBefore = this.original.slice(0, sliceIndex); - const originalAfter = this.original.slice(sliceIndex); - - this.original = originalBefore; - - const newChunk = new Chunk(index, this.end, originalAfter); - newChunk.outro = this.outro; - this.outro = ''; - - this.end = index; - - if (this.edited) { - // after split we should save the edit content record into the correct chunk - // to make sure sourcemap correct - // For example: - // ' test'.trim() - // split -> ' ' + 'test' - // ✔️ edit -> '' + 'test' - // ✖️ edit -> 'test' + '' - // TODO is this block necessary?... - newChunk.edit('', false); - this.content = ''; - } else { - this.content = originalBefore; - } - - newChunk.next = this.next; - if (newChunk.next) newChunk.next.previous = newChunk; - newChunk.previous = this; - this.next = newChunk; - - return newChunk; - } - - toString() { - return this.intro + this.content + this.outro; - } - - trimEnd(rx) { - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - this.split(this.start + trimmed.length).edit('', undefined, true); - if (this.edited) { - // save the change, if it has been edited - this.edit(trimmed, this.storeName, true); - } - } - return true; - } else { - this.edit('', undefined, true); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - } - } - - trimStart(rx) { - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - const newChunk = this.split(this.end - trimmed.length); - if (this.edited) { - // save the change, if it has been edited - newChunk.edit(trimmed, this.storeName, true); - } - this.edit('', undefined, true); - } - return true; - } else { - this.edit('', undefined, true); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - } - } -} - -function getBtoa() { - if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') { - return (str) => globalThis.btoa(unescape(encodeURIComponent(str))); - } else if (typeof Buffer === 'function') { - return (str) => Buffer.from(str, 'utf-8').toString('base64'); - } else { - return () => { - throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); - }; - } -} - -const btoa = /*#__PURE__*/ getBtoa(); - -class SourceMap { - constructor(properties) { - this.version = 3; - this.file = properties.file; - this.sources = properties.sources; - this.sourcesContent = properties.sourcesContent; - this.names = properties.names; - this.mappings = encode(properties.mappings); - if (typeof properties.x_google_ignoreList !== 'undefined') { - this.x_google_ignoreList = properties.x_google_ignoreList; - } - if (typeof properties.debugId !== 'undefined') { - this.debugId = properties.debugId; - } - } - - toString() { - return JSON.stringify(this); - } - - toUrl() { - return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); - } -} - -function guessIndent(code) { - const lines = code.split('\n'); - - const tabbed = lines.filter((line) => /^\t+/.test(line)); - const spaced = lines.filter((line) => /^ {2,}/.test(line)); - - if (tabbed.length === 0 && spaced.length === 0) { - return null; - } - - // More lines tabbed than spaced? Assume tabs, and - // default to tabs in the case of a tie (or nothing - // to go on) - if (tabbed.length >= spaced.length) { - return '\t'; - } - - // Otherwise, we need to guess the multiple - const min = spaced.reduce((previous, current) => { - const numSpaces = /^ +/.exec(current)[0].length; - return Math.min(numSpaces, previous); - }, Infinity); - - return new Array(min + 1).join(' '); -} - -function getRelativePath(from, to) { - const fromParts = from.split(/[/\\]/); - const toParts = to.split(/[/\\]/); - - fromParts.pop(); // get dirname - - while (fromParts[0] === toParts[0]) { - fromParts.shift(); - toParts.shift(); - } - - if (fromParts.length) { - let i = fromParts.length; - while (i--) fromParts[i] = '..'; - } - - return fromParts.concat(toParts).join('/'); -} - -const toString = Object.prototype.toString; - -function isObject(thing) { - return toString.call(thing) === '[object Object]'; -} - -function getLocator(source) { - const originalLines = source.split('\n'); - const lineOffsets = []; - - for (let i = 0, pos = 0; i < originalLines.length; i++) { - lineOffsets.push(pos); - pos += originalLines[i].length + 1; - } - - return function locate(index) { - let i = 0; - let j = lineOffsets.length; - while (i < j) { - const m = (i + j) >> 1; - if (index < lineOffsets[m]) { - j = m; - } else { - i = m + 1; - } - } - const line = i - 1; - const column = index - lineOffsets[line]; - return { line, column }; - }; -} - -const wordRegex = /\w/; - -class Mappings { - constructor(hires) { - this.hires = hires; - this.generatedCodeLine = 0; - this.generatedCodeColumn = 0; - this.raw = []; - this.rawSegments = this.raw[this.generatedCodeLine] = []; - this.pending = null; - } - - addEdit(sourceIndex, content, loc, nameIndex) { - if (content.length) { - const contentLengthMinusOne = content.length - 1; - let contentLineEnd = content.indexOf('\n', 0); - let previousContentLineEnd = -1; - // Loop through each line in the content and add a segment, but stop if the last line is empty, - // else code afterwards would fill one line too many - while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - - previousContentLineEnd = contentLineEnd; - contentLineEnd = content.indexOf('\n', contentLineEnd + 1); - } - - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.advance(content.slice(previousContentLineEnd + 1)); - } else if (this.pending) { - this.rawSegments.push(this.pending); - this.advance(content); - } - - this.pending = null; - } - - addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) { - let originalCharIndex = chunk.start; - let first = true; - // when iterating each char, check if it's in a word boundary - let charInHiresBoundary = false; - - while (originalCharIndex < chunk.end) { - if (original[originalCharIndex] === '\n') { - loc.line += 1; - loc.column = 0; - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - first = true; - charInHiresBoundary = false; - } else { - if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - - if (this.hires === 'boundary') { - // in hires "boundary", group segments per word boundary than per char - if (wordRegex.test(original[originalCharIndex])) { - // for first char in the boundary found, start the boundary by pushing a segment - if (!charInHiresBoundary) { - this.rawSegments.push(segment); - charInHiresBoundary = true; - } - } else { - // for non-word char, end the boundary by pushing a segment - this.rawSegments.push(segment); - charInHiresBoundary = false; - } - } else { - this.rawSegments.push(segment); - } - } - - loc.column += 1; - this.generatedCodeColumn += 1; - first = false; - } - - originalCharIndex += 1; - } - - this.pending = null; - } - - advance(str) { - if (!str) return; - - const lines = str.split('\n'); - - if (lines.length > 1) { - for (let i = 0; i < lines.length - 1; i++) { - this.generatedCodeLine++; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - } - this.generatedCodeColumn = 0; - } - - this.generatedCodeColumn += lines[lines.length - 1].length; - } -} - -const n = '\n'; - -const warned = { - insertLeft: false, - insertRight: false, - storeName: false, -}; - -class MagicString { - constructor(string, options = {}) { - const chunk = new Chunk(0, string.length, string); - - Object.defineProperties(this, { - original: { writable: true, value: string }, - outro: { writable: true, value: '' }, - intro: { writable: true, value: '' }, - firstChunk: { writable: true, value: chunk }, - lastChunk: { writable: true, value: chunk }, - lastSearchedChunk: { writable: true, value: chunk }, - byStart: { writable: true, value: {} }, - byEnd: { writable: true, value: {} }, - filename: { writable: true, value: options.filename }, - indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, - sourcemapLocations: { writable: true, value: new BitSet() }, - storedNames: { writable: true, value: {} }, - indentStr: { writable: true, value: undefined }, - ignoreList: { writable: true, value: options.ignoreList }, - offset: { writable: true, value: options.offset || 0 }, - }); - - this.byStart[0] = chunk; - this.byEnd[string.length] = chunk; - } - - addSourcemapLocation(char) { - this.sourcemapLocations.add(char); - } - - append(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.outro += content; - return this; - } - - appendLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.appendLeft(content); - } else { - this.intro += content; - } - return this; - } - - appendRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.appendRight(content); - } else { - this.outro += content; - } - return this; - } - - clone() { - const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset }); - - let originalChunk = this.firstChunk; - let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); - - while (originalChunk) { - cloned.byStart[clonedChunk.start] = clonedChunk; - cloned.byEnd[clonedChunk.end] = clonedChunk; - - const nextOriginalChunk = originalChunk.next; - const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); - - if (nextClonedChunk) { - clonedChunk.next = nextClonedChunk; - nextClonedChunk.previous = clonedChunk; - - clonedChunk = nextClonedChunk; - } - - originalChunk = nextOriginalChunk; - } - - cloned.lastChunk = clonedChunk; - - if (this.indentExclusionRanges) { - cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); - } - - cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); - - cloned.intro = this.intro; - cloned.outro = this.outro; - - return cloned; - } - - generateDecodedMap(options) { - options = options || {}; - - const sourceIndex = 0; - const names = Object.keys(this.storedNames); - const mappings = new Mappings(options.hires); - - const locate = getLocator(this.original); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (this.outro) { - mappings.advance(this.outro); - } - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: [ - options.source ? getRelativePath(options.file || '', options.source) : options.file || '', - ], - sourcesContent: options.includeContent ? [this.original] : undefined, - names, - mappings: mappings.raw, - x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - _ensureindentStr() { - if (this.indentStr === undefined) { - this.indentStr = guessIndent(this.original); - } - } - - _getRawIndentString() { - this._ensureindentStr(); - return this.indentStr; - } - - getIndentString() { - this._ensureindentStr(); - return this.indentStr === null ? '\t' : this.indentStr; - } - - indent(indentStr, options) { - const pattern = /^[^\r\n]/gm; - - if (isObject(indentStr)) { - options = indentStr; - indentStr = undefined; - } - - if (indentStr === undefined) { - this._ensureindentStr(); - indentStr = this.indentStr || '\t'; - } - - if (indentStr === '') return this; // noop - - options = options || {}; - - // Process exclusion ranges - const isExcluded = {}; - - if (options.exclude) { - const exclusions = - typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; - exclusions.forEach((exclusion) => { - for (let i = exclusion[0]; i < exclusion[1]; i += 1) { - isExcluded[i] = true; - } - }); - } - - let shouldIndentNextCharacter = options.indentStart !== false; - const replacer = (match) => { - if (shouldIndentNextCharacter) return `${indentStr}${match}`; - shouldIndentNextCharacter = true; - return match; - }; - - this.intro = this.intro.replace(pattern, replacer); - - let charIndex = 0; - let chunk = this.firstChunk; - - while (chunk) { - const end = chunk.end; - - if (chunk.edited) { - if (!isExcluded[charIndex]) { - chunk.content = chunk.content.replace(pattern, replacer); - - if (chunk.content.length) { - shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; - } - } - } else { - charIndex = chunk.start; - - while (charIndex < end) { - if (!isExcluded[charIndex]) { - const char = this.original[charIndex]; - - if (char === '\n') { - shouldIndentNextCharacter = true; - } else if (char !== '\r' && shouldIndentNextCharacter) { - shouldIndentNextCharacter = false; - - if (charIndex === chunk.start) { - chunk.prependRight(indentStr); - } else { - this._splitChunk(chunk, charIndex); - chunk = chunk.next; - chunk.prependRight(indentStr); - } - } - } - - charIndex += 1; - } - } - - charIndex = chunk.end; - chunk = chunk.next; - } - - this.outro = this.outro.replace(pattern, replacer); - - return this; - } - - insert() { - throw new Error( - 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)', - ); - } - - insertLeft(index, content) { - if (!warned.insertLeft) { - console.warn( - 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead', - ); - warned.insertLeft = true; - } - - return this.appendLeft(index, content); - } - - insertRight(index, content) { - if (!warned.insertRight) { - console.warn( - 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead', - ); - warned.insertRight = true; - } - - return this.prependRight(index, content); - } - - move(start, end, index) { - start = start + this.offset; - end = end + this.offset; - index = index + this.offset; - - if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself'); - - this._split(start); - this._split(end); - this._split(index); - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - const oldLeft = first.previous; - const oldRight = last.next; - - const newRight = this.byStart[index]; - if (!newRight && last === this.lastChunk) return this; - const newLeft = newRight ? newRight.previous : this.lastChunk; - - if (oldLeft) oldLeft.next = oldRight; - if (oldRight) oldRight.previous = oldLeft; - - if (newLeft) newLeft.next = first; - if (newRight) newRight.previous = last; - - if (!first.previous) this.firstChunk = last.next; - if (!last.next) { - this.lastChunk = first.previous; - this.lastChunk.next = null; - } - - first.previous = newLeft; - last.next = newRight || null; - - if (!newLeft) this.firstChunk = first; - if (!newRight) this.lastChunk = last; - return this; - } - - overwrite(start, end, content, options) { - options = options || {}; - return this.update(start, end, content, { ...options, overwrite: !options.contentOnly }); - } - - update(start, end, content, options) { - start = start + this.offset; - end = end + this.offset; - - if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (end > this.original.length) throw new Error('end is out of bounds'); - if (start === end) - throw new Error( - 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead', - ); - - this._split(start); - this._split(end); - - if (options === true) { - if (!warned.storeName) { - console.warn( - 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', - ); - warned.storeName = true; - } - - options = { storeName: true }; - } - const storeName = options !== undefined ? options.storeName : false; - const overwrite = options !== undefined ? options.overwrite : false; - - if (storeName) { - const original = this.original.slice(start, end); - Object.defineProperty(this.storedNames, original, { - writable: true, - value: true, - enumerable: true, - }); - } - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - if (first) { - let chunk = first; - while (chunk !== last) { - if (chunk.next !== this.byStart[chunk.end]) { - throw new Error('Cannot overwrite across a split point'); - } - chunk = chunk.next; - chunk.edit('', false); - } - - first.edit(content, storeName, !overwrite); - } else { - // must be inserting at the end - const newChunk = new Chunk(start, end, '').edit(content, storeName); - - // TODO last chunk in the array may not be the last chunk, if it's moved... - last.next = newChunk; - newChunk.previous = last; - } - return this; - } - - prepend(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.intro = content + this.intro; - return this; - } - - prependLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.prependLeft(content); - } else { - this.intro = content + this.intro; - } - return this; - } - - prependRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.prependRight(content); - } else { - this.outro = content + this.outro; - } - return this; - } - - remove(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.intro = ''; - chunk.outro = ''; - chunk.edit(''); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - reset(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.reset(); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - lastChar() { - if (this.outro.length) return this.outro[this.outro.length - 1]; - let chunk = this.lastChunk; - do { - if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1]; - if (chunk.content.length) return chunk.content[chunk.content.length - 1]; - if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1]; - } while ((chunk = chunk.previous)); - if (this.intro.length) return this.intro[this.intro.length - 1]; - return ''; - } - - lastLine() { - let lineIndex = this.outro.lastIndexOf(n); - if (lineIndex !== -1) return this.outro.substr(lineIndex + 1); - let lineStr = this.outro; - let chunk = this.lastChunk; - do { - if (chunk.outro.length > 0) { - lineIndex = chunk.outro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.outro + lineStr; - } - - if (chunk.content.length > 0) { - lineIndex = chunk.content.lastIndexOf(n); - if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr; - lineStr = chunk.content + lineStr; - } - - if (chunk.intro.length > 0) { - lineIndex = chunk.intro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.intro + lineStr; - } - } while ((chunk = chunk.previous)); - lineIndex = this.intro.lastIndexOf(n); - if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr; - return this.intro + lineStr; - } - - slice(start = 0, end = this.original.length - this.offset) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - let result = ''; - - // find start chunk - let chunk = this.firstChunk; - while (chunk && (chunk.start > start || chunk.end <= start)) { - // found end chunk before start - if (chunk.start < end && chunk.end >= end) { - return result; - } - - chunk = chunk.next; - } - - if (chunk && chunk.edited && chunk.start !== start) - throw new Error(`Cannot use replaced character ${start} as slice start anchor.`); - - const startChunk = chunk; - while (chunk) { - if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { - result += chunk.intro; - } - - const containsEnd = chunk.start < end && chunk.end >= end; - if (containsEnd && chunk.edited && chunk.end !== end) - throw new Error(`Cannot use replaced character ${end} as slice end anchor.`); - - const sliceStart = startChunk === chunk ? start - chunk.start : 0; - const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; - - result += chunk.content.slice(sliceStart, sliceEnd); - - if (chunk.outro && (!containsEnd || chunk.end === end)) { - result += chunk.outro; - } - - if (containsEnd) { - break; - } - - chunk = chunk.next; - } - - return result; - } - - // TODO deprecate this? not really very useful - snip(start, end) { - const clone = this.clone(); - clone.remove(0, start); - clone.remove(end, clone.original.length); - - return clone; - } - - _split(index) { - if (this.byStart[index] || this.byEnd[index]) return; - - let chunk = this.lastSearchedChunk; - let previousChunk = chunk; - const searchForward = index > chunk.end; - - while (chunk) { - if (chunk.contains(index)) return this._splitChunk(chunk, index); - - chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; - - // Prevent infinite loop (e.g. via empty chunks, where start === end) - if (chunk === previousChunk) return; - - previousChunk = chunk; - } - } - - _splitChunk(chunk, index) { - if (chunk.edited && chunk.content.length) { - // zero-length edited chunks are a special case (overlapping replacements) - const loc = getLocator(this.original)(index); - throw new Error( - `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, - ); - } - - const newChunk = chunk.split(index); - - this.byEnd[index] = chunk; - this.byStart[index] = newChunk; - this.byEnd[newChunk.end] = newChunk; - - if (chunk === this.lastChunk) this.lastChunk = newChunk; - - this.lastSearchedChunk = chunk; - return true; - } - - toString() { - let str = this.intro; - - let chunk = this.firstChunk; - while (chunk) { - str += chunk.toString(); - chunk = chunk.next; - } - - return str + this.outro; - } - - isEmpty() { - let chunk = this.firstChunk; - do { - if ( - (chunk.intro.length && chunk.intro.trim()) || - (chunk.content.length && chunk.content.trim()) || - (chunk.outro.length && chunk.outro.trim()) - ) - return false; - } while ((chunk = chunk.next)); - return true; - } - - length() { - let chunk = this.firstChunk; - let length = 0; - do { - length += chunk.intro.length + chunk.content.length + chunk.outro.length; - } while ((chunk = chunk.next)); - return length; - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimEndAborted(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - let chunk = this.lastChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimEnd(rx); - - // if chunk was trimmed, we have a new lastChunk - if (chunk.end !== end) { - if (this.lastChunk === chunk) { - this.lastChunk = chunk.next; - } - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.previous; - } while (chunk); - - return false; - } - - trimEnd(charType) { - this.trimEndAborted(charType); - return this; - } - trimStartAborted(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - let chunk = this.firstChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimStart(rx); - - if (chunk.end !== end) { - // special case... - if (chunk === this.lastChunk) this.lastChunk = chunk.next; - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.next; - } while (chunk); - - return false; - } - - trimStart(charType) { - this.trimStartAborted(charType); - return this; - } - - hasChanged() { - return this.original !== this.toString(); - } - - _replaceRegexp(searchValue, replacement) { - function getReplacement(match, str) { - if (typeof replacement === 'string') { - return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter - if (i === '$') return '$'; - if (i === '&') return match[0]; - const num = +i; - if (num < match.length) return match[+i]; - return `$${i}`; - }); - } else { - return replacement(...match, match.index, str, match.groups); - } - } - function matchAll(re, str) { - let match; - const matches = []; - while ((match = re.exec(str))) { - matches.push(match); - } - return matches; - } - if (searchValue.global) { - const matches = matchAll(searchValue, this.original); - matches.forEach((match) => { - if (match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - }); - } else { - const match = this.original.match(searchValue); - if (match && match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - } - return this; - } - - _replaceString(string, replacement) { - const { original } = this; - const index = original.indexOf(string); - - if (index !== -1) { - if (typeof replacement === 'function') { - replacement = replacement(string, index, original); - } - if (string !== replacement) { - this.overwrite(index, index + string.length, replacement); - } - } - - return this; - } - - replace(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceString(searchValue, replacement); - } - - return this._replaceRegexp(searchValue, replacement); - } - - _replaceAllString(string, replacement) { - const { original } = this; - const stringLength = string.length; - for ( - let index = original.indexOf(string); - index !== -1; - index = original.indexOf(string, index + stringLength) - ) { - const previous = original.slice(index, index + stringLength); - let _replacement = replacement; - if (typeof replacement === 'function') { - _replacement = replacement(previous, index, original); - } - if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement); - } - - return this; - } - - replaceAll(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceAllString(searchValue, replacement); - } - - if (!searchValue.global) { - throw new TypeError( - 'MagicString.prototype.replaceAll called with a non-global RegExp argument', - ); - } - - return this._replaceRegexp(searchValue, replacement); - } -} - -const hasOwnProp = Object.prototype.hasOwnProperty; - -class Bundle { - constructor(options = {}) { - this.intro = options.intro || ''; - this.separator = options.separator !== undefined ? options.separator : '\n'; - this.sources = []; - this.uniqueSources = []; - this.uniqueSourceIndexByFilename = {}; - } - - addSource(source) { - if (source instanceof MagicString) { - return this.addSource({ - content: source, - filename: source.filename, - separator: this.separator, - }); - } - - if (!isObject(source) || !source.content) { - throw new Error( - 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`', - ); - } - - ['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => { - if (!hasOwnProp.call(source, option)) source[option] = source.content[option]; - }); - - if (source.separator === undefined) { - // TODO there's a bunch of this sort of thing, needs cleaning up - source.separator = this.separator; - } - - if (source.filename) { - if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) { - this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length; - this.uniqueSources.push({ filename: source.filename, content: source.content.original }); - } else { - const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]]; - if (source.content.original !== uniqueSource.content) { - throw new Error(`Illegal source: same filename (${source.filename}), different contents`); - } - } - } - - this.sources.push(source); - return this; - } - - append(str, options) { - this.addSource({ - content: new MagicString(str), - separator: (options && options.separator) || '', - }); - - return this; - } - - clone() { - const bundle = new Bundle({ - intro: this.intro, - separator: this.separator, - }); - - this.sources.forEach((source) => { - bundle.addSource({ - filename: source.filename, - content: source.content.clone(), - separator: source.separator, - }); - }); - - return bundle; - } - - generateDecodedMap(options = {}) { - const names = []; - let x_google_ignoreList = undefined; - this.sources.forEach((source) => { - Object.keys(source.content.storedNames).forEach((name) => { - if (!~names.indexOf(name)) names.push(name); - }); - }); - - const mappings = new Mappings(options.hires); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.sources.forEach((source, i) => { - if (i > 0) { - mappings.advance(this.separator); - } - - const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1; - const magicString = source.content; - const locate = getLocator(magicString.original); - - if (magicString.intro) { - mappings.advance(magicString.intro); - } - - magicString.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (source.filename) { - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk( - sourceIndex, - chunk, - magicString.original, - loc, - magicString.sourcemapLocations, - ); - } - } else { - mappings.advance(chunk.content); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (magicString.outro) { - mappings.advance(magicString.outro); - } - - if (source.ignoreList && sourceIndex !== -1) { - if (x_google_ignoreList === undefined) { - x_google_ignoreList = []; - } - x_google_ignoreList.push(sourceIndex); - } - }); - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: this.uniqueSources.map((source) => { - return options.file ? getRelativePath(options.file, source.filename) : source.filename; - }), - sourcesContent: this.uniqueSources.map((source) => { - return options.includeContent ? source.content : null; - }), - names, - mappings: mappings.raw, - x_google_ignoreList, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - getIndentString() { - const indentStringCounts = {}; - - this.sources.forEach((source) => { - const indentStr = source.content._getRawIndentString(); - - if (indentStr === null) return; - - if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0; - indentStringCounts[indentStr] += 1; - }); - - return ( - Object.keys(indentStringCounts).sort((a, b) => { - return indentStringCounts[a] - indentStringCounts[b]; - })[0] || '\t' - ); - } - - indent(indentStr) { - if (!arguments.length) { - indentStr = this.getIndentString(); - } - - if (indentStr === '') return this; // noop - - let trailingNewline = !this.intro || this.intro.slice(-1) === '\n'; - - this.sources.forEach((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator)); - - source.content.indent(indentStr, { - exclude: source.indentExclusionRanges, - indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator ) - }); - - trailingNewline = source.content.lastChar() === '\n'; - }); - - if (this.intro) { - this.intro = - indentStr + - this.intro.replace(/^[^\n]/gm, (match, index) => { - return index > 0 ? indentStr + match : match; - }); - } - - return this; - } - - prepend(str) { - this.intro = str + this.intro; - return this; - } - - toString() { - const body = this.sources - .map((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const str = (i > 0 ? separator : '') + source.content.toString(); - - return str; - }) - .join(''); - - return this.intro + body; - } - - isEmpty() { - if (this.intro.length && this.intro.trim()) return false; - if (this.sources.some((source) => !source.content.isEmpty())) return false; - return true; - } - - length() { - return this.sources.reduce( - (length, source) => length + source.content.length(), - this.intro.length, - ); - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimStart(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - this.intro = this.intro.replace(rx, ''); - - if (!this.intro) { - let source; - let i = 0; - - do { - source = this.sources[i++]; - if (!source) { - break; - } - } while (!source.content.trimStartAborted(charType)); - } - - return this; - } - - trimEnd(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - let source; - let i = this.sources.length - 1; - - do { - source = this.sources[i--]; - if (!source) { - this.intro = this.intro.replace(rx, ''); - break; - } - } while (!source.content.trimEndAborted(charType)); - - return this; - } -} - -export { Bundle, SourceMap, MagicString as default }; -//# sourceMappingURL=magic-string.es.mjs.map diff --git a/node_modules/magic-string/dist/magic-string.es.mjs.map b/node_modules/magic-string/dist/magic-string.es.mjs.map deleted file mode 100644 index a60bcc8..0000000 --- a/node_modules/magic-string/dist/magic-string.es.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"magic-string.es.mjs","sources":["../src/BitSet.js","../src/Chunk.js","../src/SourceMap.js","../src/utils/guessIndent.js","../src/utils/getRelativePath.js","../src/utils/isObject.js","../src/utils/getLocator.js","../src/utils/Mappings.js","../src/MagicString.js","../src/Bundle.js"],"sourcesContent":["export default class BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & (1 << (n & 31)));\n\t}\n}\n","export default class Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\n\t\tif (DEBUG) {\n\t\t\t// we make these non-enumerable, for sanity while debugging\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tprevious: { writable: true, value: null },\n\t\t\t\tnext: { writable: true, value: null },\n\t\t\t});\n\t\t} else {\n\t\t\tthis.previous = null;\n\t\t\tthis.next = null;\n\t\t}\n\t}\n\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t}\n\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\n\teachNext(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\n\teachPrevious(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = '';\n\t\t\tthis.outro = '';\n\t\t}\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t}\n\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\n\treset() {\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\n\t\tthis.original = originalBefore;\n\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif (this.edited) {\n\t\t\t// after split we should save the edit content record into the correct chunk\n\t\t\t// to make sure sourcemap correct\n\t\t\t// For example:\n\t\t\t// ' test'.trim()\n\t\t\t// split -> ' ' + 'test'\n\t\t\t// ✔️ edit -> '' + 'test'\n\t\t\t// ✖️ edit -> 'test' + ''\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit('', false);\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t}\n\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tthis.split(this.start + trimmed.length).edit('', undefined, true);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tthis.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tconst newChunk = this.split(this.end - trimmed.length);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tnewChunk.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t\tthis.edit('', undefined, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.outro = this.outro.replace(rx, '');\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n}\n","import { encode } from '@jridgewell/sourcemap-codec';\n\nfunction getBtoa() {\n\tif (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n\t\treturn (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\t} else if (typeof Buffer === 'function') {\n\t\treturn (str) => Buffer.from(str, 'utf-8').toString('base64');\n\t} else {\n\t\treturn () => {\n\t\t\tthrow new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');\n\t\t};\n\t}\n}\n\nconst btoa = /*#__PURE__*/ getBtoa();\n\nexport default class SourceMap {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== 'undefined') {\n\t\t\tthis.x_google_ignoreList = properties.x_google_ignoreList;\n\t\t}\n\t\tif (typeof properties.debugId !== 'undefined') {\n\t\t\tthis.debugId = properties.debugId;\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\n\ttoUrl() {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());\n\t}\n}\n","export default function guessIndent(code) {\n\tconst lines = code.split('\\n');\n\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\n\tif (tabbed.length === 0 && spaced.length === 0) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif (tabbed.length >= spaced.length) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\n\treturn new Array(min + 1).join(' ');\n}\n","export default function getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\n\tfromParts.pop(); // get dirname\n\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat(toParts).join('/');\n}\n","const toString = Object.prototype.toString;\n\nexport default function isObject(thing) {\n\treturn toString.call(thing) === '[object Object]';\n}\n","export default function getLocator(source) {\n\tconst originalLines = source.split('\\n');\n\tconst lineOffsets = [];\n\n\tfor (let i = 0, pos = 0; i < originalLines.length; i++) {\n\t\tlineOffsets.push(pos);\n\t\tpos += originalLines[i].length + 1;\n\t}\n\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = (i + j) >> 1;\n\t\t\tif (index < lineOffsets[m]) {\n\t\t\t\tj = m;\n\t\t\t} else {\n\t\t\t\ti = m + 1;\n\t\t\t}\n\t\t}\n\t\tconst line = i - 1;\n\t\tconst column = index - lineOffsets[line];\n\t\treturn { line, column };\n\t};\n}\n","const wordRegex = /\\w/;\n\nexport default class Mappings {\n\tconstructor(hires) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.pending = null;\n\t}\n\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf('\\n', 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\t// Loop through each line in the content and add a segment, but stop if the last line is empty,\n\t\t\t// else code afterwards would fill one line too many\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\t\tif (nameIndex >= 0) {\n\t\t\t\t\tsegment.push(nameIndex);\n\t\t\t\t}\n\t\t\t\tthis.rawSegments.push(segment);\n\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf('\\n', contentLineEnd + 1);\n\t\t\t}\n\n\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\tif (nameIndex >= 0) {\n\t\t\t\tsegment.push(nameIndex);\n\t\t\t}\n\t\t\tthis.rawSegments.push(segment);\n\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t} else if (this.pending) {\n\t\t\tthis.rawSegments.push(this.pending);\n\t\t\tthis.advance(content);\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tlet originalCharIndex = chunk.start;\n\t\tlet first = true;\n\t\t// when iterating each char, check if it's in a word boundary\n\t\tlet charInHiresBoundary = false;\n\n\t\twhile (originalCharIndex < chunk.end) {\n\t\t\tif (original[originalCharIndex] === '\\n') {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\t\t\t\tfirst = true;\n\t\t\t\tcharInHiresBoundary = false;\n\t\t\t} else {\n\t\t\t\tif (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n\t\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\n\t\t\t\t\tif (this.hires === 'boundary') {\n\t\t\t\t\t\t// in hires \"boundary\", group segments per word boundary than per char\n\t\t\t\t\t\tif (wordRegex.test(original[originalCharIndex])) {\n\t\t\t\t\t\t\t// for first char in the boundary found, start the boundary by pushing a segment\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// for non-word char, end the boundary by pushing a segment\n\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tloc.column += 1;\n\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\tfirst = false;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\tadvance(str) {\n\t\tif (!str) return;\n\n\t\tconst lines = str.split('\\n');\n\n\t\tif (lines.length > 1) {\n\t\t\tfor (let i = 0; i < lines.length - 1; i++) {\n\t\t\t\tthis.generatedCodeLine++;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t}\n\t\t\tthis.generatedCodeColumn = 0;\n\t\t}\n\n\t\tthis.generatedCodeColumn += lines[lines.length - 1].length;\n\t}\n}\n","import BitSet from './BitSet.js';\nimport Chunk from './Chunk.js';\nimport SourceMap from './SourceMap.js';\nimport guessIndent from './utils/guessIndent.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\nimport Stats from './utils/Stats.js';\n\nconst n = '\\n';\n\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false,\n};\n\nexport default class MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: { writable: true, value: string },\n\t\t\toutro: { writable: true, value: '' },\n\t\t\tintro: { writable: true, value: '' },\n\t\t\tfirstChunk: { writable: true, value: chunk },\n\t\t\tlastChunk: { writable: true, value: chunk },\n\t\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\t\tbyStart: { writable: true, value: {} },\n\t\t\tbyEnd: { writable: true, value: {} },\n\t\t\tfilename: { writable: true, value: options.filename },\n\t\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\t\tsourcemapLocations: { writable: true, value: new BitSet() },\n\t\t\tstoredNames: { writable: true, value: {} },\n\t\t\tindentStr: { writable: true, value: undefined },\n\t\t\tignoreList: { writable: true, value: options.ignoreList },\n\t\t\toffset: { writable: true, value: options.offset || 0 },\n\t\t});\n\n\t\tif (DEBUG) {\n\t\t\tObject.defineProperty(this, 'stats', { value: new Stats() });\n\t\t}\n\n\t\tthis.byStart[0] = chunk;\n\t\tthis.byEnd[string.length] = chunk;\n\t}\n\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\n\tappend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendLeft');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendLeft(content);\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendLeft');\n\t\treturn this;\n\t}\n\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendRight(content);\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendRight');\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });\n\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());\n\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart[clonedChunk.start] = clonedChunk;\n\t\t\tcloned.byEnd[clonedChunk.end] = clonedChunk;\n\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif (this.indentExclusionRanges) {\n\t\t\tcloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\t}\n\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\n\t\treturn cloned;\n\t}\n\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tconst locate = getLocator(this.original);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tmappings.addEdit(\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tchunk.content,\n\t\t\t\t\tloc,\n\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\t}\n\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\n\t\tif (this.outro) {\n\t\t\tmappings.advance(this.outro);\n\t\t}\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: [\n\t\t\t\toptions.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n\t\t\t],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : undefined,\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\t_ensureindentStr() {\n\t\tif (this.indentStr === undefined) {\n\t\t\tthis.indentStr = guessIndent(this.original);\n\t\t}\n\t}\n\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t}\n\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tif (indentStr === undefined) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || '\\t';\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tconst isExcluded = {};\n\n\t\tif (options.exclude) {\n\t\t\tconst exclusions =\n\t\t\t\ttypeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;\n\t\t\texclusions.forEach((exclusion) => {\n\t\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst replacer = (match) => {\n\t\t\tif (shouldIndentNextCharacter) return `${indentStr}${match}`;\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace(pattern, replacer);\n\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\tchunk.content = chunk.content.replace(pattern, replacer);\n\n\t\t\t\t\tif (chunk.content.length) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original[charIndex];\n\n\t\t\t\t\t\tif (char === '\\n') {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if (char !== '\\r' && shouldIndentNextCharacter) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif (charIndex === chunk.start) {\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._splitChunk(chunk, charIndex);\n\t\t\t\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace(pattern, replacer);\n\n\t\treturn this;\n\t}\n\n\tinsert() {\n\t\tthrow new Error(\n\t\t\t'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n\t\t);\n\t}\n\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n\t\t\t);\n\t\t\twarned.insertLeft = true;\n\t\t}\n\n\t\treturn this.appendLeft(index, content);\n\t}\n\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n\t\t\t);\n\t\t\twarned.insertRight = true;\n\t\t}\n\n\t\treturn this.prependRight(index, content);\n\t}\n\n\tmove(start, end, index) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\n\t\tif (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');\n\n\t\tif (DEBUG) this.stats.time('move');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\n\t\tconst newRight = this.byStart[index];\n\t\tif (!newRight && last === this.lastChunk) return this;\n\t\tconst newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\n\t\tif (DEBUG) this.stats.timeEnd('move');\n\t\treturn this;\n\t}\n\n\toverwrite(start, end, content, options) {\n\t\toptions = options || {};\n\t\treturn this.update(start, end, content, { ...options, overwrite: !options.contentOnly });\n\t}\n\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('replacement content must be a string');\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (end > this.original.length) throw new Error('end is out of bounds');\n\t\tif (start === end)\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n\t\t\t);\n\n\t\tif (DEBUG) this.stats.time('overwrite');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n\t\t\t\t);\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst storeName = options !== undefined ? options.storeName : false;\n\t\tconst overwrite = options !== undefined ? options.overwrite : false;\n\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart[chunk.end]) {\n\t\t\t\t\tthrow new Error('Cannot overwrite across a split point');\n\t\t\t\t}\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit('', false);\n\t\t\t}\n\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\t// must be inserting at the end\n\t\t\tconst newChunk = new Chunk(start, end, '').edit(content, storeName);\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('overwrite');\n\t\treturn this;\n\t}\n\n\tprepend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependLeft(content);\n\t\t} else {\n\t\t\tthis.intro = content + this.intro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependRight(content);\n\t\t} else {\n\t\t\tthis.outro = content + this.outro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('remove');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.intro = '';\n\t\t\tchunk.outro = '';\n\t\t\tchunk.edit('');\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('remove');\n\t\treturn this;\n\t}\n\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('reset');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('reset');\n\t\treturn this;\n\t}\n\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t} while ((chunk = chunk.previous));\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn '';\n\t}\n\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t} while ((chunk = chunk.previous));\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tlet result = '';\n\n\t\t// find start chunk\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\t// found end chunk before start\n\t\t\tif (chunk.start < end && chunk.end >= end) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif (chunk && chunk.edited && chunk.start !== start)\n\t\t\tthrow new Error(`Cannot use replaced character ${start} as slice start anchor.`);\n\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end)\n\t\t\t\tthrow new Error(`Cannot use replaced character ${end} as slice end anchor.`);\n\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif (containsEnd) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// TODO deprecate this? not really very useful\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\n\t\treturn clone;\n\t}\n\n\t_split(index) {\n\t\tif (this.byStart[index] || this.byEnd[index]) return;\n\n\t\tif (DEBUG) this.stats.time('_split');\n\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\n\t\t\tchunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];\n\n\t\t\t// Prevent infinite loop (e.g. via empty chunks, where start === end)\n\t\t\tif (chunk === previousChunk) return;\n\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\t// zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n\t\t\t);\n\t\t}\n\n\t\tconst newChunk = chunk.split(index);\n\n\t\tthis.byEnd[index] = chunk;\n\t\tthis.byStart[index] = newChunk;\n\t\tthis.byEnd[newChunk.end] = newChunk;\n\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\tif (DEBUG) this.stats.timeEnd('_split');\n\t\treturn true;\n\t}\n\n\ttoString() {\n\t\tlet str = this.intro;\n\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t}\n\n\tisEmpty() {\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tif (\n\t\t\t\t(chunk.intro.length && chunk.intro.trim()) ||\n\t\t\t\t(chunk.content.length && chunk.content.trim()) ||\n\t\t\t\t(chunk.outro.length && chunk.outro.trim())\n\t\t\t)\n\t\t\t\treturn false;\n\t\t} while ((chunk = chunk.next));\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\tdo {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t} while ((chunk = chunk.next));\n\t\treturn length;\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tlet chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) {\n\t\t\t\t\tthis.lastChunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tlet chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\n\t\t\tif (chunk.end !== end) {\n\t\t\t\t// special case...\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\n\thasChanged() {\n\t\treturn this.original !== this.toString();\n\t}\n\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === 'string') {\n\t\t\t\treturn replacement.replace(/\\$(\\$|&|\\d+)/g, (_, i) => {\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n\t\t\t\t\tif (i === '$') return '$';\n\t\t\t\t\tif (i === '&') return match[0];\n\t\t\t\t\tconst num = +i;\n\t\t\t\t\tif (num < match.length) return match[+i];\n\t\t\t\t\treturn `$${i}`;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn replacement(...match, match.index, str, match.groups);\n\t\t\t}\n\t\t}\n\t\tfunction matchAll(re, str) {\n\t\t\tlet match;\n\t\t\tconst matches = [];\n\t\t\twhile ((match = re.exec(str))) {\n\t\t\t\tmatches.push(match);\n\t\t\t}\n\t\t\treturn matches;\n\t\t}\n\t\tif (searchValue.global) {\n\t\t\tconst matches = matchAll(searchValue, this.original);\n\t\t\tmatches.forEach((match) => {\n\t\t\t\tif (match.index != null) {\n\t\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && match.index != null) {\n\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst index = original.indexOf(string);\n\n\t\tif (index !== -1) {\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\treplacement = replacement(string, index, original);\n\t\t\t}\n\t\t\tif (string !== replacement) {\n\t\t\t\tthis.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceString(searchValue, replacement);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tfor (\n\t\t\tlet index = original.indexOf(string);\n\t\t\tindex !== -1;\n\t\t\tindex = original.indexOf(string, index + stringLength)\n\t\t) {\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tlet _replacement = replacement;\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\t_replacement = replacement(previous, index, original);\n\t\t\t}\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceAllString(searchValue, replacement);\n\t\t}\n\n\t\tif (!searchValue.global) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n\t\t\t);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n}\n","import MagicString from './MagicString.js';\nimport SourceMap from './SourceMap.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\n\nconst hasOwnProp = Object.prototype.hasOwnProperty;\n\nexport default class Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || '';\n\t\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\n\taddSource(source) {\n\t\tif (source instanceof MagicString) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator,\n\t\t\t});\n\t\t}\n\n\t\tif (!isObject(source) || !source.content) {\n\t\t\tthrow new Error(\n\t\t\t\t'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n\t\t\t);\n\t\t}\n\n\t\t['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\n\t\tif (source.separator === undefined) {\n\t\t\t// TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) {\n\t\t\t\t\tthrow new Error(`Illegal source: same filename (${source.filename}), different contents`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: (options && options.separator) || '',\n\t\t});\n\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator,\n\t\t});\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator,\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t}\n\n\tgenerateDecodedMap(options = {}) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList = undefined;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!~names.indexOf(name)) names.push(name);\n\t\t\t});\n\t\t});\n\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0) {\n\t\t\t\tmappings.advance(this.separator);\n\t\t\t}\n\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\n\t\t\tif (magicString.intro) {\n\t\t\t\tmappings.advance(magicString.intro);\n\t\t\t}\n\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) {\n\t\t\t\t\t\tmappings.addEdit(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk.content,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.addUneditedChunk(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk,\n\t\t\t\t\t\t\tmagicString.original,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tmagicString.sourcemapLocations,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmappings.advance(chunk.content);\n\t\t\t\t}\n\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\n\t\t\tif (magicString.outro) {\n\t\t\t\tmappings.advance(magicString.outro);\n\t\t\t}\n\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === undefined) {\n\t\t\t\t\tx_google_ignoreList = [];\n\t\t\t\t}\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\n\t\t\tif (indentStr === null) return;\n\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\n\t\treturn (\n\t\t\tObject.keys(indentStringCounts).sort((a, b) => {\n\t\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t\t})[0] || '\\t'\n\t\t);\n\t}\n\n\tindent(indentStr) {\n\t\tif (!arguments.length) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === '\\n';\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator));\n\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart, //: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\ttrailingNewline = source.content.lastChar() === '\\n';\n\t\t});\n\n\t\tif (this.intro) {\n\t\t\tthis.intro =\n\t\t\t\tindentStr +\n\t\t\t\tthis.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\n\ttoString() {\n\t\tconst body = this.sources\n\t\t\t.map((source, i) => {\n\t\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\t\tconst str = (i > 0 ? separator : '') + source.content.toString();\n\n\t\t\t\treturn str;\n\t\t\t})\n\t\t\t.join('');\n\n\t\treturn this.intro + body;\n\t}\n\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source) => !source.content.isEmpty())) return false;\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\treturn this.sources.reduce(\n\t\t\t(length, source) => length + source.content.length(),\n\t\t\tthis.intro.length,\n\t\t);\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\t\tthis.intro = this.intro.replace(rx, '');\n\n\t\tif (!this.intro) {\n\t\t\tlet source;\n\t\t\tlet i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this.sources[i++];\n\t\t\t\tif (!source) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (!source.content.trimStartAborted(charType));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tlet source;\n\t\tlet i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this.sources[i--];\n\t\t\tif (!source) {\n\t\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (!source.content.trimEndAborted(charType));\n\n\t\treturn this;\n\t}\n}\n"],"names":[],"mappings":";;AAAe,MAAM,MAAM,CAAC;AAC5B,CAAC,WAAW,CAAC,GAAG,EAAE;AAClB,EAAE,IAAI,CAAC,IAAI,GAAG,GAAG,YAAY,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;AAC3D,CAAC;;AAED,CAAC,GAAG,CAAC,CAAC,EAAE;AACR,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,I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AC,gBAAgB,CAAC,QAAQ,CAAC;AACtD,EAAE;;AAEF,EAAE,OAAO,IAAI;AACb,CAAC;;AAED,CAAC,OAAO,CAAC,QAAQ,EAAE;AACnB,EAAE,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,CAAC,QAAQ,IAAI,KAAK,IAAI,IAAI,CAAC;;AAEnD,EAAE,IAAI,MAAM;AACZ,EAAE,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;;AAEjC,EAAE,GAAG;AACL,GAAG,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;AAC7B,GAAG,IAAI,CAAC,MAAM,EAAE;AAChB,IAAI,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC;AAC3C,IAAI;AACJ,GAAG;AACH,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,QAAQ,CAAC;;AAEnD,EAAE,OAAO,IAAI;AACb,CAAC;AACD;;;;"} \ No newline at end of file diff --git a/node_modules/magic-string/dist/magic-string.umd.js b/node_modules/magic-string/dist/magic-string.umd.js deleted file mode 100644 index 0c399cd..0000000 --- a/node_modules/magic-string/dist/magic-string.umd.js +++ /dev/null @@ -1,1682 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.MagicString = factory()); -})(this, (function () { 'use strict'; - - class BitSet { - constructor(arg) { - this.bits = arg instanceof BitSet ? arg.bits.slice() : []; - } - - add(n) { - this.bits[n >> 5] |= 1 << (n & 31); - } - - has(n) { - return !!(this.bits[n >> 5] & (1 << (n & 31))); - } - } - - class Chunk { - constructor(start, end, content) { - this.start = start; - this.end = end; - this.original = content; - - this.intro = ''; - this.outro = ''; - - this.content = content; - this.storeName = false; - this.edited = false; - - { - this.previous = null; - this.next = null; - } - } - - appendLeft(content) { - this.outro += content; - } - - appendRight(content) { - this.intro = this.intro + content; - } - - clone() { - const chunk = new Chunk(this.start, this.end, this.original); - - chunk.intro = this.intro; - chunk.outro = this.outro; - chunk.content = this.content; - chunk.storeName = this.storeName; - chunk.edited = this.edited; - - return chunk; - } - - contains(index) { - return this.start < index && index < this.end; - } - - eachNext(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.next; - } - } - - eachPrevious(fn) { - let chunk = this; - while (chunk) { - fn(chunk); - chunk = chunk.previous; - } - } - - edit(content, storeName, contentOnly) { - this.content = content; - if (!contentOnly) { - this.intro = ''; - this.outro = ''; - } - this.storeName = storeName; - - this.edited = true; - - return this; - } - - prependLeft(content) { - this.outro = content + this.outro; - } - - prependRight(content) { - this.intro = content + this.intro; - } - - reset() { - this.intro = ''; - this.outro = ''; - if (this.edited) { - this.content = this.original; - this.storeName = false; - this.edited = false; - } - } - - split(index) { - const sliceIndex = index - this.start; - - const originalBefore = this.original.slice(0, sliceIndex); - const originalAfter = this.original.slice(sliceIndex); - - this.original = originalBefore; - - const newChunk = new Chunk(index, this.end, originalAfter); - newChunk.outro = this.outro; - this.outro = ''; - - this.end = index; - - if (this.edited) { - // after split we should save the edit content record into the correct chunk - // to make sure sourcemap correct - // For example: - // ' test'.trim() - // split -> ' ' + 'test' - // ✔️ edit -> '' + 'test' - // ✖️ edit -> 'test' + '' - // TODO is this block necessary?... - newChunk.edit('', false); - this.content = ''; - } else { - this.content = originalBefore; - } - - newChunk.next = this.next; - if (newChunk.next) newChunk.next.previous = newChunk; - newChunk.previous = this; - this.next = newChunk; - - return newChunk; - } - - toString() { - return this.intro + this.content + this.outro; - } - - trimEnd(rx) { - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - this.split(this.start + trimmed.length).edit('', undefined, true); - if (this.edited) { - // save the change, if it has been edited - this.edit(trimmed, this.storeName, true); - } - } - return true; - } else { - this.edit('', undefined, true); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - } - } - - trimStart(rx) { - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - const trimmed = this.content.replace(rx, ''); - - if (trimmed.length) { - if (trimmed !== this.content) { - const newChunk = this.split(this.end - trimmed.length); - if (this.edited) { - // save the change, if it has been edited - newChunk.edit(trimmed, this.storeName, true); - } - this.edit('', undefined, true); - } - return true; - } else { - this.edit('', undefined, true); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - } - } - } - - // src/vlq.ts - var comma = ",".charCodeAt(0); - var semicolon = ";".charCodeAt(0); - var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var intToChar = new Uint8Array(64); - var charToInt = new Uint8Array(128); - for (let i = 0; i < chars.length; i++) { - const c = chars.charCodeAt(i); - intToChar[i] = c; - charToInt[c] = i; - } - function encodeInteger(builder, num, relative) { - let delta = num - relative; - delta = delta < 0 ? -delta << 1 | 1 : delta << 1; - do { - let clamped = delta & 31; - delta >>>= 5; - if (delta > 0) clamped |= 32; - builder.write(intToChar[clamped]); - } while (delta > 0); - return num; - } - - // src/strings.ts - var bufLength = 1024 * 16; - var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? { - decode(buf) { - const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength); - return out.toString(); - } - } : { - decode(buf) { - let out = ""; - for (let i = 0; i < buf.length; i++) { - out += String.fromCharCode(buf[i]); - } - return out; - } - }; - var StringWriter = class { - constructor() { - this.pos = 0; - this.out = ""; - this.buffer = new Uint8Array(bufLength); - } - write(v) { - const { buffer } = this; - buffer[this.pos++] = v; - if (this.pos === bufLength) { - this.out += td.decode(buffer); - this.pos = 0; - } - } - flush() { - const { buffer, out, pos } = this; - return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out; - } - }; - function encode(decoded) { - const writer = new StringWriter(); - let sourcesIndex = 0; - let sourceLine = 0; - let sourceColumn = 0; - let namesIndex = 0; - for (let i = 0; i < decoded.length; i++) { - const line = decoded[i]; - if (i > 0) writer.write(semicolon); - if (line.length === 0) continue; - let genColumn = 0; - for (let j = 0; j < line.length; j++) { - const segment = line[j]; - if (j > 0) writer.write(comma); - genColumn = encodeInteger(writer, segment[0], genColumn); - if (segment.length === 1) continue; - sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex); - sourceLine = encodeInteger(writer, segment[2], sourceLine); - sourceColumn = encodeInteger(writer, segment[3], sourceColumn); - if (segment.length === 4) continue; - namesIndex = encodeInteger(writer, segment[4], namesIndex); - } - } - return writer.flush(); - } - - function getBtoa() { - if (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') { - return (str) => globalThis.btoa(unescape(encodeURIComponent(str))); - } else if (typeof Buffer === 'function') { - return (str) => Buffer.from(str, 'utf-8').toString('base64'); - } else { - return () => { - throw new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.'); - }; - } - } - - const btoa = /*#__PURE__*/ getBtoa(); - - class SourceMap { - constructor(properties) { - this.version = 3; - this.file = properties.file; - this.sources = properties.sources; - this.sourcesContent = properties.sourcesContent; - this.names = properties.names; - this.mappings = encode(properties.mappings); - if (typeof properties.x_google_ignoreList !== 'undefined') { - this.x_google_ignoreList = properties.x_google_ignoreList; - } - if (typeof properties.debugId !== 'undefined') { - this.debugId = properties.debugId; - } - } - - toString() { - return JSON.stringify(this); - } - - toUrl() { - return 'data:application/json;charset=utf-8;base64,' + btoa(this.toString()); - } - } - - function guessIndent(code) { - const lines = code.split('\n'); - - const tabbed = lines.filter((line) => /^\t+/.test(line)); - const spaced = lines.filter((line) => /^ {2,}/.test(line)); - - if (tabbed.length === 0 && spaced.length === 0) { - return null; - } - - // More lines tabbed than spaced? Assume tabs, and - // default to tabs in the case of a tie (or nothing - // to go on) - if (tabbed.length >= spaced.length) { - return '\t'; - } - - // Otherwise, we need to guess the multiple - const min = spaced.reduce((previous, current) => { - const numSpaces = /^ +/.exec(current)[0].length; - return Math.min(numSpaces, previous); - }, Infinity); - - return new Array(min + 1).join(' '); - } - - function getRelativePath(from, to) { - const fromParts = from.split(/[/\\]/); - const toParts = to.split(/[/\\]/); - - fromParts.pop(); // get dirname - - while (fromParts[0] === toParts[0]) { - fromParts.shift(); - toParts.shift(); - } - - if (fromParts.length) { - let i = fromParts.length; - while (i--) fromParts[i] = '..'; - } - - return fromParts.concat(toParts).join('/'); - } - - const toString = Object.prototype.toString; - - function isObject(thing) { - return toString.call(thing) === '[object Object]'; - } - - function getLocator(source) { - const originalLines = source.split('\n'); - const lineOffsets = []; - - for (let i = 0, pos = 0; i < originalLines.length; i++) { - lineOffsets.push(pos); - pos += originalLines[i].length + 1; - } - - return function locate(index) { - let i = 0; - let j = lineOffsets.length; - while (i < j) { - const m = (i + j) >> 1; - if (index < lineOffsets[m]) { - j = m; - } else { - i = m + 1; - } - } - const line = i - 1; - const column = index - lineOffsets[line]; - return { line, column }; - }; - } - - const wordRegex = /\w/; - - class Mappings { - constructor(hires) { - this.hires = hires; - this.generatedCodeLine = 0; - this.generatedCodeColumn = 0; - this.raw = []; - this.rawSegments = this.raw[this.generatedCodeLine] = []; - this.pending = null; - } - - addEdit(sourceIndex, content, loc, nameIndex) { - if (content.length) { - const contentLengthMinusOne = content.length - 1; - let contentLineEnd = content.indexOf('\n', 0); - let previousContentLineEnd = -1; - // Loop through each line in the content and add a segment, but stop if the last line is empty, - // else code afterwards would fill one line too many - while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - - previousContentLineEnd = contentLineEnd; - contentLineEnd = content.indexOf('\n', contentLineEnd + 1); - } - - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - if (nameIndex >= 0) { - segment.push(nameIndex); - } - this.rawSegments.push(segment); - - this.advance(content.slice(previousContentLineEnd + 1)); - } else if (this.pending) { - this.rawSegments.push(this.pending); - this.advance(content); - } - - this.pending = null; - } - - addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) { - let originalCharIndex = chunk.start; - let first = true; - // when iterating each char, check if it's in a word boundary - let charInHiresBoundary = false; - - while (originalCharIndex < chunk.end) { - if (original[originalCharIndex] === '\n') { - loc.line += 1; - loc.column = 0; - this.generatedCodeLine += 1; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - this.generatedCodeColumn = 0; - first = true; - charInHiresBoundary = false; - } else { - if (this.hires || first || sourcemapLocations.has(originalCharIndex)) { - const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column]; - - if (this.hires === 'boundary') { - // in hires "boundary", group segments per word boundary than per char - if (wordRegex.test(original[originalCharIndex])) { - // for first char in the boundary found, start the boundary by pushing a segment - if (!charInHiresBoundary) { - this.rawSegments.push(segment); - charInHiresBoundary = true; - } - } else { - // for non-word char, end the boundary by pushing a segment - this.rawSegments.push(segment); - charInHiresBoundary = false; - } - } else { - this.rawSegments.push(segment); - } - } - - loc.column += 1; - this.generatedCodeColumn += 1; - first = false; - } - - originalCharIndex += 1; - } - - this.pending = null; - } - - advance(str) { - if (!str) return; - - const lines = str.split('\n'); - - if (lines.length > 1) { - for (let i = 0; i < lines.length - 1; i++) { - this.generatedCodeLine++; - this.raw[this.generatedCodeLine] = this.rawSegments = []; - } - this.generatedCodeColumn = 0; - } - - this.generatedCodeColumn += lines[lines.length - 1].length; - } - } - - const n = '\n'; - - const warned = { - insertLeft: false, - insertRight: false, - storeName: false, - }; - - class MagicString { - constructor(string, options = {}) { - const chunk = new Chunk(0, string.length, string); - - Object.defineProperties(this, { - original: { writable: true, value: string }, - outro: { writable: true, value: '' }, - intro: { writable: true, value: '' }, - firstChunk: { writable: true, value: chunk }, - lastChunk: { writable: true, value: chunk }, - lastSearchedChunk: { writable: true, value: chunk }, - byStart: { writable: true, value: {} }, - byEnd: { writable: true, value: {} }, - filename: { writable: true, value: options.filename }, - indentExclusionRanges: { writable: true, value: options.indentExclusionRanges }, - sourcemapLocations: { writable: true, value: new BitSet() }, - storedNames: { writable: true, value: {} }, - indentStr: { writable: true, value: undefined }, - ignoreList: { writable: true, value: options.ignoreList }, - offset: { writable: true, value: options.offset || 0 }, - }); - - this.byStart[0] = chunk; - this.byEnd[string.length] = chunk; - } - - addSourcemapLocation(char) { - this.sourcemapLocations.add(char); - } - - append(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.outro += content; - return this; - } - - appendLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.appendLeft(content); - } else { - this.intro += content; - } - return this; - } - - appendRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.appendRight(content); - } else { - this.outro += content; - } - return this; - } - - clone() { - const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset }); - - let originalChunk = this.firstChunk; - let clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone()); - - while (originalChunk) { - cloned.byStart[clonedChunk.start] = clonedChunk; - cloned.byEnd[clonedChunk.end] = clonedChunk; - - const nextOriginalChunk = originalChunk.next; - const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone(); - - if (nextClonedChunk) { - clonedChunk.next = nextClonedChunk; - nextClonedChunk.previous = clonedChunk; - - clonedChunk = nextClonedChunk; - } - - originalChunk = nextOriginalChunk; - } - - cloned.lastChunk = clonedChunk; - - if (this.indentExclusionRanges) { - cloned.indentExclusionRanges = this.indentExclusionRanges.slice(); - } - - cloned.sourcemapLocations = new BitSet(this.sourcemapLocations); - - cloned.intro = this.intro; - cloned.outro = this.outro; - - return cloned; - } - - generateDecodedMap(options) { - options = options || {}; - - const sourceIndex = 0; - const names = Object.keys(this.storedNames); - const mappings = new Mappings(options.hires); - - const locate = getLocator(this.original); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (this.outro) { - mappings.advance(this.outro); - } - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: [ - options.source ? getRelativePath(options.file || '', options.source) : options.file || '', - ], - sourcesContent: options.includeContent ? [this.original] : undefined, - names, - mappings: mappings.raw, - x_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - _ensureindentStr() { - if (this.indentStr === undefined) { - this.indentStr = guessIndent(this.original); - } - } - - _getRawIndentString() { - this._ensureindentStr(); - return this.indentStr; - } - - getIndentString() { - this._ensureindentStr(); - return this.indentStr === null ? '\t' : this.indentStr; - } - - indent(indentStr, options) { - const pattern = /^[^\r\n]/gm; - - if (isObject(indentStr)) { - options = indentStr; - indentStr = undefined; - } - - if (indentStr === undefined) { - this._ensureindentStr(); - indentStr = this.indentStr || '\t'; - } - - if (indentStr === '') return this; // noop - - options = options || {}; - - // Process exclusion ranges - const isExcluded = {}; - - if (options.exclude) { - const exclusions = - typeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude; - exclusions.forEach((exclusion) => { - for (let i = exclusion[0]; i < exclusion[1]; i += 1) { - isExcluded[i] = true; - } - }); - } - - let shouldIndentNextCharacter = options.indentStart !== false; - const replacer = (match) => { - if (shouldIndentNextCharacter) return `${indentStr}${match}`; - shouldIndentNextCharacter = true; - return match; - }; - - this.intro = this.intro.replace(pattern, replacer); - - let charIndex = 0; - let chunk = this.firstChunk; - - while (chunk) { - const end = chunk.end; - - if (chunk.edited) { - if (!isExcluded[charIndex]) { - chunk.content = chunk.content.replace(pattern, replacer); - - if (chunk.content.length) { - shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\n'; - } - } - } else { - charIndex = chunk.start; - - while (charIndex < end) { - if (!isExcluded[charIndex]) { - const char = this.original[charIndex]; - - if (char === '\n') { - shouldIndentNextCharacter = true; - } else if (char !== '\r' && shouldIndentNextCharacter) { - shouldIndentNextCharacter = false; - - if (charIndex === chunk.start) { - chunk.prependRight(indentStr); - } else { - this._splitChunk(chunk, charIndex); - chunk = chunk.next; - chunk.prependRight(indentStr); - } - } - } - - charIndex += 1; - } - } - - charIndex = chunk.end; - chunk = chunk.next; - } - - this.outro = this.outro.replace(pattern, replacer); - - return this; - } - - insert() { - throw new Error( - 'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)', - ); - } - - insertLeft(index, content) { - if (!warned.insertLeft) { - console.warn( - 'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead', - ); - warned.insertLeft = true; - } - - return this.appendLeft(index, content); - } - - insertRight(index, content) { - if (!warned.insertRight) { - console.warn( - 'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead', - ); - warned.insertRight = true; - } - - return this.prependRight(index, content); - } - - move(start, end, index) { - start = start + this.offset; - end = end + this.offset; - index = index + this.offset; - - if (index >= start && index <= end) throw new Error('Cannot move a selection inside itself'); - - this._split(start); - this._split(end); - this._split(index); - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - const oldLeft = first.previous; - const oldRight = last.next; - - const newRight = this.byStart[index]; - if (!newRight && last === this.lastChunk) return this; - const newLeft = newRight ? newRight.previous : this.lastChunk; - - if (oldLeft) oldLeft.next = oldRight; - if (oldRight) oldRight.previous = oldLeft; - - if (newLeft) newLeft.next = first; - if (newRight) newRight.previous = last; - - if (!first.previous) this.firstChunk = last.next; - if (!last.next) { - this.lastChunk = first.previous; - this.lastChunk.next = null; - } - - first.previous = newLeft; - last.next = newRight || null; - - if (!newLeft) this.firstChunk = first; - if (!newRight) this.lastChunk = last; - return this; - } - - overwrite(start, end, content, options) { - options = options || {}; - return this.update(start, end, content, { ...options, overwrite: !options.contentOnly }); - } - - update(start, end, content, options) { - start = start + this.offset; - end = end + this.offset; - - if (typeof content !== 'string') throw new TypeError('replacement content must be a string'); - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (end > this.original.length) throw new Error('end is out of bounds'); - if (start === end) - throw new Error( - 'Cannot overwrite a zero-length range – use appendLeft or prependRight instead', - ); - - this._split(start); - this._split(end); - - if (options === true) { - if (!warned.storeName) { - console.warn( - 'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string', - ); - warned.storeName = true; - } - - options = { storeName: true }; - } - const storeName = options !== undefined ? options.storeName : false; - const overwrite = options !== undefined ? options.overwrite : false; - - if (storeName) { - const original = this.original.slice(start, end); - Object.defineProperty(this.storedNames, original, { - writable: true, - value: true, - enumerable: true, - }); - } - - const first = this.byStart[start]; - const last = this.byEnd[end]; - - if (first) { - let chunk = first; - while (chunk !== last) { - if (chunk.next !== this.byStart[chunk.end]) { - throw new Error('Cannot overwrite across a split point'); - } - chunk = chunk.next; - chunk.edit('', false); - } - - first.edit(content, storeName, !overwrite); - } else { - // must be inserting at the end - const newChunk = new Chunk(start, end, '').edit(content, storeName); - - // TODO last chunk in the array may not be the last chunk, if it's moved... - last.next = newChunk; - newChunk.previous = last; - } - return this; - } - - prepend(content) { - if (typeof content !== 'string') throw new TypeError('outro content must be a string'); - - this.intro = content + this.intro; - return this; - } - - prependLeft(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byEnd[index]; - - if (chunk) { - chunk.prependLeft(content); - } else { - this.intro = content + this.intro; - } - return this; - } - - prependRight(index, content) { - index = index + this.offset; - - if (typeof content !== 'string') throw new TypeError('inserted content must be a string'); - - this._split(index); - - const chunk = this.byStart[index]; - - if (chunk) { - chunk.prependRight(content); - } else { - this.outro = content + this.outro; - } - return this; - } - - remove(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.intro = ''; - chunk.outro = ''; - chunk.edit(''); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - reset(start, end) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - if (start === end) return this; - - if (start < 0 || end > this.original.length) throw new Error('Character is out of bounds'); - if (start > end) throw new Error('end must be greater than start'); - - this._split(start); - this._split(end); - - let chunk = this.byStart[start]; - - while (chunk) { - chunk.reset(); - - chunk = end > chunk.end ? this.byStart[chunk.end] : null; - } - return this; - } - - lastChar() { - if (this.outro.length) return this.outro[this.outro.length - 1]; - let chunk = this.lastChunk; - do { - if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1]; - if (chunk.content.length) return chunk.content[chunk.content.length - 1]; - if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1]; - } while ((chunk = chunk.previous)); - if (this.intro.length) return this.intro[this.intro.length - 1]; - return ''; - } - - lastLine() { - let lineIndex = this.outro.lastIndexOf(n); - if (lineIndex !== -1) return this.outro.substr(lineIndex + 1); - let lineStr = this.outro; - let chunk = this.lastChunk; - do { - if (chunk.outro.length > 0) { - lineIndex = chunk.outro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.outro + lineStr; - } - - if (chunk.content.length > 0) { - lineIndex = chunk.content.lastIndexOf(n); - if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr; - lineStr = chunk.content + lineStr; - } - - if (chunk.intro.length > 0) { - lineIndex = chunk.intro.lastIndexOf(n); - if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr; - lineStr = chunk.intro + lineStr; - } - } while ((chunk = chunk.previous)); - lineIndex = this.intro.lastIndexOf(n); - if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr; - return this.intro + lineStr; - } - - slice(start = 0, end = this.original.length - this.offset) { - start = start + this.offset; - end = end + this.offset; - - if (this.original.length !== 0) { - while (start < 0) start += this.original.length; - while (end < 0) end += this.original.length; - } - - let result = ''; - - // find start chunk - let chunk = this.firstChunk; - while (chunk && (chunk.start > start || chunk.end <= start)) { - // found end chunk before start - if (chunk.start < end && chunk.end >= end) { - return result; - } - - chunk = chunk.next; - } - - if (chunk && chunk.edited && chunk.start !== start) - throw new Error(`Cannot use replaced character ${start} as slice start anchor.`); - - const startChunk = chunk; - while (chunk) { - if (chunk.intro && (startChunk !== chunk || chunk.start === start)) { - result += chunk.intro; - } - - const containsEnd = chunk.start < end && chunk.end >= end; - if (containsEnd && chunk.edited && chunk.end !== end) - throw new Error(`Cannot use replaced character ${end} as slice end anchor.`); - - const sliceStart = startChunk === chunk ? start - chunk.start : 0; - const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length; - - result += chunk.content.slice(sliceStart, sliceEnd); - - if (chunk.outro && (!containsEnd || chunk.end === end)) { - result += chunk.outro; - } - - if (containsEnd) { - break; - } - - chunk = chunk.next; - } - - return result; - } - - // TODO deprecate this? not really very useful - snip(start, end) { - const clone = this.clone(); - clone.remove(0, start); - clone.remove(end, clone.original.length); - - return clone; - } - - _split(index) { - if (this.byStart[index] || this.byEnd[index]) return; - - let chunk = this.lastSearchedChunk; - let previousChunk = chunk; - const searchForward = index > chunk.end; - - while (chunk) { - if (chunk.contains(index)) return this._splitChunk(chunk, index); - - chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start]; - - // Prevent infinite loop (e.g. via empty chunks, where start === end) - if (chunk === previousChunk) return; - - previousChunk = chunk; - } - } - - _splitChunk(chunk, index) { - if (chunk.edited && chunk.content.length) { - // zero-length edited chunks are a special case (overlapping replacements) - const loc = getLocator(this.original)(index); - throw new Error( - `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – "${chunk.original}")`, - ); - } - - const newChunk = chunk.split(index); - - this.byEnd[index] = chunk; - this.byStart[index] = newChunk; - this.byEnd[newChunk.end] = newChunk; - - if (chunk === this.lastChunk) this.lastChunk = newChunk; - - this.lastSearchedChunk = chunk; - return true; - } - - toString() { - let str = this.intro; - - let chunk = this.firstChunk; - while (chunk) { - str += chunk.toString(); - chunk = chunk.next; - } - - return str + this.outro; - } - - isEmpty() { - let chunk = this.firstChunk; - do { - if ( - (chunk.intro.length && chunk.intro.trim()) || - (chunk.content.length && chunk.content.trim()) || - (chunk.outro.length && chunk.outro.trim()) - ) - return false; - } while ((chunk = chunk.next)); - return true; - } - - length() { - let chunk = this.firstChunk; - let length = 0; - do { - length += chunk.intro.length + chunk.content.length + chunk.outro.length; - } while ((chunk = chunk.next)); - return length; - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimEndAborted(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - this.outro = this.outro.replace(rx, ''); - if (this.outro.length) return true; - - let chunk = this.lastChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimEnd(rx); - - // if chunk was trimmed, we have a new lastChunk - if (chunk.end !== end) { - if (this.lastChunk === chunk) { - this.lastChunk = chunk.next; - } - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.previous; - } while (chunk); - - return false; - } - - trimEnd(charType) { - this.trimEndAborted(charType); - return this; - } - trimStartAborted(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - - this.intro = this.intro.replace(rx, ''); - if (this.intro.length) return true; - - let chunk = this.firstChunk; - - do { - const end = chunk.end; - const aborted = chunk.trimStart(rx); - - if (chunk.end !== end) { - // special case... - if (chunk === this.lastChunk) this.lastChunk = chunk.next; - - this.byEnd[chunk.end] = chunk; - this.byStart[chunk.next.start] = chunk.next; - this.byEnd[chunk.next.end] = chunk.next; - } - - if (aborted) return true; - chunk = chunk.next; - } while (chunk); - - return false; - } - - trimStart(charType) { - this.trimStartAborted(charType); - return this; - } - - hasChanged() { - return this.original !== this.toString(); - } - - _replaceRegexp(searchValue, replacement) { - function getReplacement(match, str) { - if (typeof replacement === 'string') { - return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => { - // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter - if (i === '$') return '$'; - if (i === '&') return match[0]; - const num = +i; - if (num < match.length) return match[+i]; - return `$${i}`; - }); - } else { - return replacement(...match, match.index, str, match.groups); - } - } - function matchAll(re, str) { - let match; - const matches = []; - while ((match = re.exec(str))) { - matches.push(match); - } - return matches; - } - if (searchValue.global) { - const matches = matchAll(searchValue, this.original); - matches.forEach((match) => { - if (match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - }); - } else { - const match = this.original.match(searchValue); - if (match && match.index != null) { - const replacement = getReplacement(match, this.original); - if (replacement !== match[0]) { - this.overwrite(match.index, match.index + match[0].length, replacement); - } - } - } - return this; - } - - _replaceString(string, replacement) { - const { original } = this; - const index = original.indexOf(string); - - if (index !== -1) { - if (typeof replacement === 'function') { - replacement = replacement(string, index, original); - } - if (string !== replacement) { - this.overwrite(index, index + string.length, replacement); - } - } - - return this; - } - - replace(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceString(searchValue, replacement); - } - - return this._replaceRegexp(searchValue, replacement); - } - - _replaceAllString(string, replacement) { - const { original } = this; - const stringLength = string.length; - for ( - let index = original.indexOf(string); - index !== -1; - index = original.indexOf(string, index + stringLength) - ) { - const previous = original.slice(index, index + stringLength); - let _replacement = replacement; - if (typeof replacement === 'function') { - _replacement = replacement(previous, index, original); - } - if (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement); - } - - return this; - } - - replaceAll(searchValue, replacement) { - if (typeof searchValue === 'string') { - return this._replaceAllString(searchValue, replacement); - } - - if (!searchValue.global) { - throw new TypeError( - 'MagicString.prototype.replaceAll called with a non-global RegExp argument', - ); - } - - return this._replaceRegexp(searchValue, replacement); - } - } - - const hasOwnProp = Object.prototype.hasOwnProperty; - - class Bundle { - constructor(options = {}) { - this.intro = options.intro || ''; - this.separator = options.separator !== undefined ? options.separator : '\n'; - this.sources = []; - this.uniqueSources = []; - this.uniqueSourceIndexByFilename = {}; - } - - addSource(source) { - if (source instanceof MagicString) { - return this.addSource({ - content: source, - filename: source.filename, - separator: this.separator, - }); - } - - if (!isObject(source) || !source.content) { - throw new Error( - 'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`', - ); - } - - ['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => { - if (!hasOwnProp.call(source, option)) source[option] = source.content[option]; - }); - - if (source.separator === undefined) { - // TODO there's a bunch of this sort of thing, needs cleaning up - source.separator = this.separator; - } - - if (source.filename) { - if (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) { - this.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length; - this.uniqueSources.push({ filename: source.filename, content: source.content.original }); - } else { - const uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]]; - if (source.content.original !== uniqueSource.content) { - throw new Error(`Illegal source: same filename (${source.filename}), different contents`); - } - } - } - - this.sources.push(source); - return this; - } - - append(str, options) { - this.addSource({ - content: new MagicString(str), - separator: (options && options.separator) || '', - }); - - return this; - } - - clone() { - const bundle = new Bundle({ - intro: this.intro, - separator: this.separator, - }); - - this.sources.forEach((source) => { - bundle.addSource({ - filename: source.filename, - content: source.content.clone(), - separator: source.separator, - }); - }); - - return bundle; - } - - generateDecodedMap(options = {}) { - const names = []; - let x_google_ignoreList = undefined; - this.sources.forEach((source) => { - Object.keys(source.content.storedNames).forEach((name) => { - if (!~names.indexOf(name)) names.push(name); - }); - }); - - const mappings = new Mappings(options.hires); - - if (this.intro) { - mappings.advance(this.intro); - } - - this.sources.forEach((source, i) => { - if (i > 0) { - mappings.advance(this.separator); - } - - const sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1; - const magicString = source.content; - const locate = getLocator(magicString.original); - - if (magicString.intro) { - mappings.advance(magicString.intro); - } - - magicString.firstChunk.eachNext((chunk) => { - const loc = locate(chunk.start); - - if (chunk.intro.length) mappings.advance(chunk.intro); - - if (source.filename) { - if (chunk.edited) { - mappings.addEdit( - sourceIndex, - chunk.content, - loc, - chunk.storeName ? names.indexOf(chunk.original) : -1, - ); - } else { - mappings.addUneditedChunk( - sourceIndex, - chunk, - magicString.original, - loc, - magicString.sourcemapLocations, - ); - } - } else { - mappings.advance(chunk.content); - } - - if (chunk.outro.length) mappings.advance(chunk.outro); - }); - - if (magicString.outro) { - mappings.advance(magicString.outro); - } - - if (source.ignoreList && sourceIndex !== -1) { - if (x_google_ignoreList === undefined) { - x_google_ignoreList = []; - } - x_google_ignoreList.push(sourceIndex); - } - }); - - return { - file: options.file ? options.file.split(/[/\\]/).pop() : undefined, - sources: this.uniqueSources.map((source) => { - return options.file ? getRelativePath(options.file, source.filename) : source.filename; - }), - sourcesContent: this.uniqueSources.map((source) => { - return options.includeContent ? source.content : null; - }), - names, - mappings: mappings.raw, - x_google_ignoreList, - }; - } - - generateMap(options) { - return new SourceMap(this.generateDecodedMap(options)); - } - - getIndentString() { - const indentStringCounts = {}; - - this.sources.forEach((source) => { - const indentStr = source.content._getRawIndentString(); - - if (indentStr === null) return; - - if (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0; - indentStringCounts[indentStr] += 1; - }); - - return ( - Object.keys(indentStringCounts).sort((a, b) => { - return indentStringCounts[a] - indentStringCounts[b]; - })[0] || '\t' - ); - } - - indent(indentStr) { - if (!arguments.length) { - indentStr = this.getIndentString(); - } - - if (indentStr === '') return this; // noop - - let trailingNewline = !this.intro || this.intro.slice(-1) === '\n'; - - this.sources.forEach((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const indentStart = trailingNewline || (i > 0 && /\r?\n$/.test(separator)); - - source.content.indent(indentStr, { - exclude: source.indentExclusionRanges, - indentStart, //: trailingNewline || /\r?\n$/.test( separator ) //true///\r?\n/.test( separator ) - }); - - trailingNewline = source.content.lastChar() === '\n'; - }); - - if (this.intro) { - this.intro = - indentStr + - this.intro.replace(/^[^\n]/gm, (match, index) => { - return index > 0 ? indentStr + match : match; - }); - } - - return this; - } - - prepend(str) { - this.intro = str + this.intro; - return this; - } - - toString() { - const body = this.sources - .map((source, i) => { - const separator = source.separator !== undefined ? source.separator : this.separator; - const str = (i > 0 ? separator : '') + source.content.toString(); - - return str; - }) - .join(''); - - return this.intro + body; - } - - isEmpty() { - if (this.intro.length && this.intro.trim()) return false; - if (this.sources.some((source) => !source.content.isEmpty())) return false; - return true; - } - - length() { - return this.sources.reduce( - (length, source) => length + source.content.length(), - this.intro.length, - ); - } - - trimLines() { - return this.trim('[\\r\\n]'); - } - - trim(charType) { - return this.trimStart(charType).trimEnd(charType); - } - - trimStart(charType) { - const rx = new RegExp('^' + (charType || '\\s') + '+'); - this.intro = this.intro.replace(rx, ''); - - if (!this.intro) { - let source; - let i = 0; - - do { - source = this.sources[i++]; - if (!source) { - break; - } - } while (!source.content.trimStartAborted(charType)); - } - - return this; - } - - trimEnd(charType) { - const rx = new RegExp((charType || '\\s') + '+$'); - - let source; - let i = this.sources.length - 1; - - do { - source = this.sources[i--]; - if (!source) { - this.intro = this.intro.replace(rx, ''); - break; - } - } while (!source.content.trimEndAborted(charType)); - - return this; - } - } - - MagicString.Bundle = Bundle; - MagicString.SourceMap = SourceMap; - MagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121 - - return MagicString; - -})); -//# sourceMappingURL=magic-string.umd.js.map diff --git a/node_modules/magic-string/dist/magic-string.umd.js.map b/node_modules/magic-string/dist/magic-string.umd.js.map deleted file mode 100644 index 43addb8..0000000 --- a/node_modules/magic-string/dist/magic-string.umd.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"magic-string.umd.js","sources":["../src/BitSet.js","../src/Chunk.js","../node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs","../src/SourceMap.js","../src/utils/guessIndent.js","../src/utils/getRelativePath.js","../src/utils/isObject.js","../src/utils/getLocator.js","../src/utils/Mappings.js","../src/MagicString.js","../src/Bundle.js","../src/index-legacy.js"],"sourcesContent":["export default class BitSet {\n\tconstructor(arg) {\n\t\tthis.bits = arg instanceof BitSet ? arg.bits.slice() : [];\n\t}\n\n\tadd(n) {\n\t\tthis.bits[n >> 5] |= 1 << (n & 31);\n\t}\n\n\thas(n) {\n\t\treturn !!(this.bits[n >> 5] & (1 << (n & 31)));\n\t}\n}\n","export default class Chunk {\n\tconstructor(start, end, content) {\n\t\tthis.start = start;\n\t\tthis.end = end;\n\t\tthis.original = content;\n\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\n\t\tthis.content = content;\n\t\tthis.storeName = false;\n\t\tthis.edited = false;\n\n\t\tif (DEBUG) {\n\t\t\t// we make these non-enumerable, for sanity while debugging\n\t\t\tObject.defineProperties(this, {\n\t\t\t\tprevious: { writable: true, value: null },\n\t\t\t\tnext: { writable: true, value: null },\n\t\t\t});\n\t\t} else {\n\t\t\tthis.previous = null;\n\t\t\tthis.next = null;\n\t\t}\n\t}\n\n\tappendLeft(content) {\n\t\tthis.outro += content;\n\t}\n\n\tappendRight(content) {\n\t\tthis.intro = this.intro + content;\n\t}\n\n\tclone() {\n\t\tconst chunk = new Chunk(this.start, this.end, this.original);\n\n\t\tchunk.intro = this.intro;\n\t\tchunk.outro = this.outro;\n\t\tchunk.content = this.content;\n\t\tchunk.storeName = this.storeName;\n\t\tchunk.edited = this.edited;\n\n\t\treturn chunk;\n\t}\n\n\tcontains(index) {\n\t\treturn this.start < index && index < this.end;\n\t}\n\n\teachNext(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.next;\n\t\t}\n\t}\n\n\teachPrevious(fn) {\n\t\tlet chunk = this;\n\t\twhile (chunk) {\n\t\t\tfn(chunk);\n\t\t\tchunk = chunk.previous;\n\t\t}\n\t}\n\n\tedit(content, storeName, contentOnly) {\n\t\tthis.content = content;\n\t\tif (!contentOnly) {\n\t\t\tthis.intro = '';\n\t\t\tthis.outro = '';\n\t\t}\n\t\tthis.storeName = storeName;\n\n\t\tthis.edited = true;\n\n\t\treturn this;\n\t}\n\n\tprependLeft(content) {\n\t\tthis.outro = content + this.outro;\n\t}\n\n\tprependRight(content) {\n\t\tthis.intro = content + this.intro;\n\t}\n\n\treset() {\n\t\tthis.intro = '';\n\t\tthis.outro = '';\n\t\tif (this.edited) {\n\t\t\tthis.content = this.original;\n\t\t\tthis.storeName = false;\n\t\t\tthis.edited = false;\n\t\t}\n\t}\n\n\tsplit(index) {\n\t\tconst sliceIndex = index - this.start;\n\n\t\tconst originalBefore = this.original.slice(0, sliceIndex);\n\t\tconst originalAfter = this.original.slice(sliceIndex);\n\n\t\tthis.original = originalBefore;\n\n\t\tconst newChunk = new Chunk(index, this.end, originalAfter);\n\t\tnewChunk.outro = this.outro;\n\t\tthis.outro = '';\n\n\t\tthis.end = index;\n\n\t\tif (this.edited) {\n\t\t\t// after split we should save the edit content record into the correct chunk\n\t\t\t// to make sure sourcemap correct\n\t\t\t// For example:\n\t\t\t// ' test'.trim()\n\t\t\t// split -> ' ' + 'test'\n\t\t\t// ✔️ edit -> '' + 'test'\n\t\t\t// ✖️ edit -> 'test' + ''\n\t\t\t// TODO is this block necessary?...\n\t\t\tnewChunk.edit('', false);\n\t\t\tthis.content = '';\n\t\t} else {\n\t\t\tthis.content = originalBefore;\n\t\t}\n\n\t\tnewChunk.next = this.next;\n\t\tif (newChunk.next) newChunk.next.previous = newChunk;\n\t\tnewChunk.previous = this;\n\t\tthis.next = newChunk;\n\n\t\treturn newChunk;\n\t}\n\n\ttoString() {\n\t\treturn this.intro + this.content + this.outro;\n\t}\n\n\ttrimEnd(rx) {\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tthis.split(this.start + trimmed.length).edit('', undefined, true);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tthis.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\tif (this.intro.length) return true;\n\t\t}\n\t}\n\n\ttrimStart(rx) {\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tconst trimmed = this.content.replace(rx, '');\n\n\t\tif (trimmed.length) {\n\t\t\tif (trimmed !== this.content) {\n\t\t\t\tconst newChunk = this.split(this.end - trimmed.length);\n\t\t\t\tif (this.edited) {\n\t\t\t\t\t// save the change, if it has been edited\n\t\t\t\t\tnewChunk.edit(trimmed, this.storeName, true);\n\t\t\t\t}\n\t\t\t\tthis.edit('', undefined, true);\n\t\t\t}\n\t\t\treturn true;\n\t\t} else {\n\t\t\tthis.edit('', undefined, true);\n\n\t\t\tthis.outro = this.outro.replace(rx, '');\n\t\t\tif (this.outro.length) return true;\n\t\t}\n\t}\n}\n","// src/vlq.ts\nvar comma = \",\".charCodeAt(0);\nvar semicolon = \";\".charCodeAt(0);\nvar chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nvar intToChar = new Uint8Array(64);\nvar charToInt = new Uint8Array(128);\nfor (let i = 0; i < chars.length; i++) {\n const c = chars.charCodeAt(i);\n intToChar[i] = c;\n charToInt[c] = i;\n}\nfunction decodeInteger(reader, relative) {\n let value = 0;\n let shift = 0;\n let integer = 0;\n do {\n const c = reader.next();\n integer = charToInt[c];\n value |= (integer & 31) << shift;\n shift += 5;\n } while (integer & 32);\n const shouldNegate = value & 1;\n value >>>= 1;\n if (shouldNegate) {\n value = -2147483648 | -value;\n }\n return relative + value;\n}\nfunction encodeInteger(builder, num, relative) {\n let delta = num - relative;\n delta = delta < 0 ? -delta << 1 | 1 : delta << 1;\n do {\n let clamped = delta & 31;\n delta >>>= 5;\n if (delta > 0) clamped |= 32;\n builder.write(intToChar[clamped]);\n } while (delta > 0);\n return num;\n}\nfunction hasMoreVlq(reader, max) {\n if (reader.pos >= max) return false;\n return reader.peek() !== comma;\n}\n\n// src/strings.ts\nvar bufLength = 1024 * 16;\nvar td = typeof TextDecoder !== \"undefined\" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== \"undefined\" ? {\n decode(buf) {\n const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);\n return out.toString();\n }\n} : {\n decode(buf) {\n let out = \"\";\n for (let i = 0; i < buf.length; i++) {\n out += String.fromCharCode(buf[i]);\n }\n return out;\n }\n};\nvar StringWriter = class {\n constructor() {\n this.pos = 0;\n this.out = \"\";\n this.buffer = new Uint8Array(bufLength);\n }\n write(v) {\n const { buffer } = this;\n buffer[this.pos++] = v;\n if (this.pos === bufLength) {\n this.out += td.decode(buffer);\n this.pos = 0;\n }\n }\n flush() {\n const { buffer, out, pos } = this;\n return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;\n }\n};\nvar StringReader = class {\n constructor(buffer) {\n this.pos = 0;\n this.buffer = buffer;\n }\n next() {\n return this.buffer.charCodeAt(this.pos++);\n }\n peek() {\n return this.buffer.charCodeAt(this.pos);\n }\n indexOf(char) {\n const { buffer, pos } = this;\n const idx = buffer.indexOf(char, pos);\n return idx === -1 ? buffer.length : idx;\n }\n};\n\n// src/scopes.ts\nvar EMPTY = [];\nfunction decodeOriginalScopes(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const scopes = [];\n const stack = [];\n let line = 0;\n for (; reader.pos < length; reader.pos++) {\n line = decodeInteger(reader, line);\n const column = decodeInteger(reader, 0);\n if (!hasMoreVlq(reader, length)) {\n const last = stack.pop();\n last[2] = line;\n last[3] = column;\n continue;\n }\n const kind = decodeInteger(reader, 0);\n const fields = decodeInteger(reader, 0);\n const hasName = fields & 1;\n const scope = hasName ? [line, column, 0, 0, kind, decodeInteger(reader, 0)] : [line, column, 0, 0, kind];\n let vars = EMPTY;\n if (hasMoreVlq(reader, length)) {\n vars = [];\n do {\n const varsIndex = decodeInteger(reader, 0);\n vars.push(varsIndex);\n } while (hasMoreVlq(reader, length));\n }\n scope.vars = vars;\n scopes.push(scope);\n stack.push(scope);\n }\n return scopes;\n}\nfunction encodeOriginalScopes(scopes) {\n const writer = new StringWriter();\n for (let i = 0; i < scopes.length; ) {\n i = _encodeOriginalScopes(scopes, i, writer, [0]);\n }\n return writer.flush();\n}\nfunction _encodeOriginalScopes(scopes, index, writer, state) {\n const scope = scopes[index];\n const { 0: startLine, 1: startColumn, 2: endLine, 3: endColumn, 4: kind, vars } = scope;\n if (index > 0) writer.write(comma);\n state[0] = encodeInteger(writer, startLine, state[0]);\n encodeInteger(writer, startColumn, 0);\n encodeInteger(writer, kind, 0);\n const fields = scope.length === 6 ? 1 : 0;\n encodeInteger(writer, fields, 0);\n if (scope.length === 6) encodeInteger(writer, scope[5], 0);\n for (const v of vars) {\n encodeInteger(writer, v, 0);\n }\n for (index++; index < scopes.length; ) {\n const next = scopes[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeOriginalScopes(scopes, index, writer, state);\n }\n writer.write(comma);\n state[0] = encodeInteger(writer, endLine, state[0]);\n encodeInteger(writer, endColumn, 0);\n return index;\n}\nfunction decodeGeneratedRanges(input) {\n const { length } = input;\n const reader = new StringReader(input);\n const ranges = [];\n const stack = [];\n let genLine = 0;\n let definitionSourcesIndex = 0;\n let definitionScopeIndex = 0;\n let callsiteSourcesIndex = 0;\n let callsiteLine = 0;\n let callsiteColumn = 0;\n let bindingLine = 0;\n let bindingColumn = 0;\n do {\n const semi = reader.indexOf(\";\");\n let genColumn = 0;\n for (; reader.pos < semi; reader.pos++) {\n genColumn = decodeInteger(reader, genColumn);\n if (!hasMoreVlq(reader, semi)) {\n const last = stack.pop();\n last[2] = genLine;\n last[3] = genColumn;\n continue;\n }\n const fields = decodeInteger(reader, 0);\n const hasDefinition = fields & 1;\n const hasCallsite = fields & 2;\n const hasScope = fields & 4;\n let callsite = null;\n let bindings = EMPTY;\n let range;\n if (hasDefinition) {\n const defSourcesIndex = decodeInteger(reader, definitionSourcesIndex);\n definitionScopeIndex = decodeInteger(\n reader,\n definitionSourcesIndex === defSourcesIndex ? definitionScopeIndex : 0\n );\n definitionSourcesIndex = defSourcesIndex;\n range = [genLine, genColumn, 0, 0, defSourcesIndex, definitionScopeIndex];\n } else {\n range = [genLine, genColumn, 0, 0];\n }\n range.isScope = !!hasScope;\n if (hasCallsite) {\n const prevCsi = callsiteSourcesIndex;\n const prevLine = callsiteLine;\n callsiteSourcesIndex = decodeInteger(reader, callsiteSourcesIndex);\n const sameSource = prevCsi === callsiteSourcesIndex;\n callsiteLine = decodeInteger(reader, sameSource ? callsiteLine : 0);\n callsiteColumn = decodeInteger(\n reader,\n sameSource && prevLine === callsiteLine ? callsiteColumn : 0\n );\n callsite = [callsiteSourcesIndex, callsiteLine, callsiteColumn];\n }\n range.callsite = callsite;\n if (hasMoreVlq(reader, semi)) {\n bindings = [];\n do {\n bindingLine = genLine;\n bindingColumn = genColumn;\n const expressionsCount = decodeInteger(reader, 0);\n let expressionRanges;\n if (expressionsCount < -1) {\n expressionRanges = [[decodeInteger(reader, 0)]];\n for (let i = -1; i > expressionsCount; i--) {\n const prevBl = bindingLine;\n bindingLine = decodeInteger(reader, bindingLine);\n bindingColumn = decodeInteger(reader, bindingLine === prevBl ? bindingColumn : 0);\n const expression = decodeInteger(reader, 0);\n expressionRanges.push([expression, bindingLine, bindingColumn]);\n }\n } else {\n expressionRanges = [[expressionsCount]];\n }\n bindings.push(expressionRanges);\n } while (hasMoreVlq(reader, semi));\n }\n range.bindings = bindings;\n ranges.push(range);\n stack.push(range);\n }\n genLine++;\n reader.pos = semi + 1;\n } while (reader.pos < length);\n return ranges;\n}\nfunction encodeGeneratedRanges(ranges) {\n if (ranges.length === 0) return \"\";\n const writer = new StringWriter();\n for (let i = 0; i < ranges.length; ) {\n i = _encodeGeneratedRanges(ranges, i, writer, [0, 0, 0, 0, 0, 0, 0]);\n }\n return writer.flush();\n}\nfunction _encodeGeneratedRanges(ranges, index, writer, state) {\n const range = ranges[index];\n const {\n 0: startLine,\n 1: startColumn,\n 2: endLine,\n 3: endColumn,\n isScope,\n callsite,\n bindings\n } = range;\n if (state[0] < startLine) {\n catchupLine(writer, state[0], startLine);\n state[0] = startLine;\n state[1] = 0;\n } else if (index > 0) {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, range[1], state[1]);\n const fields = (range.length === 6 ? 1 : 0) | (callsite ? 2 : 0) | (isScope ? 4 : 0);\n encodeInteger(writer, fields, 0);\n if (range.length === 6) {\n const { 4: sourcesIndex, 5: scopesIndex } = range;\n if (sourcesIndex !== state[2]) {\n state[3] = 0;\n }\n state[2] = encodeInteger(writer, sourcesIndex, state[2]);\n state[3] = encodeInteger(writer, scopesIndex, state[3]);\n }\n if (callsite) {\n const { 0: sourcesIndex, 1: callLine, 2: callColumn } = range.callsite;\n if (sourcesIndex !== state[4]) {\n state[5] = 0;\n state[6] = 0;\n } else if (callLine !== state[5]) {\n state[6] = 0;\n }\n state[4] = encodeInteger(writer, sourcesIndex, state[4]);\n state[5] = encodeInteger(writer, callLine, state[5]);\n state[6] = encodeInteger(writer, callColumn, state[6]);\n }\n if (bindings) {\n for (const binding of bindings) {\n if (binding.length > 1) encodeInteger(writer, -binding.length, 0);\n const expression = binding[0][0];\n encodeInteger(writer, expression, 0);\n let bindingStartLine = startLine;\n let bindingStartColumn = startColumn;\n for (let i = 1; i < binding.length; i++) {\n const expRange = binding[i];\n bindingStartLine = encodeInteger(writer, expRange[1], bindingStartLine);\n bindingStartColumn = encodeInteger(writer, expRange[2], bindingStartColumn);\n encodeInteger(writer, expRange[0], 0);\n }\n }\n }\n for (index++; index < ranges.length; ) {\n const next = ranges[index];\n const { 0: l, 1: c } = next;\n if (l > endLine || l === endLine && c >= endColumn) {\n break;\n }\n index = _encodeGeneratedRanges(ranges, index, writer, state);\n }\n if (state[0] < endLine) {\n catchupLine(writer, state[0], endLine);\n state[0] = endLine;\n state[1] = 0;\n } else {\n writer.write(comma);\n }\n state[1] = encodeInteger(writer, endColumn, state[1]);\n return index;\n}\nfunction catchupLine(writer, lastLine, line) {\n do {\n writer.write(semicolon);\n } while (++lastLine < line);\n}\n\n// src/sourcemap-codec.ts\nfunction decode(mappings) {\n const { length } = mappings;\n const reader = new StringReader(mappings);\n const decoded = [];\n let genColumn = 0;\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n do {\n const semi = reader.indexOf(\";\");\n const line = [];\n let sorted = true;\n let lastCol = 0;\n genColumn = 0;\n while (reader.pos < semi) {\n let seg;\n genColumn = decodeInteger(reader, genColumn);\n if (genColumn < lastCol) sorted = false;\n lastCol = genColumn;\n if (hasMoreVlq(reader, semi)) {\n sourcesIndex = decodeInteger(reader, sourcesIndex);\n sourceLine = decodeInteger(reader, sourceLine);\n sourceColumn = decodeInteger(reader, sourceColumn);\n if (hasMoreVlq(reader, semi)) {\n namesIndex = decodeInteger(reader, namesIndex);\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn, namesIndex];\n } else {\n seg = [genColumn, sourcesIndex, sourceLine, sourceColumn];\n }\n } else {\n seg = [genColumn];\n }\n line.push(seg);\n reader.pos++;\n }\n if (!sorted) sort(line);\n decoded.push(line);\n reader.pos = semi + 1;\n } while (reader.pos <= length);\n return decoded;\n}\nfunction sort(line) {\n line.sort(sortComparator);\n}\nfunction sortComparator(a, b) {\n return a[0] - b[0];\n}\nfunction encode(decoded) {\n const writer = new StringWriter();\n let sourcesIndex = 0;\n let sourceLine = 0;\n let sourceColumn = 0;\n let namesIndex = 0;\n for (let i = 0; i < decoded.length; i++) {\n const line = decoded[i];\n if (i > 0) writer.write(semicolon);\n if (line.length === 0) continue;\n let genColumn = 0;\n for (let j = 0; j < line.length; j++) {\n const segment = line[j];\n if (j > 0) writer.write(comma);\n genColumn = encodeInteger(writer, segment[0], genColumn);\n if (segment.length === 1) continue;\n sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);\n sourceLine = encodeInteger(writer, segment[2], sourceLine);\n sourceColumn = encodeInteger(writer, segment[3], sourceColumn);\n if (segment.length === 4) continue;\n namesIndex = encodeInteger(writer, segment[4], namesIndex);\n }\n }\n return writer.flush();\n}\nexport {\n decode,\n decodeGeneratedRanges,\n decodeOriginalScopes,\n encode,\n encodeGeneratedRanges,\n encodeOriginalScopes\n};\n//# sourceMappingURL=sourcemap-codec.mjs.map\n","import { encode } from '@jridgewell/sourcemap-codec';\n\nfunction getBtoa() {\n\tif (typeof globalThis !== 'undefined' && typeof globalThis.btoa === 'function') {\n\t\treturn (str) => globalThis.btoa(unescape(encodeURIComponent(str)));\n\t} else if (typeof Buffer === 'function') {\n\t\treturn (str) => Buffer.from(str, 'utf-8').toString('base64');\n\t} else {\n\t\treturn () => {\n\t\t\tthrow new Error('Unsupported environment: `window.btoa` or `Buffer` should be supported.');\n\t\t};\n\t}\n}\n\nconst btoa = /*#__PURE__*/ getBtoa();\n\nexport default class SourceMap {\n\tconstructor(properties) {\n\t\tthis.version = 3;\n\t\tthis.file = properties.file;\n\t\tthis.sources = properties.sources;\n\t\tthis.sourcesContent = properties.sourcesContent;\n\t\tthis.names = properties.names;\n\t\tthis.mappings = encode(properties.mappings);\n\t\tif (typeof properties.x_google_ignoreList !== 'undefined') {\n\t\t\tthis.x_google_ignoreList = properties.x_google_ignoreList;\n\t\t}\n\t\tif (typeof properties.debugId !== 'undefined') {\n\t\t\tthis.debugId = properties.debugId;\n\t\t}\n\t}\n\n\ttoString() {\n\t\treturn JSON.stringify(this);\n\t}\n\n\ttoUrl() {\n\t\treturn 'data:application/json;charset=utf-8;base64,' + btoa(this.toString());\n\t}\n}\n","export default function guessIndent(code) {\n\tconst lines = code.split('\\n');\n\n\tconst tabbed = lines.filter((line) => /^\\t+/.test(line));\n\tconst spaced = lines.filter((line) => /^ {2,}/.test(line));\n\n\tif (tabbed.length === 0 && spaced.length === 0) {\n\t\treturn null;\n\t}\n\n\t// More lines tabbed than spaced? Assume tabs, and\n\t// default to tabs in the case of a tie (or nothing\n\t// to go on)\n\tif (tabbed.length >= spaced.length) {\n\t\treturn '\\t';\n\t}\n\n\t// Otherwise, we need to guess the multiple\n\tconst min = spaced.reduce((previous, current) => {\n\t\tconst numSpaces = /^ +/.exec(current)[0].length;\n\t\treturn Math.min(numSpaces, previous);\n\t}, Infinity);\n\n\treturn new Array(min + 1).join(' ');\n}\n","export default function getRelativePath(from, to) {\n\tconst fromParts = from.split(/[/\\\\]/);\n\tconst toParts = to.split(/[/\\\\]/);\n\n\tfromParts.pop(); // get dirname\n\n\twhile (fromParts[0] === toParts[0]) {\n\t\tfromParts.shift();\n\t\ttoParts.shift();\n\t}\n\n\tif (fromParts.length) {\n\t\tlet i = fromParts.length;\n\t\twhile (i--) fromParts[i] = '..';\n\t}\n\n\treturn fromParts.concat(toParts).join('/');\n}\n","const toString = Object.prototype.toString;\n\nexport default function isObject(thing) {\n\treturn toString.call(thing) === '[object Object]';\n}\n","export default function getLocator(source) {\n\tconst originalLines = source.split('\\n');\n\tconst lineOffsets = [];\n\n\tfor (let i = 0, pos = 0; i < originalLines.length; i++) {\n\t\tlineOffsets.push(pos);\n\t\tpos += originalLines[i].length + 1;\n\t}\n\n\treturn function locate(index) {\n\t\tlet i = 0;\n\t\tlet j = lineOffsets.length;\n\t\twhile (i < j) {\n\t\t\tconst m = (i + j) >> 1;\n\t\t\tif (index < lineOffsets[m]) {\n\t\t\t\tj = m;\n\t\t\t} else {\n\t\t\t\ti = m + 1;\n\t\t\t}\n\t\t}\n\t\tconst line = i - 1;\n\t\tconst column = index - lineOffsets[line];\n\t\treturn { line, column };\n\t};\n}\n","const wordRegex = /\\w/;\n\nexport default class Mappings {\n\tconstructor(hires) {\n\t\tthis.hires = hires;\n\t\tthis.generatedCodeLine = 0;\n\t\tthis.generatedCodeColumn = 0;\n\t\tthis.raw = [];\n\t\tthis.rawSegments = this.raw[this.generatedCodeLine] = [];\n\t\tthis.pending = null;\n\t}\n\n\taddEdit(sourceIndex, content, loc, nameIndex) {\n\t\tif (content.length) {\n\t\t\tconst contentLengthMinusOne = content.length - 1;\n\t\t\tlet contentLineEnd = content.indexOf('\\n', 0);\n\t\t\tlet previousContentLineEnd = -1;\n\t\t\t// Loop through each line in the content and add a segment, but stop if the last line is empty,\n\t\t\t// else code afterwards would fill one line too many\n\t\t\twhile (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {\n\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\t\tif (nameIndex >= 0) {\n\t\t\t\t\tsegment.push(nameIndex);\n\t\t\t\t}\n\t\t\t\tthis.rawSegments.push(segment);\n\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\n\t\t\t\tpreviousContentLineEnd = contentLineEnd;\n\t\t\t\tcontentLineEnd = content.indexOf('\\n', contentLineEnd + 1);\n\t\t\t}\n\n\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\t\t\tif (nameIndex >= 0) {\n\t\t\t\tsegment.push(nameIndex);\n\t\t\t}\n\t\t\tthis.rawSegments.push(segment);\n\n\t\t\tthis.advance(content.slice(previousContentLineEnd + 1));\n\t\t} else if (this.pending) {\n\t\t\tthis.rawSegments.push(this.pending);\n\t\t\tthis.advance(content);\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\taddUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {\n\t\tlet originalCharIndex = chunk.start;\n\t\tlet first = true;\n\t\t// when iterating each char, check if it's in a word boundary\n\t\tlet charInHiresBoundary = false;\n\n\t\twhile (originalCharIndex < chunk.end) {\n\t\t\tif (original[originalCharIndex] === '\\n') {\n\t\t\t\tloc.line += 1;\n\t\t\t\tloc.column = 0;\n\t\t\t\tthis.generatedCodeLine += 1;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t\tthis.generatedCodeColumn = 0;\n\t\t\t\tfirst = true;\n\t\t\t\tcharInHiresBoundary = false;\n\t\t\t} else {\n\t\t\t\tif (this.hires || first || sourcemapLocations.has(originalCharIndex)) {\n\t\t\t\t\tconst segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];\n\n\t\t\t\t\tif (this.hires === 'boundary') {\n\t\t\t\t\t\t// in hires \"boundary\", group segments per word boundary than per char\n\t\t\t\t\t\tif (wordRegex.test(original[originalCharIndex])) {\n\t\t\t\t\t\t\t// for first char in the boundary found, start the boundary by pushing a segment\n\t\t\t\t\t\t\tif (!charInHiresBoundary) {\n\t\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\t\tcharInHiresBoundary = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// for non-word char, end the boundary by pushing a segment\n\t\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t\t\tcharInHiresBoundary = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.rawSegments.push(segment);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tloc.column += 1;\n\t\t\t\tthis.generatedCodeColumn += 1;\n\t\t\t\tfirst = false;\n\t\t\t}\n\n\t\t\toriginalCharIndex += 1;\n\t\t}\n\n\t\tthis.pending = null;\n\t}\n\n\tadvance(str) {\n\t\tif (!str) return;\n\n\t\tconst lines = str.split('\\n');\n\n\t\tif (lines.length > 1) {\n\t\t\tfor (let i = 0; i < lines.length - 1; i++) {\n\t\t\t\tthis.generatedCodeLine++;\n\t\t\t\tthis.raw[this.generatedCodeLine] = this.rawSegments = [];\n\t\t\t}\n\t\t\tthis.generatedCodeColumn = 0;\n\t\t}\n\n\t\tthis.generatedCodeColumn += lines[lines.length - 1].length;\n\t}\n}\n","import BitSet from './BitSet.js';\nimport Chunk from './Chunk.js';\nimport SourceMap from './SourceMap.js';\nimport guessIndent from './utils/guessIndent.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\nimport Stats from './utils/Stats.js';\n\nconst n = '\\n';\n\nconst warned = {\n\tinsertLeft: false,\n\tinsertRight: false,\n\tstoreName: false,\n};\n\nexport default class MagicString {\n\tconstructor(string, options = {}) {\n\t\tconst chunk = new Chunk(0, string.length, string);\n\n\t\tObject.defineProperties(this, {\n\t\t\toriginal: { writable: true, value: string },\n\t\t\toutro: { writable: true, value: '' },\n\t\t\tintro: { writable: true, value: '' },\n\t\t\tfirstChunk: { writable: true, value: chunk },\n\t\t\tlastChunk: { writable: true, value: chunk },\n\t\t\tlastSearchedChunk: { writable: true, value: chunk },\n\t\t\tbyStart: { writable: true, value: {} },\n\t\t\tbyEnd: { writable: true, value: {} },\n\t\t\tfilename: { writable: true, value: options.filename },\n\t\t\tindentExclusionRanges: { writable: true, value: options.indentExclusionRanges },\n\t\t\tsourcemapLocations: { writable: true, value: new BitSet() },\n\t\t\tstoredNames: { writable: true, value: {} },\n\t\t\tindentStr: { writable: true, value: undefined },\n\t\t\tignoreList: { writable: true, value: options.ignoreList },\n\t\t\toffset: { writable: true, value: options.offset || 0 },\n\t\t});\n\n\t\tif (DEBUG) {\n\t\t\tObject.defineProperty(this, 'stats', { value: new Stats() });\n\t\t}\n\n\t\tthis.byStart[0] = chunk;\n\t\tthis.byEnd[string.length] = chunk;\n\t}\n\n\taddSourcemapLocation(char) {\n\t\tthis.sourcemapLocations.add(char);\n\t}\n\n\tappend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.outro += content;\n\t\treturn this;\n\t}\n\n\tappendLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendLeft');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendLeft(content);\n\t\t} else {\n\t\t\tthis.intro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendLeft');\n\t\treturn this;\n\t}\n\n\tappendRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('appendRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.appendRight(content);\n\t\t} else {\n\t\t\tthis.outro += content;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('appendRight');\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });\n\n\t\tlet originalChunk = this.firstChunk;\n\t\tlet clonedChunk = (cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone());\n\n\t\twhile (originalChunk) {\n\t\t\tcloned.byStart[clonedChunk.start] = clonedChunk;\n\t\t\tcloned.byEnd[clonedChunk.end] = clonedChunk;\n\n\t\t\tconst nextOriginalChunk = originalChunk.next;\n\t\t\tconst nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();\n\n\t\t\tif (nextClonedChunk) {\n\t\t\t\tclonedChunk.next = nextClonedChunk;\n\t\t\t\tnextClonedChunk.previous = clonedChunk;\n\n\t\t\t\tclonedChunk = nextClonedChunk;\n\t\t\t}\n\n\t\t\toriginalChunk = nextOriginalChunk;\n\t\t}\n\n\t\tcloned.lastChunk = clonedChunk;\n\n\t\tif (this.indentExclusionRanges) {\n\t\t\tcloned.indentExclusionRanges = this.indentExclusionRanges.slice();\n\t\t}\n\n\t\tcloned.sourcemapLocations = new BitSet(this.sourcemapLocations);\n\n\t\tcloned.intro = this.intro;\n\t\tcloned.outro = this.outro;\n\n\t\treturn cloned;\n\t}\n\n\tgenerateDecodedMap(options) {\n\t\toptions = options || {};\n\n\t\tconst sourceIndex = 0;\n\t\tconst names = Object.keys(this.storedNames);\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tconst locate = getLocator(this.original);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.firstChunk.eachNext((chunk) => {\n\t\t\tconst loc = locate(chunk.start);\n\n\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tmappings.addEdit(\n\t\t\t\t\tsourceIndex,\n\t\t\t\t\tchunk.content,\n\t\t\t\t\tloc,\n\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tmappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);\n\t\t\t}\n\n\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t});\n\n\t\tif (this.outro) {\n\t\t\tmappings.advance(this.outro);\n\t\t}\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: [\n\t\t\t\toptions.source ? getRelativePath(options.file || '', options.source) : options.file || '',\n\t\t\t],\n\t\t\tsourcesContent: options.includeContent ? [this.original] : undefined,\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList: this.ignoreList ? [sourceIndex] : undefined,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\t_ensureindentStr() {\n\t\tif (this.indentStr === undefined) {\n\t\t\tthis.indentStr = guessIndent(this.original);\n\t\t}\n\t}\n\n\t_getRawIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr;\n\t}\n\n\tgetIndentString() {\n\t\tthis._ensureindentStr();\n\t\treturn this.indentStr === null ? '\\t' : this.indentStr;\n\t}\n\n\tindent(indentStr, options) {\n\t\tconst pattern = /^[^\\r\\n]/gm;\n\n\t\tif (isObject(indentStr)) {\n\t\t\toptions = indentStr;\n\t\t\tindentStr = undefined;\n\t\t}\n\n\t\tif (indentStr === undefined) {\n\t\t\tthis._ensureindentStr();\n\t\t\tindentStr = this.indentStr || '\\t';\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\toptions = options || {};\n\n\t\t// Process exclusion ranges\n\t\tconst isExcluded = {};\n\n\t\tif (options.exclude) {\n\t\t\tconst exclusions =\n\t\t\t\ttypeof options.exclude[0] === 'number' ? [options.exclude] : options.exclude;\n\t\t\texclusions.forEach((exclusion) => {\n\t\t\t\tfor (let i = exclusion[0]; i < exclusion[1]; i += 1) {\n\t\t\t\t\tisExcluded[i] = true;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tlet shouldIndentNextCharacter = options.indentStart !== false;\n\t\tconst replacer = (match) => {\n\t\t\tif (shouldIndentNextCharacter) return `${indentStr}${match}`;\n\t\t\tshouldIndentNextCharacter = true;\n\t\t\treturn match;\n\t\t};\n\n\t\tthis.intro = this.intro.replace(pattern, replacer);\n\n\t\tlet charIndex = 0;\n\t\tlet chunk = this.firstChunk;\n\n\t\twhile (chunk) {\n\t\t\tconst end = chunk.end;\n\n\t\t\tif (chunk.edited) {\n\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\tchunk.content = chunk.content.replace(pattern, replacer);\n\n\t\t\t\t\tif (chunk.content.length) {\n\t\t\t\t\t\tshouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === '\\n';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tcharIndex = chunk.start;\n\n\t\t\t\twhile (charIndex < end) {\n\t\t\t\t\tif (!isExcluded[charIndex]) {\n\t\t\t\t\t\tconst char = this.original[charIndex];\n\n\t\t\t\t\t\tif (char === '\\n') {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = true;\n\t\t\t\t\t\t} else if (char !== '\\r' && shouldIndentNextCharacter) {\n\t\t\t\t\t\t\tshouldIndentNextCharacter = false;\n\n\t\t\t\t\t\t\tif (charIndex === chunk.start) {\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis._splitChunk(chunk, charIndex);\n\t\t\t\t\t\t\t\tchunk = chunk.next;\n\t\t\t\t\t\t\t\tchunk.prependRight(indentStr);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tcharIndex += 1;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tcharIndex = chunk.end;\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tthis.outro = this.outro.replace(pattern, replacer);\n\n\t\treturn this;\n\t}\n\n\tinsert() {\n\t\tthrow new Error(\n\t\t\t'magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)',\n\t\t);\n\t}\n\n\tinsertLeft(index, content) {\n\t\tif (!warned.insertLeft) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead',\n\t\t\t);\n\t\t\twarned.insertLeft = true;\n\t\t}\n\n\t\treturn this.appendLeft(index, content);\n\t}\n\n\tinsertRight(index, content) {\n\t\tif (!warned.insertRight) {\n\t\t\tconsole.warn(\n\t\t\t\t'magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead',\n\t\t\t);\n\t\t\twarned.insertRight = true;\n\t\t}\n\n\t\treturn this.prependRight(index, content);\n\t}\n\n\tmove(start, end, index) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\t\tindex = index + this.offset;\n\n\t\tif (index >= start && index <= end) throw new Error('Cannot move a selection inside itself');\n\n\t\tif (DEBUG) this.stats.time('move');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\t\tthis._split(index);\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tconst oldLeft = first.previous;\n\t\tconst oldRight = last.next;\n\n\t\tconst newRight = this.byStart[index];\n\t\tif (!newRight && last === this.lastChunk) return this;\n\t\tconst newLeft = newRight ? newRight.previous : this.lastChunk;\n\n\t\tif (oldLeft) oldLeft.next = oldRight;\n\t\tif (oldRight) oldRight.previous = oldLeft;\n\n\t\tif (newLeft) newLeft.next = first;\n\t\tif (newRight) newRight.previous = last;\n\n\t\tif (!first.previous) this.firstChunk = last.next;\n\t\tif (!last.next) {\n\t\t\tthis.lastChunk = first.previous;\n\t\t\tthis.lastChunk.next = null;\n\t\t}\n\n\t\tfirst.previous = newLeft;\n\t\tlast.next = newRight || null;\n\n\t\tif (!newLeft) this.firstChunk = first;\n\t\tif (!newRight) this.lastChunk = last;\n\n\t\tif (DEBUG) this.stats.timeEnd('move');\n\t\treturn this;\n\t}\n\n\toverwrite(start, end, content, options) {\n\t\toptions = options || {};\n\t\treturn this.update(start, end, content, { ...options, overwrite: !options.contentOnly });\n\t}\n\n\tupdate(start, end, content, options) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('replacement content must be a string');\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (end > this.original.length) throw new Error('end is out of bounds');\n\t\tif (start === end)\n\t\t\tthrow new Error(\n\t\t\t\t'Cannot overwrite a zero-length range – use appendLeft or prependRight instead',\n\t\t\t);\n\n\t\tif (DEBUG) this.stats.time('overwrite');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tif (options === true) {\n\t\t\tif (!warned.storeName) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string',\n\t\t\t\t);\n\t\t\t\twarned.storeName = true;\n\t\t\t}\n\n\t\t\toptions = { storeName: true };\n\t\t}\n\t\tconst storeName = options !== undefined ? options.storeName : false;\n\t\tconst overwrite = options !== undefined ? options.overwrite : false;\n\n\t\tif (storeName) {\n\t\t\tconst original = this.original.slice(start, end);\n\t\t\tObject.defineProperty(this.storedNames, original, {\n\t\t\t\twritable: true,\n\t\t\t\tvalue: true,\n\t\t\t\tenumerable: true,\n\t\t\t});\n\t\t}\n\n\t\tconst first = this.byStart[start];\n\t\tconst last = this.byEnd[end];\n\n\t\tif (first) {\n\t\t\tlet chunk = first;\n\t\t\twhile (chunk !== last) {\n\t\t\t\tif (chunk.next !== this.byStart[chunk.end]) {\n\t\t\t\t\tthrow new Error('Cannot overwrite across a split point');\n\t\t\t\t}\n\t\t\t\tchunk = chunk.next;\n\t\t\t\tchunk.edit('', false);\n\t\t\t}\n\n\t\t\tfirst.edit(content, storeName, !overwrite);\n\t\t} else {\n\t\t\t// must be inserting at the end\n\t\t\tconst newChunk = new Chunk(start, end, '').edit(content, storeName);\n\n\t\t\t// TODO last chunk in the array may not be the last chunk, if it's moved...\n\t\t\tlast.next = newChunk;\n\t\t\tnewChunk.previous = last;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('overwrite');\n\t\treturn this;\n\t}\n\n\tprepend(content) {\n\t\tif (typeof content !== 'string') throw new TypeError('outro content must be a string');\n\n\t\tthis.intro = content + this.intro;\n\t\treturn this;\n\t}\n\n\tprependLeft(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byEnd[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependLeft(content);\n\t\t} else {\n\t\t\tthis.intro = content + this.intro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tprependRight(index, content) {\n\t\tindex = index + this.offset;\n\n\t\tif (typeof content !== 'string') throw new TypeError('inserted content must be a string');\n\n\t\tif (DEBUG) this.stats.time('insertRight');\n\n\t\tthis._split(index);\n\n\t\tconst chunk = this.byStart[index];\n\n\t\tif (chunk) {\n\t\t\tchunk.prependRight(content);\n\t\t} else {\n\t\t\tthis.outro = content + this.outro;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('insertRight');\n\t\treturn this;\n\t}\n\n\tremove(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('remove');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.intro = '';\n\t\t\tchunk.outro = '';\n\t\t\tchunk.edit('');\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('remove');\n\t\treturn this;\n\t}\n\n\treset(start, end) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tif (start === end) return this;\n\n\t\tif (start < 0 || end > this.original.length) throw new Error('Character is out of bounds');\n\t\tif (start > end) throw new Error('end must be greater than start');\n\n\t\tif (DEBUG) this.stats.time('reset');\n\n\t\tthis._split(start);\n\t\tthis._split(end);\n\n\t\tlet chunk = this.byStart[start];\n\n\t\twhile (chunk) {\n\t\t\tchunk.reset();\n\n\t\t\tchunk = end > chunk.end ? this.byStart[chunk.end] : null;\n\t\t}\n\n\t\tif (DEBUG) this.stats.timeEnd('reset');\n\t\treturn this;\n\t}\n\n\tlastChar() {\n\t\tif (this.outro.length) return this.outro[this.outro.length - 1];\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];\n\t\t\tif (chunk.content.length) return chunk.content[chunk.content.length - 1];\n\t\t\tif (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];\n\t\t} while ((chunk = chunk.previous));\n\t\tif (this.intro.length) return this.intro[this.intro.length - 1];\n\t\treturn '';\n\t}\n\n\tlastLine() {\n\t\tlet lineIndex = this.outro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.outro.substr(lineIndex + 1);\n\t\tlet lineStr = this.outro;\n\t\tlet chunk = this.lastChunk;\n\t\tdo {\n\t\t\tif (chunk.outro.length > 0) {\n\t\t\t\tlineIndex = chunk.outro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.outro + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.content.length > 0) {\n\t\t\t\tlineIndex = chunk.content.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.content + lineStr;\n\t\t\t}\n\n\t\t\tif (chunk.intro.length > 0) {\n\t\t\t\tlineIndex = chunk.intro.lastIndexOf(n);\n\t\t\t\tif (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;\n\t\t\t\tlineStr = chunk.intro + lineStr;\n\t\t\t}\n\t\t} while ((chunk = chunk.previous));\n\t\tlineIndex = this.intro.lastIndexOf(n);\n\t\tif (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;\n\t\treturn this.intro + lineStr;\n\t}\n\n\tslice(start = 0, end = this.original.length - this.offset) {\n\t\tstart = start + this.offset;\n\t\tend = end + this.offset;\n\n\t\tif (this.original.length !== 0) {\n\t\t\twhile (start < 0) start += this.original.length;\n\t\t\twhile (end < 0) end += this.original.length;\n\t\t}\n\n\t\tlet result = '';\n\n\t\t// find start chunk\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk && (chunk.start > start || chunk.end <= start)) {\n\t\t\t// found end chunk before start\n\t\t\tif (chunk.start < end && chunk.end >= end) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\tif (chunk && chunk.edited && chunk.start !== start)\n\t\t\tthrow new Error(`Cannot use replaced character ${start} as slice start anchor.`);\n\n\t\tconst startChunk = chunk;\n\t\twhile (chunk) {\n\t\t\tif (chunk.intro && (startChunk !== chunk || chunk.start === start)) {\n\t\t\t\tresult += chunk.intro;\n\t\t\t}\n\n\t\t\tconst containsEnd = chunk.start < end && chunk.end >= end;\n\t\t\tif (containsEnd && chunk.edited && chunk.end !== end)\n\t\t\t\tthrow new Error(`Cannot use replaced character ${end} as slice end anchor.`);\n\n\t\t\tconst sliceStart = startChunk === chunk ? start - chunk.start : 0;\n\t\t\tconst sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;\n\n\t\t\tresult += chunk.content.slice(sliceStart, sliceEnd);\n\n\t\t\tif (chunk.outro && (!containsEnd || chunk.end === end)) {\n\t\t\t\tresult += chunk.outro;\n\t\t\t}\n\n\t\t\tif (containsEnd) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t// TODO deprecate this? not really very useful\n\tsnip(start, end) {\n\t\tconst clone = this.clone();\n\t\tclone.remove(0, start);\n\t\tclone.remove(end, clone.original.length);\n\n\t\treturn clone;\n\t}\n\n\t_split(index) {\n\t\tif (this.byStart[index] || this.byEnd[index]) return;\n\n\t\tif (DEBUG) this.stats.time('_split');\n\n\t\tlet chunk = this.lastSearchedChunk;\n\t\tlet previousChunk = chunk;\n\t\tconst searchForward = index > chunk.end;\n\n\t\twhile (chunk) {\n\t\t\tif (chunk.contains(index)) return this._splitChunk(chunk, index);\n\n\t\t\tchunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];\n\n\t\t\t// Prevent infinite loop (e.g. via empty chunks, where start === end)\n\t\t\tif (chunk === previousChunk) return;\n\n\t\t\tpreviousChunk = chunk;\n\t\t}\n\t}\n\n\t_splitChunk(chunk, index) {\n\t\tif (chunk.edited && chunk.content.length) {\n\t\t\t// zero-length edited chunks are a special case (overlapping replacements)\n\t\t\tconst loc = getLocator(this.original)(index);\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot split a chunk that has already been edited (${loc.line}:${loc.column} – \"${chunk.original}\")`,\n\t\t\t);\n\t\t}\n\n\t\tconst newChunk = chunk.split(index);\n\n\t\tthis.byEnd[index] = chunk;\n\t\tthis.byStart[index] = newChunk;\n\t\tthis.byEnd[newChunk.end] = newChunk;\n\n\t\tif (chunk === this.lastChunk) this.lastChunk = newChunk;\n\n\t\tthis.lastSearchedChunk = chunk;\n\t\tif (DEBUG) this.stats.timeEnd('_split');\n\t\treturn true;\n\t}\n\n\ttoString() {\n\t\tlet str = this.intro;\n\n\t\tlet chunk = this.firstChunk;\n\t\twhile (chunk) {\n\t\t\tstr += chunk.toString();\n\t\t\tchunk = chunk.next;\n\t\t}\n\n\t\treturn str + this.outro;\n\t}\n\n\tisEmpty() {\n\t\tlet chunk = this.firstChunk;\n\t\tdo {\n\t\t\tif (\n\t\t\t\t(chunk.intro.length && chunk.intro.trim()) ||\n\t\t\t\t(chunk.content.length && chunk.content.trim()) ||\n\t\t\t\t(chunk.outro.length && chunk.outro.trim())\n\t\t\t)\n\t\t\t\treturn false;\n\t\t} while ((chunk = chunk.next));\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\tlet chunk = this.firstChunk;\n\t\tlet length = 0;\n\t\tdo {\n\t\t\tlength += chunk.intro.length + chunk.content.length + chunk.outro.length;\n\t\t} while ((chunk = chunk.next));\n\t\treturn length;\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimEndAborted(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tthis.outro = this.outro.replace(rx, '');\n\t\tif (this.outro.length) return true;\n\n\t\tlet chunk = this.lastChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimEnd(rx);\n\n\t\t\t// if chunk was trimmed, we have a new lastChunk\n\t\t\tif (chunk.end !== end) {\n\t\t\t\tif (this.lastChunk === chunk) {\n\t\t\t\t\tthis.lastChunk = chunk.next;\n\t\t\t\t}\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.previous;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimEnd(charType) {\n\t\tthis.trimEndAborted(charType);\n\t\treturn this;\n\t}\n\ttrimStartAborted(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\n\t\tthis.intro = this.intro.replace(rx, '');\n\t\tif (this.intro.length) return true;\n\n\t\tlet chunk = this.firstChunk;\n\n\t\tdo {\n\t\t\tconst end = chunk.end;\n\t\t\tconst aborted = chunk.trimStart(rx);\n\n\t\t\tif (chunk.end !== end) {\n\t\t\t\t// special case...\n\t\t\t\tif (chunk === this.lastChunk) this.lastChunk = chunk.next;\n\n\t\t\t\tthis.byEnd[chunk.end] = chunk;\n\t\t\t\tthis.byStart[chunk.next.start] = chunk.next;\n\t\t\t\tthis.byEnd[chunk.next.end] = chunk.next;\n\t\t\t}\n\n\t\t\tif (aborted) return true;\n\t\t\tchunk = chunk.next;\n\t\t} while (chunk);\n\n\t\treturn false;\n\t}\n\n\ttrimStart(charType) {\n\t\tthis.trimStartAborted(charType);\n\t\treturn this;\n\t}\n\n\thasChanged() {\n\t\treturn this.original !== this.toString();\n\t}\n\n\t_replaceRegexp(searchValue, replacement) {\n\t\tfunction getReplacement(match, str) {\n\t\t\tif (typeof replacement === 'string') {\n\t\t\t\treturn replacement.replace(/\\$(\\$|&|\\d+)/g, (_, i) => {\n\t\t\t\t\t// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_a_parameter\n\t\t\t\t\tif (i === '$') return '$';\n\t\t\t\t\tif (i === '&') return match[0];\n\t\t\t\t\tconst num = +i;\n\t\t\t\t\tif (num < match.length) return match[+i];\n\t\t\t\t\treturn `$${i}`;\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\treturn replacement(...match, match.index, str, match.groups);\n\t\t\t}\n\t\t}\n\t\tfunction matchAll(re, str) {\n\t\t\tlet match;\n\t\t\tconst matches = [];\n\t\t\twhile ((match = re.exec(str))) {\n\t\t\t\tmatches.push(match);\n\t\t\t}\n\t\t\treturn matches;\n\t\t}\n\t\tif (searchValue.global) {\n\t\t\tconst matches = matchAll(searchValue, this.original);\n\t\t\tmatches.forEach((match) => {\n\t\t\t\tif (match.index != null) {\n\t\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tconst match = this.original.match(searchValue);\n\t\t\tif (match && match.index != null) {\n\t\t\t\tconst replacement = getReplacement(match, this.original);\n\t\t\t\tif (replacement !== match[0]) {\n\t\t\t\t\tthis.overwrite(match.index, match.index + match[0].length, replacement);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t_replaceString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst index = original.indexOf(string);\n\n\t\tif (index !== -1) {\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\treplacement = replacement(string, index, original);\n\t\t\t}\n\t\t\tif (string !== replacement) {\n\t\t\t\tthis.overwrite(index, index + string.length, replacement);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplace(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceString(searchValue, replacement);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n\n\t_replaceAllString(string, replacement) {\n\t\tconst { original } = this;\n\t\tconst stringLength = string.length;\n\t\tfor (\n\t\t\tlet index = original.indexOf(string);\n\t\t\tindex !== -1;\n\t\t\tindex = original.indexOf(string, index + stringLength)\n\t\t) {\n\t\t\tconst previous = original.slice(index, index + stringLength);\n\t\t\tlet _replacement = replacement;\n\t\t\tif (typeof replacement === 'function') {\n\t\t\t\t_replacement = replacement(previous, index, original);\n\t\t\t}\n\t\t\tif (previous !== _replacement) this.overwrite(index, index + stringLength, _replacement);\n\t\t}\n\n\t\treturn this;\n\t}\n\n\treplaceAll(searchValue, replacement) {\n\t\tif (typeof searchValue === 'string') {\n\t\t\treturn this._replaceAllString(searchValue, replacement);\n\t\t}\n\n\t\tif (!searchValue.global) {\n\t\t\tthrow new TypeError(\n\t\t\t\t'MagicString.prototype.replaceAll called with a non-global RegExp argument',\n\t\t\t);\n\t\t}\n\n\t\treturn this._replaceRegexp(searchValue, replacement);\n\t}\n}\n","import MagicString from './MagicString.js';\nimport SourceMap from './SourceMap.js';\nimport getRelativePath from './utils/getRelativePath.js';\nimport isObject from './utils/isObject.js';\nimport getLocator from './utils/getLocator.js';\nimport Mappings from './utils/Mappings.js';\n\nconst hasOwnProp = Object.prototype.hasOwnProperty;\n\nexport default class Bundle {\n\tconstructor(options = {}) {\n\t\tthis.intro = options.intro || '';\n\t\tthis.separator = options.separator !== undefined ? options.separator : '\\n';\n\t\tthis.sources = [];\n\t\tthis.uniqueSources = [];\n\t\tthis.uniqueSourceIndexByFilename = {};\n\t}\n\n\taddSource(source) {\n\t\tif (source instanceof MagicString) {\n\t\t\treturn this.addSource({\n\t\t\t\tcontent: source,\n\t\t\t\tfilename: source.filename,\n\t\t\t\tseparator: this.separator,\n\t\t\t});\n\t\t}\n\n\t\tif (!isObject(source) || !source.content) {\n\t\t\tthrow new Error(\n\t\t\t\t'bundle.addSource() takes an object with a `content` property, which should be an instance of MagicString, and an optional `filename`',\n\t\t\t);\n\t\t}\n\n\t\t['filename', 'ignoreList', 'indentExclusionRanges', 'separator'].forEach((option) => {\n\t\t\tif (!hasOwnProp.call(source, option)) source[option] = source.content[option];\n\t\t});\n\n\t\tif (source.separator === undefined) {\n\t\t\t// TODO there's a bunch of this sort of thing, needs cleaning up\n\t\t\tsource.separator = this.separator;\n\t\t}\n\n\t\tif (source.filename) {\n\t\t\tif (!hasOwnProp.call(this.uniqueSourceIndexByFilename, source.filename)) {\n\t\t\t\tthis.uniqueSourceIndexByFilename[source.filename] = this.uniqueSources.length;\n\t\t\t\tthis.uniqueSources.push({ filename: source.filename, content: source.content.original });\n\t\t\t} else {\n\t\t\t\tconst uniqueSource = this.uniqueSources[this.uniqueSourceIndexByFilename[source.filename]];\n\t\t\t\tif (source.content.original !== uniqueSource.content) {\n\t\t\t\t\tthrow new Error(`Illegal source: same filename (${source.filename}), different contents`);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.sources.push(source);\n\t\treturn this;\n\t}\n\n\tappend(str, options) {\n\t\tthis.addSource({\n\t\t\tcontent: new MagicString(str),\n\t\t\tseparator: (options && options.separator) || '',\n\t\t});\n\n\t\treturn this;\n\t}\n\n\tclone() {\n\t\tconst bundle = new Bundle({\n\t\t\tintro: this.intro,\n\t\t\tseparator: this.separator,\n\t\t});\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tbundle.addSource({\n\t\t\t\tfilename: source.filename,\n\t\t\t\tcontent: source.content.clone(),\n\t\t\t\tseparator: source.separator,\n\t\t\t});\n\t\t});\n\n\t\treturn bundle;\n\t}\n\n\tgenerateDecodedMap(options = {}) {\n\t\tconst names = [];\n\t\tlet x_google_ignoreList = undefined;\n\t\tthis.sources.forEach((source) => {\n\t\t\tObject.keys(source.content.storedNames).forEach((name) => {\n\t\t\t\tif (!~names.indexOf(name)) names.push(name);\n\t\t\t});\n\t\t});\n\n\t\tconst mappings = new Mappings(options.hires);\n\n\t\tif (this.intro) {\n\t\t\tmappings.advance(this.intro);\n\t\t}\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tif (i > 0) {\n\t\t\t\tmappings.advance(this.separator);\n\t\t\t}\n\n\t\t\tconst sourceIndex = source.filename ? this.uniqueSourceIndexByFilename[source.filename] : -1;\n\t\t\tconst magicString = source.content;\n\t\t\tconst locate = getLocator(magicString.original);\n\n\t\t\tif (magicString.intro) {\n\t\t\t\tmappings.advance(magicString.intro);\n\t\t\t}\n\n\t\t\tmagicString.firstChunk.eachNext((chunk) => {\n\t\t\t\tconst loc = locate(chunk.start);\n\n\t\t\t\tif (chunk.intro.length) mappings.advance(chunk.intro);\n\n\t\t\t\tif (source.filename) {\n\t\t\t\t\tif (chunk.edited) {\n\t\t\t\t\t\tmappings.addEdit(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk.content,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tchunk.storeName ? names.indexOf(chunk.original) : -1,\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmappings.addUneditedChunk(\n\t\t\t\t\t\t\tsourceIndex,\n\t\t\t\t\t\t\tchunk,\n\t\t\t\t\t\t\tmagicString.original,\n\t\t\t\t\t\t\tloc,\n\t\t\t\t\t\t\tmagicString.sourcemapLocations,\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tmappings.advance(chunk.content);\n\t\t\t\t}\n\n\t\t\t\tif (chunk.outro.length) mappings.advance(chunk.outro);\n\t\t\t});\n\n\t\t\tif (magicString.outro) {\n\t\t\t\tmappings.advance(magicString.outro);\n\t\t\t}\n\n\t\t\tif (source.ignoreList && sourceIndex !== -1) {\n\t\t\t\tif (x_google_ignoreList === undefined) {\n\t\t\t\t\tx_google_ignoreList = [];\n\t\t\t\t}\n\t\t\t\tx_google_ignoreList.push(sourceIndex);\n\t\t\t}\n\t\t});\n\n\t\treturn {\n\t\t\tfile: options.file ? options.file.split(/[/\\\\]/).pop() : undefined,\n\t\t\tsources: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.file ? getRelativePath(options.file, source.filename) : source.filename;\n\t\t\t}),\n\t\t\tsourcesContent: this.uniqueSources.map((source) => {\n\t\t\t\treturn options.includeContent ? source.content : null;\n\t\t\t}),\n\t\t\tnames,\n\t\t\tmappings: mappings.raw,\n\t\t\tx_google_ignoreList,\n\t\t};\n\t}\n\n\tgenerateMap(options) {\n\t\treturn new SourceMap(this.generateDecodedMap(options));\n\t}\n\n\tgetIndentString() {\n\t\tconst indentStringCounts = {};\n\n\t\tthis.sources.forEach((source) => {\n\t\t\tconst indentStr = source.content._getRawIndentString();\n\n\t\t\tif (indentStr === null) return;\n\n\t\t\tif (!indentStringCounts[indentStr]) indentStringCounts[indentStr] = 0;\n\t\t\tindentStringCounts[indentStr] += 1;\n\t\t});\n\n\t\treturn (\n\t\t\tObject.keys(indentStringCounts).sort((a, b) => {\n\t\t\t\treturn indentStringCounts[a] - indentStringCounts[b];\n\t\t\t})[0] || '\\t'\n\t\t);\n\t}\n\n\tindent(indentStr) {\n\t\tif (!arguments.length) {\n\t\t\tindentStr = this.getIndentString();\n\t\t}\n\n\t\tif (indentStr === '') return this; // noop\n\n\t\tlet trailingNewline = !this.intro || this.intro.slice(-1) === '\\n';\n\n\t\tthis.sources.forEach((source, i) => {\n\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\tconst indentStart = trailingNewline || (i > 0 && /\\r?\\n$/.test(separator));\n\n\t\t\tsource.content.indent(indentStr, {\n\t\t\t\texclude: source.indentExclusionRanges,\n\t\t\t\tindentStart, //: trailingNewline || /\\r?\\n$/.test( separator ) //true///\\r?\\n/.test( separator )\n\t\t\t});\n\n\t\t\ttrailingNewline = source.content.lastChar() === '\\n';\n\t\t});\n\n\t\tif (this.intro) {\n\t\t\tthis.intro =\n\t\t\t\tindentStr +\n\t\t\t\tthis.intro.replace(/^[^\\n]/gm, (match, index) => {\n\t\t\t\t\treturn index > 0 ? indentStr + match : match;\n\t\t\t\t});\n\t\t}\n\n\t\treturn this;\n\t}\n\n\tprepend(str) {\n\t\tthis.intro = str + this.intro;\n\t\treturn this;\n\t}\n\n\ttoString() {\n\t\tconst body = this.sources\n\t\t\t.map((source, i) => {\n\t\t\t\tconst separator = source.separator !== undefined ? source.separator : this.separator;\n\t\t\t\tconst str = (i > 0 ? separator : '') + source.content.toString();\n\n\t\t\t\treturn str;\n\t\t\t})\n\t\t\t.join('');\n\n\t\treturn this.intro + body;\n\t}\n\n\tisEmpty() {\n\t\tif (this.intro.length && this.intro.trim()) return false;\n\t\tif (this.sources.some((source) => !source.content.isEmpty())) return false;\n\t\treturn true;\n\t}\n\n\tlength() {\n\t\treturn this.sources.reduce(\n\t\t\t(length, source) => length + source.content.length(),\n\t\t\tthis.intro.length,\n\t\t);\n\t}\n\n\ttrimLines() {\n\t\treturn this.trim('[\\\\r\\\\n]');\n\t}\n\n\ttrim(charType) {\n\t\treturn this.trimStart(charType).trimEnd(charType);\n\t}\n\n\ttrimStart(charType) {\n\t\tconst rx = new RegExp('^' + (charType || '\\\\s') + '+');\n\t\tthis.intro = this.intro.replace(rx, '');\n\n\t\tif (!this.intro) {\n\t\t\tlet source;\n\t\t\tlet i = 0;\n\n\t\t\tdo {\n\t\t\t\tsource = this.sources[i++];\n\t\t\t\tif (!source) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (!source.content.trimStartAborted(charType));\n\t\t}\n\n\t\treturn this;\n\t}\n\n\ttrimEnd(charType) {\n\t\tconst rx = new RegExp((charType || '\\\\s') + '+$');\n\n\t\tlet source;\n\t\tlet i = this.sources.length - 1;\n\n\t\tdo {\n\t\t\tsource = this.sources[i--];\n\t\t\tif (!source) {\n\t\t\t\tthis.intro = this.intro.replace(rx, '');\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} while (!source.content.trimEndAborted(charType));\n\n\t\treturn this;\n\t}\n}\n","import MagicString from './MagicString.js';\nimport Bundle from './Bundle.js';\nimport SourceMap from './SourceMap.js';\n\nMagicString.Bundle = Bundle;\nMagicString.SourceMap = SourceMap;\nMagicString.default = MagicString; // work around TypeScript bug https://github.com/Rich-Harris/magic-string/pull/121\n\nexport default MagicString;\n"],"names":[],"mappings":";;;;;;CAAe,MAAM,MAAM,CAAC;CAC5B,CAAC,WAAW,CAAC,GAAG,EAAE;CAClB,EAAE,IAAI,CAAC,IAAI,GAAG,GAAG,YAAY,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;CAC3D,CAAC;;CAED,CAAC,GAAG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ic-string/package.json deleted file mode 100644 index 5ba3ac6..0000000 --- a/node_modules/magic-string/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "magic-string", - "version": "0.30.21", - "type": "commonjs", - "description": "Modify strings, generate sourcemaps", - "keywords": [ - "string", - "string manipulation", - "sourcemap", - "templating", - "transpilation" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/Rich-Harris/magic-string.git" - }, - "license": "MIT", - "author": "Rich Harris", - "main": "./dist/magic-string.cjs.js", - "module": "./dist/magic-string.es.mjs", - "sideEffects": false, - "jsnext:main": "./dist/magic-string.es.mjs", - "types": "./dist/magic-string.cjs.d.ts", - "exports": { - "./package.json": "./package.json", - ".": { - "import": "./dist/magic-string.es.mjs", - "require": "./dist/magic-string.cjs.js" - } - }, - "files": [ - "dist/*", - "index.d.ts", - "README.md" - ], - "devDependencies": { - "@eslint/js": "^9.38.0", - "@rollup/plugin-node-resolve": "^16.0.3", - "@rollup/plugin-replace": "^6.0.2", - "benchmark": "^2.1.4", - "bumpp": "^10.3.1", - "conventional-changelog-cli": "^5.0.0", - "eslint": "^9.38.0", - "prettier": "^3.6.2", - "publint": "^0.3.15", - "rollup": "^4.52.5", - "source-map-js": "^1.2.1", - "source-map-support": "^0.5.21", - "vitest": "^4.0.2" - }, - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.5" - }, - "scripts": { - "build": "rollup -c", - "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", - "format": "prettier --single-quote --print-width 100 --use-tabs --write .", - "lint": "eslint src test && publint", - "lint:fix": "eslint src test --fix", - "release": "bumpp -x \"pnpm run changelog\" --all", - "pretest": "pnpm run build", - "test": "vitest run", - "test:dev": "vitest", - "bench": "pnpm run build && node benchmark/index.mjs", - "watch": "rollup -cw" - } -} \ No newline at end of file diff --git a/node_modules/nanoid/LICENSE b/node_modules/nanoid/LICENSE deleted file mode 100644 index 37f56aa..0000000 --- a/node_modules/nanoid/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright 2017 Andrey Sitnik - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/nanoid/README.md b/node_modules/nanoid/README.md deleted file mode 100644 index 35abb57..0000000 --- a/node_modules/nanoid/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Nano ID - -Nano ID logo by Anton Lovchikov - -**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) - -A tiny, secure, URL-friendly, unique string ID generator for JavaScript. - -> “An amazing level of senseless perfectionism, -> which is simply impossible not to respect.” - -* **Small.** 130 bytes (minified and gzipped). No dependencies. - [Size Limit] controls the size. -* **Fast.** It is 2 times faster than UUID. -* **Safe.** It uses hardware random generator. Can be used in clusters. -* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`). - So ID size was reduced from 36 to 21 symbols. -* **Portable.** Nano ID was ported - to [20 programming languages](#other-programming-languages). - -```js -import { nanoid } from 'nanoid' -model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT" -``` - -Supports modern browsers, IE [with Babel], Node.js and React Native. - -[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/ -[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/ -[Size Limit]: https://github.com/ai/size-limit - - - Sponsored by Evil Martians - - -## Docs -Read full docs **[here](https://github.com/ai/nanoid#readme)**. diff --git a/node_modules/nanoid/async/index.browser.cjs b/node_modules/nanoid/async/index.browser.cjs deleted file mode 100644 index 80d1871..0000000 --- a/node_modules/nanoid/async/index.browser.cjs +++ /dev/null @@ -1,69 +0,0 @@ -let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) - -let customAlphabet = (alphabet, defaultSize = 21) => { - // First, a bitmask is necessary to generate the ID. The bitmask makes bytes - // values closer to the alphabet size. The bitmask calculates the closest - // `2^31 - 1` number, which exceeds the alphabet size. - // For example, the bitmask for the alphabet size 30 is 31 (00011111). - // `Math.clz32` is not used, because it is not available in browsers. - let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 - // Though, the bitmask solution is not perfect since the bytes exceeding - // the alphabet size are refused. Therefore, to reliably generate the ID, - // the random bytes redundancy has to be satisfied. - - // Note: every hardware random generator call is performance expensive, - // because the system call for entropy collection takes a lot of time. - // So, to avoid additional system calls, extra bytes are requested in advance. - - // Next, a step determines how many random bytes to generate. - // The number of random bytes gets decided upon the ID size, mask, - // alphabet size, and magic number 1.6 (using 1.6 peaks at performance - // according to benchmarks). - - // `-~f => Math.ceil(f)` if f is a float - // `-~i => i + 1` if i is an integer - let step = -~((1.6 * mask * defaultSize) / alphabet.length) - - return async (size = defaultSize) => { - let id = '' - while (true) { - let bytes = crypto.getRandomValues(new Uint8Array(step)) - // A compact alternative for `for (var i = 0; i < step; i++)`. - let i = step | 0 - while (i--) { - // Adding `|| ''` refuses a random byte that exceeds the alphabet size. - id += alphabet[bytes[i] & mask] || '' - if (id.length === size) return id - } - } - } -} - -let nanoid = async (size = 21) => { - let id = '' - let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) - - // A compact alternative for `for (var i = 0; i < step; i++)`. - while (size--) { - // It is incorrect to use bytes exceeding the alphabet size. - // The following mask reduces the random byte in the 0-255 value - // range to the 0-63 value range. Therefore, adding hacks, such - // as empty string fallback or magic numbers, is unneccessary because - // the bitmask trims bytes down to the alphabet size. - let byte = bytes[size] & 63 - if (byte < 36) { - // `0-9a-z` - id += byte.toString(36) - } else if (byte < 62) { - // `A-Z` - id += (byte - 26).toString(36).toUpperCase() - } else if (byte < 63) { - id += '_' - } else { - id += '-' - } - } - return id -} - -module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.browser.js b/node_modules/nanoid/async/index.browser.js deleted file mode 100644 index fbaa230..0000000 --- a/node_modules/nanoid/async/index.browser.js +++ /dev/null @@ -1,34 +0,0 @@ -let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) -let customAlphabet = (alphabet, defaultSize = 21) => { - let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 - let step = -~((1.6 * mask * defaultSize) / alphabet.length) - return async (size = defaultSize) => { - let id = '' - while (true) { - let bytes = crypto.getRandomValues(new Uint8Array(step)) - let i = step | 0 - while (i--) { - id += alphabet[bytes[i] & mask] || '' - if (id.length === size) return id - } - } - } -} -let nanoid = async (size = 21) => { - let id = '' - let bytes = crypto.getRandomValues(new Uint8Array((size |= 0))) - while (size--) { - let byte = bytes[size] & 63 - if (byte < 36) { - id += byte.toString(36) - } else if (byte < 62) { - id += (byte - 26).toString(36).toUpperCase() - } else if (byte < 63) { - id += '_' - } else { - id += '-' - } - } - return id -} -export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.cjs b/node_modules/nanoid/async/index.cjs deleted file mode 100644 index f1b0ad0..0000000 --- a/node_modules/nanoid/async/index.cjs +++ /dev/null @@ -1,71 +0,0 @@ -let crypto = require('crypto') - -let { urlAlphabet } = require('../url-alphabet/index.cjs') - -// `crypto.randomFill()` is a little faster than `crypto.randomBytes()`, -// because it is possible to use in combination with `Buffer.allocUnsafe()`. -let random = bytes => - new Promise((resolve, reject) => { - // `Buffer.allocUnsafe()` is faster because it doesn’t flush the memory. - // Memory flushing is unnecessary since the buffer allocation itself resets - // the memory with the new bytes. - crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { - if (err) { - reject(err) - } else { - resolve(buf) - } - }) - }) - -let customAlphabet = (alphabet, defaultSize = 21) => { - // First, a bitmask is necessary to generate the ID. The bitmask makes bytes - // values closer to the alphabet size. The bitmask calculates the closest - // `2^31 - 1` number, which exceeds the alphabet size. - // For example, the bitmask for the alphabet size 30 is 31 (00011111). - let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 - // Though, the bitmask solution is not perfect since the bytes exceeding - // the alphabet size are refused. Therefore, to reliably generate the ID, - // the random bytes redundancy has to be satisfied. - - // Note: every hardware random generator call is performance expensive, - // because the system call for entropy collection takes a lot of time. - // So, to avoid additional system calls, extra bytes are requested in advance. - - // Next, a step determines how many random bytes to generate. - // The number of random bytes gets decided upon the ID size, mask, - // alphabet size, and magic number 1.6 (using 1.6 peaks at performance - // according to benchmarks). - let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) - - let tick = (id, size = defaultSize) => - random(step).then(bytes => { - // A compact alternative for `for (var i = 0; i < step; i++)`. - let i = step - while (i--) { - // Adding `|| ''` refuses a random byte that exceeds the alphabet size. - id += alphabet[bytes[i] & mask] || '' - if (id.length >= size) return id - } - return tick(id, size) - }) - - return size => tick('', size) -} - -let nanoid = (size = 21) => - random((size |= 0)).then(bytes => { - let id = '' - // A compact alternative for `for (var i = 0; i < step; i++)`. - while (size--) { - // It is incorrect to use bytes exceeding the alphabet size. - // The following mask reduces the random byte in the 0-255 value - // range to the 0-63 value range. Therefore, adding hacks, such - // as empty string fallback or magic numbers, is unneccessary because - // the bitmask trims bytes down to the alphabet size. - id += urlAlphabet[bytes[size] & 63] - } - return id - }) - -module.exports = { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.d.ts b/node_modules/nanoid/async/index.d.ts deleted file mode 100644 index 9e91965..0000000 --- a/node_modules/nanoid/async/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Generate secure URL-friendly unique ID. The non-blocking version. - * - * By default, the ID will have 21 symbols to have a collision probability - * similar to UUID v4. - * - * ```js - * import { nanoid } from 'nanoid/async' - * nanoid().then(id => { - * model.id = id - * }) - * ``` - * - * @param size Size of the ID. The default size is 21. - * @returns A promise with a random string. - */ -export function nanoid(size?: number): Promise - -/** - * A low-level function. - * Generate secure unique ID with custom alphabet. The non-blocking version. - * - * Alphabet must contain 256 symbols or less. Otherwise, the generator - * will not be secure. - * - * @param alphabet Alphabet used to generate the ID. - * @param defaultSize Size of the ID. The default size is 21. - * @returns A function that returns a promise with a random string. - * - * ```js - * import { customAlphabet } from 'nanoid/async' - * const nanoid = customAlphabet('0123456789абвгдеё', 5) - * nanoid().then(id => { - * model.id = id //=> "8ё56а" - * }) - * ``` - */ -export function customAlphabet( - alphabet: string, - defaultSize?: number -): (size?: number) => Promise - -/** - * Generate an array of random bytes collected from hardware noise. - * - * ```js - * import { random } from 'nanoid/async' - * random(5).then(bytes => { - * bytes //=> [10, 67, 212, 67, 89] - * }) - * ``` - * - * @param bytes Size of the array. - * @returns A promise with a random bytes array. - */ -export function random(bytes: number): Promise diff --git a/node_modules/nanoid/async/index.js b/node_modules/nanoid/async/index.js deleted file mode 100644 index cec454a..0000000 --- a/node_modules/nanoid/async/index.js +++ /dev/null @@ -1,35 +0,0 @@ -import crypto from 'crypto' -import { urlAlphabet } from '../url-alphabet/index.js' -let random = bytes => - new Promise((resolve, reject) => { - crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { - if (err) { - reject(err) - } else { - resolve(buf) - } - }) - }) -let customAlphabet = (alphabet, defaultSize = 21) => { - let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 - let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) - let tick = (id, size = defaultSize) => - random(step).then(bytes => { - let i = step - while (i--) { - id += alphabet[bytes[i] & mask] || '' - if (id.length >= size) return id - } - return tick(id, size) - }) - return size => tick('', size) -} -let nanoid = (size = 21) => - random((size |= 0)).then(bytes => { - let id = '' - while (size--) { - id += urlAlphabet[bytes[size] & 63] - } - return id - }) -export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/index.native.js b/node_modules/nanoid/async/index.native.js deleted file mode 100644 index 7c1d6f3..0000000 --- a/node_modules/nanoid/async/index.native.js +++ /dev/null @@ -1,26 +0,0 @@ -import { getRandomBytesAsync } from 'expo-random' -import { urlAlphabet } from '../url-alphabet/index.js' -let random = getRandomBytesAsync -let customAlphabet = (alphabet, defaultSize = 21) => { - let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 - let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) - let tick = (id, size = defaultSize) => - random(step).then(bytes => { - let i = step - while (i--) { - id += alphabet[bytes[i] & mask] || '' - if (id.length >= size) return id - } - return tick(id, size) - }) - return size => tick('', size) -} -let nanoid = (size = 21) => - random((size |= 0)).then(bytes => { - let id = '' - while (size--) { - id += urlAlphabet[bytes[size] & 63] - } - return id - }) -export { nanoid, customAlphabet, random } diff --git a/node_modules/nanoid/async/package.json b/node_modules/nanoid/async/package.json deleted file mode 100644 index 578cdb4..0000000 --- a/node_modules/nanoid/async/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "module", - "main": "index.cjs", - "module": "index.js", - "react-native": { - "./index.js": "./index.native.js" - }, - "browser": { - "./index.js": "./index.browser.js", - "./index.cjs": "./index.browser.cjs" - } -} \ No newline at end of file diff --git a/node_modules/nanoid/bin/nanoid.cjs b/node_modules/nanoid/bin/nanoid.cjs deleted file mode 100755 index c76db0f..0000000 --- a/node_modules/nanoid/bin/nanoid.cjs +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env node - -let { nanoid, customAlphabet } = require('..') - -function print(msg) { - process.stdout.write(msg + '\n') -} - -function error(msg) { - process.stderr.write(msg + '\n') - process.exit(1) -} - -if (process.argv.includes('--help') || process.argv.includes('-h')) { - print(` - Usage - $ nanoid [options] - - Options - -s, --size Generated ID size - -a, --alphabet Alphabet to use - -h, --help Show this help - - Examples - $ nanoid --s 15 - S9sBF77U6sDB8Yg - - $ nanoid --size 10 --alphabet abc - bcabababca`) - process.exit() -} - -let alphabet, size -for (let i = 2; i < process.argv.length; i++) { - let arg = process.argv[i] - if (arg === '--size' || arg === '-s') { - size = Number(process.argv[i + 1]) - i += 1 - if (Number.isNaN(size) || size <= 0) { - error('Size must be positive integer') - } - } else if (arg === '--alphabet' || arg === '-a') { - alphabet = process.argv[i + 1] - i += 1 - } else { - error('Unknown argument ' + arg) - } -} - -if (alphabet) { - let customNanoid = customAlphabet(alphabet, size) - print(customNanoid()) -} else { - print(nanoid(size)) -} diff --git a/node_modules/nanoid/index.browser.cjs b/node_modules/nanoid/index.browser.cjs deleted file mode 100644 index d21a91f..0000000 --- a/node_modules/nanoid/index.browser.cjs +++ /dev/null @@ -1,72 +0,0 @@ -// This file replaces `index.js` in bundlers like webpack or Rollup, -// according to `browser` config in `package.json`. - -let { urlAlphabet } = require('./url-alphabet/index.cjs') - -let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) - -let customRandom = (alphabet, defaultSize, getRandom) => { - // First, a bitmask is necessary to generate the ID. The bitmask makes bytes - // values closer to the alphabet size. The bitmask calculates the closest - // `2^31 - 1` number, which exceeds the alphabet size. - // For example, the bitmask for the alphabet size 30 is 31 (00011111). - // `Math.clz32` is not used, because it is not available in browsers. - let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 - // Though, the bitmask solution is not perfect since the bytes exceeding - // the alphabet size are refused. Therefore, to reliably generate the ID, - // the random bytes redundancy has to be satisfied. - - // Note: every hardware random generator call is performance expensive, - // because the system call for entropy collection takes a lot of time. - // So, to avoid additional system calls, extra bytes are requested in advance. - - // Next, a step determines how many random bytes to generate. - // The number of random bytes gets decided upon the ID size, mask, - // alphabet size, and magic number 1.6 (using 1.6 peaks at performance - // according to benchmarks). - - // `-~f => Math.ceil(f)` if f is a float - // `-~i => i + 1` if i is an integer - let step = -~((1.6 * mask * defaultSize) / alphabet.length) - - return (size = defaultSize) => { - let id = '' - while (true) { - let bytes = getRandom(step) - // A compact alternative for `for (var i = 0; i < step; i++)`. - let j = step | 0 - while (j--) { - // Adding `|| ''` refuses a random byte that exceeds the alphabet size. - id += alphabet[bytes[j] & mask] || '' - if (id.length === size) return id - } - } - } -} - -let customAlphabet = (alphabet, size = 21) => - customRandom(alphabet, size, random) - -let nanoid = (size = 21) => - crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { - // It is incorrect to use bytes exceeding the alphabet size. - // The following mask reduces the random byte in the 0-255 value - // range to the 0-63 value range. Therefore, adding hacks, such - // as empty string fallback or magic numbers, is unneccessary because - // the bitmask trims bytes down to the alphabet size. - byte &= 63 - if (byte < 36) { - // `0-9a-z` - id += byte.toString(36) - } else if (byte < 62) { - // `A-Z` - id += (byte - 26).toString(36).toUpperCase() - } else if (byte > 62) { - id += '-' - } else { - id += '_' - } - return id - }, '') - -module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.browser.js b/node_modules/nanoid/index.browser.js deleted file mode 100644 index 7d3b876..0000000 --- a/node_modules/nanoid/index.browser.js +++ /dev/null @@ -1,34 +0,0 @@ -import { urlAlphabet } from './url-alphabet/index.js' -let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) -let customRandom = (alphabet, defaultSize, getRandom) => { - let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 - let step = -~((1.6 * mask * defaultSize) / alphabet.length) - return (size = defaultSize) => { - let id = '' - while (true) { - let bytes = getRandom(step) - let j = step | 0 - while (j--) { - id += alphabet[bytes[j] & mask] || '' - if (id.length === size) return id - } - } - } -} -let customAlphabet = (alphabet, size = 21) => - customRandom(alphabet, size, random) -let nanoid = (size = 21) => - crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { - byte &= 63 - if (byte < 36) { - id += byte.toString(36) - } else if (byte < 62) { - id += (byte - 26).toString(36).toUpperCase() - } else if (byte > 62) { - id += '-' - } else { - id += '_' - } - return id - }, '') -export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.cjs b/node_modules/nanoid/index.cjs deleted file mode 100644 index c20e374..0000000 --- a/node_modules/nanoid/index.cjs +++ /dev/null @@ -1,85 +0,0 @@ -let crypto = require('crypto') - -let { urlAlphabet } = require('./url-alphabet/index.cjs') - -// It is best to make fewer, larger requests to the crypto module to -// avoid system call overhead. So, random numbers are generated in a -// pool. The pool is a Buffer that is larger than the initial random -// request size by this multiplier. The pool is enlarged if subsequent -// requests exceed the maximum buffer size. -const POOL_SIZE_MULTIPLIER = 128 -let pool, poolOffset - -let fillPool = bytes => { - if (!pool || pool.length < bytes) { - pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) - crypto.randomFillSync(pool) - poolOffset = 0 - } else if (poolOffset + bytes > pool.length) { - crypto.randomFillSync(pool) - poolOffset = 0 - } - poolOffset += bytes -} - -let random = bytes => { - // `|=` convert `bytes` to number to prevent `valueOf` abusing and pool pollution - fillPool((bytes |= 0)) - return pool.subarray(poolOffset - bytes, poolOffset) -} - -let customRandom = (alphabet, defaultSize, getRandom) => { - // First, a bitmask is necessary to generate the ID. The bitmask makes bytes - // values closer to the alphabet size. The bitmask calculates the closest - // `2^31 - 1` number, which exceeds the alphabet size. - // For example, the bitmask for the alphabet size 30 is 31 (00011111). - let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 - // Though, the bitmask solution is not perfect since the bytes exceeding - // the alphabet size are refused. Therefore, to reliably generate the ID, - // the random bytes redundancy has to be satisfied. - - // Note: every hardware random generator call is performance expensive, - // because the system call for entropy collection takes a lot of time. - // So, to avoid additional system calls, extra bytes are requested in advance. - - // Next, a step determines how many random bytes to generate. - // The number of random bytes gets decided upon the ID size, mask, - // alphabet size, and magic number 1.6 (using 1.6 peaks at performance - // according to benchmarks). - let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) - - return (size = defaultSize) => { - let id = '' - while (true) { - let bytes = getRandom(step) - // A compact alternative for `for (let i = 0; i < step; i++)`. - let i = step - while (i--) { - // Adding `|| ''` refuses a random byte that exceeds the alphabet size. - id += alphabet[bytes[i] & mask] || '' - if (id.length === size) return id - } - } - } -} - -let customAlphabet = (alphabet, size = 21) => - customRandom(alphabet, size, random) - -let nanoid = (size = 21) => { - // `|=` convert `size` to number to prevent `valueOf` abusing and pool pollution - fillPool((size |= 0)) - let id = '' - // We are reading directly from the random pool to avoid creating new array - for (let i = poolOffset - size; i < poolOffset; i++) { - // It is incorrect to use bytes exceeding the alphabet size. - // The following mask reduces the random byte in the 0-255 value - // range to the 0-63 value range. Therefore, adding hacks, such - // as empty string fallback or magic numbers, is unneccessary because - // the bitmask trims bytes down to the alphabet size. - id += urlAlphabet[pool[i] & 63] - } - return id -} - -module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/index.d.cts b/node_modules/nanoid/index.d.cts deleted file mode 100644 index 3e111a3..0000000 --- a/node_modules/nanoid/index.d.cts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Generate secure URL-friendly unique ID. - * - * By default, the ID will have 21 symbols to have a collision probability - * similar to UUID v4. - * - * ```js - * import { nanoid } from 'nanoid' - * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" - * ``` - * - * @param size Size of the ID. The default size is 21. - * @returns A random string. - */ -export function nanoid(size?: number): string - -/** - * Generate secure unique ID with custom alphabet. - * - * Alphabet must contain 256 symbols or less. Otherwise, the generator - * will not be secure. - * - * @param alphabet Alphabet used to generate the ID. - * @param defaultSize Size of the ID. The default size is 21. - * @returns A random string generator. - * - * ```js - * const { customAlphabet } = require('nanoid') - * const nanoid = customAlphabet('0123456789абвгдеё', 5) - * nanoid() //=> "8ё56а" - * ``` - */ -export function customAlphabet( - alphabet: string, - defaultSize?: number -): (size?: number) => string - -/** - * Generate unique ID with custom random generator and alphabet. - * - * Alphabet must contain 256 symbols or less. Otherwise, the generator - * will not be secure. - * - * ```js - * import { customRandom } from 'nanoid/format' - * - * const nanoid = customRandom('abcdef', 5, size => { - * const random = [] - * for (let i = 0; i < size; i++) { - * random.push(randomByte()) - * } - * return random - * }) - * - * nanoid() //=> "fbaef" - * ``` - * - * @param alphabet Alphabet used to generate a random string. - * @param size Size of the random string. - * @param random A random bytes generator. - * @returns A random string generator. - */ -export function customRandom( - alphabet: string, - size: number, - random: (bytes: number) => Uint8Array -): () => string - -/** - * URL safe symbols. - * - * ```js - * import { urlAlphabet } from 'nanoid' - * const nanoid = customAlphabet(urlAlphabet, 10) - * nanoid() //=> "Uakgb_J5m9" - * ``` - */ -export const urlAlphabet: string - -/** - * Generate an array of random bytes collected from hardware noise. - * - * ```js - * import { customRandom, random } from 'nanoid' - * const nanoid = customRandom("abcdef", 5, random) - * ``` - * - * @param bytes Size of the array. - * @returns An array of random bytes. - */ -export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.d.ts b/node_modules/nanoid/index.d.ts deleted file mode 100644 index 3e111a3..0000000 --- a/node_modules/nanoid/index.d.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Generate secure URL-friendly unique ID. - * - * By default, the ID will have 21 symbols to have a collision probability - * similar to UUID v4. - * - * ```js - * import { nanoid } from 'nanoid' - * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" - * ``` - * - * @param size Size of the ID. The default size is 21. - * @returns A random string. - */ -export function nanoid(size?: number): string - -/** - * Generate secure unique ID with custom alphabet. - * - * Alphabet must contain 256 symbols or less. Otherwise, the generator - * will not be secure. - * - * @param alphabet Alphabet used to generate the ID. - * @param defaultSize Size of the ID. The default size is 21. - * @returns A random string generator. - * - * ```js - * const { customAlphabet } = require('nanoid') - * const nanoid = customAlphabet('0123456789абвгдеё', 5) - * nanoid() //=> "8ё56а" - * ``` - */ -export function customAlphabet( - alphabet: string, - defaultSize?: number -): (size?: number) => string - -/** - * Generate unique ID with custom random generator and alphabet. - * - * Alphabet must contain 256 symbols or less. Otherwise, the generator - * will not be secure. - * - * ```js - * import { customRandom } from 'nanoid/format' - * - * const nanoid = customRandom('abcdef', 5, size => { - * const random = [] - * for (let i = 0; i < size; i++) { - * random.push(randomByte()) - * } - * return random - * }) - * - * nanoid() //=> "fbaef" - * ``` - * - * @param alphabet Alphabet used to generate a random string. - * @param size Size of the random string. - * @param random A random bytes generator. - * @returns A random string generator. - */ -export function customRandom( - alphabet: string, - size: number, - random: (bytes: number) => Uint8Array -): () => string - -/** - * URL safe symbols. - * - * ```js - * import { urlAlphabet } from 'nanoid' - * const nanoid = customAlphabet(urlAlphabet, 10) - * nanoid() //=> "Uakgb_J5m9" - * ``` - */ -export const urlAlphabet: string - -/** - * Generate an array of random bytes collected from hardware noise. - * - * ```js - * import { customRandom, random } from 'nanoid' - * const nanoid = customRandom("abcdef", 5, random) - * ``` - * - * @param bytes Size of the array. - * @returns An array of random bytes. - */ -export function random(bytes: number): Uint8Array diff --git a/node_modules/nanoid/index.js b/node_modules/nanoid/index.js deleted file mode 100644 index 9bc909d..0000000 --- a/node_modules/nanoid/index.js +++ /dev/null @@ -1,45 +0,0 @@ -import crypto from 'crypto' -import { urlAlphabet } from './url-alphabet/index.js' -const POOL_SIZE_MULTIPLIER = 128 -let pool, poolOffset -let fillPool = bytes => { - if (!pool || pool.length < bytes) { - pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) - crypto.randomFillSync(pool) - poolOffset = 0 - } else if (poolOffset + bytes > pool.length) { - crypto.randomFillSync(pool) - poolOffset = 0 - } - poolOffset += bytes -} -let random = bytes => { - fillPool((bytes |= 0)) - return pool.subarray(poolOffset - bytes, poolOffset) -} -let customRandom = (alphabet, defaultSize, getRandom) => { - let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 - let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) - return (size = defaultSize) => { - let id = '' - while (true) { - let bytes = getRandom(step) - let i = step - while (i--) { - id += alphabet[bytes[i] & mask] || '' - if (id.length === size) return id - } - } - } -} -let customAlphabet = (alphabet, size = 21) => - customRandom(alphabet, size, random) -let nanoid = (size = 21) => { - fillPool((size |= 0)) - let id = '' - for (let i = poolOffset - size; i < poolOffset; i++) { - id += urlAlphabet[pool[i] & 63] - } - return id -} -export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/node_modules/nanoid/nanoid.js b/node_modules/nanoid/nanoid.js deleted file mode 100644 index ec242ea..0000000 --- a/node_modules/nanoid/nanoid.js +++ /dev/null @@ -1 +0,0 @@ -export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); \ No newline at end of file diff --git a/node_modules/nanoid/non-secure/index.cjs b/node_modules/nanoid/non-secure/index.cjs deleted file mode 100644 index d51fcb6..0000000 --- a/node_modules/nanoid/non-secure/index.cjs +++ /dev/null @@ -1,34 +0,0 @@ -// This alphabet uses `A-Za-z0-9_-` symbols. -// The order of characters is optimized for better gzip and brotli compression. -// References to the same file (works both for gzip and brotli): -// `'use`, `andom`, and `rict'` -// References to the brotli default dictionary: -// `-26T`, `1983`, `40px`, `75px`, `bush`, `jack`, `mind`, `very`, and `wolf` -let urlAlphabet = - 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' - -let customAlphabet = (alphabet, defaultSize = 21) => { - return (size = defaultSize) => { - let id = '' - // A compact alternative for `for (var i = 0; i < step; i++)`. - let i = size | 0 - while (i--) { - // `| 0` is more compact and faster than `Math.floor()`. - id += alphabet[(Math.random() * alphabet.length) | 0] - } - return id - } -} - -let nanoid = (size = 21) => { - let id = '' - // A compact alternative for `for (var i = 0; i < step; i++)`. - let i = size | 0 - while (i--) { - // `| 0` is more compact and faster than `Math.floor()`. - id += urlAlphabet[(Math.random() * 64) | 0] - } - return id -} - -module.exports = { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/index.d.ts b/node_modules/nanoid/non-secure/index.d.ts deleted file mode 100644 index 4965322..0000000 --- a/node_modules/nanoid/non-secure/index.d.ts +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Generate URL-friendly unique ID. This method uses the non-secure - * predictable random generator with bigger collision probability. - * - * ```js - * import { nanoid } from 'nanoid/non-secure' - * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" - * ``` - * - * @param size Size of the ID. The default size is 21. - * @returns A random string. - */ -export function nanoid(size?: number): string - -/** - * Generate a unique ID based on a custom alphabet. - * This method uses the non-secure predictable random generator - * with bigger collision probability. - * - * @param alphabet Alphabet used to generate the ID. - * @param defaultSize Size of the ID. The default size is 21. - * @returns A random string generator. - * - * ```js - * import { customAlphabet } from 'nanoid/non-secure' - * const nanoid = customAlphabet('0123456789абвгдеё', 5) - * model.id = //=> "8ё56а" - * ``` - */ -export function customAlphabet( - alphabet: string, - defaultSize?: number -): (size?: number) => string diff --git a/node_modules/nanoid/non-secure/index.js b/node_modules/nanoid/non-secure/index.js deleted file mode 100644 index 2ea5827..0000000 --- a/node_modules/nanoid/non-secure/index.js +++ /dev/null @@ -1,21 +0,0 @@ -let urlAlphabet = - 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' -let customAlphabet = (alphabet, defaultSize = 21) => { - return (size = defaultSize) => { - let id = '' - let i = size | 0 - while (i--) { - id += alphabet[(Math.random() * alphabet.length) | 0] - } - return id - } -} -let nanoid = (size = 21) => { - let id = '' - let i = size | 0 - while (i--) { - id += urlAlphabet[(Math.random() * 64) | 0] - } - return id -} -export { nanoid, customAlphabet } diff --git a/node_modules/nanoid/non-secure/package.json b/node_modules/nanoid/non-secure/package.json deleted file mode 100644 index 9930d6a..0000000 --- a/node_modules/nanoid/non-secure/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "main": "index.cjs", - "module": "index.js", - "react-native": "index.js" -} \ No newline at end of file diff --git a/node_modules/nanoid/package.json b/node_modules/nanoid/package.json deleted file mode 100644 index a3d3f44..0000000 --- a/node_modules/nanoid/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "nanoid", - "version": "3.3.11", - "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator", - "keywords": [ - "uuid", - "random", - "id", - "url" - ], - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - }, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "author": "Andrey Sitnik ", - "license": "MIT", - "repository": "ai/nanoid", - "browser": { - "./index.js": "./index.browser.js", - "./async/index.js": "./async/index.browser.js", - "./async/index.cjs": "./async/index.browser.cjs", - "./index.cjs": "./index.browser.cjs" - }, - "react-native": "index.js", - "bin": "./bin/nanoid.cjs", - "sideEffects": false, - "types": "./index.d.ts", - "type": "module", - "main": "index.cjs", - "module": "index.js", - "exports": { - ".": { - "react-native": "./index.browser.js", - "browser": "./index.browser.js", - "require": { - "types": "./index.d.cts", - "default": "./index.cjs" - }, - "import": { - "types": "./index.d.ts", - "default": "./index.js" - }, - "default": "./index.js" - }, - "./package.json": "./package.json", - "./async/package.json": "./async/package.json", - "./async": { - "browser": "./async/index.browser.js", - "require": { - "types": "./index.d.cts", - "default": "./async/index.cjs" - }, - "import": { - "types": "./index.d.ts", - "default": "./async/index.js" - }, - "default": "./async/index.js" - }, - "./non-secure/package.json": "./non-secure/package.json", - "./non-secure": { - "require": { - "types": "./index.d.cts", - "default": "./non-secure/index.cjs" - }, - "import": { - "types": "./index.d.ts", - "default": "./non-secure/index.js" - }, - "default": "./non-secure/index.js" - }, - "./url-alphabet/package.json": "./url-alphabet/package.json", - "./url-alphabet": { - "require": { - "types": "./index.d.cts", - "default": "./url-alphabet/index.cjs" - }, - "import": { - "types": "./index.d.ts", - "default": "./url-alphabet/index.js" - }, - "default": "./url-alphabet/index.js" - } - } -} diff --git a/node_modules/nanoid/url-alphabet/index.cjs b/node_modules/nanoid/url-alphabet/index.cjs deleted file mode 100644 index a332f0b..0000000 --- a/node_modules/nanoid/url-alphabet/index.cjs +++ /dev/null @@ -1,7 +0,0 @@ -// This alphabet uses `A-Za-z0-9_-` symbols. -// The order of characters is optimized for better gzip and brotli compression. -// Same as in non-secure/index.js -let urlAlphabet = - 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' - -module.exports = { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/index.js b/node_modules/nanoid/url-alphabet/index.js deleted file mode 100644 index c2782e5..0000000 --- a/node_modules/nanoid/url-alphabet/index.js +++ /dev/null @@ -1,3 +0,0 @@ -let urlAlphabet = - 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' -export { urlAlphabet } diff --git a/node_modules/nanoid/url-alphabet/package.json b/node_modules/nanoid/url-alphabet/package.json deleted file mode 100644 index 9930d6a..0000000 --- a/node_modules/nanoid/url-alphabet/package.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "type": "module", - "main": "index.cjs", - "module": "index.js", - "react-native": "index.js" -} \ No newline at end of file diff --git a/node_modules/obug/LICENSE b/node_modules/obug/LICENSE deleted file mode 100644 index 12eb148..0000000 --- a/node_modules/obug/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz) -Copyright (c) 2014-2017 TJ Holowaychuk -Copyright (c) 2018-2021 Josh Junon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/obug/README.md b/node_modules/obug/README.md deleted file mode 100644 index e0bfb9a..0000000 --- a/node_modules/obug/README.md +++ /dev/null @@ -1,106 +0,0 @@ -# obug - -[![npm version][npm-version-src]][npm-version-href] -[![npm downloads][npm-downloads-src]][npm-downloads-href] -[![Unit Test][unit-test-src]][unit-test-href] - -A lightweight JavaScript debugging utility, forked from [debug](https://www.npmjs.com/package/debug), featuring TypeScript and ESM support. - -> [!NOTE] -> obug v1 retains most of the compatibility with [debug](https://github.com/debug-js/debug), but drops support for older browsers and Node.js, making it a drop-in replacement. -> -> obug v2 refactors some API imports and usage for better support of ESM and TypeScript, easier customization, and an even smaller package size. - -## Key Differences from `debug` - -- ✨ Minimal footprint - - 7.7 kB package size - - 1.4 KB minified + gzipped for browsers -- 📦 Zero dependencies -- 📝 Full TypeScript support -- 🚀 Native ESM compatibility -- 🌐 Optimized for modern runtimes - - ES2015+ browsers - - Modern Node.js versions -- 🎨 Customizable formatting - -## Installation - -```bash -npm install obug -``` - -## Usage - -```ts -import { createDebug, disable, enable, enabled, namespaces } from 'obug' - -// Get the currently enabled namespaces -console.log(namespaces()) - -const debug = createDebug('my-namespace', { - // All options are optional - - useColors: true, // false, true, undefined for auto-detect - color: 2, // custom color - // custom formatArgs - formatArgs(args) {}, - formatters: {}, - // Node.js only - inspectOpts: {}, - - // custom log - log: console.log, -}) - -debug('This is a debug message') -console.log( - debug.namespace, // 'my-namespace' - debug.enabled, // Check if enabled - debug.useColors, // true - debug.color, // 2 - debug.formatArgs, // custom formatArgs - debug.formatters, // {} - debug.inspectOpts, // {} - debug.log, // implemented log function -) - -// Create a sub-namespace, and it will inherit options from the parent debugger -const sub = debug.extend('sub-namespace') -sub('This is a sub-namespace debug message') -console.log(sub.namespace) // 'my-namespace:sub-namespace' -``` - -## Original Authors - -As obug is a fork of debug with significant modifications, we would like to acknowledge the original authors: - -- TJ Holowaychuk -- Nathan Rajlich -- Andrew Rhyne -- Josh Junon - -## Sponsors - -

- - - -

- -## License - -[MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz) - -[The MIT License](./LICENSE) Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> - -[The MIT License](./LICENSE) Copyright (c) 2018-2021 Josh Junon - - - -[npm-version-src]: https://img.shields.io/npm/v/obug.svg -[npm-version-href]: https://npmjs.com/package/obug -[npm-downloads-src]: https://img.shields.io/npm/dm/obug -[npm-downloads-href]: https://www.npmcharts.com/compare/obug?interval=30 -[unit-test-src]: https://github.com/sxzz/obug/actions/workflows/unit-test.yml/badge.svg -[unit-test-href]: https://github.com/sxzz/obug/actions/workflows/unit-test.yml diff --git a/node_modules/obug/dist/browser.d.ts b/node_modules/obug/dist/browser.d.ts deleted file mode 100644 index d0c8970..0000000 --- a/node_modules/obug/dist/browser.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { a as Debugger, i as DebugOptions, n as enabled, o as Formatters, r as namespaces, s as InspectOptions, t as disable } from "./core.js"; - -//#region src/browser.d.ts -declare function createDebug(namespace: string, options?: DebugOptions): Debugger; -/** -* Enables a debug mode by namespaces. This can include modes -* separated by a colon and wildcards. -*/ -declare function enable(namespaces: string): void; -//#endregion -export { DebugOptions, Debugger, Formatters, InspectOptions, createDebug, disable, enable, enabled, namespaces }; \ No newline at end of file diff --git a/node_modules/obug/dist/browser.js b/node_modules/obug/dist/browser.js deleted file mode 100644 index 414ff7d..0000000 --- a/node_modules/obug/dist/browser.js +++ /dev/null @@ -1,140 +0,0 @@ -import { a as namespaces, i as enabled, n as disable, o as humanize, r as enable$1, s as selectColor, t as createDebug$1 } from "./core.js"; -const colors = [ - "#0000CC", - "#0000FF", - "#0033CC", - "#0033FF", - "#0066CC", - "#0066FF", - "#0099CC", - "#0099FF", - "#00CC00", - "#00CC33", - "#00CC66", - "#00CC99", - "#00CCCC", - "#00CCFF", - "#3300CC", - "#3300FF", - "#3333CC", - "#3333FF", - "#3366CC", - "#3366FF", - "#3399CC", - "#3399FF", - "#33CC00", - "#33CC33", - "#33CC66", - "#33CC99", - "#33CCCC", - "#33CCFF", - "#6600CC", - "#6600FF", - "#6633CC", - "#6633FF", - "#66CC00", - "#66CC33", - "#9900CC", - "#9900FF", - "#9933CC", - "#9933FF", - "#99CC00", - "#99CC33", - "#CC0000", - "#CC0033", - "#CC0066", - "#CC0099", - "#CC00CC", - "#CC00FF", - "#CC3300", - "#CC3333", - "#CC3366", - "#CC3399", - "#CC33CC", - "#CC33FF", - "#CC6600", - "#CC6633", - "#CC9900", - "#CC9933", - "#CCCC00", - "#CCCC33", - "#FF0000", - "#FF0033", - "#FF0066", - "#FF0099", - "#FF00CC", - "#FF00FF", - "#FF3300", - "#FF3333", - "#FF3366", - "#FF3399", - "#FF33CC", - "#FF33FF", - "#FF6600", - "#FF6633", - "#FF9900", - "#FF9933", - "#FFCC00", - "#FFCC33" -]; -function formatArgs(diff, args) { - const { useColors } = this; - args[0] = `${(useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ")}+${this.humanize(diff)}`; - if (!useColors) return; - const c = `color: ${this.color}`; - args.splice(1, 0, c, "color: inherit"); - let index = 0; - let lastC = 0; - args[0].replace(/%[a-z%]/gi, (match) => { - if (match === "%%") return; - index++; - if (match === "%c") lastC = index; - }); - args.splice(lastC, 0, c); -} -const log = console.debug || console.log || (() => {}); -const storage = localstorage(); -const defaultOptions = { - useColors: true, - formatArgs, - formatters: { j(v) { - try { - return JSON.stringify(v); - } catch (error) { - return `[UnexpectedJSONParseError]: ${error.message}`; - } - } }, - inspectOpts: {}, - humanize, - log -}; -function createDebug(namespace, options) { - var _ref; - const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace); - return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options)); -} -function localstorage() { - try { - return localStorage; - } catch (_unused) {} -} -function load() { - let r; - try { - r = storage.getItem("debug") || storage.getItem("DEBUG"); - } catch (_unused2) {} - if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG; - return r || ""; -} -function save(namespaces$1) { - try { - if (namespaces$1) storage.setItem("debug", namespaces$1); - else storage.removeItem("debug"); - } catch (_unused3) {} -} -function enable(namespaces$1) { - save(namespaces$1); - enable$1(namespaces$1); -} -enable$1(load()); -export { createDebug, disable, enable, enabled, namespaces }; diff --git a/node_modules/obug/dist/browser.min.js b/node_modules/obug/dist/browser.min.js deleted file mode 100644 index 443a768..0000000 --- a/node_modules/obug/dist/browser.min.js +++ /dev/null @@ -1 +0,0 @@ -function e(e){return e instanceof Error?e.stack||e.message:e}function t(e,t){let n=0;for(let e=0;e=1e3?`${(e/1e3).toFixed(1)}s`:`${e}ms`}let i=``;function a(){return i}function o(t,n){let r,a,s,c,l=(...t)=>{if(!l.enabled)return;let i=Date.now(),a=i-(r||i);r=i,t[0]=e(t[0]),typeof t[0]!=`string`&&t.unshift(`%O`);let o=0;t[0]=t[0].replace(/%([a-z%])/gi,(e,r)=>{if(e===`%%`)return`%`;o++;let i=n.formatters[r];if(typeof i==`function`){let n=t[o];e=i.call(l,n),t.splice(o,1),o--}return e}),n.formatArgs.call(l,a,t),l.log(...t)};return l.extend=function(e,t=`:`){return o(this.namespace+t+e,{useColors:this.useColors,color:this.color,formatArgs:this.formatArgs,formatters:this.formatters,inspectOpts:this.inspectOpts,log:this.log,humanize:this.humanize})},Object.assign(l,n),l.namespace=t,Object.defineProperty(l,`enabled`,{enumerable:!0,configurable:!1,get:()=>a==null?(s!==i&&(s=i,c=d(t)),c):a,set:e=>{a=e}}),l}let s=[],c=[];function l(e){i=e,s=[],c=[];let t=i.trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?c.push(e.slice(1)):s.push(e)}function u(){let e=[...s,...c.map(e=>`-${e}`)].join(`,`);return l(``),e}function d(e){for(let t of c)if(n(e,t))return!1;for(let t of s)if(n(e,t))return!0;return!1}const f=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function p(e,t){let{useColors:n}=this;if(t[0]=`${(n?`%c`:``)+this.namespace+(n?` %c`:` `)+t[0]+(n?`%c `:` `)}+${this.humanize(e)}`,!n)return;let r=`color: ${this.color}`;t.splice(1,0,r,`color: inherit`);let i=0,a=0;t[0].replace(/%[a-z%]/gi,e=>{e!==`%%`&&(i++,e===`%c`&&(a=i))}),t.splice(a,0,r)}const m=console.debug||console.log||(()=>{}),h=v(),g={useColors:!0,formatArgs:p,formatters:{j(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: ${e.message}`}}},inspectOpts:{},humanize:r,log:m};function _(e,n){var r;let i=(r=n&&n.color)==null?t(f,e):r;return o(e,Object.assign(g,{color:i},n))}function v(){try{return localStorage}catch(e){}}function y(){let e;try{e=h.getItem(`debug`)||h.getItem(`DEBUG`)}catch(e){}return!e&&typeof process<`u`&&`env`in process&&(e=process.env.DEBUG),e||``}function b(e){try{e?h.setItem(`debug`,e):h.removeItem(`debug`)}catch(e){}}function x(e){b(e),l(e)}l(y());export{_ as createDebug,u as disable,x as enable,d as enabled,a as namespaces}; \ No newline at end of file diff --git a/node_modules/obug/dist/core.d.ts b/node_modules/obug/dist/core.d.ts deleted file mode 100644 index 61f80ae..0000000 --- a/node_modules/obug/dist/core.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { InspectOptions } from "node:util"; - -//#region src/types.d.ts -interface InspectOptions$1 extends InspectOptions { - hideDate?: boolean; -} -/** -* Map of special "%n" handling functions, for the debug "format" argument. -* -* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". -*/ -interface Formatters { - [formatter: string]: (this: Debugger, v: any) => string; -} -interface Debugger extends Required { - (formatter: any, ...args: any[]): void; - namespace: string; - enabled: boolean; - extend: (namespace: string, delimiter?: string) => Debugger; -} -interface DebugOptions { - useColors?: boolean; - color?: string | number; - formatArgs?: (this: Debugger, diff: number, args: [string, ...any[]]) => void; - formatters?: Formatters; - /** Node.js only */ - inspectOpts?: InspectOptions$1; - /** Humanize a duration in milliseconds */ - humanize?: (value: number) => string; - log?: (this: Debugger, ...args: any[]) => void; -} -//#endregion -//#region src/core.d.ts -/** -* Returns a string of the currently enabled debug namespaces. -*/ -declare function namespaces(): string; -/** -* Disable debug output. -*/ -declare function disable(): string; -/** -* Returns true if the given mode name is enabled, false otherwise. -*/ -declare function enabled(name: string): boolean; -//#endregion -export { Debugger as a, DebugOptions as i, enabled as n, Formatters as o, namespaces as r, InspectOptions$1 as s, disable as t }; \ No newline at end of file diff --git a/node_modules/obug/dist/core.js b/node_modules/obug/dist/core.js deleted file mode 100644 index db2abcd..0000000 --- a/node_modules/obug/dist/core.js +++ /dev/null @@ -1,120 +0,0 @@ -function coerce(value) { - if (value instanceof Error) return value.stack || value.message; - return value; -} -function selectColor(colors, namespace) { - let hash = 0; - for (let i = 0; i < namespace.length; i++) { - hash = (hash << 5) - hash + namespace.charCodeAt(i); - hash |= 0; - } - return colors[Math.abs(hash) % colors.length]; -} -function matchesTemplate(search, template) { - let searchIndex = 0; - let templateIndex = 0; - let starIndex = -1; - let matchIndex = 0; - while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") { - starIndex = templateIndex; - matchIndex = searchIndex; - templateIndex++; - } else { - searchIndex++; - templateIndex++; - } - else if (starIndex !== -1) { - templateIndex = starIndex + 1; - matchIndex++; - searchIndex = matchIndex; - } else return false; - while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++; - return templateIndex === template.length; -} -function humanize(value) { - if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`; - return `${value}ms`; -} -let globalNamespaces = ""; -function namespaces() { - return globalNamespaces; -} -function createDebug(namespace, options) { - let prevTime; - let enableOverride; - let namespacesCache; - let enabledCache; - const debug = (...args) => { - if (!debug.enabled) return; - const curr = Date.now(); - const diff = curr - (prevTime || curr); - prevTime = curr; - args[0] = coerce(args[0]); - if (typeof args[0] !== "string") args.unshift("%O"); - let index = 0; - args[0] = args[0].replace(/%([a-z%])/gi, (match, format) => { - if (match === "%%") return "%"; - index++; - const formatter = options.formatters[format]; - if (typeof formatter === "function") { - const value = args[index]; - match = formatter.call(debug, value); - args.splice(index, 1); - index--; - } - return match; - }); - options.formatArgs.call(debug, diff, args); - debug.log(...args); - }; - debug.extend = function(namespace$1, delimiter = ":") { - return createDebug(this.namespace + delimiter + namespace$1, { - useColors: this.useColors, - color: this.color, - formatArgs: this.formatArgs, - formatters: this.formatters, - inspectOpts: this.inspectOpts, - log: this.log, - humanize: this.humanize - }); - }; - Object.assign(debug, options); - debug.namespace = namespace; - Object.defineProperty(debug, "enabled", { - enumerable: true, - configurable: false, - get: () => { - if (enableOverride != null) return enableOverride; - if (namespacesCache !== globalNamespaces) { - namespacesCache = globalNamespaces; - enabledCache = enabled(namespace); - } - return enabledCache; - }, - set: (v) => { - enableOverride = v; - } - }); - return debug; -} -let names = []; -let skips = []; -function enable(namespaces$1) { - globalNamespaces = namespaces$1; - names = []; - skips = []; - const split = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean); - for (const ns of split) if (ns[0] === "-") skips.push(ns.slice(1)); - else names.push(ns); -} -function disable() { - const namespaces$1 = [...names, ...skips.map((namespace) => `-${namespace}`)].join(","); - enable(""); - return namespaces$1; -} -function enabled(name) { - for (const skip of skips) if (matchesTemplate(name, skip)) return false; - for (const ns of names) if (matchesTemplate(name, ns)) return true; - return false; -} -export { namespaces as a, enabled as i, disable as n, humanize as o, enable as r, selectColor as s, createDebug as t }; diff --git a/node_modules/obug/dist/node.d.ts b/node_modules/obug/dist/node.d.ts deleted file mode 100644 index 2d674e5..0000000 --- a/node_modules/obug/dist/node.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { a as Debugger, i as DebugOptions, n as enabled, o as Formatters, r as namespaces, s as InspectOptions, t as disable } from "./core.js"; - -//#region src/node.d.ts -declare function createDebug(namespace: string, options?: DebugOptions): Debugger; -/** -* Enables a debug mode by namespaces. This can include modes -* separated by a colon and wildcards. -*/ -declare function enable(namespaces: string): void; -//#endregion -export { DebugOptions, Debugger, Formatters, InspectOptions, createDebug, disable, enable, enabled, namespaces }; \ No newline at end of file diff --git a/node_modules/obug/dist/node.js b/node_modules/obug/dist/node.js deleted file mode 100644 index 4ad74a1..0000000 --- a/node_modules/obug/dist/node.js +++ /dev/null @@ -1,151 +0,0 @@ -import { a as namespaces, i as enabled, n as disable, o as humanize, r as enable$1, s as selectColor, t as createDebug$1 } from "./core.js"; -import { isatty } from "node:tty"; -import { formatWithOptions, inspect } from "node:util"; -const colors = process.stderr.getColorDepth && process.stderr.getColorDepth() > 2 ? [ - 20, - 21, - 26, - 27, - 32, - 33, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 56, - 57, - 62, - 63, - 68, - 69, - 74, - 75, - 76, - 77, - 78, - 79, - 80, - 81, - 92, - 93, - 98, - 99, - 112, - 113, - 128, - 129, - 134, - 135, - 148, - 149, - 160, - 161, - 162, - 163, - 164, - 165, - 166, - 167, - 168, - 169, - 170, - 171, - 172, - 173, - 178, - 179, - 184, - 185, - 196, - 197, - 198, - 199, - 200, - 201, - 202, - 203, - 204, - 205, - 206, - 207, - 208, - 209, - 214, - 215, - 220, - 221 -] : [ - 6, - 2, - 3, - 4, - 5, - 1 -]; -const inspectOpts = Object.keys(process.env).filter((key) => /^debug_/i.test(key)).reduce((obj, key) => { - const prop = key.slice(6).toLowerCase().replace(/_([a-z])/g, (_, k) => k.toUpperCase()); - let value = process.env[key]; - const lowerCase = typeof value === "string" && value.toLowerCase(); - if (value === "null") value = null; - else if (lowerCase === "yes" || lowerCase === "on" || lowerCase === "true" || lowerCase === "enabled") value = true; - else if (lowerCase === "no" || lowerCase === "off" || lowerCase === "false" || lowerCase === "disabled") value = false; - else value = Number(value); - obj[prop] = value; - return obj; -}, {}); -function useColors() { - return "colors" in inspectOpts ? Boolean(inspectOpts.colors) : isatty(process.stderr.fd); -} -function getDate() { - if (inspectOpts.hideDate) return ""; - return `${(/* @__PURE__ */ new Date()).toISOString()} `; -} -function formatArgs(diff, args) { - const { namespace: name, useColors: useColors$1 } = this; - if (useColors$1) { - const c = this.color; - const colorCode = `\u001B[3${c < 8 ? c : `8;5;${c}`}`; - const prefix = ` ${colorCode};1m${name} \u001B[0m`; - args[0] = prefix + args[0].split("\n").join(`\n${prefix}`); - args.push(`${colorCode}m+${this.humanize(diff)}\u001B[0m`); - } else args[0] = `${getDate()}${name} ${args[0]}`; -} -function log(...args) { - process.stderr.write(`${formatWithOptions(this.inspectOpts, ...args)}\n`); -} -const defaultOptions = { - useColors: useColors(), - formatArgs, - formatters: { - o(v) { - this.inspectOpts.colors = this.useColors; - return inspect(v, this.inspectOpts).split("\n").map((str) => str.trim()).join(" "); - }, - O(v) { - this.inspectOpts.colors = this.useColors; - return inspect(v, this.inspectOpts); - } - }, - inspectOpts, - log, - humanize -}; -function createDebug(namespace, options) { - var _ref; - const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace); - return createDebug$1(namespace, Object.assign(defaultOptions, { color }, options)); -} -function save(namespaces$1) { - if (namespaces$1) process.env.DEBUG = namespaces$1; - else delete process.env.DEBUG; -} -function enable(namespaces$1) { - save(namespaces$1); - enable$1(namespaces$1); -} -enable$1(process.env.DEBUG || ""); -export { createDebug, disable, enable, enabled, namespaces }; diff --git a/node_modules/obug/package.json b/node_modules/obug/package.json deleted file mode 100644 index 651d753..0000000 --- a/node_modules/obug/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "obug", - "version": "2.1.1", - "description": "A lightweight JavaScript debugging utility, forked from debug, featuring TypeScript and ESM support.", - "type": "module", - "license": "MIT", - "homepage": "https://github.com/sxzz/obug#readme", - "bugs": { - "url": "https://github.com/sxzz/obug/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/sxzz/obug.git" - }, - "author": "Kevin Deng ", - "funding": [ - "https://github.com/sponsors/sxzz", - "https://opencollective.com/debug" - ], - "files": [ - "dist" - ], - "main": "./dist/node.js", - "module": "./dist/node.js", - "types": "./dist/browser.d.ts", - "exports": { - ".": { - "browser": "./dist/browser.js", - "default": "./dist/node.js" - }, - "./package.json": "./package.json" - }, - "unpkg": "./dist/browser.min.js", - "jsdelivr": "./dist/browser.min.js", - "publishConfig": { - "access": "public" - }, - "devDependencies": { - "@sxzz/eslint-config": "^7.3.0", - "@sxzz/prettier-config": "^2.2.5", - "@types/debug": "^4.1.12", - "@types/node": "^24.10.1", - "@vitest/browser-playwright": "^4.0.10", - "@vitest/coverage-v8": "^4.0.10", - "bumpp": "^10.3.1", - "debug": "^4.4.3", - "eslint": "^9.39.1", - "playwright": "^1.56.1", - "prettier": "^3.6.2", - "tsdown": "^0.16.5", - "typescript": "^5.9.3", - "vite": "^7.2.2", - "vitest": "^4.0.10" - }, - "prettier": "@sxzz/prettier-config", - "scripts": { - "lint": "eslint --cache .", - "lint:fix": "pnpm run lint --fix", - "build": "tsdown", - "dev": "tsdown --watch", - "test": "vitest", - "test:coverage": "vitest --project node --coverage", - "play": "vite playground", - "typecheck": "tsc --noEmit", - "format": "prettier --cache --write .", - "release": "bumpp" - } -} \ No newline at end of file diff --git a/node_modules/pathe/LICENSE b/node_modules/pathe/LICENSE deleted file mode 100644 index 8eb90c4..0000000 --- a/node_modules/pathe/LICENSE +++ /dev/null @@ -1,70 +0,0 @@ -MIT License - -Copyright (c) Pooya Parsa - Daniel Roe - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - ---- - -Copyright Joyent, Inc. and other Node contributors. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the -following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - ---- - -Bundled zeptomatch (https://github.com/fabiospampinato/zeptomatch) - -The MIT License (MIT) - -Copyright (c) 2023-present Fabio Spampinato - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/node_modules/pathe/README.md b/node_modules/pathe/README.md deleted file mode 100644 index 8eddf93..0000000 --- a/node_modules/pathe/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# 🛣️ pathe - -> Universal filesystem path utils - -[![version][npm-v-src]][npm-v-href] -[![downloads][npm-d-src]][npm-d-href] -[![size][size-src]][size-href] - -## ❓ Why - -For [historical reasons](https://docs.microsoft.com/en-us/archive/blogs/larryosterman/why-is-the-dos-path-character), windows followed MS-DOS and used backslash for separating paths rather than slash used for macOS, Linux, and other Posix operating systems. Nowadays, [Windows](https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file?redirectedfrom=MSDN) supports both Slash and Backslash for paths. [Node.js's built-in `path` module](https://nodejs.org/api/path.html) in the default operation of the path module varies based on the operating system on which a Node.js application is running. Specifically, when running on a Windows operating system, the path module will assume that Windows-style paths are being used. **This makes inconsistent code behavior between Windows and POSIX.** - -Compared to popular [upath](https://github.com/anodynos/upath), pathe provides **identical exports** of Node.js with normalization on **all operations** and is written in modern **ESM/TypeScript** and has **no dependency on Node.js**! - -This package is a drop-in replacement of the Node.js's [path module](https://nodejs.org/api/path.html) module and ensures paths are normalized with slash `/` and work in environments including Node.js. - -## 💿 Usage - -Install using npm or yarn: - -```bash -# npm -npm i pathe - -# yarn -yarn add pathe - -# pnpm -pnpm i pathe -``` - -Import: - -```js -// ESM / Typescript -import { resolve, matchesGlob } from "pathe"; - -// CommonJS -const { resolve, matchesGlob } = require("pathe"); -``` - -Read more about path utils from [Node.js documentation](https://nodejs.org/api/path.html) and rest assured behavior is consistently like POSIX regardless of your input paths format and running platform (the only exception is `delimiter` constant export, it will be set to `;` on windows platform). - -### Extra utilities - -Pathe exports some extra utilities that do not exist in standard Node.js [path module](https://nodejs.org/api/path.html). -In order to use them, you can import from `pathe/utils` subpath: - -```js -import { - filename, - normalizeAliases, - resolveAlias, - reverseResolveAlias, -} from "pathe/utils"; -``` - -## License - -Made with 💛 Published under the [MIT](./LICENSE) license. - -Some code was used from the Node.js project. Glob supported is powered by [zeptomatch](https://github.com/fabiospampinato/zeptomatch). - - - -[npm-v-src]: https://img.shields.io/npm/v/pathe?style=flat-square -[npm-v-href]: https://npmjs.com/package/pathe -[npm-d-src]: https://img.shields.io/npm/dm/pathe?style=flat-square -[npm-d-href]: https://npmjs.com/package/pathe -[github-actions-src]: https://img.shields.io/github/workflow/status/unjs/pathe/ci/main?style=flat-square -[github-actions-href]: https://github.com/unjs/pathe/actions?query=workflow%3Aci -[size-src]: https://packagephobia.now.sh/badge?p=pathe -[size-href]: https://packagephobia.now.sh/result?p=pathe diff --git a/node_modules/pathe/dist/index.cjs b/node_modules/pathe/dist/index.cjs deleted file mode 100644 index d64a6d2..0000000 --- a/node_modules/pathe/dist/index.cjs +++ /dev/null @@ -1,39 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -const _path = require('./shared/pathe.BSlhyZSM.cjs'); - -const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")(); -const _platforms = { posix: void 0, win32: void 0 }; -const mix = (del = delimiter) => { - return new Proxy(_path._path, { - get(_, prop) { - if (prop === "delimiter") return del; - if (prop === "posix") return posix; - if (prop === "win32") return win32; - return _platforms[prop] || _path._path[prop]; - } - }); -}; -const posix = /* @__PURE__ */ mix(":"); -const win32 = /* @__PURE__ */ mix(";"); - -exports.basename = _path.basename; -exports.dirname = _path.dirname; -exports.extname = _path.extname; -exports.format = _path.format; -exports.isAbsolute = _path.isAbsolute; -exports.join = _path.join; -exports.matchesGlob = _path.matchesGlob; -exports.normalize = _path.normalize; -exports.normalizeString = _path.normalizeString; -exports.parse = _path.parse; -exports.relative = _path.relative; -exports.resolve = _path.resolve; -exports.sep = _path.sep; -exports.toNamespacedPath = _path.toNamespacedPath; -exports.default = posix; -exports.delimiter = delimiter; -exports.posix = posix; -exports.win32 = win32; diff --git a/node_modules/pathe/dist/index.d.cts b/node_modules/pathe/dist/index.d.cts deleted file mode 100644 index 61046da..0000000 --- a/node_modules/pathe/dist/index.d.cts +++ /dev/null @@ -1,47 +0,0 @@ -import * as path from 'node:path'; -import path__default from 'node:path'; - -/** - * Constant for path separator. - * - * Always equals to `"/"`. - */ -declare const sep = "/"; -declare const normalize: typeof path__default.normalize; -declare const join: typeof path__default.join; -declare const resolve: typeof path__default.resolve; -/** - * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root. - * - * @param path - The path to normalise. - * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory. - * @returns the normalised path string. - */ -declare function normalizeString(path: string, allowAboveRoot: boolean): string; -declare const isAbsolute: typeof path__default.isAbsolute; -declare const toNamespacedPath: typeof path__default.toNamespacedPath; -declare const extname: typeof path__default.extname; -declare const relative: typeof path__default.relative; -declare const dirname: typeof path__default.dirname; -declare const format: typeof path__default.format; -declare const basename: typeof path__default.basename; -declare const parse: typeof path__default.parse; -/** - * The `path.matchesGlob()` method determines if `path` matches the `pattern`. - * @param path The path to glob-match against. - * @param pattern The glob to check the path against. - */ -declare const matchesGlob: (path: string, pattern: string | string[]) => boolean; - -type NodePath = typeof path; -/** - * The platform-specific file delimiter. - * - * Equals to `";"` in windows and `":"` in all other platforms. - */ -declare const delimiter: ";" | ":"; -declare const posix: NodePath["posix"]; -declare const win32: NodePath["win32"]; -declare const _default: NodePath; - -export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 }; diff --git a/node_modules/pathe/dist/index.d.mts b/node_modules/pathe/dist/index.d.mts deleted file mode 100644 index 61046da..0000000 --- a/node_modules/pathe/dist/index.d.mts +++ /dev/null @@ -1,47 +0,0 @@ -import * as path from 'node:path'; -import path__default from 'node:path'; - -/** - * Constant for path separator. - * - * Always equals to `"/"`. - */ -declare const sep = "/"; -declare const normalize: typeof path__default.normalize; -declare const join: typeof path__default.join; -declare const resolve: typeof path__default.resolve; -/** - * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root. - * - * @param path - The path to normalise. - * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory. - * @returns the normalised path string. - */ -declare function normalizeString(path: string, allowAboveRoot: boolean): string; -declare const isAbsolute: typeof path__default.isAbsolute; -declare const toNamespacedPath: typeof path__default.toNamespacedPath; -declare const extname: typeof path__default.extname; -declare const relative: typeof path__default.relative; -declare const dirname: typeof path__default.dirname; -declare const format: typeof path__default.format; -declare const basename: typeof path__default.basename; -declare const parse: typeof path__default.parse; -/** - * The `path.matchesGlob()` method determines if `path` matches the `pattern`. - * @param path The path to glob-match against. - * @param pattern The glob to check the path against. - */ -declare const matchesGlob: (path: string, pattern: string | string[]) => boolean; - -type NodePath = typeof path; -/** - * The platform-specific file delimiter. - * - * Equals to `";"` in windows and `":"` in all other platforms. - */ -declare const delimiter: ";" | ":"; -declare const posix: NodePath["posix"]; -declare const win32: NodePath["win32"]; -declare const _default: NodePath; - -export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 }; diff --git a/node_modules/pathe/dist/index.d.ts b/node_modules/pathe/dist/index.d.ts deleted file mode 100644 index 61046da..0000000 --- a/node_modules/pathe/dist/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -import * as path from 'node:path'; -import path__default from 'node:path'; - -/** - * Constant for path separator. - * - * Always equals to `"/"`. - */ -declare const sep = "/"; -declare const normalize: typeof path__default.normalize; -declare const join: typeof path__default.join; -declare const resolve: typeof path__default.resolve; -/** - * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root. - * - * @param path - The path to normalise. - * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory. - * @returns the normalised path string. - */ -declare function normalizeString(path: string, allowAboveRoot: boolean): string; -declare const isAbsolute: typeof path__default.isAbsolute; -declare const toNamespacedPath: typeof path__default.toNamespacedPath; -declare const extname: typeof path__default.extname; -declare const relative: typeof path__default.relative; -declare const dirname: typeof path__default.dirname; -declare const format: typeof path__default.format; -declare const basename: typeof path__default.basename; -declare const parse: typeof path__default.parse; -/** - * The `path.matchesGlob()` method determines if `path` matches the `pattern`. - * @param path The path to glob-match against. - * @param pattern The glob to check the path against. - */ -declare const matchesGlob: (path: string, pattern: string | string[]) => boolean; - -type NodePath = typeof path; -/** - * The platform-specific file delimiter. - * - * Equals to `";"` in windows and `":"` in all other platforms. - */ -declare const delimiter: ";" | ":"; -declare const posix: NodePath["posix"]; -declare const win32: NodePath["win32"]; -declare const _default: NodePath; - -export { basename, _default as default, delimiter, dirname, extname, format, isAbsolute, join, matchesGlob, normalize, normalizeString, parse, posix, relative, resolve, sep, toNamespacedPath, win32 }; diff --git a/node_modules/pathe/dist/index.mjs b/node_modules/pathe/dist/index.mjs deleted file mode 100644 index 0582c1f..0000000 --- a/node_modules/pathe/dist/index.mjs +++ /dev/null @@ -1,19 +0,0 @@ -import { _ as _path } from './shared/pathe.M-eThtNZ.mjs'; -export { c as basename, d as dirname, e as extname, f as format, i as isAbsolute, j as join, m as matchesGlob, n as normalize, a as normalizeString, p as parse, b as relative, r as resolve, s as sep, t as toNamespacedPath } from './shared/pathe.M-eThtNZ.mjs'; - -const delimiter = /* @__PURE__ */ (() => globalThis.process?.platform === "win32" ? ";" : ":")(); -const _platforms = { posix: void 0, win32: void 0 }; -const mix = (del = delimiter) => { - return new Proxy(_path, { - get(_, prop) { - if (prop === "delimiter") return del; - if (prop === "posix") return posix; - if (prop === "win32") return win32; - return _platforms[prop] || _path[prop]; - } - }); -}; -const posix = /* @__PURE__ */ mix(":"); -const win32 = /* @__PURE__ */ mix(";"); - -export { posix as default, delimiter, posix, win32 }; diff --git a/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs b/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs deleted file mode 100644 index f4a62e3..0000000 --- a/node_modules/pathe/dist/shared/pathe.BSlhyZSM.cjs +++ /dev/null @@ -1,266 +0,0 @@ -'use strict'; - -let _lazyMatch = () => { var __lib__=(()=>{var m=Object.defineProperty,V=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyNames,T=Object.prototype.hasOwnProperty,q=(r,e)=>{for(var n in e)m(r,n,{get:e[n],enumerable:true});},H=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of G(e))!T.call(r,t)&&t!==n&&m(r,t,{get:()=>e[t],enumerable:!(a=V(e,t))||a.enumerable});return r},J=r=>H(m({},"__esModule",{value:true}),r),w={};q(w,{default:()=>re});var A=r=>Array.isArray(r),d=r=>typeof r=="function",Q=r=>r.length===0,W=r=>typeof r=="number",K=r=>typeof r=="object"&&r!==null,X=r=>r instanceof RegExp,b=r=>typeof r=="string",h=r=>r===void 0,Y=r=>{const e=new Map;return n=>{const a=e.get(n);if(a)return a;const t=r(n);return e.set(n,t),t}},rr=(r,e,n={})=>{const a={cache:{},input:r,index:0,indexMax:0,options:n,output:[]};if(v(e)(a)&&a.index===r.length)return a.output;throw new Error(`Failed to parse at index ${a.indexMax}`)},i=(r,e)=>A(r)?er(r,e):b(r)?ar(r,e):nr(r,e),er=(r,e)=>{const n={};for(const a of r){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const t=a.charCodeAt(0);n[t]=true;}return a=>{const t=a.index,o=a.input;for(;a.indext){if(!h(e)&&!a.options.silent){const s=a.input.slice(t,u),c=d(e)?e(s,o,String(t)):e;h(c)||a.output.push(c);}a.indexMax=Math.max(a.indexMax,a.index);}return true}},nr=(r,e)=>{const n=r.source,a=r.flags.replace(/y|$/,"y"),t=new RegExp(n,a);return g(o=>{t.lastIndex=o.index;const u=t.exec(o.input);if(u){if(!h(e)&&!o.options.silent){const s=d(e)?e(...u,o.input,String(o.index)):e;h(s)||o.output.push(s);}return o.index+=u[0].length,o.indexMax=Math.max(o.indexMax,o.index),true}else return false})},ar=(r,e)=>n=>{if(n.input.startsWith(r,n.index)){if(!h(e)&&!n.options.silent){const t=d(e)?e(r,n.input,String(n.index)):e;h(t)||n.output.push(t);}return n.index+=r.length,n.indexMax=Math.max(n.indexMax,n.index),true}else return false},C=(r,e,n,a)=>{const t=v(r);return g(_(M(o=>{let u=0;for(;u=e})))},tr=(r,e)=>C(r,0,1),f=(r,e)=>C(r,0,1/0),x=(r,e)=>{const n=r.map(v);return g(_(M(a=>{for(let t=0,o=n.length;t{const n=r.map(v);return g(_(a=>{for(let t=0,o=n.length;t{const n=v(r);return a=>{const t=a.index,o=a.output.length,u=n(a);return (!u||e)&&(a.index=t,a.output.length!==o&&(a.output.length=o)),u}},_=(r,e)=>{const n=v(r);return n},g=(()=>{let r=0;return e=>{const n=v(e),a=r+=1;return t=>{var o;if(t.options.memoization===false)return n(t);const u=t.index,s=(o=t.cache)[a]||(o[a]=new Map),c=s.get(u);if(c===false)return false;if(W(c))return t.index=c,true;if(c)return t.index=c.index,c.output?.length&&t.output.push(...c.output),true;{const Z=t.output.length;if(n(t)){const D=t.index,U=t.output.length;if(U>Z){const ee=t.output.slice(Z,U);s.set(u,{index:D,output:ee});}else s.set(u,D);return true}else return s.set(u,false),false}}}})(),E=r=>{let e;return n=>(e||(e=v(r())),e(n))},v=Y(r=>{if(d(r))return Q(r)?E(r):r;if(b(r)||X(r))return i(r);if(A(r))return x(r);if(K(r))return l(Object.values(r));throw new Error("Invalid rule")}),P="abcdefghijklmnopqrstuvwxyz",ir=r=>{let e="";for(;r>0;){const n=(r-1)%26;e=P[n]+e,r=Math.floor((r-1)/26);}return e},O=r=>{let e=0;for(let n=0,a=r.length;n{if(eS(r,e).map(a=>String(a).padStart(n,"0")),R=(r,e)=>S(O(r),O(e)).map(ir),p=r=>r,z=r=>ur(e=>rr(e,r,{memoization:false}).join("")),ur=r=>{const e={};return n=>e[n]??(e[n]=r(n))},sr=i(/^\*\*\/\*$/,".*"),cr=i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(r,e,n)=>`.*${e?"":"(?:^|/)"}${n.replaceAll(".","\\.")}`),lr=i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(r,e,n,a)=>`.*${e?"":"(?:^|/)"}${n.replaceAll(".","\\.")}(?:${a.replaceAll(",","|").replaceAll(".","\\.")})`),y=i(/\\./,p),pr=i(/[$.*+?^(){}[\]\|]/,r=>`\\${r}`),vr=i(/./,p),hr=i(/^(?:!!)*!(.*)$/,(r,e)=>`(?!^${L(e)}$).*?`),dr=i(/^(!!)+/,""),fr=l([hr,dr]),xr=i(/\/(\*\*\/)+/,"(?:/.+/|/)"),gr=i(/^(\*\*\/)+/,"(?:^|.*/)"),mr=i(/\/(\*\*)$/,"(?:/.*|$)"),_r=i(/\*\*/,".*"),j=l([xr,gr,mr,_r]),Sr=i(/\*\/(?!\*\*\/)/,"[^/]*/"),yr=i(/\*/,"[^/]*"),N=l([Sr,yr]),k=i("?","[^/]"),$r=i("[",p),wr=i("]",p),Ar=i(/[!^]/,"^/"),br=i(/[a-z]-[a-z]|[0-9]-[0-9]/i,p),Cr=i(/[$.*+?^(){}[\|]/,r=>`\\${r}`),Mr=i(/[^\]]/,p),Er=l([y,Cr,br,Mr]),B=x([$r,tr(Ar),f(Er),wr]),Pr=i("{","(?:"),Or=i("}",")"),Rr=i(/(\d+)\.\.(\d+)/,(r,e,n)=>or(+e,+n,Math.min(e.length,n.length)).join("|")),zr=i(/([a-z]+)\.\.([a-z]+)/,(r,e,n)=>R(e,n).join("|")),jr=i(/([A-Z]+)\.\.([A-Z]+)/,(r,e,n)=>R(e.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Nr=l([Rr,zr,jr]),I=x([Pr,Nr,Or]),kr=i("{","(?:"),Br=i("}",")"),Ir=i(",","|"),Fr=i(/[$.*+?^(){[\]\|]/,r=>`\\${r}`),Lr=i(/[^}]/,p),Zr=E(()=>F),Dr=l([j,N,k,B,I,Zr,y,Fr,Ir,Lr]),F=x([kr,f(Dr),Br]),Ur=f(l([sr,cr,lr,fr,j,N,k,B,I,F,y,pr,vr])),Vr=Ur,Gr=z(Vr),L=Gr,Tr=i(/\\./,p),qr=i(/./,p),Hr=i(/\*\*\*+/,"*"),Jr=i(/([^/{[(!])\*\*/,(r,e)=>`${e}*`),Qr=i(/(^|.)\*\*(?=[^*/)\]}])/,(r,e)=>`${e}*`),Wr=f(l([Tr,Hr,Jr,Qr,qr])),Kr=Wr,Xr=z(Kr),Yr=Xr,$=(r,e)=>{const n=Array.isArray(r)?r:[r];if(!n.length)return false;const a=n.map($.compile),t=n.every(s=>/(\/(?:\*\*)?|\[\/\])$/.test(s)),o=e.replace(/[\\\/]+/g,"/").replace(/\/$/,t?"/":"");return a.some(s=>s.test(o))};$.compile=r=>new RegExp(`^${L(Yr(r))}$`,"s");var re=$;return J(w)})(); - return __lib__.default || __lib__; }; -let _match; -const zeptomatch = (path, pattern) => { - if (!_match) { - _match = _lazyMatch(); - _lazyMatch = null; - } - return _match(path, pattern); -}; - -const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//; -function normalizeWindowsPath(input = "") { - if (!input) { - return input; - } - return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase()); -} - -const _UNC_REGEX = /^[/\\]{2}/; -const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/; -const _DRIVE_LETTER_RE = /^[A-Za-z]:$/; -const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/; -const _EXTNAME_RE = /.(\.[^./]+|\.)$/; -const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/; -const sep = "/"; -const normalize = function(path) { - if (path.length === 0) { - return "."; - } - path = normalizeWindowsPath(path); - const isUNCPath = path.match(_UNC_REGEX); - const isPathAbsolute = isAbsolute(path); - const trailingSeparator = path[path.length - 1] === "/"; - path = normalizeString(path, !isPathAbsolute); - if (path.length === 0) { - if (isPathAbsolute) { - return "/"; - } - return trailingSeparator ? "./" : "."; - } - if (trailingSeparator) { - path += "/"; - } - if (_DRIVE_LETTER_RE.test(path)) { - path += "/"; - } - if (isUNCPath) { - if (!isPathAbsolute) { - return `//./${path}`; - } - return `//${path}`; - } - return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path; -}; -const join = function(...segments) { - let path = ""; - for (const seg of segments) { - if (!seg) { - continue; - } - if (path.length > 0) { - const pathTrailing = path[path.length - 1] === "/"; - const segLeading = seg[0] === "/"; - const both = pathTrailing && segLeading; - if (both) { - path += seg.slice(1); - } else { - path += pathTrailing || segLeading ? seg : `/${seg}`; - } - } else { - path += seg; - } - } - return normalize(path); -}; -function cwd() { - if (typeof process !== "undefined" && typeof process.cwd === "function") { - return process.cwd().replace(/\\/g, "/"); - } - return "/"; -} -const resolve = function(...arguments_) { - arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument)); - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) { - const path = index >= 0 ? arguments_[index] : cwd(); - if (!path || path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isAbsolute(path); - } - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute); - if (resolvedAbsolute && !isAbsolute(resolvedPath)) { - return `/${resolvedPath}`; - } - return resolvedPath.length > 0 ? resolvedPath : "."; -}; -function normalizeString(path, allowAboveRoot) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let char = null; - for (let index = 0; index <= path.length; ++index) { - if (index < path.length) { - char = path[index]; - } else if (char === "/") { - break; - } else { - char = "/"; - } - if (char === "/") { - if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf("/"); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf("/"); - } - lastSlash = index; - dots = 0; - continue; - } else if (res.length > 0) { - res = ""; - lastSegmentLength = 0; - lastSlash = index; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - res += res.length > 0 ? "/.." : ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) { - res += `/${path.slice(lastSlash + 1, index)}`; - } else { - res = path.slice(lastSlash + 1, index); - } - lastSegmentLength = index - lastSlash - 1; - } - lastSlash = index; - dots = 0; - } else if (char === "." && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} -const isAbsolute = function(p) { - return _IS_ABSOLUTE_RE.test(p); -}; -const toNamespacedPath = function(p) { - return normalizeWindowsPath(p); -}; -const extname = function(p) { - if (p === "..") return ""; - const match = _EXTNAME_RE.exec(normalizeWindowsPath(p)); - return match && match[1] || ""; -}; -const relative = function(from, to) { - const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"); - const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/"); - if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) { - return _to.join("/"); - } - const _fromCopy = [..._from]; - for (const segment of _fromCopy) { - if (_to[0] !== segment) { - break; - } - _from.shift(); - _to.shift(); - } - return [..._from.map(() => ".."), ..._to].join("/"); -}; -const dirname = function(p) { - const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1); - if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) { - segments[0] += "/"; - } - return segments.join("/") || (isAbsolute(p) ? "/" : "."); -}; -const format = function(p) { - const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : ""; - const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter( - Boolean - ); - return normalizeWindowsPath( - p.root ? resolve(...segments) : segments.join("/") - ); -}; -const basename = function(p, extension) { - const segments = normalizeWindowsPath(p).split("/"); - let lastSegment = ""; - for (let i = segments.length - 1; i >= 0; i--) { - const val = segments[i]; - if (val) { - lastSegment = val; - break; - } - } - return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment; -}; -const parse = function(p) { - const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || ""; - const base = basename(p); - const extension = extname(base); - return { - root, - dir: dirname(p), - base, - ext: extension, - name: base.slice(0, base.length - extension.length) - }; -}; -const matchesGlob = (path, pattern) => { - return zeptomatch(pattern, normalize(path)); -}; - -const _path = { - __proto__: null, - basename: basename, - dirname: dirname, - extname: extname, - format: format, - isAbsolute: isAbsolute, - join: join, - matchesGlob: matchesGlob, - normalize: normalize, - normalizeString: normalizeString, - parse: parse, - relative: relative, - resolve: resolve, - sep: sep, - toNamespacedPath: toNamespacedPath -}; - -exports._path = _path; -exports.basename = basename; -exports.dirname = dirname; -exports.extname = extname; -exports.format = format; -exports.isAbsolute = isAbsolute; -exports.join = join; -exports.matchesGlob = matchesGlob; -exports.normalize = normalize; -exports.normalizeString = normalizeString; -exports.normalizeWindowsPath = normalizeWindowsPath; -exports.parse = parse; -exports.relative = relative; -exports.resolve = resolve; -exports.sep = sep; -exports.toNamespacedPath = toNamespacedPath; diff --git a/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs b/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs deleted file mode 100644 index 81d714d..0000000 --- a/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +++ /dev/null @@ -1,249 +0,0 @@ -let _lazyMatch = () => { var __lib__=(()=>{var m=Object.defineProperty,V=Object.getOwnPropertyDescriptor,G=Object.getOwnPropertyNames,T=Object.prototype.hasOwnProperty,q=(r,e)=>{for(var n in e)m(r,n,{get:e[n],enumerable:true});},H=(r,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of G(e))!T.call(r,t)&&t!==n&&m(r,t,{get:()=>e[t],enumerable:!(a=V(e,t))||a.enumerable});return r},J=r=>H(m({},"__esModule",{value:true}),r),w={};q(w,{default:()=>re});var A=r=>Array.isArray(r),d=r=>typeof r=="function",Q=r=>r.length===0,W=r=>typeof r=="number",K=r=>typeof r=="object"&&r!==null,X=r=>r instanceof RegExp,b=r=>typeof r=="string",h=r=>r===void 0,Y=r=>{const e=new Map;return n=>{const a=e.get(n);if(a)return a;const t=r(n);return e.set(n,t),t}},rr=(r,e,n={})=>{const a={cache:{},input:r,index:0,indexMax:0,options:n,output:[]};if(v(e)(a)&&a.index===r.length)return a.output;throw new Error(`Failed to parse at index ${a.indexMax}`)},i=(r,e)=>A(r)?er(r,e):b(r)?ar(r,e):nr(r,e),er=(r,e)=>{const n={};for(const a of r){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const t=a.charCodeAt(0);n[t]=true;}return a=>{const t=a.index,o=a.input;for(;a.indext){if(!h(e)&&!a.options.silent){const s=a.input.slice(t,u),c=d(e)?e(s,o,String(t)):e;h(c)||a.output.push(c);}a.indexMax=Math.max(a.indexMax,a.index);}return true}},nr=(r,e)=>{const n=r.source,a=r.flags.replace(/y|$/,"y"),t=new RegExp(n,a);return g(o=>{t.lastIndex=o.index;const u=t.exec(o.input);if(u){if(!h(e)&&!o.options.silent){const s=d(e)?e(...u,o.input,String(o.index)):e;h(s)||o.output.push(s);}return o.index+=u[0].length,o.indexMax=Math.max(o.indexMax,o.index),true}else return false})},ar=(r,e)=>n=>{if(n.input.startsWith(r,n.index)){if(!h(e)&&!n.options.silent){const t=d(e)?e(r,n.input,String(n.index)):e;h(t)||n.output.push(t);}return n.index+=r.length,n.indexMax=Math.max(n.indexMax,n.index),true}else return false},C=(r,e,n,a)=>{const t=v(r);return g(_(M(o=>{let u=0;for(;u=e})))},tr=(r,e)=>C(r,0,1),f=(r,e)=>C(r,0,1/0),x=(r,e)=>{const n=r.map(v);return g(_(M(a=>{for(let t=0,o=n.length;t{const n=r.map(v);return g(_(a=>{for(let t=0,o=n.length;t{const n=v(r);return a=>{const t=a.index,o=a.output.length,u=n(a);return (!u||e)&&(a.index=t,a.output.length!==o&&(a.output.length=o)),u}},_=(r,e)=>{const n=v(r);return n},g=(()=>{let r=0;return e=>{const n=v(e),a=r+=1;return t=>{var o;if(t.options.memoization===false)return n(t);const u=t.index,s=(o=t.cache)[a]||(o[a]=new Map),c=s.get(u);if(c===false)return false;if(W(c))return t.index=c,true;if(c)return t.index=c.index,c.output?.length&&t.output.push(...c.output),true;{const Z=t.output.length;if(n(t)){const D=t.index,U=t.output.length;if(U>Z){const ee=t.output.slice(Z,U);s.set(u,{index:D,output:ee});}else s.set(u,D);return true}else return s.set(u,false),false}}}})(),E=r=>{let e;return n=>(e||(e=v(r())),e(n))},v=Y(r=>{if(d(r))return Q(r)?E(r):r;if(b(r)||X(r))return i(r);if(A(r))return x(r);if(K(r))return l(Object.values(r));throw new Error("Invalid rule")}),P="abcdefghijklmnopqrstuvwxyz",ir=r=>{let e="";for(;r>0;){const n=(r-1)%26;e=P[n]+e,r=Math.floor((r-1)/26);}return e},O=r=>{let e=0;for(let n=0,a=r.length;n{if(eS(r,e).map(a=>String(a).padStart(n,"0")),R=(r,e)=>S(O(r),O(e)).map(ir),p=r=>r,z=r=>ur(e=>rr(e,r,{memoization:false}).join("")),ur=r=>{const e={};return n=>e[n]??(e[n]=r(n))},sr=i(/^\*\*\/\*$/,".*"),cr=i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/,(r,e,n)=>`.*${e?"":"(?:^|/)"}${n.replaceAll(".","\\.")}`),lr=i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/,(r,e,n,a)=>`.*${e?"":"(?:^|/)"}${n.replaceAll(".","\\.")}(?:${a.replaceAll(",","|").replaceAll(".","\\.")})`),y=i(/\\./,p),pr=i(/[$.*+?^(){}[\]\|]/,r=>`\\${r}`),vr=i(/./,p),hr=i(/^(?:!!)*!(.*)$/,(r,e)=>`(?!^${L(e)}$).*?`),dr=i(/^(!!)+/,""),fr=l([hr,dr]),xr=i(/\/(\*\*\/)+/,"(?:/.+/|/)"),gr=i(/^(\*\*\/)+/,"(?:^|.*/)"),mr=i(/\/(\*\*)$/,"(?:/.*|$)"),_r=i(/\*\*/,".*"),j=l([xr,gr,mr,_r]),Sr=i(/\*\/(?!\*\*\/)/,"[^/]*/"),yr=i(/\*/,"[^/]*"),N=l([Sr,yr]),k=i("?","[^/]"),$r=i("[",p),wr=i("]",p),Ar=i(/[!^]/,"^/"),br=i(/[a-z]-[a-z]|[0-9]-[0-9]/i,p),Cr=i(/[$.*+?^(){}[\|]/,r=>`\\${r}`),Mr=i(/[^\]]/,p),Er=l([y,Cr,br,Mr]),B=x([$r,tr(Ar),f(Er),wr]),Pr=i("{","(?:"),Or=i("}",")"),Rr=i(/(\d+)\.\.(\d+)/,(r,e,n)=>or(+e,+n,Math.min(e.length,n.length)).join("|")),zr=i(/([a-z]+)\.\.([a-z]+)/,(r,e,n)=>R(e,n).join("|")),jr=i(/([A-Z]+)\.\.([A-Z]+)/,(r,e,n)=>R(e.toLowerCase(),n.toLowerCase()).join("|").toUpperCase()),Nr=l([Rr,zr,jr]),I=x([Pr,Nr,Or]),kr=i("{","(?:"),Br=i("}",")"),Ir=i(",","|"),Fr=i(/[$.*+?^(){[\]\|]/,r=>`\\${r}`),Lr=i(/[^}]/,p),Zr=E(()=>F),Dr=l([j,N,k,B,I,Zr,y,Fr,Ir,Lr]),F=x([kr,f(Dr),Br]),Ur=f(l([sr,cr,lr,fr,j,N,k,B,I,F,y,pr,vr])),Vr=Ur,Gr=z(Vr),L=Gr,Tr=i(/\\./,p),qr=i(/./,p),Hr=i(/\*\*\*+/,"*"),Jr=i(/([^/{[(!])\*\*/,(r,e)=>`${e}*`),Qr=i(/(^|.)\*\*(?=[^*/)\]}])/,(r,e)=>`${e}*`),Wr=f(l([Tr,Hr,Jr,Qr,qr])),Kr=Wr,Xr=z(Kr),Yr=Xr,$=(r,e)=>{const n=Array.isArray(r)?r:[r];if(!n.length)return false;const a=n.map($.compile),t=n.every(s=>/(\/(?:\*\*)?|\[\/\])$/.test(s)),o=e.replace(/[\\\/]+/g,"/").replace(/\/$/,t?"/":"");return a.some(s=>s.test(o))};$.compile=r=>new RegExp(`^${L(Yr(r))}$`,"s");var re=$;return J(w)})(); - return __lib__.default || __lib__; }; -let _match; -const zeptomatch = (path, pattern) => { - if (!_match) { - _match = _lazyMatch(); - _lazyMatch = null; - } - return _match(path, pattern); -}; - -const _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//; -function normalizeWindowsPath(input = "") { - if (!input) { - return input; - } - return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase()); -} - -const _UNC_REGEX = /^[/\\]{2}/; -const _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/; -const _DRIVE_LETTER_RE = /^[A-Za-z]:$/; -const _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/; -const _EXTNAME_RE = /.(\.[^./]+|\.)$/; -const _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/; -const sep = "/"; -const normalize = function(path) { - if (path.length === 0) { - return "."; - } - path = normalizeWindowsPath(path); - const isUNCPath = path.match(_UNC_REGEX); - const isPathAbsolute = isAbsolute(path); - const trailingSeparator = path[path.length - 1] === "/"; - path = normalizeString(path, !isPathAbsolute); - if (path.length === 0) { - if (isPathAbsolute) { - return "/"; - } - return trailingSeparator ? "./" : "."; - } - if (trailingSeparator) { - path += "/"; - } - if (_DRIVE_LETTER_RE.test(path)) { - path += "/"; - } - if (isUNCPath) { - if (!isPathAbsolute) { - return `//./${path}`; - } - return `//${path}`; - } - return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path; -}; -const join = function(...segments) { - let path = ""; - for (const seg of segments) { - if (!seg) { - continue; - } - if (path.length > 0) { - const pathTrailing = path[path.length - 1] === "/"; - const segLeading = seg[0] === "/"; - const both = pathTrailing && segLeading; - if (both) { - path += seg.slice(1); - } else { - path += pathTrailing || segLeading ? seg : `/${seg}`; - } - } else { - path += seg; - } - } - return normalize(path); -}; -function cwd() { - if (typeof process !== "undefined" && typeof process.cwd === "function") { - return process.cwd().replace(/\\/g, "/"); - } - return "/"; -} -const resolve = function(...arguments_) { - arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument)); - let resolvedPath = ""; - let resolvedAbsolute = false; - for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) { - const path = index >= 0 ? arguments_[index] : cwd(); - if (!path || path.length === 0) { - continue; - } - resolvedPath = `${path}/${resolvedPath}`; - resolvedAbsolute = isAbsolute(path); - } - resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute); - if (resolvedAbsolute && !isAbsolute(resolvedPath)) { - return `/${resolvedPath}`; - } - return resolvedPath.length > 0 ? resolvedPath : "."; -}; -function normalizeString(path, allowAboveRoot) { - let res = ""; - let lastSegmentLength = 0; - let lastSlash = -1; - let dots = 0; - let char = null; - for (let index = 0; index <= path.length; ++index) { - if (index < path.length) { - char = path[index]; - } else if (char === "/") { - break; - } else { - char = "/"; - } - if (char === "/") { - if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) { - if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") { - if (res.length > 2) { - const lastSlashIndex = res.lastIndexOf("/"); - if (lastSlashIndex === -1) { - res = ""; - lastSegmentLength = 0; - } else { - res = res.slice(0, lastSlashIndex); - lastSegmentLength = res.length - 1 - res.lastIndexOf("/"); - } - lastSlash = index; - dots = 0; - continue; - } else if (res.length > 0) { - res = ""; - lastSegmentLength = 0; - lastSlash = index; - dots = 0; - continue; - } - } - if (allowAboveRoot) { - res += res.length > 0 ? "/.." : ".."; - lastSegmentLength = 2; - } - } else { - if (res.length > 0) { - res += `/${path.slice(lastSlash + 1, index)}`; - } else { - res = path.slice(lastSlash + 1, index); - } - lastSegmentLength = index - lastSlash - 1; - } - lastSlash = index; - dots = 0; - } else if (char === "." && dots !== -1) { - ++dots; - } else { - dots = -1; - } - } - return res; -} -const isAbsolute = function(p) { - return _IS_ABSOLUTE_RE.test(p); -}; -const toNamespacedPath = function(p) { - return normalizeWindowsPath(p); -}; -const extname = function(p) { - if (p === "..") return ""; - const match = _EXTNAME_RE.exec(normalizeWindowsPath(p)); - return match && match[1] || ""; -}; -const relative = function(from, to) { - const _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"); - const _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/"); - if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0]) { - return _to.join("/"); - } - const _fromCopy = [..._from]; - for (const segment of _fromCopy) { - if (_to[0] !== segment) { - break; - } - _from.shift(); - _to.shift(); - } - return [..._from.map(() => ".."), ..._to].join("/"); -}; -const dirname = function(p) { - const segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1); - if (segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0])) { - segments[0] += "/"; - } - return segments.join("/") || (isAbsolute(p) ? "/" : "."); -}; -const format = function(p) { - const ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : ""; - const segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter( - Boolean - ); - return normalizeWindowsPath( - p.root ? resolve(...segments) : segments.join("/") - ); -}; -const basename = function(p, extension) { - const segments = normalizeWindowsPath(p).split("/"); - let lastSegment = ""; - for (let i = segments.length - 1; i >= 0; i--) { - const val = segments[i]; - if (val) { - lastSegment = val; - break; - } - } - return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment; -}; -const parse = function(p) { - const root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || ""; - const base = basename(p); - const extension = extname(base); - return { - root, - dir: dirname(p), - base, - ext: extension, - name: base.slice(0, base.length - extension.length) - }; -}; -const matchesGlob = (path, pattern) => { - return zeptomatch(pattern, normalize(path)); -}; - -const _path = { - __proto__: null, - basename: basename, - dirname: dirname, - extname: extname, - format: format, - isAbsolute: isAbsolute, - join: join, - matchesGlob: matchesGlob, - normalize: normalize, - normalizeString: normalizeString, - parse: parse, - relative: relative, - resolve: resolve, - sep: sep, - toNamespacedPath: toNamespacedPath -}; - -export { _path as _, normalizeString as a, relative as b, basename as c, dirname as d, extname as e, format as f, normalizeWindowsPath as g, isAbsolute as i, join as j, matchesGlob as m, normalize as n, parse as p, resolve as r, sep as s, toNamespacedPath as t }; diff --git a/node_modules/pathe/dist/utils.cjs b/node_modules/pathe/dist/utils.cjs deleted file mode 100644 index 03c7ff3..0000000 --- a/node_modules/pathe/dist/utils.cjs +++ /dev/null @@ -1,82 +0,0 @@ -'use strict'; - -const _path = require('./shared/pathe.BSlhyZSM.cjs'); - -const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]); -const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias"); -const SLASH_RE = /[/\\]/; -function normalizeAliases(_aliases) { - if (_aliases[normalizedAliasSymbol]) { - return _aliases; - } - const aliases = Object.fromEntries( - Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b)) - ); - for (const key in aliases) { - for (const alias in aliases) { - if (alias === key || key.startsWith(alias)) { - continue; - } - if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) { - aliases[key] = aliases[alias] + aliases[key].slice(alias.length); - } - } - } - Object.defineProperty(aliases, normalizedAliasSymbol, { - value: true, - enumerable: false - }); - return aliases; -} -function resolveAlias(path, aliases) { - const _path$1 = _path.normalizeWindowsPath(path); - aliases = normalizeAliases(aliases); - for (const [alias, to] of Object.entries(aliases)) { - if (!_path$1.startsWith(alias)) { - continue; - } - const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias; - if (hasTrailingSlash(_path$1[_alias.length])) { - return _path.join(to, _path$1.slice(alias.length)); - } - } - return _path$1; -} -function reverseResolveAlias(path, aliases) { - const _path$1 = _path.normalizeWindowsPath(path); - aliases = normalizeAliases(aliases); - const matches = []; - for (const [to, alias] of Object.entries(aliases)) { - if (!_path$1.startsWith(alias)) { - continue; - } - const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias; - if (hasTrailingSlash(_path$1[_alias.length])) { - matches.push(_path.join(to, _path$1.slice(alias.length))); - } - } - return matches.sort((a, b) => b.length - a.length); -} -function filename(path) { - const base = path.split(SLASH_RE).pop(); - if (!base) { - return void 0; - } - const separatorIndex = base.lastIndexOf("."); - if (separatorIndex <= 0) { - return base; - } - return base.slice(0, separatorIndex); -} -function _compareAliases(a, b) { - return b.split("/").length - a.split("/").length; -} -function hasTrailingSlash(path = "/") { - const lastChar = path[path.length - 1]; - return lastChar === "/" || lastChar === "\\"; -} - -exports.filename = filename; -exports.normalizeAliases = normalizeAliases; -exports.resolveAlias = resolveAlias; -exports.reverseResolveAlias = reverseResolveAlias; diff --git a/node_modules/pathe/dist/utils.d.cts b/node_modules/pathe/dist/utils.d.cts deleted file mode 100644 index af369d0..0000000 --- a/node_modules/pathe/dist/utils.d.cts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones. - * This function also ensures that aliases do not resolve to themselves cyclically. - * - * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to. - * @returns a set of normalised alias mappings. - */ -declare function normalizeAliases(_aliases: Record): Record; -/** - * Resolves a path string to its alias if applicable, otherwise returns the original path. - * This function normalises the path, resolves the alias and then joins it to the alias target if necessary. - * - * @param path - The path string to resolve. - * @param aliases - A set of alias mappings to use for resolution. - * @returns the resolved path as a string. - */ -declare function resolveAlias(path: string, aliases: Record): string; -/** - * Resolves a path string to its possible alias. - * - * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first). - */ -declare function reverseResolveAlias(path: string, aliases: Record): string[]; -/** - * Extracts the filename from a given path, excluding any directory paths and the file extension. - * - * @param path - The full path of the file from which to extract the filename. - * @returns the filename without the extension, or `undefined` if the filename cannot be extracted. - */ -declare function filename(path: string): string | undefined; - -export { filename, normalizeAliases, resolveAlias, reverseResolveAlias }; diff --git a/node_modules/pathe/dist/utils.d.mts b/node_modules/pathe/dist/utils.d.mts deleted file mode 100644 index af369d0..0000000 --- a/node_modules/pathe/dist/utils.d.mts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones. - * This function also ensures that aliases do not resolve to themselves cyclically. - * - * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to. - * @returns a set of normalised alias mappings. - */ -declare function normalizeAliases(_aliases: Record): Record; -/** - * Resolves a path string to its alias if applicable, otherwise returns the original path. - * This function normalises the path, resolves the alias and then joins it to the alias target if necessary. - * - * @param path - The path string to resolve. - * @param aliases - A set of alias mappings to use for resolution. - * @returns the resolved path as a string. - */ -declare function resolveAlias(path: string, aliases: Record): string; -/** - * Resolves a path string to its possible alias. - * - * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first). - */ -declare function reverseResolveAlias(path: string, aliases: Record): string[]; -/** - * Extracts the filename from a given path, excluding any directory paths and the file extension. - * - * @param path - The full path of the file from which to extract the filename. - * @returns the filename without the extension, or `undefined` if the filename cannot be extracted. - */ -declare function filename(path: string): string | undefined; - -export { filename, normalizeAliases, resolveAlias, reverseResolveAlias }; diff --git a/node_modules/pathe/dist/utils.d.ts b/node_modules/pathe/dist/utils.d.ts deleted file mode 100644 index af369d0..0000000 --- a/node_modules/pathe/dist/utils.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Normalises alias mappings, ensuring that more specific aliases are resolved before less specific ones. - * This function also ensures that aliases do not resolve to themselves cyclically. - * - * @param _aliases - A set of alias mappings where each key is an alias and its value is the actual path it points to. - * @returns a set of normalised alias mappings. - */ -declare function normalizeAliases(_aliases: Record): Record; -/** - * Resolves a path string to its alias if applicable, otherwise returns the original path. - * This function normalises the path, resolves the alias and then joins it to the alias target if necessary. - * - * @param path - The path string to resolve. - * @param aliases - A set of alias mappings to use for resolution. - * @returns the resolved path as a string. - */ -declare function resolveAlias(path: string, aliases: Record): string; -/** - * Resolves a path string to its possible alias. - * - * Returns an array of possible alias resolutions (could be empty), sorted by specificity (longest first). - */ -declare function reverseResolveAlias(path: string, aliases: Record): string[]; -/** - * Extracts the filename from a given path, excluding any directory paths and the file extension. - * - * @param path - The full path of the file from which to extract the filename. - * @returns the filename without the extension, or `undefined` if the filename cannot be extracted. - */ -declare function filename(path: string): string | undefined; - -export { filename, normalizeAliases, resolveAlias, reverseResolveAlias }; diff --git a/node_modules/pathe/dist/utils.mjs b/node_modules/pathe/dist/utils.mjs deleted file mode 100644 index 748072e..0000000 --- a/node_modules/pathe/dist/utils.mjs +++ /dev/null @@ -1,77 +0,0 @@ -import { g as normalizeWindowsPath, j as join } from './shared/pathe.M-eThtNZ.mjs'; - -const pathSeparators = /* @__PURE__ */ new Set(["/", "\\", void 0]); -const normalizedAliasSymbol = Symbol.for("pathe:normalizedAlias"); -const SLASH_RE = /[/\\]/; -function normalizeAliases(_aliases) { - if (_aliases[normalizedAliasSymbol]) { - return _aliases; - } - const aliases = Object.fromEntries( - Object.entries(_aliases).sort(([a], [b]) => _compareAliases(a, b)) - ); - for (const key in aliases) { - for (const alias in aliases) { - if (alias === key || key.startsWith(alias)) { - continue; - } - if (aliases[key]?.startsWith(alias) && pathSeparators.has(aliases[key][alias.length])) { - aliases[key] = aliases[alias] + aliases[key].slice(alias.length); - } - } - } - Object.defineProperty(aliases, normalizedAliasSymbol, { - value: true, - enumerable: false - }); - return aliases; -} -function resolveAlias(path, aliases) { - const _path = normalizeWindowsPath(path); - aliases = normalizeAliases(aliases); - for (const [alias, to] of Object.entries(aliases)) { - if (!_path.startsWith(alias)) { - continue; - } - const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias; - if (hasTrailingSlash(_path[_alias.length])) { - return join(to, _path.slice(alias.length)); - } - } - return _path; -} -function reverseResolveAlias(path, aliases) { - const _path = normalizeWindowsPath(path); - aliases = normalizeAliases(aliases); - const matches = []; - for (const [to, alias] of Object.entries(aliases)) { - if (!_path.startsWith(alias)) { - continue; - } - const _alias = hasTrailingSlash(alias) ? alias.slice(0, -1) : alias; - if (hasTrailingSlash(_path[_alias.length])) { - matches.push(join(to, _path.slice(alias.length))); - } - } - return matches.sort((a, b) => b.length - a.length); -} -function filename(path) { - const base = path.split(SLASH_RE).pop(); - if (!base) { - return void 0; - } - const separatorIndex = base.lastIndexOf("."); - if (separatorIndex <= 0) { - return base; - } - return base.slice(0, separatorIndex); -} -function _compareAliases(a, b) { - return b.split("/").length - a.split("/").length; -} -function hasTrailingSlash(path = "/") { - const lastChar = path[path.length - 1]; - return lastChar === "/" || lastChar === "\\"; -} - -export { filename, normalizeAliases, resolveAlias, reverseResolveAlias }; diff --git a/node_modules/pathe/package.json b/node_modules/pathe/package.json deleted file mode 100644 index 5522b28..0000000 --- a/node_modules/pathe/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "pathe", - "version": "2.0.3", - "description": "Universal filesystem path utils", - "repository": "unjs/pathe", - "license": "MIT", - "sideEffects": false, - "type": "module", - "exports": { - ".": { - "import": { - "types": "./dist/index.d.mts", - "default": "./dist/index.mjs" - }, - "require": { - "types": "./dist/index.d.cts", - "default": "./dist/index.cjs" - } - }, - "./utils": { - "import": { - "types": "./dist/utils.d.mts", - "default": "./dist/utils.mjs" - }, - "require": { - "types": "./dist/utils.d.cts", - "default": "./dist/utils.cjs" - } - } - }, - "main": "./dist/index.cjs", - "module": "./dist/index.mjs", - "types": "./dist/index.d.ts", - "files": [ - "dist", - "utils.d.ts" - ], - "devDependencies": { - "@types/node": "^22.13.1", - "@vitest/coverage-v8": "^3.0.5", - "changelogen": "^0.5.7", - "esbuild": "^0.25.0", - "eslint": "^9.20.1", - "eslint-config-unjs": "^0.4.2", - "jiti": "^2.4.2", - "prettier": "^3.5.0", - "typescript": "^5.7.3", - "unbuild": "^3.3.1", - "vitest": "^3.0.5", - "zeptomatch": "^2.0.0" - }, - "scripts": { - "build": "unbuild", - "dev": "vitest", - "lint": "eslint . && prettier -c src test", - "lint:fix": "eslint . --fix && prettier -w src test", - "release": "pnpm test && pnpm build && changelogen --release && pnpm publish && git push --follow-tags", - "test": "pnpm lint && vitest run --coverage", - "test:types": "tsc --noEmit" - } -} \ No newline at end of file diff --git a/node_modules/pathe/utils.d.ts b/node_modules/pathe/utils.d.ts deleted file mode 100644 index 59cabd3..0000000 --- a/node_modules/pathe/utils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./dist/utils"; diff --git a/node_modules/picocolors/LICENSE b/node_modules/picocolors/LICENSE deleted file mode 100644 index 46c9b95..0000000 --- a/node_modules/picocolors/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -ISC License - -Copyright (c) 2021-2024 Oleksii Raspopov, Kostiantyn Denysov, Anton Verinov - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/picocolors/README.md b/node_modules/picocolors/README.md deleted file mode 100644 index 8e47aa8..0000000 --- a/node_modules/picocolors/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# picocolors - -The tiniest and the fastest library for terminal output formatting with ANSI colors. - -```javascript -import pc from "picocolors" - -console.log( - pc.green(`How are ${pc.italic(`you`)} doing?`) -) -``` - -- **No dependencies.** -- **14 times** smaller and **2 times** faster than chalk. -- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist. -- Node.js v6+ & browsers support. Support for both CJS and ESM projects. -- TypeScript type declarations included. -- [`NO_COLOR`](https://no-color.org/) friendly. - -## Docs -Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub. diff --git a/node_modules/picocolors/package.json b/node_modules/picocolors/package.json deleted file mode 100644 index 372d4b6..0000000 --- a/node_modules/picocolors/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "picocolors", - "version": "1.1.1", - "main": "./picocolors.js", - "types": "./picocolors.d.ts", - "browser": { - "./picocolors.js": "./picocolors.browser.js" - }, - "sideEffects": false, - "description": "The tiniest and the fastest library for terminal output formatting with ANSI colors", - "files": [ - "picocolors.*", - "types.d.ts" - ], - "keywords": [ - "terminal", - "colors", - "formatting", - "cli", - "console" - ], - "author": "Alexey Raspopov", - "repository": "alexeyraspopov/picocolors", - "license": "ISC" -} diff --git a/node_modules/picocolors/picocolors.browser.js b/node_modules/picocolors/picocolors.browser.js deleted file mode 100644 index 9dcf637..0000000 --- a/node_modules/picocolors/picocolors.browser.js +++ /dev/null @@ -1,4 +0,0 @@ -var x=String; -var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x,blackBright:x,redBright:x,greenBright:x,yellowBright:x,blueBright:x,magentaBright:x,cyanBright:x,whiteBright:x,bgBlackBright:x,bgRedBright:x,bgGreenBright:x,bgYellowBright:x,bgBlueBright:x,bgMagentaBright:x,bgCyanBright:x,bgWhiteBright:x}}; -module.exports=create(); -module.exports.createColors = create; diff --git a/node_modules/picocolors/picocolors.d.ts b/node_modules/picocolors/picocolors.d.ts deleted file mode 100644 index 94e146a..0000000 --- a/node_modules/picocolors/picocolors.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { Colors } from "./types" - -declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors } - -export = picocolors diff --git a/node_modules/picocolors/picocolors.js b/node_modules/picocolors/picocolors.js deleted file mode 100644 index e32df85..0000000 --- a/node_modules/picocolors/picocolors.js +++ /dev/null @@ -1,75 +0,0 @@ -let p = process || {}, argv = p.argv || [], env = p.env || {} -let isColorSupported = - !(!!env.NO_COLOR || argv.includes("--no-color")) && - (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || ((p.stdout || {}).isTTY && env.TERM !== "dumb") || !!env.CI) - -let formatter = (open, close, replace = open) => - input => { - let string = "" + input, index = string.indexOf(close, open.length) - return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close - } - -let replaceClose = (string, close, replace, index) => { - let result = "", cursor = 0 - do { - result += string.substring(cursor, index) + replace - cursor = index + close.length - index = string.indexOf(close, cursor) - } while (~index) - return result + string.substring(cursor) -} - -let createColors = (enabled = isColorSupported) => { - let f = enabled ? formatter : () => String - return { - isColorSupported: enabled, - reset: f("\x1b[0m", "\x1b[0m"), - bold: f("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m"), - dim: f("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m"), - italic: f("\x1b[3m", "\x1b[23m"), - underline: f("\x1b[4m", "\x1b[24m"), - inverse: f("\x1b[7m", "\x1b[27m"), - hidden: f("\x1b[8m", "\x1b[28m"), - strikethrough: f("\x1b[9m", "\x1b[29m"), - - black: f("\x1b[30m", "\x1b[39m"), - red: f("\x1b[31m", "\x1b[39m"), - green: f("\x1b[32m", "\x1b[39m"), - yellow: f("\x1b[33m", "\x1b[39m"), - blue: f("\x1b[34m", "\x1b[39m"), - magenta: f("\x1b[35m", "\x1b[39m"), - cyan: f("\x1b[36m", "\x1b[39m"), - white: f("\x1b[37m", "\x1b[39m"), - gray: f("\x1b[90m", "\x1b[39m"), - - bgBlack: f("\x1b[40m", "\x1b[49m"), - bgRed: f("\x1b[41m", "\x1b[49m"), - bgGreen: f("\x1b[42m", "\x1b[49m"), - bgYellow: f("\x1b[43m", "\x1b[49m"), - bgBlue: f("\x1b[44m", "\x1b[49m"), - bgMagenta: f("\x1b[45m", "\x1b[49m"), - bgCyan: f("\x1b[46m", "\x1b[49m"), - bgWhite: f("\x1b[47m", "\x1b[49m"), - - blackBright: f("\x1b[90m", "\x1b[39m"), - redBright: f("\x1b[91m", "\x1b[39m"), - greenBright: f("\x1b[92m", "\x1b[39m"), - yellowBright: f("\x1b[93m", "\x1b[39m"), - blueBright: f("\x1b[94m", "\x1b[39m"), - magentaBright: f("\x1b[95m", "\x1b[39m"), - cyanBright: f("\x1b[96m", "\x1b[39m"), - whiteBright: f("\x1b[97m", "\x1b[39m"), - - bgBlackBright: f("\x1b[100m", "\x1b[49m"), - bgRedBright: f("\x1b[101m", "\x1b[49m"), - bgGreenBright: f("\x1b[102m", "\x1b[49m"), - bgYellowBright: f("\x1b[103m", "\x1b[49m"), - bgBlueBright: f("\x1b[104m", "\x1b[49m"), - bgMagentaBright: f("\x1b[105m", "\x1b[49m"), - bgCyanBright: f("\x1b[106m", "\x1b[49m"), - bgWhiteBright: f("\x1b[107m", "\x1b[49m"), - } -} - -module.exports = createColors() -module.exports.createColors = createColors diff --git a/node_modules/picocolors/types.d.ts b/node_modules/picocolors/types.d.ts deleted file mode 100644 index cd1aec4..0000000 --- a/node_modules/picocolors/types.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -export type Formatter = (input: string | number | null | undefined) => string - -export interface Colors { - isColorSupported: boolean - - reset: Formatter - bold: Formatter - dim: Formatter - italic: Formatter - underline: Formatter - inverse: Formatter - hidden: Formatter - strikethrough: Formatter - - black: Formatter - red: Formatter - green: Formatter - yellow: Formatter - blue: Formatter - magenta: Formatter - cyan: Formatter - white: Formatter - gray: Formatter - - bgBlack: Formatter - bgRed: Formatter - bgGreen: Formatter - bgYellow: Formatter - bgBlue: Formatter - bgMagenta: Formatter - bgCyan: Formatter - bgWhite: Formatter - - blackBright: Formatter - redBright: Formatter - greenBright: Formatter - yellowBright: Formatter - blueBright: Formatter - magentaBright: Formatter - cyanBright: Formatter - whiteBright: Formatter - - bgBlackBright: Formatter - bgRedBright: Formatter - bgGreenBright: Formatter - bgYellowBright: Formatter - bgBlueBright: Formatter - bgMagentaBright: Formatter - bgCyanBright: Formatter - bgWhiteBright: Formatter -} diff --git a/node_modules/picomatch/LICENSE b/node_modules/picomatch/LICENSE deleted file mode 100644 index 3608dca..0000000 --- a/node_modules/picomatch/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017-present, Jon Schlinkert. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/picomatch/README.md b/node_modules/picomatch/README.md deleted file mode 100644 index 0764496..0000000 --- a/node_modules/picomatch/README.md +++ /dev/null @@ -1,738 +0,0 @@ -

Picomatch

- -

- -version - - -test status - - -coverage status - - -downloads - -

- -
-
- -

-Blazing fast and accurate glob matcher written in JavaScript.
-No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions. -

- -
-
- -## Why picomatch? - -* **Lightweight** - No dependencies -* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function. -* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps) -* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files) -* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes. -* **Well tested** - Thousands of unit tests - -See the [library comparison](#library-comparisons) to other libraries. - -
-
- -## Table of Contents - -
Click to expand - -- [Install](#install) -- [Usage](#usage) -- [API](#api) - * [picomatch](#picomatch) - * [.test](#test) - * [.matchBase](#matchbase) - * [.isMatch](#ismatch) - * [.parse](#parse) - * [.scan](#scan) - * [.compileRe](#compilere) - * [.makeRe](#makere) - * [.toRegex](#toregex) -- [Options](#options) - * [Picomatch options](#picomatch-options) - * [Scan Options](#scan-options) - * [Options Examples](#options-examples) -- [Globbing features](#globbing-features) - * [Basic globbing](#basic-globbing) - * [Advanced globbing](#advanced-globbing) - * [Braces](#braces) - * [Matching special characters as literals](#matching-special-characters-as-literals) -- [Library Comparisons](#library-comparisons) -- [Benchmarks](#benchmarks) -- [Philosophies](#philosophies) -- [About](#about) - * [Author](#author) - * [License](#license) - -_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ - -
- -
-
- -## Install - -Install with [npm](https://www.npmjs.com/): - -```sh -npm install --save picomatch -``` - -
- -## Usage - -The main export is a function that takes a glob pattern and an options object and returns a function for matching strings. - -```js -const pm = require('picomatch'); -const isMatch = pm('*.js'); - -console.log(isMatch('abcd')); //=> false -console.log(isMatch('a.js')); //=> true -console.log(isMatch('a.md')); //=> false -console.log(isMatch('a/b.js')); //=> false -``` - -
- -## API - -### [picomatch](lib/picomatch.js#L31) - -Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information. - -**Params** - -* `globs` **{String|Array}**: One or more glob patterns. -* `options` **{Object=}** -* `returns` **{Function=}**: Returns a matcher function. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch(glob[, options]); - -const isMatch = picomatch('*.!(*a)'); -console.log(isMatch('a.a')); //=> false -console.log(isMatch('a.b')); //=> true -``` - -**Example without node.js** - -For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection. - -```js -const picomatch = require('picomatch/posix'); -// the same API, defaulting to posix paths -const isMatch = picomatch('a/*'); -console.log(isMatch('a\\b')); //=> false -console.log(isMatch('a/b')); //=> true - -// you can still configure the matcher function to accept windows paths -const isMatch = picomatch('a/*', { options: windows }); -console.log(isMatch('a\\b')); //=> true -console.log(isMatch('a/b')); //=> true -``` - -### [.test](lib/picomatch.js#L116) - -Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string. - -**Params** - -* `input` **{String}**: String to test. -* `regex` **{RegExp}** -* `returns` **{Object}**: Returns an object with matching info. - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.test(input, regex[, options]); - -console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); -// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } -``` - -### [.matchBase](lib/picomatch.js#L160) - -Match the basename of a filepath. - -**Params** - -* `input` **{String}**: String to test. -* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe). -* `returns` **{Boolean}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.matchBase(input, glob[, options]); -console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true -``` - -### [.isMatch](lib/picomatch.js#L182) - -Returns true if **any** of the given glob `patterns` match the specified `string`. - -**Params** - -* **{String|Array}**: str The string to test. -* **{String|Array}**: patterns One or more glob patterns to use for matching. -* **{Object}**: See available [options](#options). -* `returns` **{Boolean}**: Returns true if any patterns match `str` - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.isMatch(string, patterns[, options]); - -console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true -console.log(picomatch.isMatch('a.a', 'b.*')); //=> false -``` - -### [.parse](lib/picomatch.js#L198) - -Parse a glob pattern to create the source string for a regular expression. - -**Params** - -* `pattern` **{String}** -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string. - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.parse(pattern[, options]); -``` - -### [.scan](lib/picomatch.js#L230) - -Scan a glob pattern to separate the pattern into segments. - -**Params** - -* `input` **{String}**: Glob pattern to scan. -* `options` **{Object}** -* `returns` **{Object}**: Returns an object with - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.scan(input[, options]); - -const result = picomatch.scan('!./foo/*.js'); -console.log(result); -{ prefix: '!./', - input: '!./foo/*.js', - start: 3, - base: 'foo', - glob: '*.js', - isBrace: false, - isBracket: false, - isGlob: true, - isExtglob: false, - isGlobstar: false, - negated: true } -``` - -### [.compileRe](lib/picomatch.js#L244) - -Compile a regular expression from the `state` object returned by the -[parse()](#parse) method. - -**Params** - -* `state` **{Object}** -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser. -* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. -* `returns` **{RegExp}** - -### [.makeRe](lib/picomatch.js#L285) - -Create a regular expression from a parsed glob pattern. - -**Params** - -* `state` **{String}**: The object returned from the `.parse` method. -* `options` **{Object}** -* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. -* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression. -* `returns` **{RegExp}**: Returns a regex created from the given pattern. - -**Example** - -```js -const picomatch = require('picomatch'); -const state = picomatch.parse('*.js'); -// picomatch.compileRe(state[, options]); - -console.log(picomatch.compileRe(state)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -### [.toRegex](lib/picomatch.js#L320) - -Create a regular expression from the given regex source string. - -**Params** - -* `source` **{String}**: Regular expression source string. -* `options` **{Object}** -* `returns` **{RegExp}** - -**Example** - -```js -const picomatch = require('picomatch'); -// picomatch.toRegex(source[, options]); - -const { output } = picomatch.parse('*.js'); -console.log(picomatch.toRegex(output)); -//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ -``` - -
- -## Options - -### Picomatch options - -The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. | -| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). | -| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. | -| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). | -| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` | -| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. | -| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true | -| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. | -| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. | -| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. | -| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. | -| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. | -| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. | -| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. | -| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. | -| `matchBase` | `boolean` | `false` | Alias for `basename` | -| `maxLength` | `number` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. | -| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. | -| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. | -| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. | -| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. | -| `noext` | `boolean` | `false` | Alias for `noextglob` | -| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) | -| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) | -| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` | -| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. | -| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. | -| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. | -| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. | -| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). | -| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself | -| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. | -| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). | -| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. | -| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. | -| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. | -| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. | -| `windows` | `boolean` | `false` | Also accept backslashes as the path separator. | - -### Scan Options - -In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method. - -| **Option** | **Type** | **Default value** | **Description** | -| --- | --- | --- | --- | -| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern | -| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true | - -**Example** - -```js -const picomatch = require('picomatch'); -const result = picomatch.scan('!./foo/*.js', { tokens: true }); -console.log(result); -// { -// prefix: '!./', -// input: '!./foo/*.js', -// start: 3, -// base: 'foo', -// glob: '*.js', -// isBrace: false, -// isBracket: false, -// isGlob: true, -// isExtglob: false, -// isGlobstar: false, -// negated: true, -// maxDepth: 2, -// tokens: [ -// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true }, -// { value: 'foo', depth: 1, isGlob: false }, -// { value: '*.js', depth: 1, isGlob: true } -// ], -// slashes: [ 2, 6 ], -// parts: [ 'foo', '*.js' ] -// } -``` - -
- -### Options Examples - -#### options.expandRange - -**Type**: `function` - -**Default**: `undefined` - -Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need. - -**Example** - -The following example shows how to create a glob that matches a folder - -```js -const fill = require('fill-range'); -const regex = pm.makeRe('foo/{01..25}/bar', { - expandRange(a, b) { - return `(${fill(a, b, { toRegex: true })})`; - } -}); - -console.log(regex); -//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/ - -console.log(regex.test('foo/00/bar')) // false -console.log(regex.test('foo/01/bar')) // true -console.log(regex.test('foo/10/bar')) // true -console.log(regex.test('foo/22/bar')) // true -console.log(regex.test('foo/25/bar')) // true -console.log(regex.test('foo/26/bar')) // false -``` - -#### options.format - -**Type**: `function` - -**Default**: `undefined` - -Custom function for formatting strings before they're matched. - -**Example** - -```js -// strip leading './' from strings -const format = str => str.replace(/^\.\//, ''); -const isMatch = picomatch('foo/*.js', { format }); -console.log(isMatch('./foo/bar.js')); //=> true -``` - -#### options.onMatch - -```js -const onMatch = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onMatch }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onIgnore - -```js -const onIgnore = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onIgnore, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -#### options.onResult - -```js -const onResult = ({ glob, regex, input, output }) => { - console.log({ glob, regex, input, output }); -}; - -const isMatch = picomatch('*', { onResult, ignore: 'f*' }); -isMatch('foo'); -isMatch('bar'); -isMatch('baz'); -``` - -
-
- -## Globbing features - -* [Basic globbing](#basic-globbing) (Wildcard matching) -* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching) - -### Basic globbing - -| **Character** | **Description** | -| --- | --- | -| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. | -| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. | -| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. | -| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. | - -#### Matching behavior vs. Bash - -Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions: - -* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`. -* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`. - -
- -### Advanced globbing - -* [extglobs](#extglobs) -* [POSIX brackets](#posix-brackets) -* [Braces](#brace-expansion) - -#### Extglobs - -| **Pattern** | **Description** | -| --- | --- | -| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` | -| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` | -| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` | -| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` | -| `!(pattern)` | Match _anything but_ `pattern` | - -**Examples** - -```js -const pm = require('picomatch'); - -// *(pattern) matches ZERO or more of "pattern" -console.log(pm.isMatch('a', 'a*(z)')); // true -console.log(pm.isMatch('az', 'a*(z)')); // true -console.log(pm.isMatch('azzz', 'a*(z)')); // true - -// +(pattern) matches ONE or more of "pattern" -console.log(pm.isMatch('a', 'a+(z)')); // false -console.log(pm.isMatch('az', 'a+(z)')); // true -console.log(pm.isMatch('azzz', 'a+(z)')); // true - -// supports multiple extglobs -console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false - -// supports nested extglobs -console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true -``` - -#### POSIX brackets - -POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true. - -**Enable POSIX bracket support** - -```js -console.log(pm.makeRe('[[:word:]]+', { posix: true })); -//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/ -``` - -**Supported POSIX classes** - -The following named POSIX bracket expressions are supported: - -* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]` -* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`. -* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`. -* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`. -* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`. -* `[:digit:]` - Numerical digits, equivalent to `[0-9]`. -* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`. -* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`. -* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`. -* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`. -* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`. -* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`. -* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`. -* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`. - -See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information. - -### Braces - -Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces. - -### Matching special characters as literals - -If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes: - -**Special Characters** - -Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms. - -To match any of the following characters as literals: `$^*+?()[] - -Examples: - -```js -console.log(pm.makeRe('foo/bar \\(1\\)')); -console.log(pm.makeRe('foo/bar \\(1\\)')); -``` - -
-
- -## Library Comparisons - -The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets). - -| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` | -| --- | --- | --- | --- | --- | --- | --- | --- | -| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - | -| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - | -| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - | -| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - | -| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - | -| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ | -| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | -| File system operations | - | - | - | - | - | - | - | - -
-
- -## Benchmarks - -Performance comparison of picomatch and minimatch. - -_(Pay special attention to the last three benchmarks. Minimatch freezes on long ranges.)_ - -``` -# .makeRe star (*) - picomatch x 4,449,159 ops/sec ±0.24% (97 runs sampled) - minimatch x 632,772 ops/sec ±0.14% (98 runs sampled) - -# .makeRe star; dot=true (*) - picomatch x 3,500,079 ops/sec ±0.26% (99 runs sampled) - minimatch x 564,916 ops/sec ±0.23% (96 runs sampled) - -# .makeRe globstar (**) - picomatch x 3,261,000 ops/sec ±0.27% (98 runs sampled) - minimatch x 1,664,766 ops/sec ±0.20% (100 runs sampled) - -# .makeRe globstars (**/**/**) - picomatch x 3,284,469 ops/sec ±0.18% (97 runs sampled) - minimatch x 1,435,880 ops/sec ±0.34% (95 runs sampled) - -# .makeRe with leading star (*.txt) - picomatch x 3,100,197 ops/sec ±0.35% (99 runs sampled) - minimatch x 428,347 ops/sec ±0.42% (94 runs sampled) - -# .makeRe - basic braces ({a,b,c}*.txt) - picomatch x 443,578 ops/sec ±1.33% (89 runs sampled) - minimatch x 107,143 ops/sec ±0.35% (94 runs sampled) - -# .makeRe - short ranges ({a..z}*.txt) - picomatch x 415,484 ops/sec ±0.76% (96 runs sampled) - minimatch x 14,299 ops/sec ±0.26% (96 runs sampled) - -# .makeRe - medium ranges ({1..100000}*.txt) - picomatch x 395,020 ops/sec ±0.87% (89 runs sampled) - minimatch x 2 ops/sec ±4.59% (10 runs sampled) - -# .makeRe - long ranges ({1..10000000}*.txt) - picomatch x 400,036 ops/sec ±0.83% (90 runs sampled) - minimatch (FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory) -``` - -
-
- -## Philosophies - -The goal of this library is to be blazing fast, without compromising on accuracy. - -**Accuracy** - -The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`. - -Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements. - -**Performance** - -Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer. - -
-
- -## About - -
-Contributing - -Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). - -Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. - -
- -
-Running Tests - -Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: - -```sh -npm install && npm test -``` - -
- -
-Building docs - -_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ - -To generate the readme, run the following command: - -```sh -npm install -g verbose/verb#dev verb-generate-readme && verb -``` - -
- -### Author - -**Jon Schlinkert** - -* [GitHub Profile](https://github.com/jonschlinkert) -* [Twitter Profile](https://twitter.com/jonschlinkert) -* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) - -### License - -Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert). -Released under the [MIT License](LICENSE). diff --git a/node_modules/picomatch/index.js b/node_modules/picomatch/index.js deleted file mode 100644 index a753b1d..0000000 --- a/node_modules/picomatch/index.js +++ /dev/null @@ -1,17 +0,0 @@ -'use strict'; - -const pico = require('./lib/picomatch'); -const utils = require('./lib/utils'); - -function picomatch(glob, options, returnState = false) { - // default to os.platform() - if (options && (options.windows === null || options.windows === undefined)) { - // don't mutate the original options object - options = { ...options, windows: utils.isWindows() }; - } - - return pico(glob, options, returnState); -} - -Object.assign(picomatch, pico); -module.exports = picomatch; diff --git a/node_modules/picomatch/lib/constants.js b/node_modules/picomatch/lib/constants.js deleted file mode 100644 index 3f7ef7e..0000000 --- a/node_modules/picomatch/lib/constants.js +++ /dev/null @@ -1,180 +0,0 @@ -'use strict'; - -const WIN_SLASH = '\\\\/'; -const WIN_NO_SLASH = `[^${WIN_SLASH}]`; - -/** - * Posix glob regex - */ - -const DOT_LITERAL = '\\.'; -const PLUS_LITERAL = '\\+'; -const QMARK_LITERAL = '\\?'; -const SLASH_LITERAL = '\\/'; -const ONE_CHAR = '(?=.)'; -const QMARK = '[^/]'; -const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`; -const START_ANCHOR = `(?:^|${SLASH_LITERAL})`; -const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`; -const NO_DOT = `(?!${DOT_LITERAL})`; -const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`; -const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`; -const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`; -const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`; -const STAR = `${QMARK}*?`; -const SEP = '/'; - -const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR, - SEP -}; - -/** - * Windows glob regex - */ - -const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: `[${WIN_SLASH}]`, - QMARK: WIN_NO_SLASH, - STAR: `${WIN_NO_SLASH}*?`, - DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`, - NO_DOT: `(?!${DOT_LITERAL})`, - NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`, - NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`, - QMARK_NO_DOT: `[^.${WIN_SLASH}]`, - START_ANCHOR: `(?:^|[${WIN_SLASH}])`, - END_ANCHOR: `(?:[${WIN_SLASH}]|$)`, - SEP: '\\' -}; - -/** - * POSIX Bracket Regex - */ - -const POSIX_REGEX_SOURCE = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\x00-\\x7F', - blank: ' \\t', - cntrl: '\\x00-\\x1F\\x7F', - digit: '0-9', - graph: '\\x21-\\x7E', - lower: 'a-z', - print: '\\x20-\\x7E ', - punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~', - space: ' \\t\\r\\n\\v\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' -}; - -module.exports = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE, - - // regular expressions - REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - __proto__: null, - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \ */ - CHAR_CARRIAGE_RETURN: 13, /* \r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* ` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \n */ - CHAR_NO_BREAK_SPACE: 160, /* \u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \uFEFF */ - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: `))${chars.STAR})` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } -}; diff --git a/node_modules/picomatch/lib/parse.js b/node_modules/picomatch/lib/parse.js deleted file mode 100644 index 8fd8ff4..0000000 --- a/node_modules/picomatch/lib/parse.js +++ /dev/null @@ -1,1085 +0,0 @@ -'use strict'; - -const constants = require('./constants'); -const utils = require('./utils'); - -/** - * Constants - */ - -const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS -} = constants; - -/** - * Helpers - */ - -const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = `[${args.join('-')}]`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils.escapeRegex(v)).join('..'); - } - - return value; -}; - -/** - * Create the message for a syntax error - */ - -const syntaxError = (type, char) => { - return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`; -}; - -/** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - -const parse = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants.globChars(opts.windows); - const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = opts => { - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } - - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index] || ''; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren') { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.output = (prev.output || prev.value) + tok.value; - prev.value += tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - let rest; - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } - - if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) { - output = token.close = `)$))${extglobStar}`; - } - - if (token.inner.includes('*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) { - // Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis. - // In this case, we need to parse the string and use it in the output of the original pattern. - // Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`. - // - // Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`. - const expression = parse(rest, { ...options, fastpaths: false }).output; - - output = token.close = `)${expression})${extglobStar})`; - } - - if (token.prev.type === 'bos') { - state.negatedExtglob = true; - } - } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : `\\${m}`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\/g, ''); - } else { - output = output.replace(/\\+/g, m => { - return m.length % 2 === 0 ? '\\\\' : (m ? '\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\'; - } - } - - if (opts.unescape === true) { - value = advance(); - } else { - value += advance(); - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } - } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = `\\${value}`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = `\\${value}`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } - - /** - * Parentheses - */ - - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; - } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\)' }); - decrement('parens'); - continue; - } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); - } - - value = `\\${value}`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: `\\${value}` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = `/${value}`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = `(${capture}${escaped}|${prev.value})`; - state.output += prev.value; - continue; - } - - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; - - braces.push(open); - push(open); - continue; - } - - if (value === '}') { - const brace = braces[braces.length - 1]; - - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } - - let output = ')'; - - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; - - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } - - output = expandRange(range, opts); - state.backtrack = true; - } - - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\{'; - value = output = '\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } - - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } - - /** - * Pipes - */ - - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } - - /** - * Commas - */ - - if (value === ',') { - let output = value; - - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } - - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } - - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } - - /** - * Dots - */ - - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } - - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } - - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } - - /** - * Question marks - */ - - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } - - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; - - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\w+>)/.test(remaining()))) { - output = `\\${value}`; - } - - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ - - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; - } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } - - /** - * Plus - */ - - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } - - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } - - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } - - push({ type: 'plus', value: PLUS_LITERAL }); - continue; - } - - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = `\\${value}`; - } - - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } - - push({ type: 'text', value }); - continue; - } - - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } - - let rest = remaining(); - if (opts.noextglob !== true && /^\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } - - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } - - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); - - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } - - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } - - // strip consecutive `/**/` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = `(?:${prior.output}`; - - prev.type = 'globstar'; - prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } - - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; - } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } - } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils.escapeLast(state.output, '('); - decrement('parens'); - } - - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils.escapeLast(state.output, '{'); - decrement('braces'); - } - - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: `${SLASH_LITERAL}?` }); - } - - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; - - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; - - if (token.suffix) { - state.output += token.suffix; - } - } - } - - return state; -}; - -/** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ - -parse.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`); - } - - input = REPLACEMENTS[input] || input; - - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants.globChars(opts.windows); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = `(${star})`; - } - - const globstar = opts => { - if (opts.noglobstar === true) return star; - return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`; - }; - - const create = str => { - switch (str) { - case '*': - return `${nodot}${ONE_CHAR}${star}`; - - case '.*': - return `${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*.*': - return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '*/*': - return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`; - - case '**': - return nodot + globstar(opts); - - case '**/*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`; - - case '**/*.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`; - - case '**/.*': - return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`; - - default: { - const match = /^(.*?)\.(\w+)$/.exec(str); - if (!match) return; - - const source = create(match[1]); - if (!source) return; - - return source + DOT_LITERAL + match[2]; - } - } - }; - - const output = utils.removePrefix(input, state); - let source = create(output); - - if (source && opts.strictSlashes !== true) { - source += `${SLASH_LITERAL}?`; - } - - return source; -}; - -module.exports = parse; diff --git a/node_modules/picomatch/lib/picomatch.js b/node_modules/picomatch/lib/picomatch.js deleted file mode 100644 index d0ebd9f..0000000 --- a/node_modules/picomatch/lib/picomatch.js +++ /dev/null @@ -1,341 +0,0 @@ -'use strict'; - -const scan = require('./scan'); -const parse = require('./parse'); -const utils = require('./utils'); -const constants = require('./constants'); -const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - -/** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * ``` - * @name picomatch - * @param {String|Array} `globs` One or more glob patterns. - * @param {Object=} `options` - * @return {Function=} Returns a matcher function. - * @api public - */ - -const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } - - const isState = isObject(glob) && glob.tokens && glob.input; - - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); - } - - const opts = options || {}; - const posix = opts.windows; - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); - - const state = regex.state; - delete regex.state; - - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); - } - - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; - - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } - - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } - - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } - - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; - }; - - if (returnState) { - matcher.state = state; - } - - return matcher; -}; - -/** - * Test `input` with the given `regex`. This is used by the main - * `picomatch()` function to test the input string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * ``` - * @param {String} `input` String to test. - * @param {RegExp} `regex` - * @return {Object} Returns an object with matching info. - * @api public - */ - -picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } - - if (input === '') { - return { isMatch: false, output: '' }; - } - - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; - - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } - - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } - - return { isMatch: Boolean(match), match, output }; -}; - -/** - * Match the basename of a filepath. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * ``` - * @param {String} `input` String to test. - * @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ - -picomatch.matchBase = (input, glob, options) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(utils.basename(input)); -}; - -/** - * Returns true if **any** of the given glob `patterns` match the specified `string`. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * ``` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match `str` - * @api public - */ - -picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - -/** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * ```js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * ``` - * @param {String} `pattern` - * @param {Object} `options` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ - -picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse(pattern, { ...options, fastpaths: false }); -}; - -/** - * Scan a glob pattern to separate the pattern into segments. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * ``` - * @param {String} `input` Glob pattern to scan. - * @param {Object} `options` - * @return {Object} Returns an object with - * @api public - */ - -picomatch.scan = (input, options) => scan(input, options); - -/** - * Compile a regular expression from the `state` object returned by the - * [parse()](#parse) method. - * - * @param {Object} `state` - * @param {Object} `options` - * @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser. - * @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging. - * @return {RegExp} - * @api public - */ - -picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return state.output; - } - - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; - - let source = `${prepend}(?:${state.output})${append}`; - if (state && state.negated === true) { - source = `^(?!${source}).*$`; - } - - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = state; - } - - return regex; -}; - -/** - * Create a regular expression from a parsed glob pattern. - * - * ```js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `state` The object returned from the `.parse` method. - * @param {Object} `options` - * @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. - * @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ - -picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } - - let parsed = { negated: false, fastpaths: true }; - - if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - parsed.output = parse.fastpaths(input, options); - } - - if (!parsed.output) { - parsed = parse(input, options); - } - - return picomatch.compileRe(parsed, options, returnOutput, returnState); -}; - -/** - * Create a regular expression from the given regex source string. - * - * ```js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/ - * ``` - * @param {String} `source` Regular expression source string. - * @param {Object} `options` - * @return {RegExp} - * @api public - */ - -picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; - } -}; - -/** - * Picomatch constants. - * @return {Object} - */ - -picomatch.constants = constants; - -/** - * Expose "picomatch" - */ - -module.exports = picomatch; diff --git a/node_modules/picomatch/lib/scan.js b/node_modules/picomatch/lib/scan.js deleted file mode 100644 index e59cd7a..0000000 --- a/node_modules/picomatch/lib/scan.js +++ /dev/null @@ -1,391 +0,0 @@ -'use strict'; - -const utils = require('./utils'); -const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ -} = require('./constants'); - -const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; -}; - -const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } -}; - -/** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like `isGlob`, `path` (the leading non-glob, if it exists), - * `glob` (the actual pattern), `negated` (true if the path starts with `!` but not - * with `!(`) and `negatedExtglob` (true if the path starts with `!(`). - * - * ```js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * ``` - * @param {String} `str` - * @param {Object} `options` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - -const scan = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let negatedExtglob = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; - - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; - - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } - - lastIndex = index + 1; - continue; - } - - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; - - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; - if (code === CHAR_EXCLAMATION_MARK && index === start) { - negatedExtglob = true; - } - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } - - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - break; - } - - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; - break; - } - } - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } - - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } - - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } - - if (isGlob === true) { - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - } - - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } - - let base = str; - let prefix = ''; - let glob = ''; - - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } - - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } - - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } - - if (opts.unescape === true) { - if (glob) glob = utils.removeBackslashes(glob); - - if (base && backslashes === true) { - base = utils.removeBackslashes(base); - } - } - - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated, - negatedExtglob - }; - - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; -}; - -module.exports = scan; diff --git a/node_modules/picomatch/lib/utils.js b/node_modules/picomatch/lib/utils.js deleted file mode 100644 index 9c97cae..0000000 --- a/node_modules/picomatch/lib/utils.js +++ /dev/null @@ -1,72 +0,0 @@ -/*global navigator*/ -'use strict'; - -const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL -} = require('./constants'); - -exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); -exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); -exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); -exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1'); -exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - -exports.isWindows = () => { - if (typeof navigator !== 'undefined' && navigator.platform) { - const platform = navigator.platform.toLowerCase(); - return platform === 'win32' || platform === 'windows'; - } - - if (typeof process !== 'undefined' && process.platform) { - return process.platform === 'win32'; - } - - return false; -}; - -exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\' ? '' : match; - }); -}; - -exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1); - return `${input.slice(0, idx)}\\${input.slice(idx)}`; -}; - -exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; - } - return output; -}; - -exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = `${prepend}(?:${input})${append}`; - if (state.negated === true) { - output = `(?:^(?!${output}).*$)`; - } - return output; -}; - -exports.basename = (path, { windows } = {}) => { - const segs = path.split(windows ? /[\\/]/ : '/'); - const last = segs[segs.length - 1]; - - if (last === '') { - return segs[segs.length - 2]; - } - - return last; -}; diff --git a/node_modules/picomatch/package.json b/node_modules/picomatch/package.json deleted file mode 100644 index 372e27e..0000000 --- a/node_modules/picomatch/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "picomatch", - "description": "Blazing fast and accurate glob matcher written in JavaScript, with no dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.", - "version": "4.0.3", - "homepage": "https://github.com/micromatch/picomatch", - "author": "Jon Schlinkert (https://github.com/jonschlinkert)", - "funding": "https://github.com/sponsors/jonschlinkert", - "repository": "micromatch/picomatch", - "bugs": { - "url": "https://github.com/micromatch/picomatch/issues" - }, - "license": "MIT", - "files": [ - "index.js", - "posix.js", - "lib" - ], - "sideEffects": false, - "main": "index.js", - "engines": { - "node": ">=12" - }, - "scripts": { - "lint": "eslint --cache --cache-location node_modules/.cache/.eslintcache --report-unused-disable-directives --ignore-path .gitignore .", - "mocha": "mocha --reporter dot", - "test": "npm run lint && npm run mocha", - "test:ci": "npm run test:cover", - "test:cover": "nyc npm run mocha" - }, - "devDependencies": { - "eslint": "^8.57.0", - "fill-range": "^7.0.1", - "gulp-format-md": "^2.0.0", - "mocha": "^10.4.0", - "nyc": "^15.1.0", - "time-require": "github:jonschlinkert/time-require" - }, - "keywords": [ - "glob", - "match", - "picomatch" - ], - "nyc": { - "reporter": [ - "html", - "lcov", - "text-summary" - ] - }, - "verb": { - "toc": { - "render": true, - "method": "preWrite", - "maxdepth": 3 - }, - "layout": "empty", - "tasks": [ - "readme" - ], - "plugins": [ - "gulp-format-md" - ], - "lint": { - "reflinks": true - }, - "related": { - "list": [ - "braces", - "micromatch" - ] - }, - "reflinks": [ - "braces", - "expand-brackets", - "extglob", - "fill-range", - "micromatch", - "minimatch", - "nanomatch", - "picomatch" - ] - } -} diff --git a/node_modules/picomatch/posix.js b/node_modules/picomatch/posix.js deleted file mode 100644 index d2f2bc5..0000000 --- a/node_modules/picomatch/posix.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; - -module.exports = require('./lib/picomatch'); diff --git a/node_modules/postcss/LICENSE b/node_modules/postcss/LICENSE deleted file mode 100644 index da057b4..0000000 --- a/node_modules/postcss/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright 2013 Andrey Sitnik - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/postcss/README.md b/node_modules/postcss/README.md deleted file mode 100644 index 05fed07..0000000 --- a/node_modules/postcss/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# PostCSS - -Philosopher’s stone, logo of PostCSS - -PostCSS is a tool for transforming styles with JS plugins. -These plugins can lint your CSS, support variables and mixins, -transpile future CSS syntax, inline images, and more. - -PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba, -and JetBrains. The [Autoprefixer] and [Stylelint] PostCSS plugins are some of the most popular CSS tools. - ---- - -  Built by - Evil Martians, go-to agency for developer tools. - ---- - -[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree -[Evil Martians]: https://evilmartians.com/?utm_source=postcss -[Autoprefixer]: https://github.com/postcss/autoprefixer -[Stylelint]: https://stylelint.io/ -[plugins]: https://github.com/postcss/postcss#plugins - - -## Docs -Read full docs **[here](https://postcss.org/)**. diff --git a/node_modules/postcss/lib/at-rule.d.ts b/node_modules/postcss/lib/at-rule.d.ts deleted file mode 100644 index 89fb505..0000000 --- a/node_modules/postcss/lib/at-rule.d.ts +++ /dev/null @@ -1,140 +0,0 @@ -import Container, { - ContainerProps, - ContainerWithChildren -} from './container.js' - -declare namespace AtRule { - export interface AtRuleRaws extends Record { - /** - * The space symbols after the last child of the node to the end of the node. - */ - after?: string - - /** - * The space between the at-rule name and its parameters. - */ - afterName?: string - - /** - * The space symbols before the node. It also stores `*` - * and `_` symbols before the declaration (IE hack). - */ - before?: string - - /** - * The symbols between the last parameter and `{` for rules. - */ - between?: string - - /** - * The rule’s selector with comments. - */ - params?: { - raw: string - value: string - } - - /** - * Contains `true` if the last child has an (optional) semicolon. - */ - semicolon?: boolean - } - - export interface AtRuleProps extends ContainerProps { - /** Name of the at-rule. */ - name: string - /** Parameters following the name of the at-rule. */ - params?: number | string - /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ - raws?: AtRuleRaws - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { AtRule_ as default } -} - -/** - * Represents an at-rule. - * - * ```js - * Once (root, { AtRule }) { - * let media = new AtRule({ name: 'media', params: 'print' }) - * media.append(…) - * root.append(media) - * } - * ``` - * - * If it’s followed in the CSS by a `{}` block, this node will have - * a nodes property representing its children. - * - * ```js - * const root = postcss.parse('@charset "UTF-8"; @media print {}') - * - * const charset = root.first - * charset.type //=> 'atrule' - * charset.nodes //=> undefined - * - * const media = root.last - * media.nodes //=> [] - * ``` - */ -declare class AtRule_ extends Container { - /** - * An array containing the layer’s children. - * - * ```js - * const root = postcss.parse('@layer example { a { color: black } }') - * const layer = root.first - * layer.nodes.length //=> 1 - * layer.nodes[0].selector //=> 'a' - * ``` - * - * Can be `undefinded` if the at-rule has no body. - * - * ```js - * const root = postcss.parse('@layer a, b, c;') - * const layer = root.first - * layer.nodes //=> undefined - * ``` - */ - nodes: Container['nodes'] | undefined - parent: ContainerWithChildren | undefined - - raws: AtRule.AtRuleRaws - type: 'atrule' - /** - * The at-rule’s name immediately follows the `@`. - * - * ```js - * const root = postcss.parse('@media print {}') - * const media = root.first - * media.name //=> 'media' - * ``` - */ - get name(): string - set name(value: string) - - /** - * The at-rule’s parameters, the values that follow the at-rule’s name - * but precede any `{}` block. - * - * ```js - * const root = postcss.parse('@media print, screen {}') - * const media = root.first - * media.params //=> 'print, screen' - * ``` - */ - get params(): string - - set params(value: string) - - constructor(defaults?: AtRule.AtRuleProps) - assign(overrides: AtRule.AtRuleProps | object): this - clone(overrides?: Partial): this - cloneAfter(overrides?: Partial): this - cloneBefore(overrides?: Partial): this -} - -declare class AtRule extends AtRule_ {} - -export = AtRule diff --git a/node_modules/postcss/lib/at-rule.js b/node_modules/postcss/lib/at-rule.js deleted file mode 100644 index 9486447..0000000 --- a/node_modules/postcss/lib/at-rule.js +++ /dev/null @@ -1,25 +0,0 @@ -'use strict' - -let Container = require('./container') - -class AtRule extends Container { - constructor(defaults) { - super(defaults) - this.type = 'atrule' - } - - append(...children) { - if (!this.proxyOf.nodes) this.nodes = [] - return super.append(...children) - } - - prepend(...children) { - if (!this.proxyOf.nodes) this.nodes = [] - return super.prepend(...children) - } -} - -module.exports = AtRule -AtRule.default = AtRule - -Container.registerAtRule(AtRule) diff --git a/node_modules/postcss/lib/comment.d.ts b/node_modules/postcss/lib/comment.d.ts deleted file mode 100644 index 6f1f66f..0000000 --- a/node_modules/postcss/lib/comment.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -import Container from './container.js' -import Node, { NodeProps } from './node.js' - -declare namespace Comment { - export interface CommentRaws extends Record { - /** - * The space symbols before the node. - */ - before?: string - - /** - * The space symbols between `/*` and the comment’s text. - */ - left?: string - - /** - * The space symbols between the comment’s text. - */ - right?: string - } - - export interface CommentProps extends NodeProps { - /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ - raws?: CommentRaws - /** Content of the comment. */ - text: string - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { Comment_ as default } -} - -/** - * It represents a class that handles - * [CSS comments](https://developer.mozilla.org/en-US/docs/Web/CSS/Comments) - * - * ```js - * Once (root, { Comment }) { - * const note = new Comment({ text: 'Note: …' }) - * root.append(note) - * } - * ``` - * - * Remember that CSS comments inside selectors, at-rule parameters, - * or declaration values will be stored in the `raws` properties - * explained above. - */ -declare class Comment_ extends Node { - parent: Container | undefined - raws: Comment.CommentRaws - type: 'comment' - /** - * The comment's text. - */ - get text(): string - - set text(value: string) - - constructor(defaults?: Comment.CommentProps) - assign(overrides: Comment.CommentProps | object): this - clone(overrides?: Partial): this - cloneAfter(overrides?: Partial): this - cloneBefore(overrides?: Partial): this -} - -declare class Comment extends Comment_ {} - -export = Comment diff --git a/node_modules/postcss/lib/comment.js b/node_modules/postcss/lib/comment.js deleted file mode 100644 index c566506..0000000 --- a/node_modules/postcss/lib/comment.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict' - -let Node = require('./node') - -class Comment extends Node { - constructor(defaults) { - super(defaults) - this.type = 'comment' - } -} - -module.exports = Comment -Comment.default = Comment diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts deleted file mode 100644 index c2b310b..0000000 --- a/node_modules/postcss/lib/container.d.ts +++ /dev/null @@ -1,483 +0,0 @@ -import AtRule from './at-rule.js' -import Comment from './comment.js' -import Declaration from './declaration.js' -import Node, { ChildNode, ChildProps, NodeProps } from './node.js' -import { Root } from './postcss.js' -import Rule from './rule.js' - -declare namespace Container { - export type ContainerWithChildren = { - nodes: Child[] - } & ( - | AtRule - | Root - | Rule - ) - - export interface ValueOptions { - /** - * String that’s used to narrow down values and speed up the regexp search. - */ - fast?: string - - /** - * An array of property names. - */ - props?: readonly string[] - } - - export interface ContainerProps extends NodeProps { - nodes?: readonly (ChildProps | Node)[] - } - - /** - * All types that can be passed into container methods to create or add a new - * child node. - */ - export type NewChild = - | ChildProps - | Node - | readonly ChildProps[] - | readonly Node[] - | readonly string[] - | string - | undefined - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { Container_ as default } -} - -/** - * The `Root`, `AtRule`, and `Rule` container nodes - * inherit some common methods to help work with their children. - * - * Note that all containers can store any content. If you write a rule inside - * a rule, PostCSS will parse it. - */ -declare abstract class Container_ extends Node { - /** - * An array containing the container’s children. - * - * ```js - * const root = postcss.parse('a { color: black }') - * root.nodes.length //=> 1 - * root.nodes[0].selector //=> 'a' - * root.nodes[0].nodes[0].prop //=> 'color' - * ``` - */ - nodes: Child[] | undefined - - /** - * The container’s first child. - * - * ```js - * rule.first === rules.nodes[0] - * ``` - */ - get first(): Child | undefined - - /** - * The container’s last child. - * - * ```js - * rule.last === rule.nodes[rule.nodes.length - 1] - * ``` - */ - get last(): Child | undefined - /** - * Inserts new nodes to the end of the container. - * - * ```js - * const decl1 = new Declaration({ prop: 'color', value: 'black' }) - * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) - * rule.append(decl1, decl2) - * - * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule - * root.append({ selector: 'a' }) // rule - * rule.append({ prop: 'color', value: 'black' }) // declaration - * rule.append({ text: 'Comment' }) // comment - * - * root.append('a {}') - * root.first.append('color: black; z-index: 1') - * ``` - * - * @param nodes New nodes. - * @return This node for methods chain. - */ - append(...nodes: Container.NewChild[]): this - assign(overrides: Container.ContainerProps | object): this - clone(overrides?: Partial): this - - cloneAfter(overrides?: Partial): this - - cloneBefore(overrides?: Partial): this - /** - * Iterates through the container’s immediate children, - * calling `callback` for each child. - * - * Returning `false` in the callback will break iteration. - * - * This method only iterates through the container’s immediate children. - * If you need to recursively iterate through all the container’s descendant - * nodes, use `Container#walk`. - * - * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe - * if you are mutating the array of child nodes during iteration. - * PostCSS will adjust the current index to match the mutations. - * - * ```js - * const root = postcss.parse('a { color: black; z-index: 1 }') - * const rule = root.first - * - * for (const decl of rule.nodes) { - * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) - * // Cycle will be infinite, because cloneBefore moves the current node - * // to the next index - * } - * - * rule.each(decl => { - * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) - * // Will be executed only for color and z-index - * }) - * ``` - * - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - each( - callback: (node: Child, index: number) => false | void - ): false | undefined - - /** - * Returns `true` if callback returns `true` - * for all of the container’s children. - * - * ```js - * const noPrefixes = rule.every(i => i.prop[0] !== '-') - * ``` - * - * @param condition Iterator returns true or false. - * @return Is every child pass condition. - */ - every( - condition: (node: Child, index: number, nodes: Child[]) => boolean - ): boolean - /** - * Returns a `child`’s index within the `Container#nodes` array. - * - * ```js - * rule.index( rule.nodes[2] ) //=> 2 - * ``` - * - * @param child Child of the current container. - * @return Child index. - */ - index(child: Child | number): number - - /** - * Insert new node after old node within the container. - * - * @param oldNode Child or child’s index. - * @param newNode New node. - * @return This node for methods chain. - */ - insertAfter(oldNode: Child | number, newNode: Container.NewChild): this - - /** - * Traverses the container’s descendant nodes, calling callback - * for each comment node. - * - * Like `Container#each`, this method is safe - * to use if you are mutating arrays during iteration. - * - * ```js - * root.walkComments(comment => { - * comment.remove() - * }) - * ``` - * - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - - /** - * Insert new node before old node within the container. - * - * ```js - * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop })) - * ``` - * - * @param oldNode Child or child’s index. - * @param newNode New node. - * @return This node for methods chain. - */ - insertBefore(oldNode: Child | number, newNode: Container.NewChild): this - /** - * Inserts new nodes to the start of the container. - * - * ```js - * const decl1 = new Declaration({ prop: 'color', value: 'black' }) - * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) - * rule.prepend(decl1, decl2) - * - * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule - * root.append({ selector: 'a' }) // rule - * rule.append({ prop: 'color', value: 'black' }) // declaration - * rule.append({ text: 'Comment' }) // comment - * - * root.append('a {}') - * root.first.append('color: black; z-index: 1') - * ``` - * - * @param nodes New nodes. - * @return This node for methods chain. - */ - prepend(...nodes: Container.NewChild[]): this - - /** - * Add child to the end of the node. - * - * ```js - * rule.push(new Declaration({ prop: 'color', value: 'black' })) - * ``` - * - * @param child New node. - * @return This node for methods chain. - */ - push(child: Child): this - - /** - * Removes all children from the container - * and cleans their parent properties. - * - * ```js - * rule.removeAll() - * rule.nodes.length //=> 0 - * ``` - * - * @return This node for methods chain. - */ - removeAll(): this - - /** - * Removes node from the container and cleans the parent properties - * from the node and its children. - * - * ```js - * rule.nodes.length //=> 5 - * rule.removeChild(decl) - * rule.nodes.length //=> 4 - * decl.parent //=> undefined - * ``` - * - * @param child Child or child’s index. - * @return This node for methods chain. - */ - removeChild(child: Child | number): this - - replaceValues( - pattern: RegExp | string, - replaced: { (substring: string, ...args: any[]): string } | string - ): this - /** - * Passes all declaration values within the container that match pattern - * through callback, replacing those values with the returned result - * of callback. - * - * This method is useful if you are using a custom unit or function - * and need to iterate through all values. - * - * ```js - * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => { - * return 15 * parseInt(string) + 'px' - * }) - * ``` - * - * @param pattern Replace pattern. - * @param {object} options Options to speed up the search. - * @param replaced String to replace pattern or callback - * that returns a new value. The callback - * will receive the same arguments - * as those passed to a function parameter - * of `String#replace`. - * @return This node for methods chain. - */ - replaceValues( - pattern: RegExp | string, - options: Container.ValueOptions, - replaced: { (substring: string, ...args: any[]): string } | string - ): this - - /** - * Returns `true` if callback returns `true` for (at least) one - * of the container’s children. - * - * ```js - * const hasPrefix = rule.some(i => i.prop[0] === '-') - * ``` - * - * @param condition Iterator returns true or false. - * @return Is some child pass condition. - */ - some( - condition: (node: Child, index: number, nodes: Child[]) => boolean - ): boolean - - /** - * Traverses the container’s descendant nodes, calling callback - * for each node. - * - * Like container.each(), this method is safe to use - * if you are mutating arrays during iteration. - * - * If you only need to iterate through the container’s immediate children, - * use `Container#each`. - * - * ```js - * root.walk(node => { - * // Traverses all descendant nodes. - * }) - * ``` - * - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - walk( - callback: (node: ChildNode, index: number) => false | void - ): false | undefined - - /** - * Traverses the container’s descendant nodes, calling callback - * for each at-rule node. - * - * If you pass a filter, iteration will only happen over at-rules - * that have matching names. - * - * Like `Container#each`, this method is safe - * to use if you are mutating arrays during iteration. - * - * ```js - * root.walkAtRules(rule => { - * if (isOld(rule.name)) rule.remove() - * }) - * - * let first = false - * root.walkAtRules('charset', rule => { - * if (!first) { - * first = true - * } else { - * rule.remove() - * } - * }) - * ``` - * - * @param name String or regular expression to filter at-rules by name. - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - walkAtRules( - nameFilter: RegExp | string, - callback: (atRule: AtRule, index: number) => false | void - ): false | undefined - walkAtRules( - callback: (atRule: AtRule, index: number) => false | void - ): false | undefined - - walkComments( - callback: (comment: Comment, indexed: number) => false | void - ): false | undefined - walkComments( - callback: (comment: Comment, indexed: number) => false | void - ): false | undefined - - /** - * Traverses the container’s descendant nodes, calling callback - * for each declaration node. - * - * If you pass a filter, iteration will only happen over declarations - * with matching properties. - * - * ```js - * root.walkDecls(decl => { - * checkPropertySupport(decl.prop) - * }) - * - * root.walkDecls('border-radius', decl => { - * decl.remove() - * }) - * - * root.walkDecls(/^background/, decl => { - * decl.value = takeFirstColorFromGradient(decl.value) - * }) - * ``` - * - * Like `Container#each`, this method is safe - * to use if you are mutating arrays during iteration. - * - * @param prop String or regular expression to filter declarations - * by property name. - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - walkDecls( - propFilter: RegExp | string, - callback: (decl: Declaration, index: number) => false | void - ): false | undefined - walkDecls( - callback: (decl: Declaration, index: number) => false | void - ): false | undefined - /** - * Traverses the container’s descendant nodes, calling callback - * for each rule node. - * - * If you pass a filter, iteration will only happen over rules - * with matching selectors. - * - * Like `Container#each`, this method is safe - * to use if you are mutating arrays during iteration. - * - * ```js - * const selectors = [] - * root.walkRules(rule => { - * selectors.push(rule.selector) - * }) - * console.log(`Your CSS uses ${ selectors.length } selectors`) - * ``` - * - * @param selector String or regular expression to filter rules by selector. - * @param callback Iterator receives each node and index. - * @return Returns `false` if iteration was broke. - */ - walkRules( - selectorFilter: RegExp | string, - callback: (rule: Rule, index: number) => false | void - ): false | undefined - walkRules( - callback: (rule: Rule, index: number) => false | void - ): false | undefined - /** - * An internal method that converts a {@link NewChild} into a list of actual - * child nodes that can then be added to this container. - * - * This ensures that the nodes' parent is set to this container, that they use - * the correct prototype chain, and that they're marked as dirty. - * - * @param mnodes The new node or nodes to add. - * @param sample A node from whose raws the new node's `before` raw should be - * taken. - * @param type This should be set to `'prepend'` if the new nodes will be - * inserted at the beginning of the container. - * @hidden - */ - protected normalize( - nodes: Container.NewChild, - sample: Node | undefined, - type?: 'prepend' | false - ): Child[] -} - -declare class Container< - Child extends Node = ChildNode -> extends Container_ {} - -export = Container diff --git a/node_modules/postcss/lib/container.js b/node_modules/postcss/lib/container.js deleted file mode 100644 index edb07cc..0000000 --- a/node_modules/postcss/lib/container.js +++ /dev/null @@ -1,447 +0,0 @@ -'use strict' - -let Comment = require('./comment') -let Declaration = require('./declaration') -let Node = require('./node') -let { isClean, my } = require('./symbols') - -let AtRule, parse, Root, Rule - -function cleanSource(nodes) { - return nodes.map(i => { - if (i.nodes) i.nodes = cleanSource(i.nodes) - delete i.source - return i - }) -} - -function markTreeDirty(node) { - node[isClean] = false - if (node.proxyOf.nodes) { - for (let i of node.proxyOf.nodes) { - markTreeDirty(i) - } - } -} - -class Container extends Node { - get first() { - if (!this.proxyOf.nodes) return undefined - return this.proxyOf.nodes[0] - } - - get last() { - if (!this.proxyOf.nodes) return undefined - return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] - } - - append(...children) { - for (let child of children) { - let nodes = this.normalize(child, this.last) - for (let node of nodes) this.proxyOf.nodes.push(node) - } - - this.markDirty() - - return this - } - - cleanRaws(keepBetween) { - super.cleanRaws(keepBetween) - if (this.nodes) { - for (let node of this.nodes) node.cleanRaws(keepBetween) - } - } - - each(callback) { - if (!this.proxyOf.nodes) return undefined - let iterator = this.getIterator() - - let index, result - while (this.indexes[iterator] < this.proxyOf.nodes.length) { - index = this.indexes[iterator] - result = callback(this.proxyOf.nodes[index], index) - if (result === false) break - - this.indexes[iterator] += 1 - } - - delete this.indexes[iterator] - return result - } - - every(condition) { - return this.nodes.every(condition) - } - - getIterator() { - if (!this.lastEach) this.lastEach = 0 - if (!this.indexes) this.indexes = {} - - this.lastEach += 1 - let iterator = this.lastEach - this.indexes[iterator] = 0 - - return iterator - } - - getProxyProcessor() { - return { - get(node, prop) { - if (prop === 'proxyOf') { - return node - } else if (!node[prop]) { - return node[prop] - } else if ( - prop === 'each' || - (typeof prop === 'string' && prop.startsWith('walk')) - ) { - return (...args) => { - return node[prop]( - ...args.map(i => { - if (typeof i === 'function') { - return (child, index) => i(child.toProxy(), index) - } else { - return i - } - }) - ) - } - } else if (prop === 'every' || prop === 'some') { - return cb => { - return node[prop]((child, ...other) => - cb(child.toProxy(), ...other) - ) - } - } else if (prop === 'root') { - return () => node.root().toProxy() - } else if (prop === 'nodes') { - return node.nodes.map(i => i.toProxy()) - } else if (prop === 'first' || prop === 'last') { - return node[prop].toProxy() - } else { - return node[prop] - } - }, - - set(node, prop, value) { - if (node[prop] === value) return true - node[prop] = value - if (prop === 'name' || prop === 'params' || prop === 'selector') { - node.markDirty() - } - return true - } - } - } - - index(child) { - if (typeof child === 'number') return child - if (child.proxyOf) child = child.proxyOf - return this.proxyOf.nodes.indexOf(child) - } - - insertAfter(exist, add) { - let existIndex = this.index(exist) - let nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse() - existIndex = this.index(exist) - for (let node of nodes) this.proxyOf.nodes.splice(existIndex + 1, 0, node) - - let index - for (let id in this.indexes) { - index = this.indexes[id] - if (existIndex < index) { - this.indexes[id] = index + nodes.length - } - } - - this.markDirty() - - return this - } - - insertBefore(exist, add) { - let existIndex = this.index(exist) - let type = existIndex === 0 ? 'prepend' : false - let nodes = this.normalize( - add, - this.proxyOf.nodes[existIndex], - type - ).reverse() - existIndex = this.index(exist) - for (let node of nodes) this.proxyOf.nodes.splice(existIndex, 0, node) - - let index - for (let id in this.indexes) { - index = this.indexes[id] - if (existIndex <= index) { - this.indexes[id] = index + nodes.length - } - } - - this.markDirty() - - return this - } - - normalize(nodes, sample) { - if (typeof nodes === 'string') { - nodes = cleanSource(parse(nodes).nodes) - } else if (typeof nodes === 'undefined') { - nodes = [] - } else if (Array.isArray(nodes)) { - nodes = nodes.slice(0) - for (let i of nodes) { - if (i.parent) i.parent.removeChild(i, 'ignore') - } - } else if (nodes.type === 'root' && this.type !== 'document') { - nodes = nodes.nodes.slice(0) - for (let i of nodes) { - if (i.parent) i.parent.removeChild(i, 'ignore') - } - } else if (nodes.type) { - nodes = [nodes] - } else if (nodes.prop) { - if (typeof nodes.value === 'undefined') { - throw new Error('Value field is missed in node creation') - } else if (typeof nodes.value !== 'string') { - nodes.value = String(nodes.value) - } - nodes = [new Declaration(nodes)] - } else if (nodes.selector || nodes.selectors) { - nodes = [new Rule(nodes)] - } else if (nodes.name) { - nodes = [new AtRule(nodes)] - } else if (nodes.text) { - nodes = [new Comment(nodes)] - } else { - throw new Error('Unknown node type in node creation') - } - - let processed = nodes.map(i => { - /* c8 ignore next */ - if (!i[my]) Container.rebuild(i) - i = i.proxyOf - if (i.parent) i.parent.removeChild(i) - if (i[isClean]) markTreeDirty(i) - - if (!i.raws) i.raws = {} - if (typeof i.raws.before === 'undefined') { - if (sample && typeof sample.raws.before !== 'undefined') { - i.raws.before = sample.raws.before.replace(/\S/g, '') - } - } - i.parent = this.proxyOf - return i - }) - - return processed - } - - prepend(...children) { - children = children.reverse() - for (let child of children) { - let nodes = this.normalize(child, this.first, 'prepend').reverse() - for (let node of nodes) this.proxyOf.nodes.unshift(node) - for (let id in this.indexes) { - this.indexes[id] = this.indexes[id] + nodes.length - } - } - - this.markDirty() - - return this - } - - push(child) { - child.parent = this - this.proxyOf.nodes.push(child) - return this - } - - removeAll() { - for (let node of this.proxyOf.nodes) node.parent = undefined - this.proxyOf.nodes = [] - - this.markDirty() - - return this - } - - removeChild(child) { - child = this.index(child) - this.proxyOf.nodes[child].parent = undefined - this.proxyOf.nodes.splice(child, 1) - - let index - for (let id in this.indexes) { - index = this.indexes[id] - if (index >= child) { - this.indexes[id] = index - 1 - } - } - - this.markDirty() - - return this - } - - replaceValues(pattern, opts, callback) { - if (!callback) { - callback = opts - opts = {} - } - - this.walkDecls(decl => { - if (opts.props && !opts.props.includes(decl.prop)) return - if (opts.fast && !decl.value.includes(opts.fast)) return - - decl.value = decl.value.replace(pattern, callback) - }) - - this.markDirty() - - return this - } - - some(condition) { - return this.nodes.some(condition) - } - - walk(callback) { - return this.each((child, i) => { - let result - try { - result = callback(child, i) - } catch (e) { - throw child.addToError(e) - } - if (result !== false && child.walk) { - result = child.walk(callback) - } - - return result - }) - } - - walkAtRules(name, callback) { - if (!callback) { - callback = name - return this.walk((child, i) => { - if (child.type === 'atrule') { - return callback(child, i) - } - }) - } - if (name instanceof RegExp) { - return this.walk((child, i) => { - if (child.type === 'atrule' && name.test(child.name)) { - return callback(child, i) - } - }) - } - return this.walk((child, i) => { - if (child.type === 'atrule' && child.name === name) { - return callback(child, i) - } - }) - } - - walkComments(callback) { - return this.walk((child, i) => { - if (child.type === 'comment') { - return callback(child, i) - } - }) - } - - walkDecls(prop, callback) { - if (!callback) { - callback = prop - return this.walk((child, i) => { - if (child.type === 'decl') { - return callback(child, i) - } - }) - } - if (prop instanceof RegExp) { - return this.walk((child, i) => { - if (child.type === 'decl' && prop.test(child.prop)) { - return callback(child, i) - } - }) - } - return this.walk((child, i) => { - if (child.type === 'decl' && child.prop === prop) { - return callback(child, i) - } - }) - } - - walkRules(selector, callback) { - if (!callback) { - callback = selector - - return this.walk((child, i) => { - if (child.type === 'rule') { - return callback(child, i) - } - }) - } - if (selector instanceof RegExp) { - return this.walk((child, i) => { - if (child.type === 'rule' && selector.test(child.selector)) { - return callback(child, i) - } - }) - } - return this.walk((child, i) => { - if (child.type === 'rule' && child.selector === selector) { - return callback(child, i) - } - }) - } -} - -Container.registerParse = dependant => { - parse = dependant -} - -Container.registerRule = dependant => { - Rule = dependant -} - -Container.registerAtRule = dependant => { - AtRule = dependant -} - -Container.registerRoot = dependant => { - Root = dependant -} - -module.exports = Container -Container.default = Container - -/* c8 ignore start */ -Container.rebuild = node => { - if (node.type === 'atrule') { - Object.setPrototypeOf(node, AtRule.prototype) - } else if (node.type === 'rule') { - Object.setPrototypeOf(node, Rule.prototype) - } else if (node.type === 'decl') { - Object.setPrototypeOf(node, Declaration.prototype) - } else if (node.type === 'comment') { - Object.setPrototypeOf(node, Comment.prototype) - } else if (node.type === 'root') { - Object.setPrototypeOf(node, Root.prototype) - } - - node[my] = true - - if (node.nodes) { - node.nodes.forEach(child => { - Container.rebuild(child) - }) - } -} -/* c8 ignore stop */ diff --git a/node_modules/postcss/lib/css-syntax-error.d.ts b/node_modules/postcss/lib/css-syntax-error.d.ts deleted file mode 100644 index e540d84..0000000 --- a/node_modules/postcss/lib/css-syntax-error.d.ts +++ /dev/null @@ -1,248 +0,0 @@ -import { FilePosition } from './input.js' - -declare namespace CssSyntaxError { - /** - * A position that is part of a range. - */ - export interface RangePosition { - /** - * The column number in the input. - */ - column: number - - /** - * The line number in the input. - */ - line: number - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { CssSyntaxError_ as default } -} - -/** - * The CSS parser throws this error for broken CSS. - * - * Custom parsers can throw this error for broken custom syntax using - * the `Node#error` method. - * - * PostCSS will use the input source map to detect the original error location. - * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, - * PostCSS will show the original position in the Sass file. - * - * If you need the position in the PostCSS input - * (e.g., to debug the previous compiler), use `error.input.file`. - * - * ```js - * // Raising error from plugin - * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) - * ``` - * - * ```js - * // Catching and checking syntax error - * try { - * postcss.parse('a{') - * } catch (error) { - * if (error.name === 'CssSyntaxError') { - * error //=> CssSyntaxError - * } - * } - * ``` - */ -declare class CssSyntaxError_ extends Error { - /** - * Source column of the error. - * - * ```js - * error.column //=> 1 - * error.input.column //=> 4 - * ``` - * - * PostCSS will use the input source map to detect the original location. - * If you need the position in the PostCSS input, use `error.input.column`. - */ - column?: number - - /** - * Source column of the error's end, exclusive. Provided if the error pertains - * to a range. - * - * ```js - * error.endColumn //=> 1 - * error.input.endColumn //=> 4 - * ``` - * - * PostCSS will use the input source map to detect the original location. - * If you need the position in the PostCSS input, use `error.input.endColumn`. - */ - endColumn?: number - - /** - * Source line of the error's end, exclusive. Provided if the error pertains - * to a range. - * - * ```js - * error.endLine //=> 3 - * error.input.endLine //=> 4 - * ``` - * - * PostCSS will use the input source map to detect the original location. - * If you need the position in the PostCSS input, use `error.input.endLine`. - */ - endLine?: number - - /** - * Absolute path to the broken file. - * - * ```js - * error.file //=> 'a.sass' - * error.input.file //=> 'a.css' - * ``` - * - * PostCSS will use the input source map to detect the original location. - * If you need the position in the PostCSS input, use `error.input.file`. - */ - file?: string - - /** - * Input object with PostCSS internal information - * about input file. If input has source map - * from previous tool, PostCSS will use origin - * (for example, Sass) source. You can use this - * object to get PostCSS input source. - * - * ```js - * error.input.file //=> 'a.css' - * error.file //=> 'a.sass' - * ``` - */ - input?: FilePosition - - /** - * Source line of the error. - * - * ```js - * error.line //=> 2 - * error.input.line //=> 4 - * ``` - * - * PostCSS will use the input source map to detect the original location. - * If you need the position in the PostCSS input, use `error.input.line`. - */ - line?: number - - /** - * Full error text in the GNU error format - * with plugin, file, line and column. - * - * ```js - * error.message //=> 'a.css:1:1: Unclosed block' - * ``` - */ - message: string - - /** - * Always equal to `'CssSyntaxError'`. You should always check error type - * by `error.name === 'CssSyntaxError'` - * instead of `error instanceof CssSyntaxError`, - * because npm could have several PostCSS versions. - * - * ```js - * if (error.name === 'CssSyntaxError') { - * error //=> CssSyntaxError - * } - * ``` - */ - name: 'CssSyntaxError' - - /** - * Plugin name, if error came from plugin. - * - * ```js - * error.plugin //=> 'postcss-vars' - * ``` - */ - plugin?: string - - /** - * Error message. - * - * ```js - * error.message //=> 'Unclosed block' - * ``` - */ - reason: string - - /** - * Source code of the broken file. - * - * ```js - * error.source //=> 'a { b {} }' - * error.input.source //=> 'a b { }' - * ``` - */ - source?: string - - stack: string - - /** - * Instantiates a CSS syntax error. Can be instantiated for a single position - * or for a range. - * @param message Error message. - * @param lineOrStartPos If for a single position, the line number, or if for - * a range, the inclusive start position of the error. - * @param columnOrEndPos If for a single position, the column number, or if for - * a range, the exclusive end position of the error. - * @param source Source code of the broken file. - * @param file Absolute path to the broken file. - * @param plugin PostCSS plugin name, if error came from plugin. - */ - constructor( - message: string, - lineOrStartPos?: CssSyntaxError.RangePosition | number, - columnOrEndPos?: CssSyntaxError.RangePosition | number, - source?: string, - file?: string, - plugin?: string - ) - - /** - * Returns a few lines of CSS source that caused the error. - * - * If the CSS has an input source map without `sourceContent`, - * this method will return an empty string. - * - * ```js - * error.showSourceCode() //=> " 4 | } - * // 5 | a { - * // > 6 | bad - * // | ^ - * // 7 | } - * // 8 | b {" - * ``` - * - * @param color Whether arrow will be colored red by terminal - * color codes. By default, PostCSS will detect - * color support by `process.stdout.isTTY` - * and `process.env.NODE_DISABLE_COLORS`. - * @return Few lines of CSS source that caused the error. - */ - showSourceCode(color?: boolean): string - - /** - * Returns error position, message and source code of the broken part. - * - * ```js - * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block - * // > 1 | a { - * // | ^" - * ``` - * - * @return Error position, message and source code. - */ - toString(): string -} - -declare class CssSyntaxError extends CssSyntaxError_ {} - -export = CssSyntaxError diff --git a/node_modules/postcss/lib/css-syntax-error.js b/node_modules/postcss/lib/css-syntax-error.js deleted file mode 100644 index 275a4f6..0000000 --- a/node_modules/postcss/lib/css-syntax-error.js +++ /dev/null @@ -1,133 +0,0 @@ -'use strict' - -let pico = require('picocolors') - -let terminalHighlight = require('./terminal-highlight') - -class CssSyntaxError extends Error { - constructor(message, line, column, source, file, plugin) { - super(message) - this.name = 'CssSyntaxError' - this.reason = message - - if (file) { - this.file = file - } - if (source) { - this.source = source - } - if (plugin) { - this.plugin = plugin - } - if (typeof line !== 'undefined' && typeof column !== 'undefined') { - if (typeof line === 'number') { - this.line = line - this.column = column - } else { - this.line = line.line - this.column = line.column - this.endLine = column.line - this.endColumn = column.column - } - } - - this.setMessage() - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, CssSyntaxError) - } - } - - setMessage() { - this.message = this.plugin ? this.plugin + ': ' : '' - this.message += this.file ? this.file : '' - if (typeof this.line !== 'undefined') { - this.message += ':' + this.line + ':' + this.column - } - this.message += ': ' + this.reason - } - - showSourceCode(color) { - if (!this.source) return '' - - let css = this.source - if (color == null) color = pico.isColorSupported - - let aside = text => text - let mark = text => text - let highlight = text => text - if (color) { - let { bold, gray, red } = pico.createColors(true) - mark = text => bold(red(text)) - aside = text => gray(text) - if (terminalHighlight) { - highlight = text => terminalHighlight(text) - } - } - - let lines = css.split(/\r?\n/) - let start = Math.max(this.line - 3, 0) - let end = Math.min(this.line + 2, lines.length) - let maxWidth = String(end).length - - return lines - .slice(start, end) - .map((line, index) => { - let number = start + 1 + index - let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' - if (number === this.line) { - if (line.length > 160) { - let padding = 20 - let subLineStart = Math.max(0, this.column - padding) - let subLineEnd = Math.max( - this.column + padding, - this.endColumn + padding - ) - let subLine = line.slice(subLineStart, subLineEnd) - - let spacing = - aside(gutter.replace(/\d/g, ' ')) + - line - .slice(0, Math.min(this.column - 1, padding - 1)) - .replace(/[^\t]/g, ' ') - - return ( - mark('>') + - aside(gutter) + - highlight(subLine) + - '\n ' + - spacing + - mark('^') - ) - } - - let spacing = - aside(gutter.replace(/\d/g, ' ')) + - line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') - - return ( - mark('>') + - aside(gutter) + - highlight(line) + - '\n ' + - spacing + - mark('^') - ) - } - - return ' ' + aside(gutter) + highlight(line) - }) - .join('\n') - } - - toString() { - let code = this.showSourceCode() - if (code) { - code = '\n\n' + code + '\n' - } - return this.name + ': ' + this.message + code - } -} - -module.exports = CssSyntaxError -CssSyntaxError.default = CssSyntaxError diff --git a/node_modules/postcss/lib/declaration.d.ts b/node_modules/postcss/lib/declaration.d.ts deleted file mode 100644 index d489b42..0000000 --- a/node_modules/postcss/lib/declaration.d.ts +++ /dev/null @@ -1,151 +0,0 @@ -import { ContainerWithChildren } from './container.js' -import Node from './node.js' - -declare namespace Declaration { - export interface DeclarationRaws extends Record { - /** - * The space symbols before the node. It also stores `*` - * and `_` symbols before the declaration (IE hack). - */ - before?: string - - /** - * The symbols between the property and value for declarations. - */ - between?: string - - /** - * The content of the important statement, if it is not just `!important`. - */ - important?: string - - /** - * Declaration value with comments. - */ - value?: { - raw: string - value: string - } - } - - export interface DeclarationProps { - /** Whether the declaration has an `!important` annotation. */ - important?: boolean - /** Name of the declaration. */ - prop: string - /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ - raws?: DeclarationRaws - /** Value of the declaration. */ - value: string - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { Declaration_ as default } -} - -/** - * It represents a class that handles - * [CSS declarations](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax#css_declarations) - * - * ```js - * Once (root, { Declaration }) { - * const color = new Declaration({ prop: 'color', value: 'black' }) - * root.append(color) - * } - * ``` - * - * ```js - * const root = postcss.parse('a { color: black }') - * const decl = root.first?.first - * - * decl.type //=> 'decl' - * decl.toString() //=> ' color: black' - * ``` - */ -declare class Declaration_ extends Node { - parent: ContainerWithChildren | undefined - raws: Declaration.DeclarationRaws - - type: 'decl' - - /** - * It represents a specificity of the declaration. - * - * If true, the CSS declaration will have an - * [important](https://developer.mozilla.org/en-US/docs/Web/CSS/important) - * specifier. - * - * ```js - * const root = postcss.parse('a { color: black !important; color: red }') - * - * root.first.first.important //=> true - * root.first.last.important //=> undefined - * ``` - */ - get important(): boolean - set important(value: boolean) - - /** - * The property name for a CSS declaration. - * - * ```js - * const root = postcss.parse('a { color: black }') - * const decl = root.first.first - * - * decl.prop //=> 'color' - * ``` - */ - get prop(): string - - set prop(value: string) - - /** - * The property value for a CSS declaration. - * - * Any CSS comments inside the value string will be filtered out. - * CSS comments present in the source value will be available in - * the `raws` property. - * - * Assigning new `value` would ignore the comments in `raws` - * property while compiling node to string. - * - * ```js - * const root = postcss.parse('a { color: black }') - * const decl = root.first.first - * - * decl.value //=> 'black' - * ``` - */ - get value(): string - set value(value: string) - - /** - * It represents a getter that returns `true` if a declaration starts with - * `--` or `$`, which are used to declare variables in CSS and SASS/SCSS. - * - * ```js - * const root = postcss.parse(':root { --one: 1 }') - * const one = root.first.first - * - * one.variable //=> true - * ``` - * - * ```js - * const root = postcss.parse('$one: 1') - * const one = root.first - * - * one.variable //=> true - * ``` - */ - get variable(): boolean - constructor(defaults?: Declaration.DeclarationProps) - - assign(overrides: Declaration.DeclarationProps | object): this - clone(overrides?: Partial): this - cloneAfter(overrides?: Partial): this - cloneBefore(overrides?: Partial): this -} - -declare class Declaration extends Declaration_ {} - -export = Declaration diff --git a/node_modules/postcss/lib/declaration.js b/node_modules/postcss/lib/declaration.js deleted file mode 100644 index 65a03aa..0000000 --- a/node_modules/postcss/lib/declaration.js +++ /dev/null @@ -1,24 +0,0 @@ -'use strict' - -let Node = require('./node') - -class Declaration extends Node { - get variable() { - return this.prop.startsWith('--') || this.prop[0] === '$' - } - - constructor(defaults) { - if ( - defaults && - typeof defaults.value !== 'undefined' && - typeof defaults.value !== 'string' - ) { - defaults = { ...defaults, value: String(defaults.value) } - } - super(defaults) - this.type = 'decl' - } -} - -module.exports = Declaration -Declaration.default = Declaration diff --git a/node_modules/postcss/lib/document.d.ts b/node_modules/postcss/lib/document.d.ts deleted file mode 100644 index f9e8063..0000000 --- a/node_modules/postcss/lib/document.d.ts +++ /dev/null @@ -1,69 +0,0 @@ -import Container, { ContainerProps } from './container.js' -import { ProcessOptions } from './postcss.js' -import Result from './result.js' -import Root from './root.js' - -declare namespace Document { - export interface DocumentProps extends ContainerProps { - nodes?: readonly Root[] - - /** - * Information to generate byte-to-byte equal node string as it was - * in the origin input. - * - * Every parser saves its own properties. - */ - raws?: Record - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { Document_ as default } -} - -/** - * Represents a file and contains all its parsed nodes. - * - * **Experimental:** some aspects of this node could change within minor - * or patch version releases. - * - * ```js - * const document = htmlParser( - * '' - * ) - * document.type //=> 'document' - * document.nodes.length //=> 2 - * ``` - */ -declare class Document_ extends Container { - nodes: Root[] - parent: undefined - type: 'document' - - constructor(defaults?: Document.DocumentProps) - - assign(overrides: Document.DocumentProps | object): this - clone(overrides?: Partial): this - cloneAfter(overrides?: Partial): this - cloneBefore(overrides?: Partial): this - - /** - * Returns a `Result` instance representing the document’s CSS roots. - * - * ```js - * const root1 = postcss.parse(css1, { from: 'a.css' }) - * const root2 = postcss.parse(css2, { from: 'b.css' }) - * const document = postcss.document() - * document.append(root1) - * document.append(root2) - * const result = document.toResult({ to: 'all.css', map: true }) - * ``` - * - * @param opts Options. - * @return Result with current document’s CSS. - */ - toResult(options?: ProcessOptions): Result -} - -declare class Document extends Document_ {} - -export = Document diff --git a/node_modules/postcss/lib/document.js b/node_modules/postcss/lib/document.js deleted file mode 100644 index 4468991..0000000 --- a/node_modules/postcss/lib/document.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict' - -let Container = require('./container') - -let LazyResult, Processor - -class Document extends Container { - constructor(defaults) { - // type needs to be passed to super, otherwise child roots won't be normalized correctly - super({ type: 'document', ...defaults }) - - if (!this.nodes) { - this.nodes = [] - } - } - - toResult(opts = {}) { - let lazy = new LazyResult(new Processor(), this, opts) - - return lazy.stringify() - } -} - -Document.registerLazyResult = dependant => { - LazyResult = dependant -} - -Document.registerProcessor = dependant => { - Processor = dependant -} - -module.exports = Document -Document.default = Document diff --git a/node_modules/postcss/lib/fromJSON.d.ts b/node_modules/postcss/lib/fromJSON.d.ts deleted file mode 100644 index e1deedb..0000000 --- a/node_modules/postcss/lib/fromJSON.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { JSONHydrator } from './postcss.js' - -interface FromJSON extends JSONHydrator { - default: FromJSON -} - -declare const fromJSON: FromJSON - -export = fromJSON diff --git a/node_modules/postcss/lib/fromJSON.js b/node_modules/postcss/lib/fromJSON.js deleted file mode 100644 index c9ac1a8..0000000 --- a/node_modules/postcss/lib/fromJSON.js +++ /dev/null @@ -1,54 +0,0 @@ -'use strict' - -let AtRule = require('./at-rule') -let Comment = require('./comment') -let Declaration = require('./declaration') -let Input = require('./input') -let PreviousMap = require('./previous-map') -let Root = require('./root') -let Rule = require('./rule') - -function fromJSON(json, inputs) { - if (Array.isArray(json)) return json.map(n => fromJSON(n)) - - let { inputs: ownInputs, ...defaults } = json - if (ownInputs) { - inputs = [] - for (let input of ownInputs) { - let inputHydrated = { ...input, __proto__: Input.prototype } - if (inputHydrated.map) { - inputHydrated.map = { - ...inputHydrated.map, - __proto__: PreviousMap.prototype - } - } - inputs.push(inputHydrated) - } - } - if (defaults.nodes) { - defaults.nodes = json.nodes.map(n => fromJSON(n, inputs)) - } - if (defaults.source) { - let { inputId, ...source } = defaults.source - defaults.source = source - if (inputId != null) { - defaults.source.input = inputs[inputId] - } - } - if (defaults.type === 'root') { - return new Root(defaults) - } else if (defaults.type === 'decl') { - return new Declaration(defaults) - } else if (defaults.type === 'rule') { - return new Rule(defaults) - } else if (defaults.type === 'comment') { - return new Comment(defaults) - } else if (defaults.type === 'atrule') { - return new AtRule(defaults) - } else { - throw new Error('Unknown node type: ' + json.type) - } -} - -module.exports = fromJSON -fromJSON.default = fromJSON diff --git a/node_modules/postcss/lib/input.d.ts b/node_modules/postcss/lib/input.d.ts deleted file mode 100644 index 3207da3..0000000 --- a/node_modules/postcss/lib/input.d.ts +++ /dev/null @@ -1,227 +0,0 @@ -import { CssSyntaxError, ProcessOptions } from './postcss.js' -import PreviousMap from './previous-map.js' - -declare namespace Input { - export interface FilePosition { - /** - * Column of inclusive start position in source file. - */ - column: number - - /** - * Column of exclusive end position in source file. - */ - endColumn?: number - - /** - * Line of exclusive end position in source file. - */ - endLine?: number - - /** - * Offset of exclusive end position in source file. - */ - endOffset?: number - - /** - * Absolute path to the source file. - */ - file?: string - - /** - * Line of inclusive start position in source file. - */ - line: number - - /** - * Offset of inclusive start position in source file. - */ - offset: number - - /** - * Source code. - */ - source?: string - - /** - * URL for the source file. - */ - url: string - } - - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { Input_ as default } -} - -/** - * Represents the source CSS. - * - * ```js - * const root = postcss.parse(css, { from: file }) - * const input = root.source.input - * ``` - */ -declare class Input_ { - /** - * Input CSS source. - * - * ```js - * const input = postcss.parse('a{}', { from: file }).input - * input.css //=> "a{}" - * ``` - */ - css: string - - /** - * Input source with support for non-CSS documents. - * - * ```js - * const input = postcss.parse('a{}', { from: file, document: '' }).input - * input.document //=> "" - * input.css //=> "a{}" - * ``` - */ - document: string - - /** - * The absolute path to the CSS source file defined - * with the `from` option. - * - * ```js - * const root = postcss.parse(css, { from: 'a.css' }) - * root.source.input.file //=> '/home/ai/a.css' - * ``` - */ - file?: string - - /** - * The flag to indicate whether or not the source code has Unicode BOM. - */ - hasBOM: boolean - - /** - * The unique ID of the CSS source. It will be created if `from` option - * is not provided (because PostCSS does not know the file path). - * - * ```js - * const root = postcss.parse(css) - * root.source.input.file //=> undefined - * root.source.input.id //=> "" - * ``` - */ - id?: string - - /** - * The input source map passed from a compilation step before PostCSS - * (for example, from Sass compiler). - * - * ```js - * root.source.input.map.consumer().sources //=> ['a.sass'] - * ``` - */ - map: PreviousMap - - /** - * The CSS source identifier. Contains `Input#file` if the user - * set the `from` option, or `Input#id` if they did not. - * - * ```js - * const root = postcss.parse(css, { from: 'a.css' }) - * root.source.input.from //=> "/home/ai/a.css" - * - * const root = postcss.parse(css) - * root.source.input.from //=> "" - * ``` - */ - get from(): string - - /** - * @param css Input CSS source. - * @param opts Process options. - */ - constructor(css: string, opts?: ProcessOptions) - - /** - * Returns `CssSyntaxError` with information about the error and its position. - */ - error( - message: string, - start: - | { - column: number - line: number - } - | { - offset: number - }, - end: - | { - column: number - line: number - } - | { - offset: number - }, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - error( - message: string, - line: number, - column: number, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - error( - message: string, - offset: number, - opts?: { plugin?: CssSyntaxError['plugin'] } - ): CssSyntaxError - - /** - * Converts source line and column to offset. - * - * @param line Source line. - * @param column Source column. - * @return Source offset. - */ - fromLineAndColumn(line: number, column: number): number - - /** - * Converts source offset to line and column. - * - * @param offset Source offset. - */ - fromOffset(offset: number): { col: number; line: number } | null - - /** - * Reads the input source map and returns a symbol position - * in the input source (e.g., in a Sass file that was compiled - * to CSS before being passed to PostCSS). Optionally takes an - * end position, exclusive. - * - * ```js - * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } - * root.source.input.origin(1, 1, 1, 4) - * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } - * ``` - * - * @param line Line for inclusive start position in input CSS. - * @param column Column for inclusive start position in input CSS. - * @param endLine Line for exclusive end position in input CSS. - * @param endColumn Column for exclusive end position in input CSS. - * - * @return Position in input source. - */ - origin( - line: number, - column: number, - endLine?: number, - endColumn?: number - ): false | Input.FilePosition - - /** Converts this to a JSON-friendly object representation. */ - toJSON(): object -} - -declare class Input extends Input_ {} - -export = Input diff --git a/node_modules/postcss/lib/input.js b/node_modules/postcss/lib/input.js deleted file mode 100644 index bb0ccf5..0000000 --- a/node_modules/postcss/lib/input.js +++ /dev/null @@ -1,265 +0,0 @@ -'use strict' - -let { nanoid } = require('nanoid/non-secure') -let { isAbsolute, resolve } = require('path') -let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') -let { fileURLToPath, pathToFileURL } = require('url') - -let CssSyntaxError = require('./css-syntax-error') -let PreviousMap = require('./previous-map') -let terminalHighlight = require('./terminal-highlight') - -let lineToIndexCache = Symbol('lineToIndexCache') - -let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) -let pathAvailable = Boolean(resolve && isAbsolute) - -function getLineToIndex(input) { - if (input[lineToIndexCache]) return input[lineToIndexCache] - let lines = input.css.split('\n') - let lineToIndex = new Array(lines.length) - let prevIndex = 0 - - for (let i = 0, l = lines.length; i < l; i++) { - lineToIndex[i] = prevIndex - prevIndex += lines[i].length + 1 - } - - input[lineToIndexCache] = lineToIndex - return lineToIndex -} - -class Input { - get from() { - return this.file || this.id - } - - constructor(css, opts = {}) { - if ( - css === null || - typeof css === 'undefined' || - (typeof css === 'object' && !css.toString) - ) { - throw new Error(`PostCSS received ${css} instead of CSS string`) - } - - this.css = css.toString() - - if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { - this.hasBOM = true - this.css = this.css.slice(1) - } else { - this.hasBOM = false - } - - this.document = this.css - if (opts.document) this.document = opts.document.toString() - - if (opts.from) { - if ( - !pathAvailable || - /^\w+:\/\//.test(opts.from) || - isAbsolute(opts.from) - ) { - this.file = opts.from - } else { - this.file = resolve(opts.from) - } - } - - if (pathAvailable && sourceMapAvailable) { - let map = new PreviousMap(this.css, opts) - if (map.text) { - this.map = map - let file = map.consumer().file - if (!this.file && file) this.file = this.mapResolve(file) - } - } - - if (!this.file) { - this.id = '' - } - if (this.map) this.map.file = this.from - } - - error(message, line, column, opts = {}) { - let endColumn, endLine, endOffset, offset, result - - if (line && typeof line === 'object') { - let start = line - let end = column - if (typeof start.offset === 'number') { - offset = start.offset - let pos = this.fromOffset(offset) - line = pos.line - column = pos.col - } else { - line = start.line - column = start.column - offset = this.fromLineAndColumn(line, column) - } - if (typeof end.offset === 'number') { - endOffset = end.offset - let pos = this.fromOffset(endOffset) - endLine = pos.line - endColumn = pos.col - } else { - endLine = end.line - endColumn = end.column - endOffset = this.fromLineAndColumn(end.line, end.column) - } - } else if (!column) { - offset = line - let pos = this.fromOffset(offset) - line = pos.line - column = pos.col - } else { - offset = this.fromLineAndColumn(line, column) - } - - let origin = this.origin(line, column, endLine, endColumn) - if (origin) { - result = new CssSyntaxError( - message, - origin.endLine === undefined - ? origin.line - : { column: origin.column, line: origin.line }, - origin.endLine === undefined - ? origin.column - : { column: origin.endColumn, line: origin.endLine }, - origin.source, - origin.file, - opts.plugin - ) - } else { - result = new CssSyntaxError( - message, - endLine === undefined ? line : { column, line }, - endLine === undefined ? column : { column: endColumn, line: endLine }, - this.css, - this.file, - opts.plugin - ) - } - - result.input = { column, endColumn, endLine, endOffset, line, offset, source: this.css } - if (this.file) { - if (pathToFileURL) { - result.input.url = pathToFileURL(this.file).toString() - } - result.input.file = this.file - } - - return result - } - - fromLineAndColumn(line, column) { - let lineToIndex = getLineToIndex(this) - let index = lineToIndex[line - 1] - return index + column - 1 - } - - fromOffset(offset) { - let lineToIndex = getLineToIndex(this) - let lastLine = lineToIndex[lineToIndex.length - 1] - - let min = 0 - if (offset >= lastLine) { - min = lineToIndex.length - 1 - } else { - let max = lineToIndex.length - 2 - let mid - while (min < max) { - mid = min + ((max - min) >> 1) - if (offset < lineToIndex[mid]) { - max = mid - 1 - } else if (offset >= lineToIndex[mid + 1]) { - min = mid + 1 - } else { - min = mid - break - } - } - } - return { - col: offset - lineToIndex[min] + 1, - line: min + 1 - } - } - - mapResolve(file) { - if (/^\w+:\/\//.test(file)) { - return file - } - return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) - } - - origin(line, column, endLine, endColumn) { - if (!this.map) return false - let consumer = this.map.consumer() - - let from = consumer.originalPositionFor({ column, line }) - if (!from.source) return false - - let to - if (typeof endLine === 'number') { - to = consumer.originalPositionFor({ column: endColumn, line: endLine }) - } - - let fromUrl - - if (isAbsolute(from.source)) { - fromUrl = pathToFileURL(from.source) - } else { - fromUrl = new URL( - from.source, - this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) - ) - } - - let result = { - column: from.column, - endColumn: to && to.column, - endLine: to && to.line, - line: from.line, - url: fromUrl.toString() - } - - if (fromUrl.protocol === 'file:') { - if (fileURLToPath) { - result.file = fileURLToPath(fromUrl) - } else { - /* c8 ignore next 2 */ - throw new Error(`file: protocol is not available in this PostCSS build`) - } - } - - let source = consumer.sourceContentFor(from.source) - if (source) result.source = source - - return result - } - - toJSON() { - let json = {} - for (let name of ['hasBOM', 'css', 'file', 'id']) { - if (this[name] != null) { - json[name] = this[name] - } - } - if (this.map) { - json.map = { ...this.map } - if (json.map.consumerCache) { - json.map.consumerCache = undefined - } - } - return json - } -} - -module.exports = Input -Input.default = Input - -if (terminalHighlight && terminalHighlight.registerInput) { - terminalHighlight.registerInput(Input) -} diff --git a/node_modules/postcss/lib/lazy-result.d.ts b/node_modules/postcss/lib/lazy-result.d.ts deleted file mode 100644 index 2eb7279..0000000 --- a/node_modules/postcss/lib/lazy-result.d.ts +++ /dev/null @@ -1,190 +0,0 @@ -import Document from './document.js' -import { SourceMap } from './postcss.js' -import Processor from './processor.js' -import Result, { Message, ResultOptions } from './result.js' -import Root from './root.js' -import Warning from './warning.js' - -declare namespace LazyResult { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { LazyResult_ as default } -} - -/** - * A Promise proxy for the result of PostCSS transformations. - * - * A `LazyResult` instance is returned by `Processor#process`. - * - * ```js - * const lazy = postcss([autoprefixer]).process(css) - * ``` - */ -declare class LazyResult_ - implements PromiseLike> -{ - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls onRejected for each error thrown in any plugin. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css).then(result => { - * console.log(result.css) - * }).catch(error => { - * console.error(error) - * }) - * ``` - */ - catch: Promise>['catch'] - - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls onFinally on any error or when all plugins will finish work. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css).finally(() => { - * console.log('processing ended') - * }) - * ``` - */ - finally: Promise>['finally'] - - /** - * Processes input CSS through synchronous and asynchronous plugins - * and calls `onFulfilled` with a Result instance. If a plugin throws - * an error, the `onRejected` callback will be executed. - * - * It implements standard Promise API. - * - * ```js - * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => { - * console.log(result.css) - * }) - * ``` - */ - then: Promise>['then'] - - /** - * An alias for the `css` property. Use it with syntaxes - * that generate non-CSS output. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get content(): string - - /** - * Processes input CSS through synchronous plugins, converts `Root` - * to a CSS string and returns `Result#css`. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get css(): string - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#map`. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get map(): SourceMap - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#messages`. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get messages(): Message[] - - /** - * Options from the `Processor#process` call. - */ - get opts(): ResultOptions - - /** - * Returns a `Processor` instance, which will be used - * for CSS transformations. - */ - get processor(): Processor - - /** - * Processes input CSS through synchronous plugins - * and returns `Result#root`. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * PostCSS runners should always use `LazyResult#then`. - */ - get root(): RootNode - - /** - * Returns the default string description of an object. - * Required to implement the Promise interface. - */ - get [Symbol.toStringTag](): string - - /** - * @param processor Processor used for this transformation. - * @param css CSS to parse and transform. - * @param opts Options from the `Processor#process` or `Root#toResult`. - */ - constructor(processor: Processor, css: string, opts: ResultOptions) - - /** - * Run plugin in async way and return `Result`. - * - * @return Result with output content. - */ - async(): Promise> - - /** - * Run plugin in sync way and return `Result`. - * - * @return Result with output content. - */ - sync(): Result - - /** - * Alias for the `LazyResult#css` property. - * - * ```js - * lazy + '' === lazy.css - * ``` - * - * @return Output CSS. - */ - toString(): string - - /** - * Processes input CSS through synchronous plugins - * and calls `Result#warnings`. - * - * @return Warnings from plugins. - */ - warnings(): Warning[] -} - -declare class LazyResult< - RootNode = Document | Root -> extends LazyResult_ {} - -export = LazyResult diff --git a/node_modules/postcss/lib/lazy-result.js b/node_modules/postcss/lib/lazy-result.js deleted file mode 100644 index 1ea52b8..0000000 --- a/node_modules/postcss/lib/lazy-result.js +++ /dev/null @@ -1,550 +0,0 @@ -'use strict' - -let Container = require('./container') -let Document = require('./document') -let MapGenerator = require('./map-generator') -let parse = require('./parse') -let Result = require('./result') -let Root = require('./root') -let stringify = require('./stringify') -let { isClean, my } = require('./symbols') -let warnOnce = require('./warn-once') - -const TYPE_TO_CLASS_NAME = { - atrule: 'AtRule', - comment: 'Comment', - decl: 'Declaration', - document: 'Document', - root: 'Root', - rule: 'Rule' -} - -const PLUGIN_PROPS = { - AtRule: true, - AtRuleExit: true, - Comment: true, - CommentExit: true, - Declaration: true, - DeclarationExit: true, - Document: true, - DocumentExit: true, - Once: true, - OnceExit: true, - postcssPlugin: true, - prepare: true, - Root: true, - RootExit: true, - Rule: true, - RuleExit: true -} - -const NOT_VISITORS = { - Once: true, - postcssPlugin: true, - prepare: true -} - -const CHILDREN = 0 - -function isPromise(obj) { - return typeof obj === 'object' && typeof obj.then === 'function' -} - -function getEvents(node) { - let key = false - let type = TYPE_TO_CLASS_NAME[node.type] - if (node.type === 'decl') { - key = node.prop.toLowerCase() - } else if (node.type === 'atrule') { - key = node.name.toLowerCase() - } - - if (key && node.append) { - return [ - type, - type + '-' + key, - CHILDREN, - type + 'Exit', - type + 'Exit-' + key - ] - } else if (key) { - return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] - } else if (node.append) { - return [type, CHILDREN, type + 'Exit'] - } else { - return [type, type + 'Exit'] - } -} - -function toStack(node) { - let events - if (node.type === 'document') { - events = ['Document', CHILDREN, 'DocumentExit'] - } else if (node.type === 'root') { - events = ['Root', CHILDREN, 'RootExit'] - } else { - events = getEvents(node) - } - - return { - eventIndex: 0, - events, - iterator: 0, - node, - visitorIndex: 0, - visitors: [] - } -} - -function cleanMarks(node) { - node[isClean] = false - if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) - return node -} - -let postcss = {} - -class LazyResult { - get content() { - return this.stringify().content - } - - get css() { - return this.stringify().css - } - - get map() { - return this.stringify().map - } - - get messages() { - return this.sync().messages - } - - get opts() { - return this.result.opts - } - - get processor() { - return this.result.processor - } - - get root() { - return this.sync().root - } - - get [Symbol.toStringTag]() { - return 'LazyResult' - } - - constructor(processor, css, opts) { - this.stringified = false - this.processed = false - - let root - if ( - typeof css === 'object' && - css !== null && - (css.type === 'root' || css.type === 'document') - ) { - root = cleanMarks(css) - } else if (css instanceof LazyResult || css instanceof Result) { - root = cleanMarks(css.root) - if (css.map) { - if (typeof opts.map === 'undefined') opts.map = {} - if (!opts.map.inline) opts.map.inline = false - opts.map.prev = css.map - } - } else { - let parser = parse - if (opts.syntax) parser = opts.syntax.parse - if (opts.parser) parser = opts.parser - if (parser.parse) parser = parser.parse - - try { - root = parser(css, opts) - } catch (error) { - this.processed = true - this.error = error - } - - if (root && !root[my]) { - /* c8 ignore next 2 */ - Container.rebuild(root) - } - } - - this.result = new Result(processor, root, opts) - this.helpers = { ...postcss, postcss, result: this.result } - this.plugins = this.processor.plugins.map(plugin => { - if (typeof plugin === 'object' && plugin.prepare) { - return { ...plugin, ...plugin.prepare(this.result) } - } else { - return plugin - } - }) - } - - async() { - if (this.error) return Promise.reject(this.error) - if (this.processed) return Promise.resolve(this.result) - if (!this.processing) { - this.processing = this.runAsync() - } - return this.processing - } - - catch(onRejected) { - return this.async().catch(onRejected) - } - - finally(onFinally) { - return this.async().then(onFinally, onFinally) - } - - getAsyncError() { - throw new Error('Use process(css).then(cb) to work with async plugins') - } - - handleError(error, node) { - let plugin = this.result.lastPlugin - try { - if (node) node.addToError(error) - this.error = error - if (error.name === 'CssSyntaxError' && !error.plugin) { - error.plugin = plugin.postcssPlugin - error.setMessage() - } else if (plugin.postcssVersion) { - if (process.env.NODE_ENV !== 'production') { - let pluginName = plugin.postcssPlugin - let pluginVer = plugin.postcssVersion - let runtimeVer = this.result.processor.version - let a = pluginVer.split('.') - let b = runtimeVer.split('.') - - if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { - // eslint-disable-next-line no-console - console.error( - 'Unknown error from PostCSS plugin. Your current PostCSS ' + - 'version is ' + - runtimeVer + - ', but ' + - pluginName + - ' uses ' + - pluginVer + - '. Perhaps this is the source of the error below.' - ) - } - } - } - } catch (err) { - /* c8 ignore next 3 */ - // eslint-disable-next-line no-console - if (console && console.error) console.error(err) - } - return error - } - - prepareVisitors() { - this.listeners = {} - let add = (plugin, type, cb) => { - if (!this.listeners[type]) this.listeners[type] = [] - this.listeners[type].push([plugin, cb]) - } - for (let plugin of this.plugins) { - if (typeof plugin === 'object') { - for (let event in plugin) { - if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { - throw new Error( - `Unknown event ${event} in ${plugin.postcssPlugin}. ` + - `Try to update PostCSS (${this.processor.version} now).` - ) - } - if (!NOT_VISITORS[event]) { - if (typeof plugin[event] === 'object') { - for (let filter in plugin[event]) { - if (filter === '*') { - add(plugin, event, plugin[event][filter]) - } else { - add( - plugin, - event + '-' + filter.toLowerCase(), - plugin[event][filter] - ) - } - } - } else if (typeof plugin[event] === 'function') { - add(plugin, event, plugin[event]) - } - } - } - } - } - this.hasListener = Object.keys(this.listeners).length > 0 - } - - async runAsync() { - this.plugin = 0 - for (let i = 0; i < this.plugins.length; i++) { - let plugin = this.plugins[i] - let promise = this.runOnRoot(plugin) - if (isPromise(promise)) { - try { - await promise - } catch (error) { - throw this.handleError(error) - } - } - } - - this.prepareVisitors() - if (this.hasListener) { - let root = this.result.root - while (!root[isClean]) { - root[isClean] = true - let stack = [toStack(root)] - while (stack.length > 0) { - let promise = this.visitTick(stack) - if (isPromise(promise)) { - try { - await promise - } catch (e) { - let node = stack[stack.length - 1].node - throw this.handleError(e, node) - } - } - } - } - - if (this.listeners.OnceExit) { - for (let [plugin, visitor] of this.listeners.OnceExit) { - this.result.lastPlugin = plugin - try { - if (root.type === 'document') { - let roots = root.nodes.map(subRoot => - visitor(subRoot, this.helpers) - ) - - await Promise.all(roots) - } else { - await visitor(root, this.helpers) - } - } catch (e) { - throw this.handleError(e) - } - } - } - } - - this.processed = true - return this.stringify() - } - - runOnRoot(plugin) { - this.result.lastPlugin = plugin - try { - if (typeof plugin === 'object' && plugin.Once) { - if (this.result.root.type === 'document') { - let roots = this.result.root.nodes.map(root => - plugin.Once(root, this.helpers) - ) - - if (isPromise(roots[0])) { - return Promise.all(roots) - } - - return roots - } - - return plugin.Once(this.result.root, this.helpers) - } else if (typeof plugin === 'function') { - return plugin(this.result.root, this.result) - } - } catch (error) { - throw this.handleError(error) - } - } - - stringify() { - if (this.error) throw this.error - if (this.stringified) return this.result - this.stringified = true - - this.sync() - - let opts = this.result.opts - let str = stringify - if (opts.syntax) str = opts.syntax.stringify - if (opts.stringifier) str = opts.stringifier - if (str.stringify) str = str.stringify - - let map = new MapGenerator(str, this.result.root, this.result.opts) - let data = map.generate() - this.result.css = data[0] - this.result.map = data[1] - - return this.result - } - - sync() { - if (this.error) throw this.error - if (this.processed) return this.result - this.processed = true - - if (this.processing) { - throw this.getAsyncError() - } - - for (let plugin of this.plugins) { - let promise = this.runOnRoot(plugin) - if (isPromise(promise)) { - throw this.getAsyncError() - } - } - - this.prepareVisitors() - if (this.hasListener) { - let root = this.result.root - while (!root[isClean]) { - root[isClean] = true - this.walkSync(root) - } - if (this.listeners.OnceExit) { - if (root.type === 'document') { - for (let subRoot of root.nodes) { - this.visitSync(this.listeners.OnceExit, subRoot) - } - } else { - this.visitSync(this.listeners.OnceExit, root) - } - } - } - - return this.result - } - - then(onFulfilled, onRejected) { - if (process.env.NODE_ENV !== 'production') { - if (!('from' in this.opts)) { - warnOnce( - 'Without `from` option PostCSS could generate wrong source map ' + - 'and will not find Browserslist config. Set it to CSS file path ' + - 'or to `undefined` to prevent this warning.' - ) - } - } - return this.async().then(onFulfilled, onRejected) - } - - toString() { - return this.css - } - - visitSync(visitors, node) { - for (let [plugin, visitor] of visitors) { - this.result.lastPlugin = plugin - let promise - try { - promise = visitor(node, this.helpers) - } catch (e) { - throw this.handleError(e, node.proxyOf) - } - if (node.type !== 'root' && node.type !== 'document' && !node.parent) { - return true - } - if (isPromise(promise)) { - throw this.getAsyncError() - } - } - } - - visitTick(stack) { - let visit = stack[stack.length - 1] - let { node, visitors } = visit - - if (node.type !== 'root' && node.type !== 'document' && !node.parent) { - stack.pop() - return - } - - if (visitors.length > 0 && visit.visitorIndex < visitors.length) { - let [plugin, visitor] = visitors[visit.visitorIndex] - visit.visitorIndex += 1 - if (visit.visitorIndex === visitors.length) { - visit.visitors = [] - visit.visitorIndex = 0 - } - this.result.lastPlugin = plugin - try { - return visitor(node.toProxy(), this.helpers) - } catch (e) { - throw this.handleError(e, node) - } - } - - if (visit.iterator !== 0) { - let iterator = visit.iterator - let child - while ((child = node.nodes[node.indexes[iterator]])) { - node.indexes[iterator] += 1 - if (!child[isClean]) { - child[isClean] = true - stack.push(toStack(child)) - return - } - } - visit.iterator = 0 - delete node.indexes[iterator] - } - - let events = visit.events - while (visit.eventIndex < events.length) { - let event = events[visit.eventIndex] - visit.eventIndex += 1 - if (event === CHILDREN) { - if (node.nodes && node.nodes.length) { - node[isClean] = true - visit.iterator = node.getIterator() - } - return - } else if (this.listeners[event]) { - visit.visitors = this.listeners[event] - return - } - } - stack.pop() - } - - walkSync(node) { - node[isClean] = true - let events = getEvents(node) - for (let event of events) { - if (event === CHILDREN) { - if (node.nodes) { - node.each(child => { - if (!child[isClean]) this.walkSync(child) - }) - } - } else { - let visitors = this.listeners[event] - if (visitors) { - if (this.visitSync(visitors, node.toProxy())) return - } - } - } - } - - warnings() { - return this.sync().warnings() - } -} - -LazyResult.registerPostcss = dependant => { - postcss = dependant -} - -module.exports = LazyResult -LazyResult.default = LazyResult - -Root.registerLazyResult(LazyResult) -Document.registerLazyResult(LazyResult) diff --git a/node_modules/postcss/lib/list.d.ts b/node_modules/postcss/lib/list.d.ts deleted file mode 100644 index e262ad3..0000000 --- a/node_modules/postcss/lib/list.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -declare namespace list { - type List = { - /** - * Safely splits comma-separated values (such as those for `transition-*` - * and `background` properties). - * - * ```js - * Once (root, { list }) { - * list.comma('black, linear-gradient(white, black)') - * //=> ['black', 'linear-gradient(white, black)'] - * } - * ``` - * - * @param str Comma-separated values. - * @return Split values. - */ - comma(str: string): string[] - - default: List - - /** - * Safely splits space-separated values (such as those for `background`, - * `border-radius`, and other shorthand properties). - * - * ```js - * Once (root, { list }) { - * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)'] - * } - * ``` - * - * @param str Space-separated values. - * @return Split values. - */ - space(str: string): string[] - - /** - * Safely splits values. - * - * ```js - * Once (root, { list }) { - * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)'] - * } - * ``` - * - * @param string separated values. - * @param separators array of separators. - * @param last boolean indicator. - * @return Split values. - */ - split( - string: string, - separators: readonly string[], - last: boolean - ): string[] - } -} - -declare const list: list.List - -export = list diff --git a/node_modules/postcss/lib/list.js b/node_modules/postcss/lib/list.js deleted file mode 100644 index 1b31f98..0000000 --- a/node_modules/postcss/lib/list.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict' - -let list = { - comma(string) { - return list.split(string, [','], true) - }, - - space(string) { - let spaces = [' ', '\n', '\t'] - return list.split(string, spaces) - }, - - split(string, separators, last) { - let array = [] - let current = '' - let split = false - - let func = 0 - let inQuote = false - let prevQuote = '' - let escape = false - - for (let letter of string) { - if (escape) { - escape = false - } else if (letter === '\\') { - escape = true - } else if (inQuote) { - if (letter === prevQuote) { - inQuote = false - } - } else if (letter === '"' || letter === "'") { - inQuote = true - prevQuote = letter - } else if (letter === '(') { - func += 1 - } else if (letter === ')') { - if (func > 0) func -= 1 - } else if (func === 0) { - if (separators.includes(letter)) split = true - } - - if (split) { - if (current !== '') array.push(current.trim()) - current = '' - split = false - } else { - current += letter - } - } - - if (last || current !== '') array.push(current.trim()) - return array - } -} - -module.exports = list -list.default = list diff --git a/node_modules/postcss/lib/map-generator.js b/node_modules/postcss/lib/map-generator.js deleted file mode 100644 index 89069d3..0000000 --- a/node_modules/postcss/lib/map-generator.js +++ /dev/null @@ -1,368 +0,0 @@ -'use strict' - -let { dirname, relative, resolve, sep } = require('path') -let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') -let { pathToFileURL } = require('url') - -let Input = require('./input') - -let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) -let pathAvailable = Boolean(dirname && resolve && relative && sep) - -class MapGenerator { - constructor(stringify, root, opts, cssString) { - this.stringify = stringify - this.mapOpts = opts.map || {} - this.root = root - this.opts = opts - this.css = cssString - this.originalCSS = cssString - this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute - - this.memoizedFileURLs = new Map() - this.memoizedPaths = new Map() - this.memoizedURLs = new Map() - } - - addAnnotation() { - let content - - if (this.isInline()) { - content = - 'data:application/json;base64,' + this.toBase64(this.map.toString()) - } else if (typeof this.mapOpts.annotation === 'string') { - content = this.mapOpts.annotation - } else if (typeof this.mapOpts.annotation === 'function') { - content = this.mapOpts.annotation(this.opts.to, this.root) - } else { - content = this.outputFile() + '.map' - } - let eol = '\n' - if (this.css.includes('\r\n')) eol = '\r\n' - - this.css += eol + '/*# sourceMappingURL=' + content + ' */' - } - - applyPrevMaps() { - for (let prev of this.previous()) { - let from = this.toUrl(this.path(prev.file)) - let root = prev.root || dirname(prev.file) - let map - - if (this.mapOpts.sourcesContent === false) { - map = new SourceMapConsumer(prev.text) - if (map.sourcesContent) { - map.sourcesContent = null - } - } else { - map = prev.consumer() - } - - this.map.applySourceMap(map, from, this.toUrl(this.path(root))) - } - } - - clearAnnotation() { - if (this.mapOpts.annotation === false) return - - if (this.root) { - let node - for (let i = this.root.nodes.length - 1; i >= 0; i--) { - node = this.root.nodes[i] - if (node.type !== 'comment') continue - if (node.text.startsWith('# sourceMappingURL=')) { - this.root.removeChild(i) - } - } - } else if (this.css) { - this.css = this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm, '') - } - } - - generate() { - this.clearAnnotation() - if (pathAvailable && sourceMapAvailable && this.isMap()) { - return this.generateMap() - } else { - let result = '' - this.stringify(this.root, i => { - result += i - }) - return [result] - } - } - - generateMap() { - if (this.root) { - this.generateString() - } else if (this.previous().length === 1) { - let prev = this.previous()[0].consumer() - prev.file = this.outputFile() - this.map = SourceMapGenerator.fromSourceMap(prev, { - ignoreInvalidMapping: true - }) - } else { - this.map = new SourceMapGenerator({ - file: this.outputFile(), - ignoreInvalidMapping: true - }) - this.map.addMapping({ - generated: { column: 0, line: 1 }, - original: { column: 0, line: 1 }, - source: this.opts.from - ? this.toUrl(this.path(this.opts.from)) - : '' - }) - } - - if (this.isSourcesContent()) this.setSourcesContent() - if (this.root && this.previous().length > 0) this.applyPrevMaps() - if (this.isAnnotation()) this.addAnnotation() - - if (this.isInline()) { - return [this.css] - } else { - return [this.css, this.map] - } - } - - generateString() { - this.css = '' - this.map = new SourceMapGenerator({ - file: this.outputFile(), - ignoreInvalidMapping: true - }) - - let line = 1 - let column = 1 - - let noSource = '' - let mapping = { - generated: { column: 0, line: 0 }, - original: { column: 0, line: 0 }, - source: '' - } - - let last, lines - this.stringify(this.root, (str, node, type) => { - this.css += str - - if (node && type !== 'end') { - mapping.generated.line = line - mapping.generated.column = column - 1 - if (node.source && node.source.start) { - mapping.source = this.sourcePath(node) - mapping.original.line = node.source.start.line - mapping.original.column = node.source.start.column - 1 - this.map.addMapping(mapping) - } else { - mapping.source = noSource - mapping.original.line = 1 - mapping.original.column = 0 - this.map.addMapping(mapping) - } - } - - lines = str.match(/\n/g) - if (lines) { - line += lines.length - last = str.lastIndexOf('\n') - column = str.length - last - } else { - column += str.length - } - - if (node && type !== 'start') { - let p = node.parent || { raws: {} } - let childless = - node.type === 'decl' || (node.type === 'atrule' && !node.nodes) - if (!childless || node !== p.last || p.raws.semicolon) { - if (node.source && node.source.end) { - mapping.source = this.sourcePath(node) - mapping.original.line = node.source.end.line - mapping.original.column = node.source.end.column - 1 - mapping.generated.line = line - mapping.generated.column = column - 2 - this.map.addMapping(mapping) - } else { - mapping.source = noSource - mapping.original.line = 1 - mapping.original.column = 0 - mapping.generated.line = line - mapping.generated.column = column - 1 - this.map.addMapping(mapping) - } - } - } - }) - } - - isAnnotation() { - if (this.isInline()) { - return true - } - if (typeof this.mapOpts.annotation !== 'undefined') { - return this.mapOpts.annotation - } - if (this.previous().length) { - return this.previous().some(i => i.annotation) - } - return true - } - - isInline() { - if (typeof this.mapOpts.inline !== 'undefined') { - return this.mapOpts.inline - } - - let annotation = this.mapOpts.annotation - if (typeof annotation !== 'undefined' && annotation !== true) { - return false - } - - if (this.previous().length) { - return this.previous().some(i => i.inline) - } - return true - } - - isMap() { - if (typeof this.opts.map !== 'undefined') { - return !!this.opts.map - } - return this.previous().length > 0 - } - - isSourcesContent() { - if (typeof this.mapOpts.sourcesContent !== 'undefined') { - return this.mapOpts.sourcesContent - } - if (this.previous().length) { - return this.previous().some(i => i.withContent()) - } - return true - } - - outputFile() { - if (this.opts.to) { - return this.path(this.opts.to) - } else if (this.opts.from) { - return this.path(this.opts.from) - } else { - return 'to.css' - } - } - - path(file) { - if (this.mapOpts.absolute) return file - if (file.charCodeAt(0) === 60 /* `<` */) return file - if (/^\w+:\/\//.test(file)) return file - let cached = this.memoizedPaths.get(file) - if (cached) return cached - - let from = this.opts.to ? dirname(this.opts.to) : '.' - - if (typeof this.mapOpts.annotation === 'string') { - from = dirname(resolve(from, this.mapOpts.annotation)) - } - - let path = relative(from, file) - this.memoizedPaths.set(file, path) - - return path - } - - previous() { - if (!this.previousMaps) { - this.previousMaps = [] - if (this.root) { - this.root.walk(node => { - if (node.source && node.source.input.map) { - let map = node.source.input.map - if (!this.previousMaps.includes(map)) { - this.previousMaps.push(map) - } - } - }) - } else { - let input = new Input(this.originalCSS, this.opts) - if (input.map) this.previousMaps.push(input.map) - } - } - - return this.previousMaps - } - - setSourcesContent() { - let already = {} - if (this.root) { - this.root.walk(node => { - if (node.source) { - let from = node.source.input.from - if (from && !already[from]) { - already[from] = true - let fromUrl = this.usesFileUrls - ? this.toFileUrl(from) - : this.toUrl(this.path(from)) - this.map.setSourceContent(fromUrl, node.source.input.css) - } - } - }) - } else if (this.css) { - let from = this.opts.from - ? this.toUrl(this.path(this.opts.from)) - : '' - this.map.setSourceContent(from, this.css) - } - } - - sourcePath(node) { - if (this.mapOpts.from) { - return this.toUrl(this.mapOpts.from) - } else if (this.usesFileUrls) { - return this.toFileUrl(node.source.input.from) - } else { - return this.toUrl(this.path(node.source.input.from)) - } - } - - toBase64(str) { - if (Buffer) { - return Buffer.from(str).toString('base64') - } else { - return window.btoa(unescape(encodeURIComponent(str))) - } - } - - toFileUrl(path) { - let cached = this.memoizedFileURLs.get(path) - if (cached) return cached - - if (pathToFileURL) { - let fileURL = pathToFileURL(path).toString() - this.memoizedFileURLs.set(path, fileURL) - - return fileURL - } else { - throw new Error( - '`map.absolute` option is not available in this PostCSS build' - ) - } - } - - toUrl(path) { - let cached = this.memoizedURLs.get(path) - if (cached) return cached - - if (sep === '\\') { - path = path.replace(/\\/g, '/') - } - - let url = encodeURI(path).replace(/[#?]/g, encodeURIComponent) - this.memoizedURLs.set(path, url) - - return url - } -} - -module.exports = MapGenerator diff --git a/node_modules/postcss/lib/no-work-result.d.ts b/node_modules/postcss/lib/no-work-result.d.ts deleted file mode 100644 index 094f30a..0000000 --- a/node_modules/postcss/lib/no-work-result.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import LazyResult from './lazy-result.js' -import { SourceMap } from './postcss.js' -import Processor from './processor.js' -import Result, { Message, ResultOptions } from './result.js' -import Root from './root.js' -import Warning from './warning.js' - -declare namespace NoWorkResult { - // eslint-disable-next-line @typescript-eslint/no-use-before-define - export { NoWorkResult_ as default } -} - -/** - * A Promise proxy for the result of PostCSS transformations. - * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` - * are accessed. See the example below for details. - * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. - * - * ```js - * const noWorkResult = postcss().process(css) // No plugins are defined. - * // CSS is not parsed - * let root = noWorkResult.root // now css is parsed because we accessed the root - * ``` - */ -declare class NoWorkResult_ implements LazyResult { - catch: Promise>['catch'] - finally: Promise>['finally'] - then: Promise>['then'] - get content(): string - get css(): string - get map(): SourceMap - get messages(): Message[] - get opts(): ResultOptions - get processor(): Processor - get root(): Root - get [Symbol.toStringTag](): string - constructor(processor: Processor, css: string, opts: ResultOptions) - async(): Promise> - sync(): Result - toString(): string - warnings(): Warning[] -} - -declare class NoWorkResult extends NoWorkResult_ {} - -export = NoWorkResult diff --git a/node_modules/postcss/lib/no-work-result.js b/node_modules/postcss/lib/no-work-result.js deleted file mode 100644 index dd46182..0000000 --- a/node_modules/postcss/lib/no-work-result.js +++ /dev/null @@ -1,138 +0,0 @@ -'use strict' - -let MapGenerator = require('./map-generator') -let parse = require('./parse') -const Result = require('./result') -let stringify = require('./stringify') -let warnOnce = require('./warn-once') - -class NoWorkResult { - get content() { - return this.result.css - } - - get css() { - return this.result.css - } - - get map() { - return this.result.map - } - - get messages() { - return [] - } - - get opts() { - return this.result.opts - } - - get processor() { - return this.result.processor - } - - get root() { - if (this._root) { - return this._root - } - - let root - let parser = parse - - try { - root = parser(this._css, this._opts) - } catch (error) { - this.error = error - } - - if (this.error) { - throw this.error - } else { - this._root = root - return root - } - } - - get [Symbol.toStringTag]() { - return 'NoWorkResult' - } - - constructor(processor, css, opts) { - css = css.toString() - this.stringified = false - - this._processor = processor - this._css = css - this._opts = opts - this._map = undefined - let root - - let str = stringify - this.result = new Result(this._processor, root, this._opts) - this.result.css = css - - let self = this - Object.defineProperty(this.result, 'root', { - get() { - return self.root - } - }) - - let map = new MapGenerator(str, root, this._opts, css) - if (map.isMap()) { - let [generatedCSS, generatedMap] = map.generate() - if (generatedCSS) { - this.result.css = generatedCSS - } - if (generatedMap) { - this.result.map = generatedMap - } - } else { - map.clearAnnotation() - this.result.css = map.css - } - } - - async() { - if (this.error) return Promise.reject(this.error) - return Promise.resolve(this.result) - } - - catch(onRejected) { - return this.async().catch(onRejected) - } - - finally(onFinally) { - return this.async().then(onFinally, onFinally) - } - - sync() { - if (this.error) throw this.error - return this.result - } - - then(onFulfilled, onRejected) { - if (process.env.NODE_ENV !== 'production') { - if (!('from' in this._opts)) { - warnOnce( - 'Without `from` option PostCSS could generate wrong source map ' + - 'and will not find Browserslist config. Set it to CSS file path ' + - 'or to `undefined` to prevent this warning.' - ) - } - } - - return this.async().then(onFulfilled, onRejected) - } - - toString() { - return this._css - } - - warnings() { - return [] - } -} - -module.exports = NoWorkResult -NoWorkResult.default = NoWorkResult diff --git a/node_modules/postcss/lib/node.d.ts b/node_modules/postcss/lib/node.d.ts deleted file mode 100644 index a09fe4d..0000000 --- a/node_modules/postcss/lib/node.d.ts +++ /dev/null @@ -1,556 +0,0 @@ -import AtRule = require('./at-rule.js') -import { AtRuleProps } from './at-rule.js' -import Comment, { CommentProps } from './comment.js' -import Container, { NewChild } from './container.js' -import CssSyntaxError from './css-syntax-error.js' -import Declaration, { DeclarationProps } from './declaration.js' -import Document from './document.js' -import Input from './input.js' -import { Stringifier, Syntax } from './postcss.js' -import Result from './result.js' -import Root from './root.js' -import Rule, { RuleProps } from './rule.js' -import Warning, { WarningOptions } from './warning.js' - -declare namespace Node { - export type ChildNode = AtRule.default | Comment | Declaration | Rule - - export type AnyNode = - | AtRule.default - | Comment - | Declaration - | Document - | Root - | Rule - - export type ChildProps = - | AtRuleProps - | CommentProps - | DeclarationProps - | RuleProps - - export interface Position { - /** - * Source line in file. In contrast to `offset` it starts from 1. - */ - column: number - - /** - * Source column in file. - */ - line: number - - /** - * Source offset in file. It starts from 0. - */ - offset: number - } - - export interface Range { - /** - * End position, exclusive. - */ - end: Position - - /** - * Start position, inclusive. - */ - start: Position - } - - /** - * Source represents an interface for the {@link Node.source} property. - */ - export interface Source { - /** - * The inclusive ending position for the source - * code of a node. - * - * However, `end.offset` of a non `Root` node is the exclusive position. - * See https://github.com/postcss/postcss/pull/1879 for details. - * - * ```js - * const root = postcss.parse('a { color: black }') - * const a = root.first - * const color = a.first - * - * // The offset of `Root` node is the inclusive position - * css.source.end // { line: 1, column: 19, offset: 18 } - * - * // The offset of non `Root` node is the exclusive position - * a.source.end // { line: 1, column: 18, offset: 18 } - * color.source.end // { line: 1, column: 16, offset: 16 } - * ``` - */ - end?: Position - - /** - * The source file from where a node has originated. - */ - input: Input - - /** - * The inclusive starting position for the source - * code of a node. - */ - start?: Position - } - - /** - * Interface represents an interface for an object received - * as parameter by Node class constructor. - */ - export interface NodeProps { - source?: Source - } - - export interface NodeErrorOptions { - /** - * An ending index inside a node's string that should be highlighted as - * source of error. - */ - endIndex?: number - /** - * An index inside a node's string that should be highlighted as source - * of error. - */ - index?: number - /** - * Plugin name that created this error. PostCSS will set it automatically. - */ - plugin?: string - /** - * A word inside a node's string, that should be highlighted as source - * of error. - */ - word?: string - } - - // eslint-disable-next-line @typescript-eslint/no-shadow - class Node extends Node_ {} - export { Node as default } -} - -/** - * It represents an abstract class that handles common - * methods for other CSS abstract syntax tree nodes. - * - * Any node that represents CSS selector or value should - * not extend the `Node` class. - */ -declare abstract class Node_ { - /** - * It represents parent of the current node. - * - * ```js - * root.nodes[0].parent === root //=> true - * ``` - */ - parent: Container | Document | undefined - - /** - * It represents unnecessary whitespace and characters present - * in the css source code. - * - * Information to generate byte-to-byte equal node string as it was - * in the origin input. - * - * The properties of the raws object are decided by parser, - * the default parser uses the following properties: - * - * * `before`: the space symbols before the node. It also stores `*` - * and `_` symbols before the declaration (IE hack). - * * `after`: the space symbols after the last child of the node - * to the end of the node. - * * `between`: the symbols between the property and value - * for declarations, selector and `{` for rules, or last parameter - * and `{` for at-rules. - * * `semicolon`: contains true if the last child has - * an (optional) semicolon. - * * `afterName`: the space between the at-rule name and its parameters. - * * `left`: the space symbols between `/*` and the comment’s text. - * * `right`: the space symbols between the comment’s text - * and */. - * - `important`: the content of the important statement, - * if it is not just `!important`. - * - * PostCSS filters out the comments inside selectors, declaration values - * and at-rule parameters but it stores the origin content in raws. - * - * ```js - * const root = postcss.parse('a {\n color:black\n}') - * root.first.first.raws //=> { before: '\n ', between: ':' } - * ``` - */ - raws: any - - /** - * It represents information related to origin of a node and is required - * for generating source maps. - * - * The nodes that are created manually using the public APIs - * provided by PostCSS will have `source` undefined and - * will be absent in the source map. - * - * For this reason, the plugin developer should consider - * duplicating nodes as the duplicate node will have the - * same source as the original node by default or assign - * source to a node created manually. - * - * ```js - * decl.source.input.from //=> '/home/ai/source.css' - * decl.source.start //=> { line: 10, column: 2 } - * decl.source.end //=> { line: 10, column: 12 } - * ``` - * - * ```js - * // Incorrect method, source not specified! - * const prefixed = postcss.decl({ - * prop: '-moz-' + decl.prop, - * value: decl.value - * }) - * - * // Correct method, source is inherited when duplicating. - * const prefixed = decl.clone({ - * prop: '-moz-' + decl.prop - * }) - * ``` - * - * ```js - * if (atrule.name === 'add-link') { - * const rule = postcss.rule({ - * selector: 'a', - * source: atrule.source - * }) - * - * atrule.parent.insertBefore(atrule, rule) - * } - * ``` - */ - source?: Node.Source - - /** - * It represents type of a node in - * an abstract syntax tree. - * - * A type of node helps in identification of a node - * and perform operation based on it's type. - * - * ```js - * const declaration = new Declaration({ - * prop: 'color', - * value: 'black' - * }) - * - * declaration.type //=> 'decl' - * ``` - */ - type: string - - constructor(defaults?: object) - - /** - * Insert new node after current node to current node’s parent. - * - * Just alias for `node.parent.insertAfter(node, add)`. - * - * ```js - * decl.after('color: black') - * ``` - * - * @param newNode New node. - * @return This node for methods chain. - */ - after( - newNode: Node | Node.ChildProps | readonly Node[] | string | undefined - ): this - - /** - * It assigns properties to an existing node instance. - * - * ```js - * decl.assign({ prop: 'word-wrap', value: 'break-word' }) - * ``` - * - * @param overrides New properties to override the node. - * - * @return `this` for method chaining. - */ - assign(overrides: object): this - - /** - * Insert new node before current node to current node’s parent. - * - * Just alias for `node.parent.insertBefore(node, add)`. - * - * ```js - * decl.before('content: ""') - * ``` - * - * @param newNode New node. - * @return This node for methods chain. - */ - before( - newNode: Node | Node.ChildProps | readonly Node[] | string | undefined - ): this - - /** - * Clear the code style properties for the node and its children. - * - * ```js - * node.raws.before //=> ' ' - * node.cleanRaws() - * node.raws.before //=> undefined - * ``` - * - * @param keepBetween Keep the `raws.between` symbols. - */ - cleanRaws(keepBetween?: boolean): void - - /** - * It creates clone of an existing node, which includes all the properties - * and their values, that includes `raws` but not `type`. - * - * ```js - * decl.raws.before //=> "\n " - * const cloned = decl.clone({ prop: '-moz-' + decl.prop }) - * cloned.raws.before //=> "\n " - * cloned.toString() //=> -moz-transform: scale(0) - * ``` - * - * @param overrides New properties to override in the clone. - * - * @return Duplicate of the node instance. - */ - clone(overrides?: object): this - - /** - * Shortcut to clone the node and insert the resulting cloned node - * after the current node. - * - * @param overrides New properties to override in the clone. - * @return New node. - */ - cloneAfter(overrides?: object): this - - /** - * Shortcut to clone the node and insert the resulting cloned node - * before the current node. - * - * ```js - * decl.cloneBefore({ prop: '-moz-' + decl.prop }) - * ``` - * - * @param overrides Mew properties to override in the clone. - * - * @return New node - */ - cloneBefore(overrides?: object): this - - /** - * It creates an instance of the class `CssSyntaxError` and parameters passed - * to this method are assigned to the error instance. - * - * The error instance will have description for the - * error, original position of the node in the - * source, showing line and column number. - * - * If any previous map is present, it would be used - * to get original position of the source. - * - * The Previous Map here is referred to the source map - * generated by previous compilation, example: Less, - * Stylus and Sass. - * - * This method returns the error instance instead of - * throwing it. - * - * ```js - * if (!variables[name]) { - * throw decl.error(`Unknown variable ${name}`, { word: name }) - * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black - * // color: $black - * // a - * // ^ - * // background: white - * } - * ``` - * - * @param message Description for the error instance. - * @param options Options for the error instance. - * - * @return Error instance is returned. - */ - error(message: string, options?: Node.NodeErrorOptions): CssSyntaxError - - /** - * Returns the next child of the node’s parent. - * Returns `undefined` if the current node is the last child. - * - * ```js - * if (comment.text === 'delete next') { - * const next = comment.next() - * if (next) { - * next.remove() - * } - * } - * ``` - * - * @return Next node. - */ - next(): Node.ChildNode | undefined - - /** - * Get the position for a word or an index inside the node. - * - * @param opts Options. - * @return Position. - */ - positionBy(opts?: Pick): Node.Position - - /** - * Convert string index to line/column. - * - * @param index The symbol number in the node’s string. - * @return Symbol position in file. - */ - positionInside(index: number): Node.Position - - /** - * Returns the previous child of the node’s parent. - * Returns `undefined` if the current node is the first child. - * - * ```js - * const annotation = decl.prev() - * if (annotation.type === 'comment') { - * readAnnotation(annotation.text) - * } - * ``` - * - * @return Previous node. - */ - prev(): Node.ChildNode | undefined - - /** - * Get the range for a word or start and end index inside the node. - * The start index is inclusive; the end index is exclusive. - * - * @param opts Options. - * @return Range. - */ - rangeBy( - opts?: Pick - ): Node.Range - - /** - * Returns a `raws` value. If the node is missing - * the code style property (because the node was manually built or cloned), - * PostCSS will try to autodetect the code style property by looking - * at other nodes in the tree. - * - * ```js - * const root = postcss.parse('a { background: white }') - * root.nodes[0].append({ prop: 'color', value: 'black' }) - * root.nodes[0].nodes[1].raws.before //=> undefined - * root.nodes[0].nodes[1].raw('before') //=> ' ' - * ``` - * - * @param prop Name of code style property. - * @param defaultType Name of default value, it can be missed - * if the value is the same as prop. - * @return {string} Code style value. - */ - raw(prop: string, defaultType?: string): string - - /** - * It removes the node from its parent and deletes its parent property. - * - * ```js - * if (decl.prop.match(/^-webkit-/)) { - * decl.remove() - * } - * ``` - * - * @return `this` for method chaining. - */ - remove(): this - - /** - * Inserts node(s) before the current node and removes the current node. - * - * ```js - * AtRule: { - * mixin: atrule => { - * atrule.replaceWith(mixinRules[atrule.params]) - * } - * } - * ``` - * - * @param nodes Mode(s) to replace current one. - * @return Current node to methods chain. - */ - replaceWith(...nodes: NewChild[]): this - - /** - * Finds the Root instance of the node’s tree. - * - * ```js - * root.nodes[0].nodes[0].root() === root - * ``` - * - * @return Root parent. - */ - root(): Root - - /** - * Fix circular links on `JSON.stringify()`. - * - * @return Cleaned object. - */ - toJSON(): object - - /** - * It compiles the node to browser readable cascading style sheets string - * depending on it's type. - * - * ```js - * new Rule({ selector: 'a' }).toString() //=> "a {}" - * ``` - * - * @param stringifier A syntax to use in string generation. - * @return CSS string of this node. - */ - toString(stringifier?: Stringifier | Syntax): string - - /** - * It is a wrapper for {@link Result#warn}, providing convenient - * way of generating warnings. - * - * ```js - * Declaration: { - * bad: (decl, { result }) => { - * decl.warn(result, 'Deprecated property: bad') - * } - * } - * ``` - * - * @param result The `Result` instance that will receive the warning. - * @param message Description for the warning. - * @param options Options for the warning. - * - * @return `Warning` instance is returned - */ - warn(result: Result, message: string, options?: WarningOptions): Warning - - /** - * If this node isn't already dirty, marks it and its ancestors as such. This - * indicates to the LazyResult processor that the {@link Root} has been - * modified by the current plugin and may need to be processed again by other - * plugins. - */ - protected markDirty(): void -} - -declare class Node extends Node_ {} - -export = Node diff --git a/node_modules/postcss/lib/node.js b/node_modules/postcss/lib/node.js deleted file mode 100644 index b403b71..0000000 --- a/node_modules/postcss/lib/node.js +++ /dev/null @@ -1,449 +0,0 @@ -'use strict' - -let CssSyntaxError = require('./css-syntax-error') -let Stringifier = require('./stringifier') -let stringify = require('./stringify') -let { isClean, my } = require('./symbols') - -function cloneNode(obj, parent) { - let cloned = new obj.constructor() - - for (let i in obj) { - if (!Object.prototype.hasOwnProperty.call(obj, i)) { - /* c8 ignore next 2 */ - continue - } - if (i === 'proxyCache') continue - let value = obj[i] - let type = typeof value - - if (i === 'parent' && type === 'object') { - if (parent) cloned[i] = parent - } else if (i === 'source') { - cloned[i] = value - } else if (Array.isArray(value)) { - cloned[i] = value.map(j => cloneNode(j, cloned)) - } else { - if (type === 'object' && value !== null) value = cloneNode(value) - cloned[i] = value - } - } - - return cloned -} - -function sourceOffset(inputCSS, position) { - // Not all custom syntaxes support `offset` in `source.start` and `source.end` - if (position && typeof position.offset !== 'undefined') { - return position.offset - } - - let column = 1 - let line = 1 - let offset = 0 - - for (let i = 0; i < inputCSS.length; i++) { - if (line === position.line && column === position.column) { - offset = i - break - } - - if (inputCSS[i] === '\n') { - column = 1 - line += 1 - } else { - column += 1 - } - } - - return offset -} - -class Node { - get proxyOf() { - return this - } - - constructor(defaults = {}) { - this.raws = {} - this[isClean] = false - this[my] = true - - for (let name in defaults) { - if (name === 'nodes') { - this.nodes = [] - for (let node of defaults[name]) { - if (typeof node.clone === 'function') { - this.append(node.clone()) - } else { - this.append(node) - } - } - } else { - this[name] = defaults[name] - } - } - } - - addToError(error) { - error.postcssNode = this - if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { - let s = this.source - error.stack = error.stack.replace( - /\n\s{4}at /, - `$&${s.input.from}:${s.start.line}:${s.start.column}$&` - ) - } - return error - } - - after(add) { - this.parent.insertAfter(this, add) - return this - } - - assign(overrides = {}) { - for (let name in overrides) { - this[name] = overrides[name] - } - return this - } - - before(add) { - this.parent.insertBefore(this, add) - return this - } - - cleanRaws(keepBetween) { - delete this.raws.before - delete this.raws.after - if (!keepBetween) delete this.raws.between - } - - clone(overrides = {}) { - let cloned = cloneNode(this) - for (let name in overrides) { - cloned[name] = overrides[name] - } - return cloned - } - - cloneAfter(overrides = {}) { - let cloned = this.clone(overrides) - this.parent.insertAfter(this, cloned) - return cloned - } - - cloneBefore(overrides = {}) { - let cloned = this.clone(overrides) - this.parent.insertBefore(this, cloned) - return cloned - } - - error(message, opts = {}) { - if (this.source) { - let { end, start } = this.rangeBy(opts) - return this.source.input.error( - message, - { column: start.column, line: start.line }, - { column: end.column, line: end.line }, - opts - ) - } - return new CssSyntaxError(message) - } - - getProxyProcessor() { - return { - get(node, prop) { - if (prop === 'proxyOf') { - return node - } else if (prop === 'root') { - return () => node.root().toProxy() - } else { - return node[prop] - } - }, - - set(node, prop, value) { - if (node[prop] === value) return true - node[prop] = value - if ( - prop === 'prop' || - prop === 'value' || - prop === 'name' || - prop === 'params' || - prop === 'important' || - /* c8 ignore next */ - prop === 'text' - ) { - node.markDirty() - } - return true - } - } - } - - /* c8 ignore next 3 */ - markClean() { - this[isClean] = true - } - - markDirty() { - if (this[isClean]) { - this[isClean] = false - let next = this - while ((next = next.parent)) { - next[isClean] = false - } - } - } - - next() { - if (!this.parent) return undefined - let index = this.parent.index(this) - return this.parent.nodes[index + 1] - } - - positionBy(opts = {}) { - let pos = this.source.start - if (opts.index) { - pos = this.positionInside(opts.index) - } else if (opts.word) { - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let stringRepresentation = inputString.slice( - sourceOffset(inputString, this.source.start), - sourceOffset(inputString, this.source.end) - ) - let index = stringRepresentation.indexOf(opts.word) - if (index !== -1) pos = this.positionInside(index) - } - return pos - } - - positionInside(index) { - let column = this.source.start.column - let line = this.source.start.line - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let offset = sourceOffset(inputString, this.source.start) - let end = offset + index - - for (let i = offset; i < end; i++) { - if (inputString[i] === '\n') { - column = 1 - line += 1 - } else { - column += 1 - } - } - - return { column, line, offset: end } - } - - prev() { - if (!this.parent) return undefined - let index = this.parent.index(this) - return this.parent.nodes[index - 1] - } - - rangeBy(opts = {}) { - let inputString = - 'document' in this.source.input - ? this.source.input.document - : this.source.input.css - let start = { - column: this.source.start.column, - line: this.source.start.line, - offset: sourceOffset(inputString, this.source.start) - } - let end = this.source.end - ? { - column: this.source.end.column + 1, - line: this.source.end.line, - offset: - typeof this.source.end.offset === 'number' - ? // `source.end.offset` is exclusive, so we don't need to add 1 - this.source.end.offset - : // Since line/column in this.source.end is inclusive, - // the `sourceOffset(... , this.source.end)` returns an inclusive offset. - // So, we add 1 to convert it to exclusive. - sourceOffset(inputString, this.source.end) + 1 - } - : { - column: start.column + 1, - line: start.line, - offset: start.offset + 1 - } - - if (opts.word) { - let stringRepresentation = inputString.slice( - sourceOffset(inputString, this.source.start), - sourceOffset(inputString, this.source.end) - ) - let index = stringRepresentation.indexOf(opts.word) - if (index !== -1) { - start = this.positionInside(index) - end = this.positionInside(index + opts.word.length) - } - } else { - if (opts.start) { - start = { - column: opts.start.column, - line: opts.start.line, - offset: sourceOffset(inputString, opts.start) - } - } else if (opts.index) { - start = this.positionInside(opts.index) - } - - if (opts.end) { - end = { - column: opts.end.column, - line: opts.end.line, - offset: sourceOffset(inputString, opts.end) - } - } else if (typeof opts.endIndex === 'number') { - end = this.positionInside(opts.endIndex) - } else if (opts.index) { - end = this.positionInside(opts.index + 1) - } - } - - if ( - end.line < start.line || - (end.line === start.line && end.column <= start.column) - ) { - end = { - column: start.column + 1, - line: start.line, - offset: start.offset + 1 - } - } - - return { end, start } - } - - raw(prop, defaultType) { - let str = new Stringifier() - return str.raw(this, prop, defaultType) - } - - remove() { - if (this.parent) { - this.parent.removeChild(this) - } - this.parent = undefined - return this - } - - replaceWith(...nodes) { - if (this.parent) { - let bookmark = this - let foundSelf = false - for (let node of nodes) { - if (node === this) { - foundSelf = true - } else if (foundSelf) { - this.parent.insertAfter(bookmark, node) - bookmark = node - } else { - this.parent.insertBefore(bookmark, node) - } - } - - if (!foundSelf) { - this.remove() - } - } - - return this - } - - root() { - let result = this - while (result.parent && result.parent.type !== 'document') { - result = result.parent - } - return result - } - - toJSON(_, inputs) { - let fixed = {} - let emitInputs = inputs == null - inputs = inputs || new Map() - let inputsNextIndex = 0 - - for (let name in this) { - if (!Object.prototype.hasOwnProperty.call(this, name)) { - /* c8 ignore next 2 */ - continue - } - if (name === 'parent' || name === 'proxyCache') continue - let value = this[name] - - if (Array.isArray(value)) { - fixed[name] = value.map(i => { - if (typeof i === 'object' && i.toJSON) { - return i.toJSON(null, inputs) - } else { - return i - } - }) - } else if (typeof value === 'object' && value.toJSON) { - fixed[name] = value.toJSON(null, inputs) - } else if (name === 'source') { - if (value == null) continue - let inputId = inputs.get(value.input) - if (inputId == null) { - inputId = inputsNextIndex - inputs.set(value.input, inputsNextIndex) - inputsNextIndex++ - } - fixed[name] = { - end: value.end, - inputId, - start: value.start - } - } else { - fixed[name] = value - } - } - - if (emitInputs) { - fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) - } - - return fixed - } - - toProxy() { - if (!this.proxyCache) { - this.proxyCache = new Proxy(this, this.getProxyProcessor()) - } - return this.proxyCache - } - - toString(stringifier = stringify) { - if (stringifier.stringify) stringifier = stringifier.stringify - let result = '' - stringifier(this, i => { - result += i - }) - return result - } - - warn(result, text, opts = {}) { - let data = { node: this } - for (let i in opts) data[i] = opts[i] - return result.warn(text, data) - } -} - -module.exports = Node -Node.default = Node diff --git a/node_modules/postcss/lib/parse.d.ts b/node_modules/postcss/lib/parse.d.ts deleted file mode 100644 index 4c943a4..0000000 --- a/node_modules/postcss/lib/parse.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { Parser } from './postcss.js' - -interface Parse extends Parser { - default: Parse -} - -declare const parse: Parse - -export = parse diff --git a/node_modules/postcss/lib/parse.js b/node_modules/postcss/lib/parse.js deleted file mode 100644 index 00a1037..0000000 --- a/node_modules/postcss/lib/parse.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict' - -let Container = require('./container') -let Input = require('./input') -let Parser = require('./parser') - -function parse(css, opts) { - let input = new Input(css, opts) - let parser = new Parser(input) - try { - parser.parse() - } catch (e) { - if (process.env.NODE_ENV !== 'production') { - if (e.name === 'CssSyntaxError' && opts && opts.from) { - if (/\.scss$/i.test(opts.from)) { - e.message += - '\nYou tried to parse SCSS with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-scss parser' - } else if (/\.sass/i.test(opts.from)) { - e.message += - '\nYou tried to parse Sass with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-sass parser' - } else if (/\.less$/i.test(opts.from)) { - e.message += - '\nYou tried to parse Less with ' + - 'the standard CSS parser; ' + - 'try again with the postcss-less parser' - } - } - } - throw e - } - - return parser.root -} - -module.exports = parse -parse.default = parse - -Container.registerParse(parse) diff --git a/node_modules/postcss/lib/parser.js b/node_modules/postcss/lib/parser.js deleted file mode 100644 index 64fb5d8..0000000 --- a/node_modules/postcss/lib/parser.js +++ /dev/null @@ -1,611 +0,0 @@ -'use strict' - -let AtRule = require('./at-rule') -let Comment = require('./comment') -let Declaration = require('./declaration') -let Root = require('./root') -let Rule = require('./rule') -let tokenizer = require('./tokenize') - -const SAFE_COMMENT_NEIGHBOR = { - empty: true, - space: true -} - -function findLastWithPosition(tokens) { - for (let i = tokens.length - 1; i >= 0; i--) { - let token = tokens[i] - let pos = token[3] || token[2] - if (pos) return pos - } -} - -class Parser { - constructor(input) { - this.input = input - - this.root = new Root() - this.current = this.root - this.spaces = '' - this.semicolon = false - - this.createTokenizer() - this.root.source = { input, start: { column: 1, line: 1, offset: 0 } } - } - - atrule(token) { - let node = new AtRule() - node.name = token[1].slice(1) - if (node.name === '') { - this.unnamedAtrule(node, token) - } - this.init(node, token[2]) - - let type - let prev - let shift - let last = false - let open = false - let params = [] - let brackets = [] - - while (!this.tokenizer.endOfFile()) { - token = this.tokenizer.nextToken() - type = token[0] - - if (type === '(' || type === '[') { - brackets.push(type === '(' ? ')' : ']') - } else if (type === '{' && brackets.length > 0) { - brackets.push('}') - } else if (type === brackets[brackets.length - 1]) { - brackets.pop() - } - - if (brackets.length === 0) { - if (type === ';') { - node.source.end = this.getPosition(token[2]) - node.source.end.offset++ - this.semicolon = true - break - } else if (type === '{') { - open = true - break - } else if (type === '}') { - if (params.length > 0) { - shift = params.length - 1 - prev = params[shift] - while (prev && prev[0] === 'space') { - prev = params[--shift] - } - if (prev) { - node.source.end = this.getPosition(prev[3] || prev[2]) - node.source.end.offset++ - } - } - this.end(token) - break - } else { - params.push(token) - } - } else { - params.push(token) - } - - if (this.tokenizer.endOfFile()) { - last = true - break - } - } - - node.raws.between = this.spacesAndCommentsFromEnd(params) - if (params.length) { - node.raws.afterName = this.spacesAndCommentsFromStart(params) - this.raw(node, 'params', params) - if (last) { - token = params[params.length - 1] - node.source.end = this.getPosition(token[3] || token[2]) - node.source.end.offset++ - this.spaces = node.raws.between - node.raws.between = '' - } - } else { - node.raws.afterName = '' - node.params = '' - } - - if (open) { - node.nodes = [] - this.current = node - } - } - - checkMissedSemicolon(tokens) { - let colon = this.colon(tokens) - if (colon === false) return - - let founded = 0 - let token - for (let j = colon - 1; j >= 0; j--) { - token = tokens[j] - if (token[0] !== 'space') { - founded += 1 - if (founded === 2) break - } - } - // If the token is a word, e.g. `!important`, `red` or any other valid property's value. - // Then we need to return the colon after that word token. [3] is the "end" colon of that word. - // And because we need it after that one we do +1 to get the next one. - throw this.input.error( - 'Missed semicolon', - token[0] === 'word' ? token[3] + 1 : token[2] - ) - } - - colon(tokens) { - let brackets = 0 - let prev, token, type - for (let [i, element] of tokens.entries()) { - token = element - type = token[0] - - if (type === '(') { - brackets += 1 - } - if (type === ')') { - brackets -= 1 - } - if (brackets === 0 && type === ':') { - if (!prev) { - this.doubleColon(token) - } else if (prev[0] === 'word' && prev[1] === 'progid') { - continue - } else { - return i - } - } - - prev = token - } - return false - } - - comment(token) { - let node = new Comment() - this.init(node, token[2]) - node.source.end = this.getPosition(token[3] || token[2]) - node.source.end.offset++ - - let text = token[1].slice(2, -2) - if (/^\s*$/.test(text)) { - node.text = '' - node.raws.left = text - node.raws.right = '' - } else { - let match = text.match(/^(\s*)([^]*\S)(\s*)$/) - node.text = match[2] - node.raws.left = match[1] - node.raws.right = match[3] - } - } - - createTokenizer() { - this.tokenizer = tokenizer(this.input) - } - - decl(tokens, customProperty) { - let node = new Declaration() - this.init(node, tokens[0][2]) - - let last = tokens[tokens.length - 1] - if (last[0] === ';') { - this.semicolon = true - tokens.pop() - } - - node.source.end = this.getPosition( - last[3] || last[2] || findLastWithPosition(tokens) - ) - node.source.end.offset++ - - while (tokens[0][0] !== 'word') { - if (tokens.length === 1) this.unknownWord(tokens) - node.raws.before += tokens.shift()[1] - } - node.source.start = this.getPosition(tokens[0][2]) - - node.prop = '' - while (tokens.length) { - let type = tokens[0][0] - if (type === ':' || type === 'space' || type === 'comment') { - break - } - node.prop += tokens.shift()[1] - } - - node.raws.between = '' - - let token - while (tokens.length) { - token = tokens.shift() - - if (token[0] === ':') { - node.raws.between += token[1] - break - } else { - if (token[0] === 'word' && /\w/.test(token[1])) { - this.unknownWord([token]) - } - node.raws.between += token[1] - } - } - - if (node.prop[0] === '_' || node.prop[0] === '*') { - node.raws.before += node.prop[0] - node.prop = node.prop.slice(1) - } - - let firstSpaces = [] - let next - while (tokens.length) { - next = tokens[0][0] - if (next !== 'space' && next !== 'comment') break - firstSpaces.push(tokens.shift()) - } - - this.precheckMissedSemicolon(tokens) - - for (let i = tokens.length - 1; i >= 0; i--) { - token = tokens[i] - if (token[1].toLowerCase() === '!important') { - node.important = true - let string = this.stringFrom(tokens, i) - string = this.spacesFromEnd(tokens) + string - if (string !== ' !important') node.raws.important = string - break - } else if (token[1].toLowerCase() === 'important') { - let cache = tokens.slice(0) - let str = '' - for (let j = i; j > 0; j--) { - let type = cache[j][0] - if (str.trim().startsWith('!') && type !== 'space') { - break - } - str = cache.pop()[1] + str - } - if (str.trim().startsWith('!')) { - node.important = true - node.raws.important = str - tokens = cache - } - } - - if (token[0] !== 'space' && token[0] !== 'comment') { - break - } - } - - let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') - - if (hasWord) { - node.raws.between += firstSpaces.map(i => i[1]).join('') - firstSpaces = [] - } - this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) - - if (node.value.includes(':') && !customProperty) { - this.checkMissedSemicolon(tokens) - } - } - - doubleColon(token) { - throw this.input.error( - 'Double colon', - { offset: token[2] }, - { offset: token[2] + token[1].length } - ) - } - - emptyRule(token) { - let node = new Rule() - this.init(node, token[2]) - node.selector = '' - node.raws.between = '' - this.current = node - } - - end(token) { - if (this.current.nodes && this.current.nodes.length) { - this.current.raws.semicolon = this.semicolon - } - this.semicolon = false - - this.current.raws.after = (this.current.raws.after || '') + this.spaces - this.spaces = '' - - if (this.current.parent) { - this.current.source.end = this.getPosition(token[2]) - this.current.source.end.offset++ - this.current = this.current.parent - } else { - this.unexpectedClose(token) - } - } - - endFile() { - if (this.current.parent) this.unclosedBlock() - if (this.current.nodes && this.current.nodes.length) { - this.current.raws.semicolon = this.semicolon - } - this.current.raws.after = (this.current.raws.after || '') + this.spaces - this.root.source.end = this.getPosition(this.tokenizer.position()) - } - - freeSemicolon(token) { - this.spaces += token[1] - if (this.current.nodes) { - let prev = this.current.nodes[this.current.nodes.length - 1] - if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { - prev.raws.ownSemicolon = this.spaces - this.spaces = '' - prev.source.end = this.getPosition(token[2]) - prev.source.end.offset += prev.raws.ownSemicolon.length - } - } - } - - // Helpers - - getPosition(offset) { - let pos = this.input.fromOffset(offset) - return { - column: pos.col, - line: pos.line, - offset - } - } - - init(node, offset) { - this.current.push(node) - node.source = { - input: this.input, - start: this.getPosition(offset) - } - node.raws.before = this.spaces - this.spaces = '' - if (node.type !== 'comment') this.semicolon = false - } - - other(start) { - let end = false - let type = null - let colon = false - let bracket = null - let brackets = [] - let customProperty = start[1].startsWith('--') - - let tokens = [] - let token = start - while (token) { - type = token[0] - tokens.push(token) - - if (type === '(' || type === '[') { - if (!bracket) bracket = token - brackets.push(type === '(' ? ')' : ']') - } else if (customProperty && colon && type === '{') { - if (!bracket) bracket = token - brackets.push('}') - } else if (brackets.length === 0) { - if (type === ';') { - if (colon) { - this.decl(tokens, customProperty) - return - } else { - break - } - } else if (type === '{') { - this.rule(tokens) - return - } else if (type === '}') { - this.tokenizer.back(tokens.pop()) - end = true - break - } else if (type === ':') { - colon = true - } - } else if (type === brackets[brackets.length - 1]) { - brackets.pop() - if (brackets.length === 0) bracket = null - } - - token = this.tokenizer.nextToken() - } - - if (this.tokenizer.endOfFile()) end = true - if (brackets.length > 0) this.unclosedBracket(bracket) - - if (end && colon) { - if (!customProperty) { - while (tokens.length) { - token = tokens[tokens.length - 1][0] - if (token !== 'space' && token !== 'comment') break - this.tokenizer.back(tokens.pop()) - } - } - this.decl(tokens, customProperty) - } else { - this.unknownWord(tokens) - } - } - - parse() { - let token - while (!this.tokenizer.endOfFile()) { - token = this.tokenizer.nextToken() - - switch (token[0]) { - case 'space': - this.spaces += token[1] - break - - case ';': - this.freeSemicolon(token) - break - - case '}': - this.end(token) - break - - case 'comment': - this.comment(token) - break - - case 'at-word': - this.atrule(token) - break - - case '{': - this.emptyRule(token) - break - - default: - this.other(token) - break - } - } - this.endFile() - } - - precheckMissedSemicolon(/* tokens */) { - // Hook for Safe Parser - } - - raw(node, prop, tokens, customProperty) { - let token, type - let length = tokens.length - let value = '' - let clean = true - let next, prev - - for (let i = 0; i < length; i += 1) { - token = tokens[i] - type = token[0] - if (type === 'space' && i === length - 1 && !customProperty) { - clean = false - } else if (type === 'comment') { - prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' - next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' - if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { - if (value.slice(-1) === ',') { - clean = false - } else { - value += token[1] - } - } else { - clean = false - } - } else { - value += token[1] - } - } - if (!clean) { - let raw = tokens.reduce((all, i) => all + i[1], '') - node.raws[prop] = { raw, value } - } - node[prop] = value - } - - rule(tokens) { - tokens.pop() - - let node = new Rule() - this.init(node, tokens[0][2]) - - node.raws.between = this.spacesAndCommentsFromEnd(tokens) - this.raw(node, 'selector', tokens) - this.current = node - } - - spacesAndCommentsFromEnd(tokens) { - let lastTokenType - let spaces = '' - while (tokens.length) { - lastTokenType = tokens[tokens.length - 1][0] - if (lastTokenType !== 'space' && lastTokenType !== 'comment') break - spaces = tokens.pop()[1] + spaces - } - return spaces - } - - // Errors - - spacesAndCommentsFromStart(tokens) { - let next - let spaces = '' - while (tokens.length) { - next = tokens[0][0] - if (next !== 'space' && next !== 'comment') break - spaces += tokens.shift()[1] - } - return spaces - } - - spacesFromEnd(tokens) { - let lastTokenType - let spaces = '' - while (tokens.length) { - lastTokenType = tokens[tokens.length - 1][0] - if (lastTokenType !== 'space') break - spaces = tokens.pop()[1] + spaces - } - return spaces - } - - stringFrom(tokens, from) { - let result = '' - for (let i = from; i < tokens.length; i++) { - result += tokens[i][1] - } - tokens.splice(from, tokens.length - from) - return result - } - - unclosedBlock() { - let pos = this.current.source.start - throw this.input.error('Unclosed block', pos.line, pos.column) - } - - unclosedBracket(bracket) { - throw this.input.error( - 'Unclosed bracket', - { offset: bracket[2] }, - { offset: bracket[2] + 1 } - ) - } - - unexpectedClose(token) { - throw this.input.error( - 'Unexpected }', - { offset: token[2] }, - { offset: token[2] + 1 } - ) - } - - unknownWord(tokens) { - throw this.input.error( - 'Unknown word ' + tokens[0][1], - { offset: tokens[0][2] }, - { offset: tokens[0][2] + tokens[0][1].length } - ) - } - - unnamedAtrule(node, token) { - throw this.input.error( - 'At-rule without name', - { offset: token[2] }, - { offset: token[2] + token[1].length } - ) - } -} - -module.exports = Parser diff --git a/node_modules/postcss/lib/postcss.d.mts b/node_modules/postcss/lib/postcss.d.mts deleted file mode 100644 index d343f3c..0000000 --- a/node_modules/postcss/lib/postcss.d.mts +++ /dev/null @@ -1,69 +0,0 @@ -export { - // Type-only exports - AcceptedPlugin, - - AnyNode, - atRule, - AtRule, - AtRuleProps, - Builder, - ChildNode, - ChildProps, - comment, - Comment, - CommentProps, - Container, - ContainerProps, - CssSyntaxError, - decl, - Declaration, - DeclarationProps, - // postcss function / namespace - default, - document, - Document, - DocumentProps, - FilePosition, - fromJSON, - Helpers, - Input, - - JSONHydrator, - // This is a class, but it’s not re-exported. That’s why it’s exported as type-only here. - type LazyResult, - list, - Message, - Node, - NodeErrorOptions, - NodeProps, - OldPlugin, - parse, - Parser, - // @ts-expect-error This value exists, but it’s untyped. - plugin, - Plugin, - PluginCreator, - Position, - Postcss, - ProcessOptions, - Processor, - Result, - root, - Root, - RootProps, - rule, - Rule, - RuleProps, - Source, - SourceMap, - SourceMapOptions, - Stringifier, - // Value exports from postcss.mjs - stringify, - Syntax, - TransformCallback, - Transformer, - Warning, - - WarningOptions -} from './postcss.js' diff --git a/node_modules/postcss/lib/postcss.d.ts b/node_modules/postcss/lib/postcss.d.ts deleted file mode 100644 index c5e3605..0000000 --- a/node_modules/postcss/lib/postcss.d.ts +++ /dev/null @@ -1,458 +0,0 @@ -import { RawSourceMap, SourceMapGenerator } from 'source-map-js' - -import AtRule, { AtRuleProps } from './at-rule.js' -import Comment, { CommentProps } from './comment.js' -import Container, { ContainerProps, NewChild } from './container.js' -import CssSyntaxError from './css-syntax-error.js' -import Declaration, { DeclarationProps } from './declaration.js' -import Document, { DocumentProps } from './document.js' -import Input, { FilePosition } from './input.js' -import LazyResult from './lazy-result.js' -import list from './list.js' -import Node, { - AnyNode, - ChildNode, - ChildProps, - NodeErrorOptions, - NodeProps, - Position, - Source -} from './node.js' -import Processor from './processor.js' -import Result, { Message } from './result.js' -import Root, { RootProps } from './root.js' -import Rule, { RuleProps } from './rule.js' -import Warning, { WarningOptions } from './warning.js' - -type DocumentProcessor = ( - document: Document, - helper: postcss.Helpers -) => Promise | void -type RootProcessor = ( - root: Root, - helper: postcss.Helpers -) => Promise | void -type DeclarationProcessor = ( - decl: Declaration, - helper: postcss.Helpers -) => Promise | void -type RuleProcessor = ( - rule: Rule, - helper: postcss.Helpers -) => Promise | void -type AtRuleProcessor = ( - atRule: AtRule, - helper: postcss.Helpers -) => Promise | void -type CommentProcessor = ( - comment: Comment, - helper: postcss.Helpers -) => Promise | void - -interface Processors { - /** - * Will be called on all`AtRule` nodes. - * - * Will be called again on node or children changes. - */ - AtRule?: { [name: string]: AtRuleProcessor } | AtRuleProcessor - - /** - * Will be called on all `AtRule` nodes, when all children will be processed. - * - * Will be called again on node or children changes. - */ - AtRuleExit?: { [name: string]: AtRuleProcessor } | AtRuleProcessor - - /** - * Will be called on all `Comment` nodes. - * - * Will be called again on node or children changes. - */ - Comment?: CommentProcessor - - /** - * Will be called on all `Comment` nodes after listeners - * for `Comment` event. - * - * Will be called again on node or children changes. - */ - CommentExit?: CommentProcessor - - /** - * Will be called on all `Declaration` nodes after listeners - * for `Declaration` event. - * - * Will be called again on node or children changes. - */ - Declaration?: { [prop: string]: DeclarationProcessor } | DeclarationProcessor - - /** - * Will be called on all `Declaration` nodes. - * - * Will be called again on node or children changes. - */ - DeclarationExit?: - | { [prop: string]: DeclarationProcessor } - | DeclarationProcessor - - /** - * Will be called on `Document` node. - * - * Will be called again on children changes. - */ - Document?: DocumentProcessor - - /** - * Will be called on `Document` node, when all children will be processed. - * - * Will be called again on children changes. - */ - DocumentExit?: DocumentProcessor - - /** - * Will be called on `Root` node once. - */ - Once?: RootProcessor - - /** - * Will be called on `Root` node once, when all children will be processed. - */ - OnceExit?: RootProcessor - - /** - * Will be called on `Root` node. - * - * Will be called again on children changes. - */ - Root?: RootProcessor - - /** - * Will be called on `Root` node, when all children will be processed. - * - * Will be called again on children changes. - */ - RootExit?: RootProcessor - - /** - * Will be called on all `Rule` nodes. - * - * Will be called again on node or children changes. - */ - Rule?: RuleProcessor - - /** - * Will be called on all `Rule` nodes, when all children will be processed. - * - * Will be called again on node or children changes. - */ - RuleExit?: RuleProcessor -} - -declare namespace postcss { - export { - AnyNode, - AtRule, - AtRuleProps, - ChildNode, - ChildProps, - Comment, - CommentProps, - Container, - ContainerProps, - CssSyntaxError, - Declaration, - DeclarationProps, - Document, - DocumentProps, - FilePosition, - Input, - LazyResult, - list, - Message, - NewChild, - Node, - NodeErrorOptions, - NodeProps, - Position, - Processor, - Result, - Root, - RootProps, - Rule, - RuleProps, - Source, - Warning, - WarningOptions - } - - export type SourceMap = { - toJSON(): RawSourceMap - } & SourceMapGenerator - - export type Helpers = { postcss: Postcss; result: Result } & Postcss - - export interface Plugin extends Processors { - postcssPlugin: string - prepare?: (result: Result) => Processors - } - - export interface PluginCreator { - (opts?: PluginOptions): Plugin | Processor - postcss: true - } - - export interface Transformer extends TransformCallback { - postcssPlugin: string - postcssVersion: string - } - - export interface TransformCallback { - (root: Root, result: Result): Promise | void - } - - export interface OldPlugin extends Transformer { - (opts?: T): Transformer - postcss: Transformer - } - - export type AcceptedPlugin = - | { - postcss: Processor | TransformCallback - } - | OldPlugin - | Plugin - | PluginCreator - | Processor - | TransformCallback - - export interface Parser { - ( - css: { toString(): string } | string, - opts?: Pick - ): RootNode - } - - export interface Builder { - (part: string, node?: AnyNode, type?: 'end' | 'start'): void - } - - export interface Stringifier { - (node: AnyNode, builder: Builder): void - } - - export interface JSONHydrator { - (data: object): Node - (data: object[]): Node[] - } - - export interface Syntax { - /** - * Function to generate AST by string. - */ - parse?: Parser - - /** - * Class to generate string by AST. - */ - stringify?: Stringifier - } - - export interface SourceMapOptions { - /** - * Use absolute path in generated source map. - */ - absolute?: boolean - - /** - * Indicates that PostCSS should add annotation comments to the CSS. - * By default, PostCSS will always add a comment with a path - * to the source map. PostCSS will not add annotations to CSS files - * that do not contain any comments. - * - * By default, PostCSS presumes that you want to save the source map as - * `opts.to + '.map'` and will use this path in the annotation comment. - * A different path can be set by providing a string value for annotation. - * - * If you have set `inline: true`, annotation cannot be disabled. - */ - annotation?: ((file: string, root: Root) => string) | boolean | string - - /** - * Override `from` in map’s sources. - */ - from?: string - - /** - * Indicates that the source map should be embedded in the output CSS - * as a Base64-encoded comment. By default, it is `true`. - * But if all previous maps are external, not inline, PostCSS will not embed - * the map even if you do not set this option. - * - * If you have an inline source map, the result.map property will be empty, - * as the source map will be contained within the text of `result.css`. - */ - inline?: boolean - - /** - * Source map content from a previous processing step (e.g., Sass). - * - * PostCSS will try to read the previous source map - * automatically (based on comments within the source CSS), but you can use - * this option to identify it manually. - * - * If desired, you can omit the previous map with prev: `false`. - */ - prev?: ((file: string) => string) | boolean | object | string - - /** - * Indicates that PostCSS should set the origin content (e.g., Sass source) - * of the source map. By default, it is true. But if all previous maps do not - * contain sources content, PostCSS will also leave it out even if you - * do not set this option. - */ - sourcesContent?: boolean - } - - export interface ProcessOptions { - /** - * Input file if it is not simple CSS file, but HTML with - - `; -} - -//#endregion -//#region src/node/server/transformRequest.ts -var import_etag = /* @__PURE__ */ __toESM(require_etag(), 1); -var import_picocolors$19 = /* @__PURE__ */ __toESM(require_picocolors(), 1); -const ERR_LOAD_URL = "ERR_LOAD_URL"; -const ERR_LOAD_PUBLIC_URL = "ERR_LOAD_PUBLIC_URL"; -const ERR_DENIED_ID = "ERR_DENIED_ID"; -const debugLoad = createDebugger("vite:load"); -const debugTransform = createDebugger("vite:transform"); -const debugCache$1 = createDebugger("vite:cache"); -function transformRequest(environment, url$3, options$1 = {}) { - if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); - const timestamp = monotonicDateNow(); - url$3 = removeTimestampQuery(url$3); - const pending = environment._pendingRequests.get(url$3); - if (pending) return environment.moduleGraph.getModuleByUrl(url$3).then((module$1) => { - if (!module$1 || pending.timestamp > module$1.lastInvalidationTimestamp) return pending.request; - else { - pending.abort(); - return transformRequest(environment, url$3, options$1); - } - }); - const request = doTransform(environment, url$3, options$1, timestamp); - let cleared = false; - const clearCache = () => { - if (!cleared) { - environment._pendingRequests.delete(url$3); - cleared = true; - } - }; - environment._pendingRequests.set(url$3, { - request, - timestamp, - abort: clearCache - }); - return request.finally(clearCache); -} -async function doTransform(environment, url$3, options$1, timestamp) { - const { pluginContainer } = environment; - let module$1 = await environment.moduleGraph.getModuleByUrl(url$3); - if (module$1) { - const cached = await getCachedTransformResult(environment, url$3, module$1, timestamp); - if (cached) return cached; - } - const resolved = module$1 ? void 0 : await pluginContainer.resolveId(url$3, void 0) ?? void 0; - const id = module$1?.id ?? resolved?.id ?? url$3; - module$1 ??= environment.moduleGraph.getModuleById(id); - if (module$1) { - await environment.moduleGraph._ensureEntryFromUrl(url$3, void 0, resolved); - const cached = await getCachedTransformResult(environment, url$3, module$1, timestamp); - if (cached) return cached; - } - const result = loadAndTransform(environment, id, url$3, options$1, timestamp, module$1, resolved); - const { depsOptimizer } = environment; - if (!depsOptimizer?.isOptimizedDepFile(id)) environment._registerRequestProcessing(id, () => result); - return result; -} -async function getCachedTransformResult(environment, url$3, module$1, timestamp) { - const prettyUrl = debugCache$1 ? prettifyUrl(url$3, environment.config.root) : ""; - const softInvalidatedTransformResult = await handleModuleSoftInvalidation(environment, module$1, timestamp); - if (softInvalidatedTransformResult) { - debugCache$1?.(`[memory-hmr] ${prettyUrl}`); - return softInvalidatedTransformResult; - } - const cached = module$1.transformResult; - if (cached) { - debugCache$1?.(`[memory] ${prettyUrl}`); - return cached; - } -} -async function loadAndTransform(environment, id, url$3, options$1, timestamp, mod, resolved) { - const { config: config$2, pluginContainer, logger } = environment; - const prettyUrl = debugLoad || debugTransform ? prettifyUrl(url$3, config$2.root) : ""; - const moduleGraph = environment.moduleGraph; - if (options$1.allowId && !options$1.allowId(id)) { - const err$2 = /* @__PURE__ */ new Error(`Denied ID ${id}`); - err$2.code = ERR_DENIED_ID; - err$2.id = id; - throw err$2; - } - let code = null; - let map$1 = null; - const loadStart = debugLoad ? performance$1.now() : 0; - const loadResult = await pluginContainer.load(id); - if (loadResult == null) { - const file = cleanUrl(id); - if (environment.config.consumer === "server" || isFileLoadingAllowed(environment.getTopLevelConfig(), slash(file))) { - try { - code = await fsp.readFile(file, "utf-8"); - debugLoad?.(`${timeFrom(loadStart)} [fs] ${prettyUrl}`); - } catch (e$1) { - if (e$1.code !== "ENOENT" && e$1.code !== "EISDIR") throw e$1; - } - if (code != null && environment.pluginContainer.watcher) ensureWatchedFile(environment.pluginContainer.watcher, file, config$2.root); - } - if (code) try { - const extracted = await extractSourcemapFromFile(code, file); - if (extracted) { - code = extracted.code; - map$1 = extracted.map; - } - } catch (e$1) { - logger.warn(`Failed to load source map for ${file}.\n${e$1}`, { timestamp: true }); - } - } else { - debugLoad?.(`${timeFrom(loadStart)} [plugin] ${prettyUrl}`); - if (isObject(loadResult)) { - code = loadResult.code; - map$1 = loadResult.map; - } else code = loadResult; - } - if (code == null) { - const isPublicFile = checkPublicFile(url$3, environment.getTopLevelConfig()); - let publicDirName = path.relative(config$2.root, config$2.publicDir); - if (publicDirName[0] !== ".") publicDirName = "/" + publicDirName; - const msg = isPublicFile ? `This file is in ${publicDirName} and will be copied as-is during build without going through the plugin transforms, and therefore should not be imported from source code. It can only be referenced via HTML tags.` : `Does the file exist?`; - const importerMod = moduleGraph.idToModuleMap.get(id)?.importers.values().next().value; - const importer = importerMod?.file || importerMod?.url; - const err$2 = /* @__PURE__ */ new Error(`Failed to load url ${url$3} (resolved id: ${id})${importer ? ` in ${importer}` : ""}. ${msg}`); - err$2.code = isPublicFile ? ERR_LOAD_PUBLIC_URL : ERR_LOAD_URL; - throw err$2; - } - if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); - mod ??= await moduleGraph._ensureEntryFromUrl(url$3, void 0, resolved); - const transformStart = debugTransform ? performance$1.now() : 0; - const transformResult = await pluginContainer.transform(code, id, { inMap: map$1 }); - const originalCode = code; - if (transformResult.code === originalCode) debugTransform?.(timeFrom(transformStart) + import_picocolors$19.default.dim(` [skipped] ${prettyUrl}`)); - else { - debugTransform?.(`${timeFrom(transformStart)} ${prettyUrl}`); - code = transformResult.code; - map$1 = transformResult.map; - } - let normalizedMap; - if (typeof map$1 === "string") normalizedMap = JSON.parse(map$1); - else if (map$1) normalizedMap = map$1; - else normalizedMap = null; - if (normalizedMap && "version" in normalizedMap && mod.file) { - if (normalizedMap.mappings) await injectSourcesContent(normalizedMap, mod.file, logger); - const sourcemapPath = `${mod.file}.map`; - applySourcemapIgnoreList(normalizedMap, sourcemapPath, config$2.server.sourcemapIgnoreList, logger); - if (path.isAbsolute(mod.file)) { - let modDirname; - for (let sourcesIndex = 0; sourcesIndex < normalizedMap.sources.length; ++sourcesIndex) { - const sourcePath = normalizedMap.sources[sourcesIndex]; - if (sourcePath) { - if (path.isAbsolute(sourcePath)) { - modDirname ??= path.dirname(mod.file); - normalizedMap.sources[sourcesIndex] = path.relative(modDirname, sourcePath); - } - } - } - } - } - if (environment._closing && environment.config.dev.recoverable) throwClosedServerError(); - const topLevelConfig = environment.getTopLevelConfig(); - const result = environment.config.dev.moduleRunnerTransform ? await ssrTransform(code, normalizedMap, url$3, originalCode, { json: { stringify: topLevelConfig.json.stringify === true && topLevelConfig.json.namedExports !== true } }) : { - code, - map: normalizedMap, - etag: (0, import_etag.default)(code, { weak: true }) - }; - if (timestamp > mod.lastInvalidationTimestamp) moduleGraph.updateModuleTransformResult(mod, result); - return result; -} -/** -* When a module is soft-invalidated, we can preserve its previous `transformResult` and -* return similar code to before: -* -* - Client: We need to transform the import specifiers with new timestamps -* - SSR: We don't need to change anything as `ssrLoadModule` controls it -*/ -async function handleModuleSoftInvalidation(environment, mod, timestamp) { - const transformResult = mod.invalidationState; - mod.invalidationState = void 0; - if (!transformResult || transformResult === "HARD_INVALIDATED") return; - if (mod.transformResult) throw new Error(`Internal server error: Soft-invalidated module "${mod.url}" should not have existing transform result`); - let result; - if (transformResult.ssr) result = transformResult; - else { - await init; - const source = transformResult.code; - const s = new MagicString(source); - const [imports] = parse(source, mod.id || void 0); - for (const imp of imports) { - let rawUrl = source.slice(imp.s, imp.e); - if (rawUrl === "import.meta") continue; - const hasQuotes = rawUrl[0] === "\"" || rawUrl[0] === "'"; - if (hasQuotes) rawUrl = rawUrl.slice(1, -1); - const urlWithoutTimestamp = removeTimestampQuery(rawUrl); - const hmrUrl = unwrapId(stripBase(removeImportQuery(urlWithoutTimestamp), environment.config.base)); - for (const importedMod of mod.importedModules) { - if (importedMod.url !== hmrUrl) continue; - if (importedMod.lastHMRTimestamp > 0) { - const replacedUrl = injectQuery(urlWithoutTimestamp, `t=${importedMod.lastHMRTimestamp}`); - const start = hasQuotes ? imp.s + 1 : imp.s; - const end = hasQuotes ? imp.e - 1 : imp.e; - s.overwrite(start, end, replacedUrl); - } - if (imp.d === -1 && environment.config.dev.preTransformRequests) environment.warmupRequest(hmrUrl); - break; - } - } - const code = s.toString(); - result = { - ...transformResult, - code, - etag: (0, import_etag.default)(code, { weak: true }) - }; - } - if (timestamp > mod.lastInvalidationTimestamp) environment.moduleGraph.updateModuleTransformResult(mod, result); - return result; -} - -//#endregion -//#region ../../node_modules/.pnpm/js-tokens@9.0.1/node_modules/js-tokens/index.js -var require_js_tokens = /* @__PURE__ */ __commonJSMin(((exports, module) => { - var HashbangComment, Identifier, JSXIdentifier, JSXPunctuator, JSXString, JSXText, KeywordsWithExpressionAfter, KeywordsWithNoLineTerminatorAfter, LineTerminatorSequence, MultiLineComment, Newline, NumericLiteral, Punctuator, RegularExpressionLiteral = /\/(?![*\/])(?:\[(?:[^\]\\\n\r\u2028\u2029]+|\\.)*\]?|[^\/[\\\n\r\u2028\u2029]+|\\.)*(\/[$_\u200C\u200D\p{ID_Continue}]*|\\)?/uy, SingleLineComment, StringLiteral, Template, TokensNotPrecedingObjectLiteral, TokensPrecedingExpression, WhiteSpace; - Punctuator = /--|\+\+|=>|\.{3}|\??\.(?!\d)|(?:&&|\|\||\?\?|[+\-%&|^]|\*{1,2}|<{1,2}|>{1,3}|!=?|={1,2}|\/(?![\/*]))=?|[?~,:;[\](){}]/y; - Identifier = /(\x23?)(?=[$_\p{ID_Start}\\])(?:[$_\u200C\u200D\p{ID_Continue}]+|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]+\})+/uy; - StringLiteral = /(['"])(?:[^'"\\\n\r]+|(?!\1)['"]|\\(?:\r\n|[^]))*(\1)?/y; - NumericLiteral = /(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[oO][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*)n?|0n|[1-9](?:_?\d)*n|(?:(?:0(?!\d)|0\d*[89]\d*|[1-9](?:_?\d)*)(?:\.(?:\d(?:_?\d)*)?)?|\.\d(?:_?\d)*)(?:[eE][+-]?\d(?:_?\d)*)?|0[0-7]+/y; - Template = /[`}](?:[^`\\$]+|\\[^]|\$(?!\{))*(`|\$\{)?/y; - WhiteSpace = /[\t\v\f\ufeff\p{Zs}]+/uy; - LineTerminatorSequence = /\r?\n|[\r\u2028\u2029]/y; - MultiLineComment = /\/\*(?:[^*]+|\*(?!\/))*(\*\/)?/y; - SingleLineComment = /\/\/.*/y; - HashbangComment = /^#!.*/; - JSXPunctuator = /[<>.:={}]|\/(?![\/*])/y; - JSXIdentifier = /[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}-]*/uy; - JSXString = /(['"])(?:[^'"]+|(?!\1)['"])*(\1)?/y; - JSXText = /[^<>{}]+/y; - TokensPrecedingExpression = /^(?:[\/+-]|\.{3}|\?(?:InterpolationIn(?:JSX|Template)|NoLineTerminatorHere|NonExpressionParenEnd|UnaryIncDec))?$|[{}([,;<>=*%&|^!~?:]$/; - TokensNotPrecedingObjectLiteral = /^(?:=>|[;\]){}]|else|\?(?:NoLineTerminatorHere|NonExpressionParenEnd))?$/; - KeywordsWithExpressionAfter = /^(?:await|case|default|delete|do|else|instanceof|new|return|throw|typeof|void|yield)$/; - KeywordsWithNoLineTerminatorAfter = /^(?:return|throw|yield)$/; - Newline = RegExp(LineTerminatorSequence.source); - module.exports = function* (input, { jsx = false } = {}) { - var braces$2, firstCodePoint, isExpression, lastIndex, lastSignificantToken, length, match, mode, nextLastIndex, nextLastSignificantToken, parenNesting, postfixIncDec, punctuator, stack; - ({length} = input); - lastIndex = 0; - lastSignificantToken = ""; - stack = [{ tag: "JS" }]; - braces$2 = []; - parenNesting = 0; - postfixIncDec = false; - if (match = HashbangComment.exec(input)) { - yield { - type: "HashbangComment", - value: match[0] - }; - lastIndex = match[0].length; - } - while (lastIndex < length) { - mode = stack[stack.length - 1]; - switch (mode.tag) { - case "JS": - case "JSNonExpressionParen": - case "InterpolationInTemplate": - case "InterpolationInJSX": - if (input[lastIndex] === "/" && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { - RegularExpressionLiteral.lastIndex = lastIndex; - if (match = RegularExpressionLiteral.exec(input)) { - lastIndex = RegularExpressionLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield { - type: "RegularExpressionLiteral", - value: match[0], - closed: match[1] !== void 0 && match[1] !== "\\" - }; - continue; - } - } - Punctuator.lastIndex = lastIndex; - if (match = Punctuator.exec(input)) { - punctuator = match[0]; - nextLastIndex = Punctuator.lastIndex; - nextLastSignificantToken = punctuator; - switch (punctuator) { - case "(": - if (lastSignificantToken === "?NonExpressionParenKeyword") stack.push({ - tag: "JSNonExpressionParen", - nesting: parenNesting - }); - parenNesting++; - postfixIncDec = false; - break; - case ")": - parenNesting--; - postfixIncDec = true; - if (mode.tag === "JSNonExpressionParen" && parenNesting === mode.nesting) { - stack.pop(); - nextLastSignificantToken = "?NonExpressionParenEnd"; - postfixIncDec = false; - } - break; - case "{": - Punctuator.lastIndex = 0; - isExpression = !TokensNotPrecedingObjectLiteral.test(lastSignificantToken) && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken)); - braces$2.push(isExpression); - postfixIncDec = false; - break; - case "}": - switch (mode.tag) { - case "InterpolationInTemplate": - if (braces$2.length === mode.nesting) { - Template.lastIndex = lastIndex; - match = Template.exec(input); - lastIndex = Template.lastIndex; - lastSignificantToken = match[0]; - if (match[1] === "${") { - lastSignificantToken = "?InterpolationInTemplate"; - postfixIncDec = false; - yield { - type: "TemplateMiddle", - value: match[0] - }; - } else { - stack.pop(); - postfixIncDec = true; - yield { - type: "TemplateTail", - value: match[0], - closed: match[1] === "`" - }; - } - continue; - } - break; - case "InterpolationInJSX": if (braces$2.length === mode.nesting) { - stack.pop(); - lastIndex += 1; - lastSignificantToken = "}"; - yield { - type: "JSXPunctuator", - value: "}" - }; - continue; - } - } - postfixIncDec = braces$2.pop(); - nextLastSignificantToken = postfixIncDec ? "?ExpressionBraceEnd" : "}"; - break; - case "]": - postfixIncDec = true; - break; - case "++": - case "--": - nextLastSignificantToken = postfixIncDec ? "?PostfixIncDec" : "?UnaryIncDec"; - break; - case "<": - if (jsx && (TokensPrecedingExpression.test(lastSignificantToken) || KeywordsWithExpressionAfter.test(lastSignificantToken))) { - stack.push({ tag: "JSXTag" }); - lastIndex += 1; - lastSignificantToken = "<"; - yield { - type: "JSXPunctuator", - value: punctuator - }; - continue; - } - postfixIncDec = false; - break; - default: postfixIncDec = false; - } - lastIndex = nextLastIndex; - lastSignificantToken = nextLastSignificantToken; - yield { - type: "Punctuator", - value: punctuator - }; - continue; - } - Identifier.lastIndex = lastIndex; - if (match = Identifier.exec(input)) { - lastIndex = Identifier.lastIndex; - nextLastSignificantToken = match[0]; - switch (match[0]) { - case "for": - case "if": - case "while": - case "with": if (lastSignificantToken !== "." && lastSignificantToken !== "?.") nextLastSignificantToken = "?NonExpressionParenKeyword"; - } - lastSignificantToken = nextLastSignificantToken; - postfixIncDec = !KeywordsWithExpressionAfter.test(match[0]); - yield { - type: match[1] === "#" ? "PrivateIdentifier" : "IdentifierName", - value: match[0] - }; - continue; - } - StringLiteral.lastIndex = lastIndex; - if (match = StringLiteral.exec(input)) { - lastIndex = StringLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield { - type: "StringLiteral", - value: match[0], - closed: match[2] !== void 0 - }; - continue; - } - NumericLiteral.lastIndex = lastIndex; - if (match = NumericLiteral.exec(input)) { - lastIndex = NumericLiteral.lastIndex; - lastSignificantToken = match[0]; - postfixIncDec = true; - yield { - type: "NumericLiteral", - value: match[0] - }; - continue; - } - Template.lastIndex = lastIndex; - if (match = Template.exec(input)) { - lastIndex = Template.lastIndex; - lastSignificantToken = match[0]; - if (match[1] === "${") { - lastSignificantToken = "?InterpolationInTemplate"; - stack.push({ - tag: "InterpolationInTemplate", - nesting: braces$2.length - }); - postfixIncDec = false; - yield { - type: "TemplateHead", - value: match[0] - }; - } else { - postfixIncDec = true; - yield { - type: "NoSubstitutionTemplate", - value: match[0], - closed: match[1] === "`" - }; - } - continue; - } - break; - case "JSXTag": - case "JSXTagEnd": - JSXPunctuator.lastIndex = lastIndex; - if (match = JSXPunctuator.exec(input)) { - lastIndex = JSXPunctuator.lastIndex; - nextLastSignificantToken = match[0]; - switch (match[0]) { - case "<": - stack.push({ tag: "JSXTag" }); - break; - case ">": - stack.pop(); - if (lastSignificantToken === "/" || mode.tag === "JSXTagEnd") { - nextLastSignificantToken = "?JSX"; - postfixIncDec = true; - } else stack.push({ tag: "JSXChildren" }); - break; - case "{": - stack.push({ - tag: "InterpolationInJSX", - nesting: braces$2.length - }); - nextLastSignificantToken = "?InterpolationInJSX"; - postfixIncDec = false; - break; - case "/": if (lastSignificantToken === "<") { - stack.pop(); - if (stack[stack.length - 1].tag === "JSXChildren") stack.pop(); - stack.push({ tag: "JSXTagEnd" }); - } - } - lastSignificantToken = nextLastSignificantToken; - yield { - type: "JSXPunctuator", - value: match[0] - }; - continue; - } - JSXIdentifier.lastIndex = lastIndex; - if (match = JSXIdentifier.exec(input)) { - lastIndex = JSXIdentifier.lastIndex; - lastSignificantToken = match[0]; - yield { - type: "JSXIdentifier", - value: match[0] - }; - continue; - } - JSXString.lastIndex = lastIndex; - if (match = JSXString.exec(input)) { - lastIndex = JSXString.lastIndex; - lastSignificantToken = match[0]; - yield { - type: "JSXString", - value: match[0], - closed: match[2] !== void 0 - }; - continue; - } - break; - case "JSXChildren": - JSXText.lastIndex = lastIndex; - if (match = JSXText.exec(input)) { - lastIndex = JSXText.lastIndex; - lastSignificantToken = match[0]; - yield { - type: "JSXText", - value: match[0] - }; - continue; - } - switch (input[lastIndex]) { - case "<": - stack.push({ tag: "JSXTag" }); - lastIndex++; - lastSignificantToken = "<"; - yield { - type: "JSXPunctuator", - value: "<" - }; - continue; - case "{": - stack.push({ - tag: "InterpolationInJSX", - nesting: braces$2.length - }); - lastIndex++; - lastSignificantToken = "?InterpolationInJSX"; - postfixIncDec = false; - yield { - type: "JSXPunctuator", - value: "{" - }; - continue; - } - } - WhiteSpace.lastIndex = lastIndex; - if (match = WhiteSpace.exec(input)) { - lastIndex = WhiteSpace.lastIndex; - yield { - type: "WhiteSpace", - value: match[0] - }; - continue; - } - LineTerminatorSequence.lastIndex = lastIndex; - if (match = LineTerminatorSequence.exec(input)) { - lastIndex = LineTerminatorSequence.lastIndex; - postfixIncDec = false; - if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere"; - yield { - type: "LineTerminatorSequence", - value: match[0] - }; - continue; - } - MultiLineComment.lastIndex = lastIndex; - if (match = MultiLineComment.exec(input)) { - lastIndex = MultiLineComment.lastIndex; - if (Newline.test(match[0])) { - postfixIncDec = false; - if (KeywordsWithNoLineTerminatorAfter.test(lastSignificantToken)) lastSignificantToken = "?NoLineTerminatorHere"; - } - yield { - type: "MultiLineComment", - value: match[0], - closed: match[1] !== void 0 - }; - continue; - } - SingleLineComment.lastIndex = lastIndex; - if (match = SingleLineComment.exec(input)) { - lastIndex = SingleLineComment.lastIndex; - postfixIncDec = false; - yield { - type: "SingleLineComment", - value: match[0] - }; - continue; - } - firstCodePoint = String.fromCodePoint(input.codePointAt(lastIndex)); - lastIndex += firstCodePoint.length; - lastSignificantToken = firstCodePoint; - postfixIncDec = false; - yield { - type: mode.tag.startsWith("JSX") ? "JSXInvalid" : "Invalid", - value: firstCodePoint - }; - } - }; -})); - -//#endregion -//#region ../../node_modules/.pnpm/strip-literal@3.1.0/node_modules/strip-literal/dist/index.mjs -var import_js_tokens = /* @__PURE__ */ __toESM(require_js_tokens(), 1); -const FILL_COMMENT = " "; -function stripLiteralFromToken(token, fillChar, filter$1) { - if (token.type === "SingleLineComment") return FILL_COMMENT.repeat(token.value.length); - if (token.type === "MultiLineComment") return token.value.replace(/[^\n]/g, FILL_COMMENT); - if (token.type === "StringLiteral") { - if (!token.closed) return token.value; - const body = token.value.slice(1, -1); - if (filter$1(body)) return token.value[0] + fillChar.repeat(body.length) + token.value[token.value.length - 1]; - } - if (token.type === "NoSubstitutionTemplate") { - const body = token.value.slice(1, -1); - if (filter$1(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\``; - } - if (token.type === "RegularExpressionLiteral") { - const body = token.value; - if (filter$1(body)) return body.replace(/\/(.*)\/(\w?)$/g, (_, $1, $2) => `/${fillChar.repeat($1.length)}/${$2}`); - } - if (token.type === "TemplateHead") { - const body = token.value.slice(1, -2); - if (filter$1(body)) return `\`${body.replace(/[^\n]/g, fillChar)}\${`; - } - if (token.type === "TemplateTail") { - const body = token.value.slice(0, -2); - if (filter$1(body)) return `}${body.replace(/[^\n]/g, fillChar)}\``; - } - if (token.type === "TemplateMiddle") { - const body = token.value.slice(1, -2); - if (filter$1(body)) return `}${body.replace(/[^\n]/g, fillChar)}\${`; - } - return token.value; -} -function optionsWithDefaults(options$1) { - return { - fillChar: options$1?.fillChar ?? " ", - filter: options$1?.filter ?? (() => true) - }; -} -function stripLiteral(code, options$1) { - let result = ""; - const _options = optionsWithDefaults(options$1); - for (const token of (0, import_js_tokens.default)(code, { jsx: false })) result += stripLiteralFromToken(token, _options.fillChar, _options.filter); - return result; -} - -//#endregion -//#region src/node/assetSource.ts -const ALLOWED_META_NAME = [ - "msapplication-tileimage", - "msapplication-square70x70logo", - "msapplication-square150x150logo", - "msapplication-wide310x150logo", - "msapplication-square310x310logo", - "msapplication-config", - "twitter:image" -]; -const ALLOWED_META_PROPERTY = [ - "og:image", - "og:image:url", - "og:image:secure_url", - "og:audio", - "og:audio:secure_url", - "og:video", - "og:video:secure_url" -]; -const DEFAULT_HTML_ASSET_SOURCES = { - audio: { srcAttributes: ["src"] }, - embed: { srcAttributes: ["src"] }, - img: { - srcAttributes: ["src"], - srcsetAttributes: ["srcset"] - }, - image: { srcAttributes: ["href", "xlink:href"] }, - input: { srcAttributes: ["src"] }, - link: { - srcAttributes: ["href"], - srcsetAttributes: ["imagesrcset"] - }, - object: { srcAttributes: ["data"] }, - source: { - srcAttributes: ["src"], - srcsetAttributes: ["srcset"] - }, - track: { srcAttributes: ["src"] }, - use: { srcAttributes: ["href", "xlink:href"] }, - video: { srcAttributes: ["src", "poster"] }, - meta: { - srcAttributes: ["content"], - filter({ attributes }) { - if (attributes.name && ALLOWED_META_NAME.includes(attributes.name.trim().toLowerCase())) return true; - if (attributes.property && ALLOWED_META_PROPERTY.includes(attributes.property.trim().toLowerCase())) return true; - return false; - } - } -}; -/** -* Given a HTML node, find all attributes that references an asset to be processed -*/ -function getNodeAssetAttributes(node) { - const matched = DEFAULT_HTML_ASSET_SOURCES[node.nodeName]; - if (!matched) return []; - const attributes = {}; - for (const attr of node.attrs) attributes[getAttrKey(attr)] = attr.value; - if ("vite-ignore" in attributes) return [{ - type: "remove", - key: "vite-ignore", - value: "", - attributes, - location: node.sourceCodeLocation.attrs["vite-ignore"] - }]; - const actions = []; - function handleAttributeKey(key, type) { - const value$1 = attributes[key]; - if (!value$1) return; - if (matched.filter && !matched.filter({ - key, - value: value$1, - attributes - })) return; - const location$1 = node.sourceCodeLocation.attrs[key]; - actions.push({ - type, - key, - value: value$1, - attributes, - location: location$1 - }); - } - matched.srcAttributes?.forEach((key) => handleAttributeKey(key, "src")); - matched.srcsetAttributes?.forEach((key) => handleAttributeKey(key, "srcset")); - return actions; -} -function getAttrKey(attr) { - return attr.prefix === void 0 ? attr.name : `${attr.prefix}:${attr.name}`; -} - -//#endregion -//#region src/node/plugins/importAnalysisBuild.ts -var import_convert_source_map = /* @__PURE__ */ __toESM(require_convert_source_map(), 1); -/** -* A flag for injected helpers. This flag will be set to `false` if the output -* target is not native es - so that injected helper logic can be conditionally -* dropped. -*/ -const isModernFlag = `__VITE_IS_MODERN__`; -const preloadMethod = `__vitePreload`; -const preloadMarker = `__VITE_PRELOAD__`; -const preloadHelperId = "\0vite/preload-helper.js"; -const preloadMarkerRE = new RegExp(preloadMarker, "g"); -const dynamicImportPrefixRE = /import\s*\(/; -const dynamicImportTreeshakenRE = /((?:\bconst\s+|\blet\s+|\bvar\s+|,\s*)(\{[^{}.=]+\})\s*=\s*await\s+import\([^)]+\))(?=\s*(?:$|[^[.]))|(\(\s*await\s+import\([^)]+\)\s*\)(\??\.[\w$]+))|\bimport\([^)]+\)(\s*\.then\(\s*(?:function\s*)?\(\s*\{([^{}.=]+)\}\))/g; -function toRelativePath(filename, importer) { - const relPath = path.posix.relative(path.posix.dirname(importer), filename); - return relPath[0] === "." ? relPath : `./${relPath}`; -} -function findPreloadMarker(str, pos = 0) { - preloadMarkerRE.lastIndex = pos; - return preloadMarkerRE.exec(str)?.index ?? -1; -} -/** -* Helper for preloading CSS and direct imports of async chunks in parallel to -* the async chunk itself. -*/ -function detectScriptRel() { - const relList = typeof document !== "undefined" && document.createElement("link").relList; - return relList && relList.supports && relList.supports("modulepreload") ? "modulepreload" : "preload"; -} -function preload(baseModule, deps, importerUrl) { - let promise = Promise.resolve(); - if (__VITE_IS_MODERN__ && deps && deps.length > 0) { - const links = document.getElementsByTagName("link"); - const cspNonceMeta = document.querySelector("meta[property=csp-nonce]"); - const cspNonce = cspNonceMeta?.nonce || cspNonceMeta?.getAttribute("nonce"); - function allSettled(promises$2) { - return Promise.all(promises$2.map((p) => Promise.resolve(p).then((value$1) => ({ - status: "fulfilled", - value: value$1 - }), (reason) => ({ - status: "rejected", - reason - })))); - } - promise = allSettled(deps.map((dep) => { - dep = assetsURL(dep, importerUrl); - if (dep in seen) return; - seen[dep] = true; - const isCss = dep.endsWith(".css"); - const cssSelector = isCss ? "[rel=\"stylesheet\"]" : ""; - if (!!importerUrl) for (let i$1 = links.length - 1; i$1 >= 0; i$1--) { - const link$1 = links[i$1]; - if (link$1.href === dep && (!isCss || link$1.rel === "stylesheet")) return; - } - else if (document.querySelector(`link[href="${dep}"]${cssSelector}`)) return; - const link = document.createElement("link"); - link.rel = isCss ? "stylesheet" : scriptRel; - if (!isCss) link.as = "script"; - link.crossOrigin = ""; - link.href = dep; - if (cspNonce) link.setAttribute("nonce", cspNonce); - document.head.appendChild(link); - if (isCss) return new Promise((res, rej) => { - link.addEventListener("load", res); - link.addEventListener("error", () => rej(/* @__PURE__ */ new Error(`Unable to preload CSS for ${dep}`))); - }); - })); - } - function handlePreloadError(err$2) { - const e$1 = new Event("vite:preloadError", { cancelable: true }); - e$1.payload = err$2; - window.dispatchEvent(e$1); - if (!e$1.defaultPrevented) throw err$2; - } - return promise.then((res) => { - for (const item of res || []) { - if (item.status !== "rejected") continue; - handlePreloadError(item.reason); - } - return baseModule().catch(handlePreloadError); - }); -} -function getPreloadCode(environment, renderBuiltUrlBoolean, isRelativeBase) { - const { modulePreload } = environment.config.build; - return `const scriptRel = ${modulePreload && modulePreload.polyfill ? `'modulepreload'` : `/* @__PURE__ */ (${detectScriptRel.toString()})()`};const assetsURL = ${renderBuiltUrlBoolean || isRelativeBase ? `function(dep, importerUrl) { return new URL(dep, importerUrl).href }` : `function(dep) { return ${JSON.stringify(environment.config.base)}+dep }`};const seen = {};export const ${preloadMethod} = ${preload.toString()}`; -} -/** -* Build only. During serve this is performed as part of ./importAnalysis. -*/ -function buildImportAnalysisPlugin(config$2) { - const getInsertPreload = (environment) => environment.config.consumer === "client" && !config$2.isWorker && !config$2.build.lib; - const renderBuiltUrl = config$2.experimental.renderBuiltUrl; - const isRelativeBase = config$2.base === "./" || config$2.base === ""; - return { - name: "vite:build-import-analysis", - resolveId: { - filter: { id: exactRegex(preloadHelperId) }, - handler(id) { - return id; - } - }, - load: { - filter: { id: exactRegex(preloadHelperId) }, - handler(_id) { - return { - code: getPreloadCode(this.environment, !!renderBuiltUrl, isRelativeBase), - moduleSideEffects: false - }; - } - }, - transform: { - filter: { code: dynamicImportPrefixRE }, - async handler(source, importer) { - await init; - let imports = []; - try { - imports = parse(source)[0]; - } catch (_e) { - const e$1 = _e; - const { message, showCodeFrame } = createParseErrorInfo(importer, source); - this.error(message, showCodeFrame ? e$1.idx : void 0); - } - if (!imports.length) return null; - const insertPreload = getInsertPreload(this.environment); - const dynamicImports = {}; - if (insertPreload) { - let match; - while (match = dynamicImportTreeshakenRE.exec(source)) { - if (match[1]) { - dynamicImports[dynamicImportTreeshakenRE.lastIndex] = { - declaration: `const ${match[2]}`, - names: match[2]?.trim() - }; - continue; - } - if (match[3]) { - let names$1 = /\.([^.?]+)/.exec(match[4])?.[1] || ""; - if (names$1 === "default") names$1 = "default: __vite_default__"; - dynamicImports[dynamicImportTreeshakenRE.lastIndex - match[4]?.length - 1] = { - declaration: `const {${names$1}}`, - names: `{ ${names$1} }` - }; - continue; - } - const names = match[6]?.trim(); - dynamicImports[dynamicImportTreeshakenRE.lastIndex - match[5]?.length] = { - declaration: `const {${names}}`, - names: `{ ${names} }` - }; - } - } - let s; - const str = () => s || (s = new MagicString(source)); - let needPreloadHelper = false; - for (let index = 0; index < imports.length; index++) { - const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, a: attributeIndex } = imports[index]; - const isDynamicImport = dynamicIndex > -1; - if (!isDynamicImport && attributeIndex > -1) str().remove(end + 1, expEnd); - if (isDynamicImport && insertPreload && (source[start] === "\"" || source[start] === "'" || source[start] === "`")) { - needPreloadHelper = true; - const { declaration, names } = dynamicImports[expEnd] || {}; - if (names) { - str().prependLeft(expStart, `${preloadMethod}(async () => { ${declaration} = await `); - str().appendRight(expEnd, `;return ${names}}`); - } else str().prependLeft(expStart, `${preloadMethod}(() => `); - str().appendRight(expEnd, `,${isModernFlag}?${preloadMarker}:void 0${renderBuiltUrl || isRelativeBase ? ",import.meta.url" : ""})`); - } - } - if (needPreloadHelper && insertPreload && !source.includes(`const ${preloadMethod} =`)) str().prepend(`import { ${preloadMethod} } from "${preloadHelperId}";`); - if (s) return { - code: s.toString(), - map: this.environment.config.build.sourcemap ? s.generateMap({ hires: "boundary" }) : null - }; - } - }, - renderChunk(code, _, { format: format$3 }) { - if (code.indexOf(isModernFlag) > -1) { - const re = new RegExp(isModernFlag, "g"); - const isModern = String(format$3 === "es"); - const isModernWithPadding = isModern + " ".repeat(isModernFlag.length - isModern.length); - return { - code: code.replace(re, isModernWithPadding), - map: null - }; - } - return null; - }, - generateBundle({ format: format$3 }, bundle) { - if (format$3 !== "es") return; - if (!getInsertPreload(this.environment)) { - const removedPureCssFiles = removedPureCssFilesCache.get(config$2); - if (removedPureCssFiles && removedPureCssFiles.size > 0) for (const file in bundle) { - const chunk = bundle[file]; - if (chunk.type === "chunk" && chunk.code.includes("import")) { - const code = chunk.code; - let imports; - try { - imports = parse(code)[0].filter((i$1) => i$1.d > -1); - } catch (e$1) { - const loc = numberToPos(code, e$1.idx); - this.error({ - name: e$1.name, - message: e$1.message, - stack: e$1.stack, - cause: e$1.cause, - pos: e$1.idx, - loc: { - ...loc, - file: chunk.fileName - }, - frame: generateCodeFrame(code, loc) - }); - } - for (const imp of imports) { - const { n: name, s: start, e: end, ss: expStart, se: expEnd } = imp; - let url$3 = name; - if (!url$3) { - const rawUrl = code.slice(start, end); - if (rawUrl[0] === `"` && rawUrl.endsWith(`"`)) url$3 = rawUrl.slice(1, -1); - } - if (!url$3) continue; - const normalizedFile = path.posix.join(path.posix.dirname(chunk.fileName), url$3); - if (removedPureCssFiles.has(normalizedFile)) chunk.code = chunk.code.slice(0, expStart) + `Promise.resolve({${"".padEnd(expEnd - expStart - 19, " ")}})` + chunk.code.slice(expEnd); - } - } - } - return; - } - const buildSourcemap = this.environment.config.build.sourcemap; - const { modulePreload } = this.environment.config.build; - for (const file in bundle) { - const chunk = bundle[file]; - if (chunk.type === "chunk" && chunk.code.indexOf(preloadMarker) > -1) { - const code = chunk.code; - let imports; - try { - imports = parse(code)[0].filter((i$1) => i$1.d > -1); - } catch (e$1) { - const loc = numberToPos(code, e$1.idx); - this.error({ - name: e$1.name, - message: e$1.message, - stack: e$1.stack, - cause: e$1.cause, - pos: e$1.idx, - loc: { - ...loc, - file: chunk.fileName - }, - frame: generateCodeFrame(code, loc) - }); - } - const s = new MagicString(code); - const rewroteMarkerStartPos = /* @__PURE__ */ new Set(); - const fileDeps = []; - const addFileDep = (url$3, runtime = false) => { - const index = fileDeps.findIndex((dep) => dep.url === url$3); - if (index === -1) return fileDeps.push({ - url: url$3, - runtime - }) - 1; - else return index; - }; - if (imports.length) for (let index = 0; index < imports.length; index++) { - const { n: name, s: start, e: end, ss: expStart, se: expEnd } = imports[index]; - let url$3 = name; - if (!url$3) { - const rawUrl = code.slice(start, end); - if (rawUrl[0] === `"` && rawUrl.endsWith(`"`)) url$3 = rawUrl.slice(1, -1); - } - const deps = /* @__PURE__ */ new Set(); - let hasRemovedPureCssChunk = false; - let normalizedFile = void 0; - if (url$3) { - normalizedFile = path.posix.join(path.posix.dirname(chunk.fileName), url$3); - const ownerFilename = chunk.fileName; - const analyzed = /* @__PURE__ */ new Set(); - const addDeps = (filename) => { - if (filename === ownerFilename) return; - if (analyzed.has(filename)) return; - analyzed.add(filename); - const chunk$1 = bundle[filename]; - if (chunk$1) { - deps.add(chunk$1.fileName); - if (chunk$1.type === "chunk") { - chunk$1.imports.forEach(addDeps); - chunk$1.viteMetadata.importedCss.forEach((file$1) => { - deps.add(file$1); - }); - } - } else { - const chunk$2 = removedPureCssFilesCache.get(config$2).get(filename); - if (chunk$2) { - if (chunk$2.viteMetadata.importedCss.size) { - chunk$2.viteMetadata.importedCss.forEach((file$1) => { - deps.add(file$1); - }); - hasRemovedPureCssChunk = true; - } - s.update(expStart, expEnd, "Promise.resolve({})"); - } - } - }; - addDeps(normalizedFile); - } - let markerStartPos$1 = findPreloadMarker(code, end); - if (markerStartPos$1 === -1 && imports.length === 1) markerStartPos$1 = findPreloadMarker(code); - if (markerStartPos$1 > 0) { - let depsArray = deps.size > 1 || hasRemovedPureCssChunk && deps.size > 0 ? modulePreload === false ? [...deps].filter((d) => d.endsWith(".css")) : [...deps] : []; - const resolveDependencies = modulePreload ? modulePreload.resolveDependencies : void 0; - if (resolveDependencies && normalizedFile) { - const cssDeps = []; - const otherDeps = []; - for (const dep of depsArray) (dep.endsWith(".css") ? cssDeps : otherDeps).push(dep); - depsArray = [...resolveDependencies(normalizedFile, otherDeps, { - hostId: file, - hostType: "js" - }), ...cssDeps]; - } - let renderedDeps; - if (renderBuiltUrl) renderedDeps = depsArray.map((dep) => { - const replacement = toOutputFilePathInJS(this.environment, dep, "asset", chunk.fileName, "js", toRelativePath); - if (typeof replacement === "string") return addFileDep(replacement); - return addFileDep(replacement.runtime, true); - }); - else renderedDeps = depsArray.map((d) => isRelativeBase ? addFileDep(toRelativePath(d, file)) : addFileDep(d)); - s.update(markerStartPos$1, markerStartPos$1 + preloadMarker.length, renderedDeps.length > 0 ? `__vite__mapDeps([${renderedDeps.join(",")}])` : `[]`); - rewroteMarkerStartPos.add(markerStartPos$1); - } - } - if (fileDeps.length > 0) { - const mapDepsCode = `const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=${`[${fileDeps.map((fileDep) => fileDep.runtime ? fileDep.url : JSON.stringify(fileDep.url)).join(",")}]`})))=>i.map(i=>d[i]);\n`; - if (code.startsWith("#!")) s.prependLeft(code.indexOf("\n") + 1, mapDepsCode); - else s.prepend(mapDepsCode); - } - let markerStartPos = findPreloadMarker(code); - while (markerStartPos >= 0) { - if (!rewroteMarkerStartPos.has(markerStartPos)) s.update(markerStartPos, markerStartPos + preloadMarker.length, "void 0"); - markerStartPos = findPreloadMarker(code, markerStartPos + preloadMarker.length); - } - if (s.hasChanged()) { - chunk.code = s.toString(); - if (buildSourcemap && chunk.map) { - const nextMap = s.generateMap({ - source: chunk.fileName, - hires: "boundary" - }); - const originalFile = chunk.map.file; - const map$1 = combineSourcemaps(chunk.fileName, [nextMap, chunk.map]); - map$1.toUrl = () => genSourceMapUrl(map$1); - if (originalFile) map$1.file = originalFile; - const originalDebugId = chunk.map.debugId; - chunk.map = map$1; - if (buildSourcemap === "inline") { - chunk.code = chunk.code.replace(import_convert_source_map.default.mapFileCommentRegex, ""); - chunk.code += `\n//# sourceMappingURL=${genSourceMapUrl(map$1)}`; - } else { - if (originalDebugId) map$1.debugId = originalDebugId; - const mapAsset = bundle[chunk.fileName + ".map"]; - if (mapAsset && mapAsset.type === "asset") mapAsset.source = map$1.toString(); - } - } - } - } - } - } - }; -} - -//#endregion -//#region src/node/plugins/modulePreloadPolyfill.ts -const modulePreloadPolyfillId = "vite/modulepreload-polyfill"; -const resolvedModulePreloadPolyfillId = "\0" + modulePreloadPolyfillId + ".js"; -function modulePreloadPolyfillPlugin(config$2) { - let polyfillString; - return { - name: "vite:modulepreload-polyfill", - resolveId: { - filter: { id: exactRegex(modulePreloadPolyfillId) }, - handler(_id) { - return resolvedModulePreloadPolyfillId; - } - }, - load: { - filter: { id: exactRegex(resolvedModulePreloadPolyfillId) }, - handler(_id) { - if (config$2.command !== "build" || this.environment.config.consumer !== "client") return ""; - if (!polyfillString) polyfillString = `${isModernFlag}&&(${polyfill.toString()}());`; - return { - code: polyfillString, - moduleSideEffects: true - }; - } - } - }; -} -function polyfill() { - const relList = document.createElement("link").relList; - if (relList && relList.supports && relList.supports("modulepreload")) return; - for (const link of document.querySelectorAll("link[rel=\"modulepreload\"]")) processPreload(link); - new MutationObserver((mutations) => { - for (const mutation of mutations) { - if (mutation.type !== "childList") continue; - for (const node of mutation.addedNodes) if (node.tagName === "LINK" && node.rel === "modulepreload") processPreload(node); - } - }).observe(document, { - childList: true, - subtree: true - }); - function getFetchOpts(link) { - const fetchOpts = {}; - if (link.integrity) fetchOpts.integrity = link.integrity; - if (link.referrerPolicy) fetchOpts.referrerPolicy = link.referrerPolicy; - if (link.crossOrigin === "use-credentials") fetchOpts.credentials = "include"; - else if (link.crossOrigin === "anonymous") fetchOpts.credentials = "omit"; - else fetchOpts.credentials = "same-origin"; - return fetchOpts; - } - function processPreload(link) { - if (link.ep) return; - link.ep = true; - const fetchOpts = getFetchOpts(link); - fetch(link.href, fetchOpts); - } -} - -//#endregion -//#region src/node/plugins/html.ts -var import_picocolors$18 = /* @__PURE__ */ __toESM(require_picocolors(), 1); -var import_escape_html = /* @__PURE__ */ __toESM(require_escape_html(), 1); -const htmlProxyRE$1 = /[?&]html-proxy=?(?:&inline-css)?(?:&style-attr)?&index=(\d+)\.(?:js|css)$/; -const isHtmlProxyRE = /[?&]html-proxy\b/; -const inlineCSSRE$1 = /__VITE_INLINE_CSS__([a-z\d]{8}_\d+)__/g; -const inlineImportRE = /(?]*type\s*=\s*(?:"importmap"|'importmap'|importmap)[^>]*>.*?<\/script>/is; -const importMapAppendRE = new RegExp([/[ \t]*]*type\s*=\s*(?:"module"|'module'|module)[^>]*>/i, /[ \t]*]*rel\s*=\s*(?:"modulepreload"|'modulepreload'|modulepreload)[\s\S]*?\/>/i].map((r$1) => r$1.source).join("|"), "i"); -const isHTMLProxy = (id) => isHtmlProxyRE.test(id); -const isHTMLRequest = (request) => htmlLangRE.test(request); -const htmlProxyMap = /* @__PURE__ */ new WeakMap(); -const htmlProxyResult = /* @__PURE__ */ new Map(); -function htmlInlineProxyPlugin(config$2) { - htmlProxyMap.set(config$2, /* @__PURE__ */ new Map()); - return { - name: "vite:html-inline-proxy", - resolveId: { - filter: { id: isHtmlProxyRE }, - handler(id) { - return id; - } - }, - load: { - filter: { id: isHtmlProxyRE }, - handler(id) { - const proxyMatch = htmlProxyRE$1.exec(id); - if (proxyMatch) { - const index = Number(proxyMatch[1]); - const url$3 = cleanUrl(id).replace(normalizePath(config$2.root), ""); - const result = htmlProxyMap.get(config$2).get(url$3)?.[index]; - if (result) return { - ...result, - moduleSideEffects: true - }; - else throw new Error(`No matching HTML proxy module found from ${id}`); - } - } - } - }; -} -function addToHTMLProxyCache(config$2, filePath, index, result) { - if (!htmlProxyMap.get(config$2)) htmlProxyMap.set(config$2, /* @__PURE__ */ new Map()); - if (!htmlProxyMap.get(config$2).get(filePath)) htmlProxyMap.get(config$2).set(filePath, []); - htmlProxyMap.get(config$2).get(filePath)[index] = result; -} -function addToHTMLProxyTransformResult(hash$1, code) { - htmlProxyResult.set(hash$1, code); -} -const noInlineLinkRels = new Set([ - "icon", - "apple-touch-icon", - "apple-touch-startup-image", - "manifest" -]); -const isAsyncScriptMap = /* @__PURE__ */ new WeakMap(); -function nodeIsElement(node) { - return node.nodeName[0] !== "#"; -} -function traverseNodes(node, visitor) { - if (node.nodeName === "template") node = node.content; - visitor(node); - if (nodeIsElement(node) || node.nodeName === "#document" || node.nodeName === "#document-fragment") node.childNodes.forEach((childNode) => traverseNodes(childNode, visitor)); -} -async function traverseHtml(html, filePath, warn, visitor) { - const { parse: parse$15 } = await import("./dist.js"); - const warnings = {}; - traverseNodes(parse$15(html, { - scriptingEnabled: false, - sourceCodeLocationInfo: true, - onParseError: (e$1) => { - handleParseError(e$1, html, filePath, warnings); - } - }), visitor); - for (const message of Object.values(warnings)) warn(import_picocolors$18.default.yellow(`\n${message}`)); -} -function getScriptInfo(node) { - let src; - let srcSourceCodeLocation; - let isModule = false; - let isAsync = false; - let isIgnored = false; - for (const p of node.attrs) { - if (p.prefix !== void 0) continue; - if (p.name === "src") { - if (!src) { - src = p; - srcSourceCodeLocation = node.sourceCodeLocation?.attrs["src"]; - } - } else if (p.name === "type" && p.value === "module") isModule = true; - else if (p.name === "async") isAsync = true; - else if (p.name === "vite-ignore") isIgnored = true; - } - return { - src, - srcSourceCodeLocation, - isModule, - isAsync, - isIgnored - }; -} -const attrValueStartRE = /=\s*(.)/; -function overwriteAttrValue(s, sourceCodeLocation, newValue) { - const srcString = s.slice(sourceCodeLocation.startOffset, sourceCodeLocation.endOffset); - const valueStart = attrValueStartRE.exec(srcString); - if (!valueStart) throw new Error(`[vite:html] internal error, failed to overwrite attribute value`); - const wrapOffset = valueStart[1] === "\"" || valueStart[1] === "'" ? 1 : 0; - const valueOffset = valueStart.index + valueStart[0].length - 1; - s.update(sourceCodeLocation.startOffset + valueOffset + wrapOffset, sourceCodeLocation.endOffset - wrapOffset, newValue); - return s; -} -function removeViteIgnoreAttr(s, sourceCodeLocation) { - const loc = sourceCodeLocation.attrs?.["vite-ignore"]; - if (loc) s.remove(loc.startOffset, loc.endOffset); - return s; -} -/** -* Format parse5 @type {ParserError} to @type {RollupError} -*/ -function formatParseError(parserError, id, html) { - return { - code: parserError.code, - message: `parse5 error code ${parserError.code}`, - frame: generateCodeFrame(html, parserError.startOffset, parserError.endOffset), - loc: { - file: id, - line: parserError.startLine, - column: parserError.startCol - } - }; -} -function handleParseError(parserError, html, filePath, warnings) { - switch (parserError.code) { - case "missing-doctype": return; - case "abandoned-head-element-child": return; - case "duplicate-attribute": return; - case "non-void-html-element-start-tag-with-trailing-solidus": return; - case "unexpected-question-mark-instead-of-tag-name": return; - } - const parseError = formatParseError(parserError, filePath, html); - warnings[parseError.code] ??= `Unable to parse HTML; ${parseError.message}\n at ${parseError.loc.file}:${parseError.loc.line}:${parseError.loc.column}\n` + parseError.frame; -} -/** -* Compiles index.html into an entry js module -*/ -function buildHtmlPlugin(config$2) { - const [preHooks, normalHooks, postHooks] = resolveHtmlTransforms(config$2.plugins); - preHooks.unshift(injectCspNonceMetaTagHook(config$2)); - preHooks.unshift(preImportMapHook(config$2)); - preHooks.push(htmlEnvHook(config$2)); - postHooks.push(injectNonceAttributeTagHook(config$2)); - postHooks.push(postImportMapHook()); - const processedHtml = perEnvironmentState(() => /* @__PURE__ */ new Map()); - const isExcludedUrl = (url$3) => url$3[0] === "#" || isExternalUrl(url$3) || isDataUrl(url$3); - isAsyncScriptMap.set(config$2, /* @__PURE__ */ new Map()); - return { - name: "vite:build-html", - transform: { - filter: { id: /\.html$/ }, - async handler(html, id) { - id = normalizePath(id); - const relativeUrlPath = normalizePath(path.relative(config$2.root, id)); - const publicPath = `/${relativeUrlPath}`; - const publicBase = getBaseInHTML(relativeUrlPath, config$2); - const publicToRelative = (filename) => publicBase + filename; - const toOutputPublicFilePath = (url$3) => toOutputFilePathInHtml(url$3.slice(1), "public", relativeUrlPath, "html", config$2, publicToRelative); - const nodeStartWithLeadingWhitespace = (node) => { - const startOffset = node.sourceCodeLocation.startOffset; - if (startOffset === 0) return 0; - const lineStartOffset = startOffset - node.sourceCodeLocation.startCol; - let isLineEmpty = false; - try { - isLineEmpty = !s.slice(Math.max(0, lineStartOffset), startOffset).trim(); - } catch {} - return isLineEmpty ? lineStartOffset : startOffset; - }; - html = await applyHtmlTransforms(html, preHooks, this, { - path: publicPath, - filename: id - }); - let js = ""; - const s = new MagicString(html); - const scriptUrls = []; - const styleUrls = []; - let inlineModuleIndex = -1; - let everyScriptIsAsync = true; - let someScriptsAreAsync = false; - let someScriptsAreDefer = false; - const assetUrlsPromises = []; - const namedOutput = Object.keys(config$2.build.rollupOptions.input || {}); - const processAssetUrl = async (url$3, shouldInline$1) => { - if (url$3 !== "" && !namedOutput.includes(url$3) && !namedOutput.includes(removeLeadingSlash(url$3))) try { - return await urlToBuiltUrl(this, url$3, id, shouldInline$1); - } catch (e$1) { - if (e$1.code !== "ENOENT") throw e$1; - } - return url$3; - }; - const setModuleSideEffectPromises = []; - await traverseHtml(html, id, config$2.logger.warn, (node) => { - if (!nodeIsElement(node)) return; - let shouldRemove = false; - if (node.nodeName === "script") { - const { src, srcSourceCodeLocation, isModule, isAsync, isIgnored } = getScriptInfo(node); - if (isIgnored) removeViteIgnoreAttr(s, node.sourceCodeLocation); - else { - const url$3 = src && src.value; - const isPublicFile = !!(url$3 && checkPublicFile(url$3, config$2)); - if (isPublicFile) overwriteAttrValue(s, srcSourceCodeLocation, partialEncodeURIPath(toOutputPublicFilePath(url$3))); - if (isModule) { - inlineModuleIndex++; - if (url$3 && !isExcludedUrl(url$3) && !isPublicFile) { - setModuleSideEffectPromises.push(this.resolve(url$3, id).then((resolved) => { - if (!resolved) return Promise.reject(/* @__PURE__ */ new Error(`Failed to resolve ${url$3} from ${id}`)); - const moduleInfo = this.getModuleInfo(resolved.id); - if (moduleInfo) moduleInfo.moduleSideEffects = true; - else if (!resolved.external) return this.load(resolved).then((mod) => { - mod.moduleSideEffects = true; - }); - })); - js += `\nimport ${JSON.stringify(url$3)}`; - shouldRemove = true; - } else if (node.childNodes.length) { - const contents = node.childNodes.pop().value; - addToHTMLProxyCache(config$2, id.replace(normalizePath(config$2.root), ""), inlineModuleIndex, { code: contents }); - js += `\nimport "${id}?html-proxy&index=${inlineModuleIndex}.js"`; - shouldRemove = true; - } - everyScriptIsAsync &&= isAsync; - someScriptsAreAsync ||= isAsync; - someScriptsAreDefer ||= !isAsync; - } else if (url$3 && !isPublicFile) { - if (!isExcludedUrl(url$3)) config$2.logger.warn(`