Add 260+ Claude Code skills from skills.sh
Complete collection of AI agent skills including: - Frontend Development (Vue, React, Next.js, Three.js) - Backend Development (NestJS, FastAPI, Node.js) - Mobile Development (React Native, Expo) - Testing (E2E, frontend, webapp) - DevOps (GitHub Actions, CI/CD) - Marketing (SEO, copywriting, analytics) - Security (binary analysis, vulnerability scanning) - And many more... Synchronized from: https://skills.sh/ Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
211
dev-browser/skills/dev-browser/SKILL.md
Normal file
211
dev-browser/skills/dev-browser/SKILL.md
Normal file
@@ -0,0 +1,211 @@
|
||||
---
|
||||
name: dev-browser
|
||||
description: Browser automation with persistent page state. Use when users ask to navigate websites, fill forms, take screenshots, extract web data, test web apps, or automate browser workflows. Trigger phrases include "go to [url]", "click on", "fill out the form", "take a screenshot", "scrape", "automate", "test the website", "log into", or any browser interaction request.
|
||||
---
|
||||
|
||||
# Dev Browser Skill
|
||||
|
||||
Browser automation that maintains page state across script executions. Write small, focused scripts to accomplish tasks incrementally. Once you've proven out part of a workflow and there is repeated work to be done, you can write a script to do the repeated work in a single execution.
|
||||
|
||||
## Choosing Your Approach
|
||||
|
||||
- **Local/source-available sites**: Read the source code first to write selectors directly
|
||||
- **Unknown page layouts**: Use `getAISnapshot()` to discover elements and `selectSnapshotRef()` to interact with them
|
||||
- **Visual feedback**: Take screenshots to see what the user sees
|
||||
|
||||
## Setup
|
||||
|
||||
Two modes available. Ask the user if unclear which to use.
|
||||
|
||||
### Standalone Mode (Default)
|
||||
|
||||
Launches a new Chromium browser for fresh automation sessions.
|
||||
|
||||
```bash
|
||||
./skills/dev-browser/server.sh &
|
||||
```
|
||||
|
||||
Add `--headless` flag if user requests it. **Wait for the `Ready` message before running scripts.**
|
||||
|
||||
### Extension Mode
|
||||
|
||||
Connects to user's existing Chrome browser. Use this when:
|
||||
|
||||
- The user is already logged into sites and wants you to do things behind an authed experience that isn't local dev.
|
||||
- The user asks you to use the extension
|
||||
|
||||
**Important**: The core flow is still the same. You create named pages inside of their browser.
|
||||
|
||||
**Start the relay server:**
|
||||
|
||||
```bash
|
||||
cd skills/dev-browser && npm i && npm run start-extension &
|
||||
```
|
||||
|
||||
Wait for `Waiting for extension to connect...` followed by `Extension connected` in the console. To know that a client has connected and the browser is ready to be controlled.
|
||||
**Workflow:**
|
||||
|
||||
1. Scripts call `client.page("name")` just like the normal mode to create new pages / connect to existing ones.
|
||||
2. Automation runs on the user's actual browser session
|
||||
|
||||
If the extension hasn't connected yet, tell the user to launch and activate it. Download link: https://github.com/SawyerHood/dev-browser/releases
|
||||
|
||||
## Writing Scripts
|
||||
|
||||
> **Run all scripts from `skills/dev-browser/` directory.** The `@/` import alias requires this directory's config.
|
||||
|
||||
Execute scripts inline using heredocs:
|
||||
|
||||
```bash
|
||||
cd skills/dev-browser && npx tsx <<'EOF'
|
||||
import { connect, waitForPageLoad } from "@/client.js";
|
||||
|
||||
const client = await connect();
|
||||
// Create page with custom viewport size (optional)
|
||||
const page = await client.page("example", { viewport: { width: 1920, height: 1080 } });
|
||||
|
||||
await page.goto("https://example.com");
|
||||
await waitForPageLoad(page);
|
||||
|
||||
console.log({ title: await page.title(), url: page.url() });
|
||||
await client.disconnect();
|
||||
EOF
|
||||
```
|
||||
|
||||
**Write to `tmp/` files only when** the script needs reuse, is complex, or user explicitly requests it.
|
||||
|
||||
### Key Principles
|
||||
|
||||
1. **Small scripts**: Each script does ONE thing (navigate, click, fill, check)
|
||||
2. **Evaluate state**: Log/return state at the end to decide next steps
|
||||
3. **Descriptive page names**: Use `"checkout"`, `"login"`, not `"main"`
|
||||
4. **Disconnect to exit**: `await client.disconnect()` - pages persist on server
|
||||
5. **Plain JS in evaluate**: `page.evaluate()` runs in browser - no TypeScript syntax
|
||||
|
||||
## Workflow Loop
|
||||
|
||||
Follow this pattern for complex tasks:
|
||||
|
||||
1. **Write a script** to perform one action
|
||||
2. **Run it** and observe the output
|
||||
3. **Evaluate** - did it work? What's the current state?
|
||||
4. **Decide** - is the task complete or do we need another script?
|
||||
5. **Repeat** until task is done
|
||||
|
||||
### No TypeScript in Browser Context
|
||||
|
||||
Code passed to `page.evaluate()` runs in the browser, which doesn't understand TypeScript:
|
||||
|
||||
```typescript
|
||||
// ✅ Correct: plain JavaScript
|
||||
const text = await page.evaluate(() => {
|
||||
return document.body.innerText;
|
||||
});
|
||||
|
||||
// ❌ Wrong: TypeScript syntax will fail at runtime
|
||||
const text = await page.evaluate(() => {
|
||||
const el: HTMLElement = document.body; // Type annotation breaks in browser!
|
||||
return el.innerText;
|
||||
});
|
||||
```
|
||||
|
||||
## Scraping Data
|
||||
|
||||
For scraping large datasets, intercept and replay network requests rather than scrolling the DOM. See [references/scraping.md](references/scraping.md) for the complete guide covering request capture, schema discovery, and paginated API replay.
|
||||
|
||||
## Client API
|
||||
|
||||
```typescript
|
||||
const client = await connect();
|
||||
|
||||
// Get or create named page (viewport only applies to new pages)
|
||||
const page = await client.page("name");
|
||||
const pageWithSize = await client.page("name", { viewport: { width: 1920, height: 1080 } });
|
||||
|
||||
const pages = await client.list(); // List all page names
|
||||
await client.close("name"); // Close a page
|
||||
await client.disconnect(); // Disconnect (pages persist)
|
||||
|
||||
// ARIA Snapshot methods
|
||||
const snapshot = await client.getAISnapshot("name"); // Get accessibility tree
|
||||
const element = await client.selectSnapshotRef("name", "e5"); // Get element by ref
|
||||
```
|
||||
|
||||
The `page` object is a standard Playwright Page.
|
||||
|
||||
## Waiting
|
||||
|
||||
```typescript
|
||||
import { waitForPageLoad } from "@/client.js";
|
||||
|
||||
await waitForPageLoad(page); // After navigation
|
||||
await page.waitForSelector(".results"); // For specific elements
|
||||
await page.waitForURL("**/success"); // For specific URL
|
||||
```
|
||||
|
||||
## Inspecting Page State
|
||||
|
||||
### Screenshots
|
||||
|
||||
```typescript
|
||||
await page.screenshot({ path: "tmp/screenshot.png" });
|
||||
await page.screenshot({ path: "tmp/full.png", fullPage: true });
|
||||
```
|
||||
|
||||
### ARIA Snapshot (Element Discovery)
|
||||
|
||||
Use `getAISnapshot()` to discover page elements. Returns YAML-formatted accessibility tree:
|
||||
|
||||
```yaml
|
||||
- banner:
|
||||
- link "Hacker News" [ref=e1]
|
||||
- navigation:
|
||||
- link "new" [ref=e2]
|
||||
- main:
|
||||
- list:
|
||||
- listitem:
|
||||
- link "Article Title" [ref=e8]
|
||||
- link "328 comments" [ref=e9]
|
||||
- contentinfo:
|
||||
- textbox [ref=e10]
|
||||
- /placeholder: "Search"
|
||||
```
|
||||
|
||||
**Interpreting refs:**
|
||||
|
||||
- `[ref=eN]` - Element reference for interaction (visible, clickable elements only)
|
||||
- `[checked]`, `[disabled]`, `[expanded]` - Element states
|
||||
- `[level=N]` - Heading level
|
||||
- `/url:`, `/placeholder:` - Element properties
|
||||
|
||||
**Interacting with refs:**
|
||||
|
||||
```typescript
|
||||
const snapshot = await client.getAISnapshot("hackernews");
|
||||
console.log(snapshot); // Find the ref you need
|
||||
|
||||
const element = await client.selectSnapshotRef("hackernews", "e2");
|
||||
await element.click();
|
||||
```
|
||||
|
||||
## Error Recovery
|
||||
|
||||
Page state persists after failures. Debug with:
|
||||
|
||||
```bash
|
||||
cd skills/dev-browser && npx tsx <<'EOF'
|
||||
import { connect } from "@/client.js";
|
||||
|
||||
const client = await connect();
|
||||
const page = await client.page("hackernews");
|
||||
|
||||
await page.screenshot({ path: "tmp/debug.png" });
|
||||
console.log({
|
||||
url: page.url(),
|
||||
title: await page.title(),
|
||||
bodyText: await page.textContent("body").then((t) => t?.slice(0, 200)),
|
||||
});
|
||||
|
||||
await client.disconnect();
|
||||
EOF
|
||||
```
|
||||
443
dev-browser/skills/dev-browser/bun.lock
Normal file
443
dev-browser/skills/dev-browser/bun.lock
Normal file
@@ -0,0 +1,443 @@
|
||||
{
|
||||
"lockfileVersion": 1,
|
||||
"configVersion": 1,
|
||||
"workspaces": {
|
||||
"": {
|
||||
"name": "dev-browser",
|
||||
"dependencies": {
|
||||
"express": "^4.21.0",
|
||||
"playwright": "^1.49.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.0",
|
||||
"tsx": "^4.21.0",
|
||||
"vitest": "^2.1.0",
|
||||
},
|
||||
},
|
||||
},
|
||||
"packages": {
|
||||
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.1", "", { "os": "aix", "cpu": "ppc64" }, "sha512-HHB50pdsBX6k47S4u5g/CaLjqS3qwaOVE5ILsq64jyzgMhLuCuZ8rGzM9yhsAjfjkbgUPMzZEPa7DAp7yz6vuA=="],
|
||||
|
||||
"@esbuild/android-arm": ["@esbuild/android-arm@0.27.1", "", { "os": "android", "cpu": "arm" }, "sha512-kFqa6/UcaTbGm/NncN9kzVOODjhZW8e+FRdSeypWe6j33gzclHtwlANs26JrupOntlcWmB0u8+8HZo8s7thHvg=="],
|
||||
|
||||
"@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.1", "", { "os": "android", "cpu": "arm64" }, "sha512-45fuKmAJpxnQWixOGCrS+ro4Uvb4Re9+UTieUY2f8AEc+t7d4AaZ6eUJ3Hva7dtrxAAWHtlEFsXFMAgNnGU9uQ=="],
|
||||
|
||||
"@esbuild/android-x64": ["@esbuild/android-x64@0.27.1", "", { "os": "android", "cpu": "x64" }, "sha512-LBEpOz0BsgMEeHgenf5aqmn/lLNTFXVfoWMUox8CtWWYK9X4jmQzWjoGoNb8lmAYml/tQ/Ysvm8q7szu7BoxRQ=="],
|
||||
|
||||
"@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-veg7fL8eMSCVKL7IW4pxb54QERtedFDfY/ASrumK/SbFsXnRazxY4YykN/THYqFnFwJ0aVjiUrVG2PwcdAEqQQ=="],
|
||||
|
||||
"@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-+3ELd+nTzhfWb07Vol7EZ+5PTbJ/u74nC6iv4/lwIU99Ip5uuY6QoIf0Hn4m2HoV0qcnRivN3KSqc+FyCHjoVQ=="],
|
||||
|
||||
"@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.1", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-/8Rfgns4XD9XOSXlzUDepG8PX+AVWHliYlUkFI3K3GB6tqbdjYqdhcb4BKRd7C0BhZSoaCxhv8kTcBrcZWP+xg=="],
|
||||
|
||||
"@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-GITpD8dK9C+r+5yRT/UKVT36h/DQLOHdwGVwwoHidlnA168oD3uxA878XloXebK4Ul3gDBBIvEdL7go9gCUFzQ=="],
|
||||
|
||||
"@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.1", "", { "os": "linux", "cpu": "arm" }, "sha512-ieMID0JRZY/ZeCrsFQ3Y3NlHNCqIhTprJfDgSB3/lv5jJZ8FX3hqPyXWhe+gvS5ARMBJ242PM+VNz/ctNj//eA=="],
|
||||
|
||||
"@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-W9//kCrh/6in9rWIBdKaMtuTTzNj6jSeG/haWBADqLLa9P8O5YSRDzgD5y9QBok4AYlzS6ARHifAb75V6G670Q=="],
|
||||
|
||||
"@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.1", "", { "os": "linux", "cpu": "ia32" }, "sha512-VIUV4z8GD8rtSVMfAj1aXFahsi/+tcoXXNYmXgzISL+KB381vbSTNdeZHHHIYqFyXcoEhu9n5cT+05tRv13rlw=="],
|
||||
|
||||
"@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.1", "", { "os": "linux", "cpu": "none" }, "sha512-l4rfiiJRN7sTNI//ff65zJ9z8U+k6zcCg0LALU5iEWzY+a1mVZ8iWC1k5EsNKThZ7XCQ6YWtsZ8EWYm7r1UEsg=="],
|
||||
|
||||
"@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.1", "", { "os": "linux", "cpu": "none" }, "sha512-U0bEuAOLvO/DWFdygTHWY8C067FXz+UbzKgxYhXC0fDieFa0kDIra1FAhsAARRJbvEyso8aAqvPdNxzWuStBnA=="],
|
||||
|
||||
"@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NzdQ/Xwu6vPSf/GkdmRNsOfIeSGnh7muundsWItmBsVpMoNPVpM61qNzAVY3pZ1glzzAxLR40UyYM23eaDDbYQ=="],
|
||||
|
||||
"@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.1", "", { "os": "linux", "cpu": "none" }, "sha512-7zlw8p3IApcsN7mFw0O1Z1PyEk6PlKMu18roImfl3iQHTnr/yAfYv6s4hXPidbDoI2Q0pW+5xeoM4eTCC0UdrQ=="],
|
||||
|
||||
"@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-cGj5wli+G+nkVQdZo3+7FDKC25Uh4ZVwOAK6A06Hsvgr8WqBBuOy/1s+PUEd/6Je+vjfm6stX0kmib5b/O2Ykw=="],
|
||||
|
||||
"@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.1", "", { "os": "linux", "cpu": "x64" }, "sha512-z3H/HYI9MM0HTv3hQZ81f+AKb+yEoCRlUby1F80vbQ5XdzEMyY/9iNlAmhqiBKw4MJXwfgsh7ERGEOhrM1niMA=="],
|
||||
|
||||
"@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.1", "", { "os": "none", "cpu": "arm64" }, "sha512-wzC24DxAvk8Em01YmVXyjl96Mr+ecTPyOuADAvjGg+fyBpGmxmcr2E5ttf7Im8D0sXZihpxzO1isus8MdjMCXQ=="],
|
||||
|
||||
"@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.1", "", { "os": "none", "cpu": "x64" }, "sha512-1YQ8ybGi2yIXswu6eNzJsrYIGFpnlzEWRl6iR5gMgmsrR0FcNoV1m9k9sc3PuP5rUBLshOZylc9nqSgymI+TYg=="],
|
||||
|
||||
"@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.1", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-5Z+DzLCrq5wmU7RDaMDe2DVXMRm2tTDvX2KU14JJVBN2CT/qov7XVix85QoJqHltpvAOZUAc3ndU56HSMWrv8g=="],
|
||||
|
||||
"@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.1", "", { "os": "openbsd", "cpu": "x64" }, "sha512-Q73ENzIdPF5jap4wqLtsfh8YbYSZ8Q0wnxplOlZUOyZy7B4ZKW8DXGWgTCZmF8VWD7Tciwv5F4NsRf6vYlZtqg=="],
|
||||
|
||||
"@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.1", "", { "os": "none", "cpu": "arm64" }, "sha512-ajbHrGM/XiK+sXM0JzEbJAen+0E+JMQZ2l4RR4VFwvV9JEERx+oxtgkpoKv1SevhjavK2z2ReHk32pjzktWbGg=="],
|
||||
|
||||
"@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.1", "", { "os": "sunos", "cpu": "x64" }, "sha512-IPUW+y4VIjuDVn+OMzHc5FV4GubIwPnsz6ubkvN8cuhEqH81NovB53IUlrlBkPMEPxvNnf79MGBoz8rZ2iW8HA=="],
|
||||
|
||||
"@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-RIVRWiljWA6CdVu8zkWcRmGP7iRRIIwvhDKem8UMBjPql2TXM5PkDVvvrzMtj1V+WFPB4K7zkIGM7VzRtFkjdg=="],
|
||||
|
||||
"@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-2BR5M8CPbptC1AK5JbJT1fWrHLvejwZidKx3UMSF0ecHMa+smhi16drIrCEggkgviBwLYd5nwrFLSl5Kho96RQ=="],
|
||||
|
||||
"@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.1", "", { "os": "win32", "cpu": "x64" }, "sha512-d5X6RMYv6taIymSk8JBP+nxv8DQAMY6A51GPgusqLdK9wBz5wWIXy1KjTck6HnjE9hqJzJRdk+1p/t5soSbCtw=="],
|
||||
|
||||
"@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
|
||||
|
||||
"@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.53.3", "", { "os": "android", "cpu": "arm" }, "sha512-mRSi+4cBjrRLoaal2PnqH82Wqyb+d3HsPUN/W+WslCXsZsyHa9ZeQQX/pQsZaVIWDkPcpV6jJ+3KLbTbgnwv8w=="],
|
||||
|
||||
"@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.53.3", "", { "os": "android", "cpu": "arm64" }, "sha512-CbDGaMpdE9sh7sCmTrTUyllhrg65t6SwhjlMJsLr+J8YjFuPmCEjbBSx4Z/e4SmDyH3aB5hGaJUP2ltV/vcs4w=="],
|
||||
|
||||
"@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.53.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Nr7SlQeqIBpOV6BHHGZgYBuSdanCXuw09hon14MGOLGmXAFYjx1wNvquVPmpZnl0tLjg25dEdr4IQ6GgyToCUA=="],
|
||||
|
||||
"@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.53.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-DZ8N4CSNfl965CmPktJ8oBnfYr3F8dTTNBQkRlffnUarJ2ohudQD17sZBa097J8xhQ26AwhHJ5mvUyQW8ddTsQ=="],
|
||||
|
||||
"@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.53.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-yMTrCrK92aGyi7GuDNtGn2sNW+Gdb4vErx4t3Gv/Tr+1zRb8ax4z8GWVRfr3Jw8zJWvpGHNpss3vVlbF58DZ4w=="],
|
||||
|
||||
"@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.53.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-lMfF8X7QhdQzseM6XaX0vbno2m3hlyZFhwcndRMw8fbAGUGL3WFMBdK0hbUBIUYcEcMhVLr1SIamDeuLBnXS+Q=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.53.3", "", { "os": "linux", "cpu": "arm" }, "sha512-k9oD15soC/Ln6d2Wv/JOFPzZXIAIFLp6B+i14KhxAfnq76ajt0EhYc5YPeX6W1xJkAdItcVT+JhKl1QZh44/qw=="],
|
||||
|
||||
"@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.53.3", "", { "os": "linux", "cpu": "arm" }, "sha512-vTNlKq+N6CK/8UktsrFuc+/7NlEYVxgaEgRXVUVK258Z5ymho29skzW1sutgYjqNnquGwVUObAaxae8rZ6YMhg=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.53.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-RGrFLWgMhSxRs/EWJMIFM1O5Mzuz3Xy3/mnxJp/5cVhZ2XoCAxJnmNsEyeMJtpK+wu0FJFWz+QF4mjCA7AUQ3w=="],
|
||||
|
||||
"@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.53.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-kASyvfBEWYPEwe0Qv4nfu6pNkITLTb32p4yTgzFCocHnJLAHs+9LjUu9ONIhvfT/5lv4YS5muBHyuV84epBo/A=="],
|
||||
|
||||
"@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-JiuKcp2teLJwQ7vkJ95EwESWkNRFJD7TQgYmCnrPtlu50b4XvT5MOmurWNrCj3IFdyjBQ5p9vnrX4JM6I8OE7g=="],
|
||||
|
||||
"@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.53.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-EoGSa8nd6d3T7zLuqdojxC20oBfNT8nexBbB/rkxgKj5T5vhpAQKKnD+h3UkoMuTyXkP5jTjK/ccNRmQrPNDuw=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-4s+Wped2IHXHPnAEbIB0YWBv7SDohqxobiiPA1FIWZpX+w9o2i4LezzH/NkFUl8LRci/8udci6cLq+jJQlh+0g=="],
|
||||
|
||||
"@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.53.3", "", { "os": "linux", "cpu": "none" }, "sha512-68k2g7+0vs2u9CxDt5ktXTngsxOQkSEV/xBbwlqYcUrAVh6P9EgMZvFsnHy4SEiUl46Xf0IObWVbMvPrr2gw8A=="],
|
||||
|
||||
"@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.53.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-VYsFMpULAz87ZW6BVYw3I6sWesGpsP9OPcyKe8ofdg9LHxSbRMd7zrVrr5xi/3kMZtpWL/wC+UIJWJYVX5uTKg=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.53.3", "", { "os": "linux", "cpu": "x64" }, "sha512-3EhFi1FU6YL8HTUJZ51imGJWEX//ajQPfqWLI3BQq4TlvHy4X0MOr5q3D2Zof/ka0d5FNdPwZXm3Yyib/UEd+w=="],
|
||||
|
||||
"@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.53.3", "", { "os": "linux", "cpu": "x64" }, "sha512-eoROhjcc6HbZCJr+tvVT8X4fW3/5g/WkGvvmwz/88sDtSJzO7r/blvoBDgISDiCjDRZmHpwud7h+6Q9JxFwq1Q=="],
|
||||
|
||||
"@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.53.3", "", { "os": "none", "cpu": "arm64" }, "sha512-OueLAWgrNSPGAdUdIjSWXw+u/02BRTcnfw9PN41D2vq/JSEPnJnVuBgw18VkN8wcd4fjUs+jFHVM4t9+kBSNLw=="],
|
||||
|
||||
"@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.53.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-GOFuKpsxR/whszbF/bzydebLiXIHSgsEUp6M0JI8dWvi+fFa1TD6YQa4aSZHtpmh2/uAlj/Dy+nmby3TJ3pkTw=="],
|
||||
|
||||
"@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.53.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-iah+THLcBJdpfZ1TstDFbKNznlzoxa8fmnFYK4V67HvmuNYkVdAywJSoteUszvBQ9/HqN2+9AZghbajMsFT+oA=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.53.3", "", { "os": "win32", "cpu": "x64" }, "sha512-J9QDiOIZlZLdcot5NXEepDkstocktoVjkaKUtqzgzpt2yWjGlbYiKyp05rWwk4nypbYUNoFAztEgixoLaSETkg=="],
|
||||
|
||||
"@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.53.3", "", { "os": "win32", "cpu": "x64" }, "sha512-UhTd8u31dXadv0MopwGgNOBpUVROFKWVQgAg5N1ESyCz8AuBcMqm4AuTjrwgQKGDfoFuz02EuMRHQIw/frmYKQ=="],
|
||||
|
||||
"@types/body-parser": ["@types/body-parser@1.19.6", "", { "dependencies": { "@types/connect": "*", "@types/node": "*" } }, "sha512-HLFeCYgz89uk22N5Qg3dvGvsv46B8GLvKKo1zKG4NybA8U2DiEO3w9lqGg29t/tfLRJpJ6iQxnVw4OnB7MoM9g=="],
|
||||
|
||||
"@types/connect": ["@types/connect@3.4.38", "", { "dependencies": { "@types/node": "*" } }, "sha512-K6uROf1LD88uDQqJCktA4yzL1YYAK6NgfsI0v/mTgyPKWsX1CnJ0XPSDhViejru1GcRkLWb8RlzFYJRqGUbaug=="],
|
||||
|
||||
"@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
|
||||
|
||||
"@types/express": ["@types/express@5.0.6", "", { "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^5.0.0", "@types/serve-static": "^2" } }, "sha512-sKYVuV7Sv9fbPIt/442koC7+IIwK5olP1KWeD88e/idgoJqDm3JV/YUiPwkoKK92ylff2MGxSz1CSjsXelx0YA=="],
|
||||
|
||||
"@types/express-serve-static-core": ["@types/express-serve-static-core@5.1.0", "", { "dependencies": { "@types/node": "*", "@types/qs": "*", "@types/range-parser": "*", "@types/send": "*" } }, "sha512-jnHMsrd0Mwa9Cf4IdOzbz543y4XJepXrbia2T4b6+spXC2We3t1y6K44D3mR8XMFSXMCf3/l7rCgddfx7UNVBA=="],
|
||||
|
||||
"@types/http-errors": ["@types/http-errors@2.0.5", "", {}, "sha512-r8Tayk8HJnX0FztbZN7oVqGccWgw98T/0neJphO91KkmOzug1KkofZURD4UaD5uH8AqcFLfdPErnBod0u71/qg=="],
|
||||
|
||||
"@types/node": ["@types/node@24.10.1", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ=="],
|
||||
|
||||
"@types/qs": ["@types/qs@6.14.0", "", {}, "sha512-eOunJqu0K1923aExK6y8p6fsihYEn/BYuQ4g0CxAAgFc4b/ZLN4CrsRZ55srTdqoiLzU2B2evC+apEIxprEzkQ=="],
|
||||
|
||||
"@types/range-parser": ["@types/range-parser@1.2.7", "", {}, "sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ=="],
|
||||
|
||||
"@types/send": ["@types/send@1.2.1", "", { "dependencies": { "@types/node": "*" } }, "sha512-arsCikDvlU99zl1g69TcAB3mzZPpxgw0UQnaHeC1Nwb015xp8bknZv5rIfri9xTOcMuaVgvabfIRA7PSZVuZIQ=="],
|
||||
|
||||
"@types/serve-static": ["@types/serve-static@2.2.0", "", { "dependencies": { "@types/http-errors": "*", "@types/node": "*" } }, "sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ=="],
|
||||
|
||||
"@vitest/expect": ["@vitest/expect@2.1.9", "", { "dependencies": { "@vitest/spy": "2.1.9", "@vitest/utils": "2.1.9", "chai": "^5.1.2", "tinyrainbow": "^1.2.0" } }, "sha512-UJCIkTBenHeKT1TTlKMJWy1laZewsRIzYighyYiJKZreqtdxSos/S1t+ktRMQWu2CKqaarrkeszJx1cgC5tGZw=="],
|
||||
|
||||
"@vitest/mocker": ["@vitest/mocker@2.1.9", "", { "dependencies": { "@vitest/spy": "2.1.9", "estree-walker": "^3.0.3", "magic-string": "^0.30.12" }, "peerDependencies": { "msw": "^2.4.9", "vite": "^5.0.0" }, "optionalPeers": ["msw", "vite"] }, "sha512-tVL6uJgoUdi6icpxmdrn5YNo3g3Dxv+IHJBr0GXHaEdTcw3F+cPKnsXFhli6nO+f/6SDKPHEK1UN+k+TQv0Ehg=="],
|
||||
|
||||
"@vitest/pretty-format": ["@vitest/pretty-format@2.1.9", "", { "dependencies": { "tinyrainbow": "^1.2.0" } }, "sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ=="],
|
||||
|
||||
"@vitest/runner": ["@vitest/runner@2.1.9", "", { "dependencies": { "@vitest/utils": "2.1.9", "pathe": "^1.1.2" } }, "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g=="],
|
||||
|
||||
"@vitest/snapshot": ["@vitest/snapshot@2.1.9", "", { "dependencies": { "@vitest/pretty-format": "2.1.9", "magic-string": "^0.30.12", "pathe": "^1.1.2" } }, "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ=="],
|
||||
|
||||
"@vitest/spy": ["@vitest/spy@2.1.9", "", { "dependencies": { "tinyspy": "^3.0.2" } }, "sha512-E1B35FwzXXTs9FHNK6bDszs7mtydNi5MIfUWpceJ8Xbfb1gBMscAnwLbEu+B44ed6W3XjL9/ehLPHR1fkf1KLQ=="],
|
||||
|
||||
"@vitest/utils": ["@vitest/utils@2.1.9", "", { "dependencies": { "@vitest/pretty-format": "2.1.9", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" } }, "sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ=="],
|
||||
|
||||
"accepts": ["accepts@1.3.8", "", { "dependencies": { "mime-types": "~2.1.34", "negotiator": "0.6.3" } }, "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw=="],
|
||||
|
||||
"array-flatten": ["array-flatten@1.1.1", "", {}, "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="],
|
||||
|
||||
"assertion-error": ["assertion-error@2.0.1", "", {}, "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA=="],
|
||||
|
||||
"body-parser": ["body-parser@1.20.4", "", { "dependencies": { "bytes": "~3.1.2", "content-type": "~1.0.5", "debug": "2.6.9", "depd": "2.0.0", "destroy": "~1.2.0", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "on-finished": "~2.4.1", "qs": "~6.14.0", "raw-body": "~2.5.3", "type-is": "~1.6.18", "unpipe": "~1.0.0" } }, "sha512-ZTgYYLMOXY9qKU/57FAo8F+HA2dGX7bqGc71txDRC1rS4frdFI5R7NhluHxH6M0YItAP0sHB4uqAOcYKxO6uGA=="],
|
||||
|
||||
"bytes": ["bytes@3.1.2", "", {}, "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="],
|
||||
|
||||
"cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
|
||||
|
||||
"call-bind-apply-helpers": ["call-bind-apply-helpers@1.0.2", "", { "dependencies": { "es-errors": "^1.3.0", "function-bind": "^1.1.2" } }, "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ=="],
|
||||
|
||||
"call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="],
|
||||
|
||||
"chai": ["chai@5.3.3", "", { "dependencies": { "assertion-error": "^2.0.1", "check-error": "^2.1.1", "deep-eql": "^5.0.1", "loupe": "^3.1.0", "pathval": "^2.0.0" } }, "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw=="],
|
||||
|
||||
"check-error": ["check-error@2.1.1", "", {}, "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw=="],
|
||||
|
||||
"content-disposition": ["content-disposition@0.5.4", "", { "dependencies": { "safe-buffer": "5.2.1" } }, "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ=="],
|
||||
|
||||
"content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="],
|
||||
|
||||
"cookie": ["cookie@0.7.2", "", {}, "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w=="],
|
||||
|
||||
"cookie-signature": ["cookie-signature@1.0.7", "", {}, "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA=="],
|
||||
|
||||
"debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
|
||||
|
||||
"deep-eql": ["deep-eql@5.0.2", "", {}, "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q=="],
|
||||
|
||||
"depd": ["depd@2.0.0", "", {}, "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw=="],
|
||||
|
||||
"destroy": ["destroy@1.2.0", "", {}, "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg=="],
|
||||
|
||||
"dunder-proto": ["dunder-proto@1.0.1", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
||||
|
||||
"ee-first": ["ee-first@1.1.1", "", {}, "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="],
|
||||
|
||||
"encodeurl": ["encodeurl@2.0.0", "", {}, "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg=="],
|
||||
|
||||
"es-define-property": ["es-define-property@1.0.1", "", {}, "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g=="],
|
||||
|
||||
"es-errors": ["es-errors@1.3.0", "", {}, "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw=="],
|
||||
|
||||
"es-module-lexer": ["es-module-lexer@1.7.0", "", {}, "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA=="],
|
||||
|
||||
"es-object-atoms": ["es-object-atoms@1.1.1", "", { "dependencies": { "es-errors": "^1.3.0" } }, "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA=="],
|
||||
|
||||
"esbuild": ["esbuild@0.27.1", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.1", "@esbuild/android-arm": "0.27.1", "@esbuild/android-arm64": "0.27.1", "@esbuild/android-x64": "0.27.1", "@esbuild/darwin-arm64": "0.27.1", "@esbuild/darwin-x64": "0.27.1", "@esbuild/freebsd-arm64": "0.27.1", "@esbuild/freebsd-x64": "0.27.1", "@esbuild/linux-arm": "0.27.1", "@esbuild/linux-arm64": "0.27.1", "@esbuild/linux-ia32": "0.27.1", "@esbuild/linux-loong64": "0.27.1", "@esbuild/linux-mips64el": "0.27.1", "@esbuild/linux-ppc64": "0.27.1", "@esbuild/linux-riscv64": "0.27.1", "@esbuild/linux-s390x": "0.27.1", "@esbuild/linux-x64": "0.27.1", "@esbuild/netbsd-arm64": "0.27.1", "@esbuild/netbsd-x64": "0.27.1", "@esbuild/openbsd-arm64": "0.27.1", "@esbuild/openbsd-x64": "0.27.1", "@esbuild/openharmony-arm64": "0.27.1", "@esbuild/sunos-x64": "0.27.1", "@esbuild/win32-arm64": "0.27.1", "@esbuild/win32-ia32": "0.27.1", "@esbuild/win32-x64": "0.27.1" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-yY35KZckJJuVVPXpvjgxiCuVEJT67F6zDeVTv4rizyPrfGBUpZQsvmxnN+C371c2esD/hNMjj4tpBhuueLN7aA=="],
|
||||
|
||||
"escape-html": ["escape-html@1.0.3", "", {}, "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow=="],
|
||||
|
||||
"estree-walker": ["estree-walker@3.0.3", "", { "dependencies": { "@types/estree": "^1.0.0" } }, "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g=="],
|
||||
|
||||
"etag": ["etag@1.8.1", "", {}, "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg=="],
|
||||
|
||||
"expect-type": ["expect-type@1.2.2", "", {}, "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA=="],
|
||||
|
||||
"express": ["express@4.22.1", "", { "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", "body-parser": "~1.20.3", "content-disposition": "~0.5.4", "content-type": "~1.0.4", "cookie": "~0.7.1", "cookie-signature": "~1.0.6", "debug": "2.6.9", "depd": "2.0.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "finalhandler": "~1.3.1", "fresh": "~0.5.2", "http-errors": "~2.0.0", "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "~2.4.1", "parseurl": "~1.3.3", "path-to-regexp": "~0.1.12", "proxy-addr": "~2.0.7", "qs": "~6.14.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", "send": "~0.19.0", "serve-static": "~1.16.2", "setprototypeof": "1.2.0", "statuses": "~2.0.1", "type-is": "~1.6.18", "utils-merge": "1.0.1", "vary": "~1.1.2" } }, "sha512-F2X8g9P1X7uCPZMA3MVf9wcTqlyNp7IhH5qPCI0izhaOIYXaW9L535tGA3qmjRzpH+bZczqq7hVKxTR4NWnu+g=="],
|
||||
|
||||
"finalhandler": ["finalhandler@1.3.2", "", { "dependencies": { "debug": "2.6.9", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "~2.4.1", "parseurl": "~1.3.3", "statuses": "~2.0.2", "unpipe": "~1.0.0" } }, "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg=="],
|
||||
|
||||
"forwarded": ["forwarded@0.2.0", "", {}, "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="],
|
||||
|
||||
"fresh": ["fresh@0.5.2", "", {}, "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q=="],
|
||||
|
||||
"fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
|
||||
|
||||
"function-bind": ["function-bind@1.1.2", "", {}, "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="],
|
||||
|
||||
"get-intrinsic": ["get-intrinsic@1.3.0", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", "math-intrinsics": "^1.1.0" } }, "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ=="],
|
||||
|
||||
"get-proto": ["get-proto@1.0.1", "", { "dependencies": { "dunder-proto": "^1.0.1", "es-object-atoms": "^1.0.0" } }, "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g=="],
|
||||
|
||||
"get-tsconfig": ["get-tsconfig@4.13.0", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ=="],
|
||||
|
||||
"gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="],
|
||||
|
||||
"has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="],
|
||||
|
||||
"hasown": ["hasown@2.0.2", "", { "dependencies": { "function-bind": "^1.1.2" } }, "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ=="],
|
||||
|
||||
"http-errors": ["http-errors@2.0.1", "", { "dependencies": { "depd": "~2.0.0", "inherits": "~2.0.4", "setprototypeof": "~1.2.0", "statuses": "~2.0.2", "toidentifier": "~1.0.1" } }, "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ=="],
|
||||
|
||||
"iconv-lite": ["iconv-lite@0.4.24", "", { "dependencies": { "safer-buffer": ">= 2.1.2 < 3" } }, "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA=="],
|
||||
|
||||
"inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="],
|
||||
|
||||
"ipaddr.js": ["ipaddr.js@1.9.1", "", {}, "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="],
|
||||
|
||||
"loupe": ["loupe@3.2.1", "", {}, "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ=="],
|
||||
|
||||
"magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
|
||||
|
||||
"math-intrinsics": ["math-intrinsics@1.1.0", "", {}, "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g=="],
|
||||
|
||||
"media-typer": ["media-typer@0.3.0", "", {}, "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ=="],
|
||||
|
||||
"merge-descriptors": ["merge-descriptors@1.0.3", "", {}, "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ=="],
|
||||
|
||||
"methods": ["methods@1.1.2", "", {}, "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w=="],
|
||||
|
||||
"mime": ["mime@1.6.0", "", { "bin": { "mime": "cli.js" } }, "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="],
|
||||
|
||||
"mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="],
|
||||
|
||||
"mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="],
|
||||
|
||||
"ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
|
||||
|
||||
"nanoid": ["nanoid@3.3.11", "", { "bin": { "nanoid": "bin/nanoid.cjs" } }, "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w=="],
|
||||
|
||||
"negotiator": ["negotiator@0.6.3", "", {}, "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="],
|
||||
|
||||
"object-inspect": ["object-inspect@1.13.4", "", {}, "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew=="],
|
||||
|
||||
"on-finished": ["on-finished@2.4.1", "", { "dependencies": { "ee-first": "1.1.1" } }, "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg=="],
|
||||
|
||||
"parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="],
|
||||
|
||||
"path-to-regexp": ["path-to-regexp@0.1.12", "", {}, "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ=="],
|
||||
|
||||
"pathe": ["pathe@1.1.2", "", {}, "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ=="],
|
||||
|
||||
"pathval": ["pathval@2.0.1", "", {}, "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ=="],
|
||||
|
||||
"picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
|
||||
|
||||
"playwright": ["playwright@1.57.0", "", { "dependencies": { "playwright-core": "1.57.0" }, "optionalDependencies": { "fsevents": "2.3.2" }, "bin": { "playwright": "cli.js" } }, "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw=="],
|
||||
|
||||
"playwright-core": ["playwright-core@1.57.0", "", { "bin": { "playwright-core": "cli.js" } }, "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ=="],
|
||||
|
||||
"postcss": ["postcss@8.5.6", "", { "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", "source-map-js": "^1.2.1" } }, "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg=="],
|
||||
|
||||
"proxy-addr": ["proxy-addr@2.0.7", "", { "dependencies": { "forwarded": "0.2.0", "ipaddr.js": "1.9.1" } }, "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg=="],
|
||||
|
||||
"qs": ["qs@6.14.0", "", { "dependencies": { "side-channel": "^1.1.0" } }, "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w=="],
|
||||
|
||||
"range-parser": ["range-parser@1.2.1", "", {}, "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="],
|
||||
|
||||
"raw-body": ["raw-body@2.5.3", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.4.24", "unpipe": "~1.0.0" } }, "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA=="],
|
||||
|
||||
"resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="],
|
||||
|
||||
"rollup": ["rollup@4.53.3", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.53.3", "@rollup/rollup-android-arm64": "4.53.3", "@rollup/rollup-darwin-arm64": "4.53.3", "@rollup/rollup-darwin-x64": "4.53.3", "@rollup/rollup-freebsd-arm64": "4.53.3", "@rollup/rollup-freebsd-x64": "4.53.3", "@rollup/rollup-linux-arm-gnueabihf": "4.53.3", "@rollup/rollup-linux-arm-musleabihf": "4.53.3", "@rollup/rollup-linux-arm64-gnu": "4.53.3", "@rollup/rollup-linux-arm64-musl": "4.53.3", "@rollup/rollup-linux-loong64-gnu": "4.53.3", "@rollup/rollup-linux-ppc64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-gnu": "4.53.3", "@rollup/rollup-linux-riscv64-musl": "4.53.3", "@rollup/rollup-linux-s390x-gnu": "4.53.3", "@rollup/rollup-linux-x64-gnu": "4.53.3", "@rollup/rollup-linux-x64-musl": "4.53.3", "@rollup/rollup-openharmony-arm64": "4.53.3", "@rollup/rollup-win32-arm64-msvc": "4.53.3", "@rollup/rollup-win32-ia32-msvc": "4.53.3", "@rollup/rollup-win32-x64-gnu": "4.53.3", "@rollup/rollup-win32-x64-msvc": "4.53.3", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA=="],
|
||||
|
||||
"safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="],
|
||||
|
||||
"safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="],
|
||||
|
||||
"send": ["send@0.19.1", "", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "2.4.1", "range-parser": "~1.2.1", "statuses": "2.0.1" } }, "sha512-p4rRk4f23ynFEfcD9LA0xRYngj+IyGiEYyqqOak8kaN0TvNmuxC2dcVeBn62GpCeR2CpWqyHCNScTP91QbAVFg=="],
|
||||
|
||||
"serve-static": ["serve-static@1.16.2", "", { "dependencies": { "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", "send": "0.19.0" } }, "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw=="],
|
||||
|
||||
"setprototypeof": ["setprototypeof@1.2.0", "", {}, "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="],
|
||||
|
||||
"side-channel": ["side-channel@1.1.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3", "side-channel-list": "^1.0.0", "side-channel-map": "^1.0.1", "side-channel-weakmap": "^1.0.2" } }, "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw=="],
|
||||
|
||||
"side-channel-list": ["side-channel-list@1.0.0", "", { "dependencies": { "es-errors": "^1.3.0", "object-inspect": "^1.13.3" } }, "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA=="],
|
||||
|
||||
"side-channel-map": ["side-channel-map@1.0.1", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3" } }, "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA=="],
|
||||
|
||||
"side-channel-weakmap": ["side-channel-weakmap@1.0.2", "", { "dependencies": { "call-bound": "^1.0.2", "es-errors": "^1.3.0", "get-intrinsic": "^1.2.5", "object-inspect": "^1.13.3", "side-channel-map": "^1.0.1" } }, "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A=="],
|
||||
|
||||
"siginfo": ["siginfo@2.0.0", "", {}, "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g=="],
|
||||
|
||||
"source-map-js": ["source-map-js@1.2.1", "", {}, "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA=="],
|
||||
|
||||
"stackback": ["stackback@0.0.2", "", {}, "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw=="],
|
||||
|
||||
"statuses": ["statuses@2.0.2", "", {}, "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw=="],
|
||||
|
||||
"std-env": ["std-env@3.10.0", "", {}, "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg=="],
|
||||
|
||||
"tinybench": ["tinybench@2.9.0", "", {}, "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg=="],
|
||||
|
||||
"tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="],
|
||||
|
||||
"tinypool": ["tinypool@1.1.1", "", {}, "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg=="],
|
||||
|
||||
"tinyrainbow": ["tinyrainbow@1.2.0", "", {}, "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ=="],
|
||||
|
||||
"tinyspy": ["tinyspy@3.0.2", "", {}, "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q=="],
|
||||
|
||||
"toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="],
|
||||
|
||||
"tsx": ["tsx@4.21.0", "", { "dependencies": { "esbuild": "~0.27.0", "get-tsconfig": "^4.7.5" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "bin": { "tsx": "dist/cli.mjs" } }, "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw=="],
|
||||
|
||||
"type-is": ["type-is@1.6.18", "", { "dependencies": { "media-typer": "0.3.0", "mime-types": "~2.1.24" } }, "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g=="],
|
||||
|
||||
"undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
|
||||
|
||||
"unpipe": ["unpipe@1.0.0", "", {}, "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ=="],
|
||||
|
||||
"utils-merge": ["utils-merge@1.0.1", "", {}, "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA=="],
|
||||
|
||||
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
|
||||
|
||||
"vite": ["vite@5.4.21", "", { "dependencies": { "esbuild": "^0.21.3", "postcss": "^8.4.43", "rollup": "^4.20.0" }, "optionalDependencies": { "fsevents": "~2.3.3" }, "peerDependencies": { "@types/node": "^18.0.0 || >=20.0.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", "terser": "^5.4.0" }, "optionalPeers": ["@types/node", "less", "lightningcss", "sass", "sass-embedded", "stylus", "sugarss", "terser"], "bin": { "vite": "bin/vite.js" } }, "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw=="],
|
||||
|
||||
"vite-node": ["vite-node@2.1.9", "", { "dependencies": { "cac": "^6.7.14", "debug": "^4.3.7", "es-module-lexer": "^1.5.4", "pathe": "^1.1.2", "vite": "^5.0.0" }, "bin": { "vite-node": "vite-node.mjs" } }, "sha512-AM9aQ/IPrW/6ENLQg3AGY4K1N2TGZdR5e4gu/MmmR2xR3Ll1+dib+nook92g4TV3PXVyeyxdWwtaCAiUL0hMxA=="],
|
||||
|
||||
"vitest": ["vitest@2.1.9", "", { "dependencies": { "@vitest/expect": "2.1.9", "@vitest/mocker": "2.1.9", "@vitest/pretty-format": "^2.1.9", "@vitest/runner": "2.1.9", "@vitest/snapshot": "2.1.9", "@vitest/spy": "2.1.9", "@vitest/utils": "2.1.9", "chai": "^5.1.2", "debug": "^4.3.7", "expect-type": "^1.1.0", "magic-string": "^0.30.12", "pathe": "^1.1.2", "std-env": "^3.8.0", "tinybench": "^2.9.0", "tinyexec": "^0.3.1", "tinypool": "^1.0.1", "tinyrainbow": "^1.2.0", "vite": "^5.0.0", "vite-node": "2.1.9", "why-is-node-running": "^2.3.0" }, "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", "@vitest/browser": "2.1.9", "@vitest/ui": "2.1.9", "happy-dom": "*", "jsdom": "*" }, "optionalPeers": ["@edge-runtime/vm", "@types/node", "@vitest/browser", "@vitest/ui", "happy-dom", "jsdom"], "bin": { "vitest": "vitest.mjs" } }, "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q=="],
|
||||
|
||||
"why-is-node-running": ["why-is-node-running@2.3.0", "", { "dependencies": { "siginfo": "^2.0.0", "stackback": "0.0.2" }, "bin": { "why-is-node-running": "cli.js" } }, "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w=="],
|
||||
|
||||
"body-parser/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||
|
||||
"express/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||
|
||||
"finalhandler/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||
|
||||
"playwright/fsevents": ["fsevents@2.3.2", "", { "os": "darwin" }, "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA=="],
|
||||
|
||||
"send/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||
|
||||
"send/http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="],
|
||||
|
||||
"send/statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
|
||||
|
||||
"serve-static/send": ["send@0.19.0", "", { "dependencies": { "debug": "2.6.9", "depd": "2.0.0", "destroy": "1.2.0", "encodeurl": "~1.0.2", "escape-html": "~1.0.3", "etag": "~1.8.1", "fresh": "0.5.2", "http-errors": "2.0.0", "mime": "1.6.0", "ms": "2.1.3", "on-finished": "2.4.1", "range-parser": "~1.2.1", "statuses": "2.0.1" } }, "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw=="],
|
||||
|
||||
"vite/esbuild": ["esbuild@0.21.5", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.21.5", "@esbuild/android-arm": "0.21.5", "@esbuild/android-arm64": "0.21.5", "@esbuild/android-x64": "0.21.5", "@esbuild/darwin-arm64": "0.21.5", "@esbuild/darwin-x64": "0.21.5", "@esbuild/freebsd-arm64": "0.21.5", "@esbuild/freebsd-x64": "0.21.5", "@esbuild/linux-arm": "0.21.5", "@esbuild/linux-arm64": "0.21.5", "@esbuild/linux-ia32": "0.21.5", "@esbuild/linux-loong64": "0.21.5", "@esbuild/linux-mips64el": "0.21.5", "@esbuild/linux-ppc64": "0.21.5", "@esbuild/linux-riscv64": "0.21.5", "@esbuild/linux-s390x": "0.21.5", "@esbuild/linux-x64": "0.21.5", "@esbuild/netbsd-x64": "0.21.5", "@esbuild/openbsd-x64": "0.21.5", "@esbuild/sunos-x64": "0.21.5", "@esbuild/win32-arm64": "0.21.5", "@esbuild/win32-ia32": "0.21.5", "@esbuild/win32-x64": "0.21.5" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw=="],
|
||||
|
||||
"body-parser/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
|
||||
"express/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
|
||||
"finalhandler/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
|
||||
"send/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
|
||||
"serve-static/send/debug": ["debug@2.6.9", "", { "dependencies": { "ms": "2.0.0" } }, "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA=="],
|
||||
|
||||
"serve-static/send/encodeurl": ["encodeurl@1.0.2", "", {}, "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w=="],
|
||||
|
||||
"serve-static/send/http-errors": ["http-errors@2.0.0", "", { "dependencies": { "depd": "2.0.0", "inherits": "2.0.4", "setprototypeof": "1.2.0", "statuses": "2.0.1", "toidentifier": "1.0.1" } }, "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ=="],
|
||||
|
||||
"serve-static/send/statuses": ["statuses@2.0.1", "", {}, "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ=="],
|
||||
|
||||
"vite/esbuild/@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.21.5", "", { "os": "aix", "cpu": "ppc64" }, "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ=="],
|
||||
|
||||
"vite/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.21.5", "", { "os": "android", "cpu": "arm" }, "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.21.5", "", { "os": "android", "cpu": "arm64" }, "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A=="],
|
||||
|
||||
"vite/esbuild/@esbuild/android-x64": ["@esbuild/android-x64@0.21.5", "", { "os": "android", "cpu": "x64" }, "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA=="],
|
||||
|
||||
"vite/esbuild/@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.21.5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ=="],
|
||||
|
||||
"vite/esbuild/@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.21.5", "", { "os": "darwin", "cpu": "x64" }, "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw=="],
|
||||
|
||||
"vite/esbuild/@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.21.5", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g=="],
|
||||
|
||||
"vite/esbuild/@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.21.5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-arm": ["@esbuild/linux-arm@0.21.5", "", { "os": "linux", "cpu": "arm" }, "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.21.5", "", { "os": "linux", "cpu": "arm64" }, "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.21.5", "", { "os": "linux", "cpu": "ia32" }, "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.21.5", "", { "os": "linux", "cpu": "none" }, "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.21.5", "", { "os": "linux", "cpu": "none" }, "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.21.5", "", { "os": "linux", "cpu": "ppc64" }, "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.21.5", "", { "os": "linux", "cpu": "none" }, "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.21.5", "", { "os": "linux", "cpu": "s390x" }, "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A=="],
|
||||
|
||||
"vite/esbuild/@esbuild/linux-x64": ["@esbuild/linux-x64@0.21.5", "", { "os": "linux", "cpu": "x64" }, "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ=="],
|
||||
|
||||
"vite/esbuild/@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.21.5", "", { "os": "none", "cpu": "x64" }, "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.21.5", "", { "os": "openbsd", "cpu": "x64" }, "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow=="],
|
||||
|
||||
"vite/esbuild/@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.21.5", "", { "os": "sunos", "cpu": "x64" }, "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg=="],
|
||||
|
||||
"vite/esbuild/@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.21.5", "", { "os": "win32", "cpu": "arm64" }, "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A=="],
|
||||
|
||||
"vite/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.21.5", "", { "os": "win32", "cpu": "ia32" }, "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA=="],
|
||||
|
||||
"vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.21.5", "", { "os": "win32", "cpu": "x64" }, "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw=="],
|
||||
|
||||
"serve-static/send/debug/ms": ["ms@2.0.0", "", {}, "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A=="],
|
||||
}
|
||||
}
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/esbuild
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/esbuild
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esbuild/bin/esbuild
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/mime
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/mime
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../mime/cli.js
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/nanoid
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/nanoid
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../nanoid/bin/nanoid.cjs
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/playwright
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/playwright
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../playwright/cli.js
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/playwright-core
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/playwright-core
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../playwright-core/cli.js
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/rollup
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/rollup
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../rollup/dist/bin/rollup
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/tsc
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/tsc
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../typescript/bin/tsc
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/tsserver
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/tsserver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../typescript/bin/tsserver
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/tsx
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/tsx
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../tsx/dist/cli.mjs
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/vite
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/vite
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../vite/bin/vite.js
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/vite-node
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/vite-node
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../vite-node/vite-node.mjs
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/vitest
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/vitest
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../vitest/vitest.mjs
|
||||
1
dev-browser/skills/dev-browser/node_modules/.bin/why-is-node-running
generated
vendored
Symbolic link
1
dev-browser/skills/dev-browser/node_modules/.bin/why-is-node-running
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../why-is-node-running/cli.js
|
||||
1845
dev-browser/skills/dev-browser/node_modules/.package-lock.json
generated
vendored
Normal file
1845
dev-browser/skills/dev-browser/node_modules/.package-lock.json
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
3
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/README.md
generated
vendored
Normal file
3
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/README.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# esbuild
|
||||
|
||||
This is the Linux 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details.
|
||||
BIN
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/bin/esbuild
generated
vendored
Executable file
BIN
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/bin/esbuild
generated
vendored
Executable file
Binary file not shown.
20
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/package.json
generated
vendored
Normal file
20
dev-browser/skills/dev-browser/node_modules/@esbuild/linux-x64/package.json
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "@esbuild/linux-x64",
|
||||
"version": "0.27.2",
|
||||
"description": "The Linux 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": [
|
||||
"linux"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
]
|
||||
}
|
||||
340
dev-browser/skills/dev-browser/node_modules/@hono/node-server/README.md
generated
vendored
Normal file
340
dev-browser/skills/dev-browser/node_modules/@hono/node-server/README.md
generated
vendored
Normal file
@@ -0,0 +1,340 @@
|
||||
# Node.js Adapter for Hono
|
||||
|
||||
This adapter `@hono/node-server` allows you to run your Hono application on Node.js.
|
||||
Initially, Hono wasn't designed for Node.js, but with this adapter, you can now use Hono on Node.js.
|
||||
It utilizes web standard APIs implemented in Node.js version 18 or higher.
|
||||
|
||||
## Benchmarks
|
||||
|
||||
Hono is 3.5 times faster than Express.
|
||||
|
||||
Express:
|
||||
|
||||
```txt
|
||||
$ bombardier -d 10s --fasthttp http://localhost:3000/
|
||||
|
||||
Statistics Avg Stdev Max
|
||||
Reqs/sec 16438.94 1603.39 19155.47
|
||||
Latency 7.60ms 7.51ms 559.89ms
|
||||
HTTP codes:
|
||||
1xx - 0, 2xx - 164494, 3xx - 0, 4xx - 0, 5xx - 0
|
||||
others - 0
|
||||
Throughput: 4.55MB/s
|
||||
```
|
||||
|
||||
Hono + `@hono/node-server`:
|
||||
|
||||
```txt
|
||||
$ bombardier -d 10s --fasthttp http://localhost:3000/
|
||||
|
||||
Statistics Avg Stdev Max
|
||||
Reqs/sec 58296.56 5512.74 74403.56
|
||||
Latency 2.14ms 1.46ms 190.92ms
|
||||
HTTP codes:
|
||||
1xx - 0, 2xx - 583059, 3xx - 0, 4xx - 0, 5xx - 0
|
||||
others - 0
|
||||
Throughput: 12.56MB/s
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
It works on Node.js versions greater than 18.x. The specific required Node.js versions are as follows:
|
||||
|
||||
- 18.x => 18.14.1+
|
||||
- 19.x => 19.7.0+
|
||||
- 20.x => 20.0.0+
|
||||
|
||||
Essentially, you can simply use the latest version of each major release.
|
||||
|
||||
## Installation
|
||||
|
||||
You can install it from the npm registry with `npm` command:
|
||||
|
||||
```sh
|
||||
npm install @hono/node-server
|
||||
```
|
||||
|
||||
Or use `yarn`:
|
||||
|
||||
```sh
|
||||
yarn add @hono/node-server
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
Just import `@hono/node-server` at the top and write the code as usual.
|
||||
The same code that runs on Cloudflare Workers, Deno, and Bun will work.
|
||||
|
||||
```ts
|
||||
import { serve } from '@hono/node-server'
|
||||
import { Hono } from 'hono'
|
||||
|
||||
const app = new Hono()
|
||||
app.get('/', (c) => c.text('Hono meets Node.js'))
|
||||
|
||||
serve(app, (info) => {
|
||||
console.log(`Listening on http://localhost:${info.port}`) // Listening on http://localhost:3000
|
||||
})
|
||||
```
|
||||
|
||||
For example, run it using `ts-node`. Then an HTTP server will be launched. The default port is `3000`.
|
||||
|
||||
```sh
|
||||
ts-node ./index.ts
|
||||
```
|
||||
|
||||
Open `http://localhost:3000` with your browser.
|
||||
|
||||
## Options
|
||||
|
||||
### `port`
|
||||
|
||||
```ts
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
port: 8787, // Port number, default is 3000
|
||||
})
|
||||
```
|
||||
|
||||
### `createServer`
|
||||
|
||||
```ts
|
||||
import { createServer } from 'node:https'
|
||||
import fs from 'node:fs'
|
||||
|
||||
//...
|
||||
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
createServer: createServer,
|
||||
serverOptions: {
|
||||
key: fs.readFileSync('test/fixtures/keys/agent1-key.pem'),
|
||||
cert: fs.readFileSync('test/fixtures/keys/agent1-cert.pem'),
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
### `overrideGlobalObjects`
|
||||
|
||||
The default value is `true`. The Node.js Adapter rewrites the global Request/Response and uses a lightweight Request/Response to improve performance. If you don't want to do that, set `false`.
|
||||
|
||||
```ts
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
overrideGlobalObjects: false,
|
||||
})
|
||||
```
|
||||
|
||||
### `autoCleanupIncoming`
|
||||
|
||||
The default value is `true`. The Node.js Adapter automatically cleans up (explicitly call `destroy()` method) if application is not finished to consume the incoming request. If you don't want to do that, set `false`.
|
||||
|
||||
If the application accepts connections from arbitrary clients, this cleanup must be done otherwise incomplete requests from clients may cause the application to stop responding. If your application only accepts connections from trusted clients, such as in a reverse proxy environment and there is no process that returns a response without reading the body of the POST request all the way through, you can improve performance by setting it to `false`.
|
||||
|
||||
```ts
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
autoCleanupIncoming: false,
|
||||
})
|
||||
```
|
||||
|
||||
## Middleware
|
||||
|
||||
Most built-in middleware also works with Node.js.
|
||||
Read [the documentation](https://hono.dev/middleware/builtin/basic-auth) and use the Middleware of your liking.
|
||||
|
||||
```ts
|
||||
import { serve } from '@hono/node-server'
|
||||
import { Hono } from 'hono'
|
||||
import { prettyJSON } from 'hono/pretty-json'
|
||||
|
||||
const app = new Hono()
|
||||
|
||||
app.get('*', prettyJSON())
|
||||
app.get('/', (c) => c.json({ 'Hono meets': 'Node.js' }))
|
||||
|
||||
serve(app)
|
||||
```
|
||||
|
||||
## Serve Static Middleware
|
||||
|
||||
Use Serve Static Middleware that has been created for Node.js.
|
||||
|
||||
```ts
|
||||
import { serveStatic } from '@hono/node-server/serve-static'
|
||||
|
||||
//...
|
||||
|
||||
app.use('/static/*', serveStatic({ root: './' }))
|
||||
```
|
||||
|
||||
If using a relative path, `root` will be relative to the current working directory from which the app was started.
|
||||
|
||||
This can cause confusion when running your application locally.
|
||||
|
||||
Imagine your project structure is:
|
||||
|
||||
```
|
||||
my-hono-project/
|
||||
src/
|
||||
index.ts
|
||||
static/
|
||||
index.html
|
||||
```
|
||||
|
||||
Typically, you would run your app from the project's root directory (`my-hono-project`),
|
||||
so you would need the following code to serve the `static` folder:
|
||||
|
||||
```ts
|
||||
app.use('/static/*', serveStatic({ root: './static' }))
|
||||
```
|
||||
|
||||
Notice that `root` here is not relative to `src/index.ts`, rather to `my-hono-project`.
|
||||
|
||||
### Options
|
||||
|
||||
#### `rewriteRequestPath`
|
||||
|
||||
If you want to serve files in `./.foojs` with the request path `/__foo/*`, you can write like the following.
|
||||
|
||||
```ts
|
||||
app.use(
|
||||
'/__foo/*',
|
||||
serveStatic({
|
||||
root: './.foojs/',
|
||||
rewriteRequestPath: (path: string) => path.replace(/^\/__foo/, ''),
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
#### `onFound`
|
||||
|
||||
You can specify handling when the requested file is found with `onFound`.
|
||||
|
||||
```ts
|
||||
app.use(
|
||||
'/static/*',
|
||||
serveStatic({
|
||||
// ...
|
||||
onFound: (_path, c) => {
|
||||
c.header('Cache-Control', `public, immutable, max-age=31536000`)
|
||||
},
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
#### `onNotFound`
|
||||
|
||||
The `onNotFound` is useful for debugging. You can write a handle for when a file is not found.
|
||||
|
||||
```ts
|
||||
app.use(
|
||||
'/static/*',
|
||||
serveStatic({
|
||||
root: './non-existent-dir',
|
||||
onNotFound: (path, c) => {
|
||||
console.log(`${path} is not found, request to ${c.req.path}`)
|
||||
},
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
#### `precompressed`
|
||||
|
||||
The `precompressed` option checks if files with extensions like `.br` or `.gz` are available and serves them based on the `Accept-Encoding` header. It prioritizes Brotli, then Zstd, and Gzip. If none are available, it serves the original file.
|
||||
|
||||
```ts
|
||||
app.use(
|
||||
'/static/*',
|
||||
serveStatic({
|
||||
precompressed: true,
|
||||
})
|
||||
)
|
||||
```
|
||||
|
||||
## ConnInfo Helper
|
||||
|
||||
You can use the [ConnInfo Helper](https://hono.dev/docs/helpers/conninfo) by importing `getConnInfo` from `@hono/node-server/conninfo`.
|
||||
|
||||
```ts
|
||||
import { getConnInfo } from '@hono/node-server/conninfo'
|
||||
|
||||
app.get('/', (c) => {
|
||||
const info = getConnInfo(c) // info is `ConnInfo`
|
||||
return c.text(`Your remote address is ${info.remote.address}`)
|
||||
})
|
||||
```
|
||||
|
||||
## Accessing Node.js API
|
||||
|
||||
You can access the Node.js API from `c.env` in Node.js. For example, if you want to specify a type, you can write the following.
|
||||
|
||||
```ts
|
||||
import { serve } from '@hono/node-server'
|
||||
import type { HttpBindings } from '@hono/node-server'
|
||||
import { Hono } from 'hono'
|
||||
|
||||
const app = new Hono<{ Bindings: HttpBindings }>()
|
||||
|
||||
app.get('/', (c) => {
|
||||
return c.json({
|
||||
remoteAddress: c.env.incoming.socket.remoteAddress,
|
||||
})
|
||||
})
|
||||
|
||||
serve(app)
|
||||
```
|
||||
|
||||
The APIs that you can get from `c.env` are as follows.
|
||||
|
||||
```ts
|
||||
type HttpBindings = {
|
||||
incoming: IncomingMessage
|
||||
outgoing: ServerResponse
|
||||
}
|
||||
|
||||
type Http2Bindings = {
|
||||
incoming: Http2ServerRequest
|
||||
outgoing: Http2ServerResponse
|
||||
}
|
||||
```
|
||||
|
||||
## Direct response from Node.js API
|
||||
|
||||
You can directly respond to the client from the Node.js API.
|
||||
In that case, the response from Hono should be ignored, so return `RESPONSE_ALREADY_SENT`.
|
||||
|
||||
> [!NOTE]
|
||||
> This feature can be used when migrating existing Node.js applications to Hono, but we recommend using Hono's API for new applications.
|
||||
|
||||
```ts
|
||||
import { serve } from '@hono/node-server'
|
||||
import type { HttpBindings } from '@hono/node-server'
|
||||
import { RESPONSE_ALREADY_SENT } from '@hono/node-server/utils/response'
|
||||
import { Hono } from 'hono'
|
||||
|
||||
const app = new Hono<{ Bindings: HttpBindings }>()
|
||||
|
||||
app.get('/', (c) => {
|
||||
const { outgoing } = c.env
|
||||
outgoing.writeHead(200, { 'Content-Type': 'text/plain' })
|
||||
outgoing.end('Hello World\n')
|
||||
|
||||
return RESPONSE_ALREADY_SENT
|
||||
})
|
||||
|
||||
serve(app)
|
||||
```
|
||||
|
||||
## Related projects
|
||||
|
||||
- Hono - <https://hono.dev>
|
||||
- Hono GitHub repository - <https://github.com/honojs/hono>
|
||||
|
||||
## Author
|
||||
|
||||
Yusuke Wada <https://github.com/yusukebe>
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.d.mts
generated
vendored
Normal file
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.d.mts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { GetConnInfo } from 'hono/conninfo';
|
||||
|
||||
/**
|
||||
* ConnInfo Helper for Node.js
|
||||
* @param c Context
|
||||
* @returns ConnInfo
|
||||
*/
|
||||
declare const getConnInfo: GetConnInfo;
|
||||
|
||||
export { getConnInfo };
|
||||
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.d.ts
generated
vendored
Normal file
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { GetConnInfo } from 'hono/conninfo';
|
||||
|
||||
/**
|
||||
* ConnInfo Helper for Node.js
|
||||
* @param c Context
|
||||
* @returns ConnInfo
|
||||
*/
|
||||
declare const getConnInfo: GetConnInfo;
|
||||
|
||||
export { getConnInfo };
|
||||
42
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.js
generated
vendored
Normal file
42
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.js
generated
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
"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/conninfo.ts
|
||||
var conninfo_exports = {};
|
||||
__export(conninfo_exports, {
|
||||
getConnInfo: () => getConnInfo
|
||||
});
|
||||
module.exports = __toCommonJS(conninfo_exports);
|
||||
var getConnInfo = (c) => {
|
||||
const bindings = c.env.server ? c.env.server : c.env;
|
||||
const address = bindings.incoming.socket.remoteAddress;
|
||||
const port = bindings.incoming.socket.remotePort;
|
||||
const family = bindings.incoming.socket.remoteFamily;
|
||||
return {
|
||||
remote: {
|
||||
address,
|
||||
port,
|
||||
addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
|
||||
}
|
||||
};
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getConnInfo
|
||||
});
|
||||
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.mjs
generated
vendored
Normal file
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/conninfo.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// src/conninfo.ts
|
||||
var getConnInfo = (c) => {
|
||||
const bindings = c.env.server ? c.env.server : c.env;
|
||||
const address = bindings.incoming.socket.remoteAddress;
|
||||
const port = bindings.incoming.socket.remotePort;
|
||||
const family = bindings.incoming.socket.remoteFamily;
|
||||
return {
|
||||
remote: {
|
||||
address,
|
||||
port,
|
||||
addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
|
||||
}
|
||||
};
|
||||
};
|
||||
export {
|
||||
getConnInfo
|
||||
};
|
||||
2
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.d.mts
generated
vendored
Normal file
2
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.d.mts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
export { }
|
||||
2
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.d.ts
generated
vendored
Normal file
2
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
export { }
|
||||
39
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.js
generated
vendored
Normal file
39
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"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
|
||||
));
|
||||
|
||||
// src/globals.ts
|
||||
var import_node_crypto = __toESM(require("crypto"));
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = import_node_crypto.default;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
15
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.mjs
generated
vendored
Normal file
15
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/globals.mjs
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// src/globals.ts
|
||||
import crypto from "crypto";
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = crypto;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
8
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.d.mts
generated
vendored
Normal file
8
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.d.mts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export { createAdaptorServer, serve } from './server.mjs';
|
||||
export { getRequestListener } from './listener.mjs';
|
||||
export { RequestError } from './request.mjs';
|
||||
export { Http2Bindings, HttpBindings, ServerType } from './types.mjs';
|
||||
import 'node:net';
|
||||
import 'node:http';
|
||||
import 'node:http2';
|
||||
import 'node:https';
|
||||
8
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.d.ts
generated
vendored
Normal file
8
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
export { createAdaptorServer, serve } from './server.js';
|
||||
export { getRequestListener } from './listener.js';
|
||||
export { RequestError } from './request.js';
|
||||
export { Http2Bindings, HttpBindings, ServerType } from './types.js';
|
||||
import 'node:net';
|
||||
import 'node:http';
|
||||
import 'node:http2';
|
||||
import 'node:https';
|
||||
623
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.js
generated
vendored
Normal file
623
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,623 @@
|
||||
"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);
|
||||
|
||||
// src/index.ts
|
||||
var src_exports = {};
|
||||
__export(src_exports, {
|
||||
RequestError: () => RequestError,
|
||||
createAdaptorServer: () => createAdaptorServer,
|
||||
getRequestListener: () => getRequestListener,
|
||||
serve: () => serve
|
||||
});
|
||||
module.exports = __toCommonJS(src_exports);
|
||||
|
||||
// src/server.ts
|
||||
var import_node_http = require("http");
|
||||
|
||||
// src/listener.ts
|
||||
var import_node_http22 = require("http2");
|
||||
|
||||
// src/request.ts
|
||||
var import_node_http2 = require("http2");
|
||||
var import_node_stream = require("stream");
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = import_node_stream.Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
var import_node_crypto = __toESM(require("crypto"));
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = import_node_crypto.default;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof import_node_http22.Http2ServerRequest) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/server.ts
|
||||
var createAdaptorServer = (options) => {
|
||||
const fetchCallback = options.fetch;
|
||||
const requestListener = getRequestListener(fetchCallback, {
|
||||
hostname: options.hostname,
|
||||
overrideGlobalObjects: options.overrideGlobalObjects,
|
||||
autoCleanupIncoming: options.autoCleanupIncoming
|
||||
});
|
||||
const createServer = options.createServer || import_node_http.createServer;
|
||||
const server = createServer(options.serverOptions || {}, requestListener);
|
||||
return server;
|
||||
};
|
||||
var serve = (options, listeningListener) => {
|
||||
const server = createAdaptorServer(options);
|
||||
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
||||
const serverInfo = server.address();
|
||||
listeningListener && listeningListener(serverInfo);
|
||||
});
|
||||
return server;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
RequestError,
|
||||
createAdaptorServer,
|
||||
getRequestListener,
|
||||
serve
|
||||
});
|
||||
583
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.mjs
generated
vendored
Normal file
583
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,583 @@
|
||||
// src/server.ts
|
||||
import { createServer as createServerHTTP } from "http";
|
||||
|
||||
// src/listener.ts
|
||||
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
||||
|
||||
// src/request.ts
|
||||
import { Http2ServerRequest } from "http2";
|
||||
import { Readable } from "stream";
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
import crypto from "crypto";
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = crypto;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof Http2ServerRequest2) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/server.ts
|
||||
var createAdaptorServer = (options) => {
|
||||
const fetchCallback = options.fetch;
|
||||
const requestListener = getRequestListener(fetchCallback, {
|
||||
hostname: options.hostname,
|
||||
overrideGlobalObjects: options.overrideGlobalObjects,
|
||||
autoCleanupIncoming: options.autoCleanupIncoming
|
||||
});
|
||||
const createServer = options.createServer || createServerHTTP;
|
||||
const server = createServer(options.serverOptions || {}, requestListener);
|
||||
return server;
|
||||
};
|
||||
var serve = (options, listeningListener) => {
|
||||
const server = createAdaptorServer(options);
|
||||
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
||||
const serverInfo = server.address();
|
||||
listeningListener && listeningListener(serverInfo);
|
||||
});
|
||||
return server;
|
||||
};
|
||||
export {
|
||||
RequestError,
|
||||
createAdaptorServer,
|
||||
getRequestListener,
|
||||
serve
|
||||
};
|
||||
13
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.d.mts
generated
vendored
Normal file
13
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.d.mts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IncomingMessage, ServerResponse } from 'node:http';
|
||||
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
||||
import { FetchCallback, CustomErrorHandler } from './types.mjs';
|
||||
import 'node:https';
|
||||
|
||||
declare const getRequestListener: (fetchCallback: FetchCallback, options?: {
|
||||
hostname?: string;
|
||||
errorHandler?: CustomErrorHandler;
|
||||
overrideGlobalObjects?: boolean;
|
||||
autoCleanupIncoming?: boolean;
|
||||
}) => (incoming: IncomingMessage | Http2ServerRequest, outgoing: ServerResponse | Http2ServerResponse) => Promise<void>;
|
||||
|
||||
export { getRequestListener };
|
||||
13
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.d.ts
generated
vendored
Normal file
13
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.d.ts
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
import { IncomingMessage, ServerResponse } from 'node:http';
|
||||
import { Http2ServerRequest, Http2ServerResponse } from 'node:http2';
|
||||
import { FetchCallback, CustomErrorHandler } from './types.js';
|
||||
import 'node:https';
|
||||
|
||||
declare const getRequestListener: (fetchCallback: FetchCallback, options?: {
|
||||
hostname?: string;
|
||||
errorHandler?: CustomErrorHandler;
|
||||
overrideGlobalObjects?: boolean;
|
||||
autoCleanupIncoming?: boolean;
|
||||
}) => (incoming: IncomingMessage | Http2ServerRequest, outgoing: ServerResponse | Http2ServerResponse) => Promise<void>;
|
||||
|
||||
export { getRequestListener };
|
||||
591
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.js
generated
vendored
Normal file
591
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.js
generated
vendored
Normal file
@@ -0,0 +1,591 @@
|
||||
"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);
|
||||
|
||||
// src/listener.ts
|
||||
var listener_exports = {};
|
||||
__export(listener_exports, {
|
||||
getRequestListener: () => getRequestListener
|
||||
});
|
||||
module.exports = __toCommonJS(listener_exports);
|
||||
var import_node_http22 = require("http2");
|
||||
|
||||
// src/request.ts
|
||||
var import_node_http2 = require("http2");
|
||||
var import_node_stream = require("stream");
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = import_node_stream.Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
var import_node_crypto = __toESM(require("crypto"));
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = import_node_crypto.default;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof import_node_http22.Http2ServerRequest) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
getRequestListener
|
||||
});
|
||||
556
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.mjs
generated
vendored
Normal file
556
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/listener.mjs
generated
vendored
Normal file
@@ -0,0 +1,556 @@
|
||||
// src/listener.ts
|
||||
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
||||
|
||||
// src/request.ts
|
||||
import { Http2ServerRequest } from "http2";
|
||||
import { Readable } from "stream";
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
import crypto from "crypto";
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = crypto;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof Http2ServerRequest2) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
export {
|
||||
getRequestListener
|
||||
};
|
||||
25
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.d.mts
generated
vendored
Normal file
25
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.d.mts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { Http2ServerRequest } from 'node:http2';
|
||||
|
||||
declare class RequestError extends Error {
|
||||
constructor(message: string, options?: {
|
||||
cause?: unknown;
|
||||
});
|
||||
}
|
||||
declare const toRequestError: (e: unknown) => RequestError;
|
||||
declare const GlobalRequest: {
|
||||
new (input: RequestInfo | URL, init?: RequestInit): globalThis.Request;
|
||||
prototype: globalThis.Request;
|
||||
};
|
||||
declare class Request extends GlobalRequest {
|
||||
constructor(input: string | Request, options?: RequestInit);
|
||||
}
|
||||
type IncomingMessageWithWrapBodyStream = IncomingMessage & {
|
||||
[wrapBodyStream]: boolean;
|
||||
};
|
||||
declare const wrapBodyStream: unique symbol;
|
||||
declare const abortControllerKey: unique symbol;
|
||||
declare const getAbortController: unique symbol;
|
||||
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
||||
|
||||
export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
||||
25
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.d.ts
generated
vendored
Normal file
25
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { Http2ServerRequest } from 'node:http2';
|
||||
|
||||
declare class RequestError extends Error {
|
||||
constructor(message: string, options?: {
|
||||
cause?: unknown;
|
||||
});
|
||||
}
|
||||
declare const toRequestError: (e: unknown) => RequestError;
|
||||
declare const GlobalRequest: {
|
||||
new (input: RequestInfo | URL, init?: RequestInit): globalThis.Request;
|
||||
prototype: globalThis.Request;
|
||||
};
|
||||
declare class Request extends GlobalRequest {
|
||||
constructor(input: string | Request, options?: RequestInit);
|
||||
}
|
||||
type IncomingMessageWithWrapBodyStream = IncomingMessage & {
|
||||
[wrapBodyStream]: boolean;
|
||||
};
|
||||
declare const wrapBodyStream: unique symbol;
|
||||
declare const abortControllerKey: unique symbol;
|
||||
declare const getAbortController: unique symbol;
|
||||
declare const newRequest: (incoming: IncomingMessage | Http2ServerRequest, defaultHostname?: string) => any;
|
||||
|
||||
export { GlobalRequest, type IncomingMessageWithWrapBodyStream, Request, RequestError, abortControllerKey, getAbortController, newRequest, toRequestError, wrapBodyStream };
|
||||
227
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.js
generated
vendored
Normal file
227
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.js
generated
vendored
Normal file
@@ -0,0 +1,227 @@
|
||||
"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/request.ts
|
||||
var request_exports = {};
|
||||
__export(request_exports, {
|
||||
GlobalRequest: () => GlobalRequest,
|
||||
Request: () => Request,
|
||||
RequestError: () => RequestError,
|
||||
abortControllerKey: () => abortControllerKey,
|
||||
getAbortController: () => getAbortController,
|
||||
newRequest: () => newRequest,
|
||||
toRequestError: () => toRequestError,
|
||||
wrapBodyStream: () => wrapBodyStream
|
||||
});
|
||||
module.exports = __toCommonJS(request_exports);
|
||||
var import_node_http2 = require("http2");
|
||||
var import_node_stream = require("stream");
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = import_node_stream.Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GlobalRequest,
|
||||
Request,
|
||||
RequestError,
|
||||
abortControllerKey,
|
||||
getAbortController,
|
||||
newRequest,
|
||||
toRequestError,
|
||||
wrapBodyStream
|
||||
});
|
||||
195
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.mjs
generated
vendored
Normal file
195
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/request.mjs
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
// src/request.ts
|
||||
import { Http2ServerRequest } from "http2";
|
||||
import { Readable } from "stream";
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
export {
|
||||
GlobalRequest,
|
||||
Request,
|
||||
RequestError,
|
||||
abortControllerKey,
|
||||
getAbortController,
|
||||
newRequest,
|
||||
toRequestError,
|
||||
wrapBodyStream
|
||||
};
|
||||
26
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.d.mts
generated
vendored
Normal file
26
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.d.mts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { OutgoingHttpHeaders } from 'node:http';
|
||||
|
||||
declare const getResponseCache: unique symbol;
|
||||
declare const cacheKey: unique symbol;
|
||||
type InternalCache = [
|
||||
number,
|
||||
string | ReadableStream,
|
||||
Record<string, string> | Headers | OutgoingHttpHeaders
|
||||
];
|
||||
declare const GlobalResponse: {
|
||||
new (body?: BodyInit | null, init?: ResponseInit): globalThis.Response;
|
||||
prototype: globalThis.Response;
|
||||
error(): globalThis.Response;
|
||||
json(data: any, init?: ResponseInit): globalThis.Response;
|
||||
redirect(url: string | URL, status?: number): globalThis.Response;
|
||||
};
|
||||
declare class Response {
|
||||
#private;
|
||||
[getResponseCache](): globalThis.Response;
|
||||
constructor(body?: BodyInit | null, init?: ResponseInit);
|
||||
get headers(): Headers;
|
||||
get status(): number;
|
||||
get ok(): boolean;
|
||||
}
|
||||
|
||||
export { GlobalResponse, type InternalCache, Response, cacheKey };
|
||||
26
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.d.ts
generated
vendored
Normal file
26
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
import { OutgoingHttpHeaders } from 'node:http';
|
||||
|
||||
declare const getResponseCache: unique symbol;
|
||||
declare const cacheKey: unique symbol;
|
||||
type InternalCache = [
|
||||
number,
|
||||
string | ReadableStream,
|
||||
Record<string, string> | Headers | OutgoingHttpHeaders
|
||||
];
|
||||
declare const GlobalResponse: {
|
||||
new (body?: BodyInit | null, init?: ResponseInit): globalThis.Response;
|
||||
prototype: globalThis.Response;
|
||||
error(): globalThis.Response;
|
||||
json(data: any, init?: ResponseInit): globalThis.Response;
|
||||
redirect(url: string | URL, status?: number): globalThis.Response;
|
||||
};
|
||||
declare class Response {
|
||||
#private;
|
||||
[getResponseCache](): globalThis.Response;
|
||||
constructor(body?: BodyInit | null, init?: ResponseInit);
|
||||
get headers(): Headers;
|
||||
get status(): number;
|
||||
get ok(): boolean;
|
||||
}
|
||||
|
||||
export { GlobalResponse, type InternalCache, Response, cacheKey };
|
||||
99
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.js
generated
vendored
Normal file
99
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"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/response.ts
|
||||
var response_exports = {};
|
||||
__export(response_exports, {
|
||||
GlobalResponse: () => GlobalResponse,
|
||||
Response: () => Response,
|
||||
cacheKey: () => cacheKey
|
||||
});
|
||||
module.exports = __toCommonJS(response_exports);
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response, GlobalResponse);
|
||||
Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GlobalResponse,
|
||||
Response,
|
||||
cacheKey
|
||||
});
|
||||
72
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.mjs
generated
vendored
Normal file
72
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/response.mjs
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response, GlobalResponse);
|
||||
Object.setPrototypeOf(Response.prototype, GlobalResponse.prototype);
|
||||
export {
|
||||
GlobalResponse,
|
||||
Response,
|
||||
cacheKey
|
||||
};
|
||||
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.d.mts
generated
vendored
Normal file
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.d.mts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Env, Context, MiddlewareHandler } from 'hono';
|
||||
|
||||
type ServeStaticOptions<E extends Env = Env> = {
|
||||
/**
|
||||
* Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
|
||||
*/
|
||||
root?: string;
|
||||
path?: string;
|
||||
index?: string;
|
||||
precompressed?: boolean;
|
||||
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
||||
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
||||
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
||||
};
|
||||
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
||||
|
||||
export { type ServeStaticOptions, serveStatic };
|
||||
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.d.ts
generated
vendored
Normal file
17
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Env, Context, MiddlewareHandler } from 'hono';
|
||||
|
||||
type ServeStaticOptions<E extends Env = Env> = {
|
||||
/**
|
||||
* Root path, relative to current working directory from which the app was started. Absolute paths are not supported.
|
||||
*/
|
||||
root?: string;
|
||||
path?: string;
|
||||
index?: string;
|
||||
precompressed?: boolean;
|
||||
rewriteRequestPath?: (path: string, c: Context<E>) => string;
|
||||
onFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
||||
onNotFound?: (path: string, c: Context<E>) => void | Promise<void>;
|
||||
};
|
||||
declare const serveStatic: <E extends Env = any>(options?: ServeStaticOptions<E>) => MiddlewareHandler<E>;
|
||||
|
||||
export { type ServeStaticOptions, serveStatic };
|
||||
153
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.js
generated
vendored
Normal file
153
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.js
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
"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/serve-static.ts
|
||||
var serve_static_exports = {};
|
||||
__export(serve_static_exports, {
|
||||
serveStatic: () => serveStatic
|
||||
});
|
||||
module.exports = __toCommonJS(serve_static_exports);
|
||||
var import_mime = require("hono/utils/mime");
|
||||
var import_node_fs = require("fs");
|
||||
var import_node_path = require("path");
|
||||
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
||||
var ENCODINGS = {
|
||||
br: ".br",
|
||||
zstd: ".zst",
|
||||
gzip: ".gz"
|
||||
};
|
||||
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
||||
var createStreamBody = (stream) => {
|
||||
const body = new ReadableStream({
|
||||
start(controller) {
|
||||
stream.on("data", (chunk) => {
|
||||
controller.enqueue(chunk);
|
||||
});
|
||||
stream.on("error", (err) => {
|
||||
controller.error(err);
|
||||
});
|
||||
stream.on("end", () => {
|
||||
controller.close();
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
stream.destroy();
|
||||
}
|
||||
});
|
||||
return body;
|
||||
};
|
||||
var getStats = (path) => {
|
||||
let stats;
|
||||
try {
|
||||
stats = (0, import_node_fs.statSync)(path);
|
||||
} catch {
|
||||
}
|
||||
return stats;
|
||||
};
|
||||
var serveStatic = (options = { root: "" }) => {
|
||||
const root = options.root || "";
|
||||
const optionPath = options.path;
|
||||
if (root !== "" && !(0, import_node_fs.existsSync)(root)) {
|
||||
console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
|
||||
}
|
||||
return async (c, next) => {
|
||||
if (c.finalized) {
|
||||
return next();
|
||||
}
|
||||
let filename;
|
||||
if (optionPath) {
|
||||
filename = optionPath;
|
||||
} else {
|
||||
try {
|
||||
filename = decodeURIComponent(c.req.path);
|
||||
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch {
|
||||
await options.onNotFound?.(c.req.path, c);
|
||||
return next();
|
||||
}
|
||||
}
|
||||
let path = (0, import_node_path.join)(
|
||||
root,
|
||||
!optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
|
||||
);
|
||||
let stats = getStats(path);
|
||||
if (stats && stats.isDirectory()) {
|
||||
const indexFile = options.index ?? "index.html";
|
||||
path = (0, import_node_path.join)(path, indexFile);
|
||||
stats = getStats(path);
|
||||
}
|
||||
if (!stats) {
|
||||
await options.onNotFound?.(path, c);
|
||||
return next();
|
||||
}
|
||||
const mimeType = (0, import_mime.getMimeType)(path);
|
||||
c.header("Content-Type", mimeType || "application/octet-stream");
|
||||
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
||||
const acceptEncodingSet = new Set(
|
||||
c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim())
|
||||
);
|
||||
for (const encoding of ENCODINGS_ORDERED_KEYS) {
|
||||
if (!acceptEncodingSet.has(encoding)) {
|
||||
continue;
|
||||
}
|
||||
const precompressedStats = getStats(path + ENCODINGS[encoding]);
|
||||
if (precompressedStats) {
|
||||
c.header("Content-Encoding", encoding);
|
||||
c.header("Vary", "Accept-Encoding", { append: true });
|
||||
stats = precompressedStats;
|
||||
path = path + ENCODINGS[encoding];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let result;
|
||||
const size = stats.size;
|
||||
const range = c.req.header("range") || "";
|
||||
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
|
||||
c.header("Content-Length", size.toString());
|
||||
c.status(200);
|
||||
result = c.body(null);
|
||||
} else if (!range) {
|
||||
c.header("Content-Length", size.toString());
|
||||
result = c.body(createStreamBody((0, import_node_fs.createReadStream)(path)), 200);
|
||||
} else {
|
||||
c.header("Accept-Ranges", "bytes");
|
||||
c.header("Date", stats.birthtime.toUTCString());
|
||||
const parts = range.replace(/bytes=/, "").split("-", 2);
|
||||
const start = parseInt(parts[0], 10) || 0;
|
||||
let end = parseInt(parts[1], 10) || size - 1;
|
||||
if (size < end - start + 1) {
|
||||
end = size - 1;
|
||||
}
|
||||
const chunksize = end - start + 1;
|
||||
const stream = (0, import_node_fs.createReadStream)(path, { start, end });
|
||||
c.header("Content-Length", chunksize.toString());
|
||||
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
|
||||
result = c.body(createStreamBody(stream), 206);
|
||||
}
|
||||
await options.onFound?.(path, c);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
serveStatic
|
||||
});
|
||||
128
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.mjs
generated
vendored
Normal file
128
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/serve-static.mjs
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
// src/serve-static.ts
|
||||
import { getMimeType } from "hono/utils/mime";
|
||||
import { createReadStream, statSync, existsSync } from "fs";
|
||||
import { join } from "path";
|
||||
var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
|
||||
var ENCODINGS = {
|
||||
br: ".br",
|
||||
zstd: ".zst",
|
||||
gzip: ".gz"
|
||||
};
|
||||
var ENCODINGS_ORDERED_KEYS = Object.keys(ENCODINGS);
|
||||
var createStreamBody = (stream) => {
|
||||
const body = new ReadableStream({
|
||||
start(controller) {
|
||||
stream.on("data", (chunk) => {
|
||||
controller.enqueue(chunk);
|
||||
});
|
||||
stream.on("error", (err) => {
|
||||
controller.error(err);
|
||||
});
|
||||
stream.on("end", () => {
|
||||
controller.close();
|
||||
});
|
||||
},
|
||||
cancel() {
|
||||
stream.destroy();
|
||||
}
|
||||
});
|
||||
return body;
|
||||
};
|
||||
var getStats = (path) => {
|
||||
let stats;
|
||||
try {
|
||||
stats = statSync(path);
|
||||
} catch {
|
||||
}
|
||||
return stats;
|
||||
};
|
||||
var serveStatic = (options = { root: "" }) => {
|
||||
const root = options.root || "";
|
||||
const optionPath = options.path;
|
||||
if (root !== "" && !existsSync(root)) {
|
||||
console.error(`serveStatic: root path '${root}' is not found, are you sure it's correct?`);
|
||||
}
|
||||
return async (c, next) => {
|
||||
if (c.finalized) {
|
||||
return next();
|
||||
}
|
||||
let filename;
|
||||
if (optionPath) {
|
||||
filename = optionPath;
|
||||
} else {
|
||||
try {
|
||||
filename = decodeURIComponent(c.req.path);
|
||||
if (/(?:^|[\/\\])\.\.(?:$|[\/\\])/.test(filename)) {
|
||||
throw new Error();
|
||||
}
|
||||
} catch {
|
||||
await options.onNotFound?.(c.req.path, c);
|
||||
return next();
|
||||
}
|
||||
}
|
||||
let path = join(
|
||||
root,
|
||||
!optionPath && options.rewriteRequestPath ? options.rewriteRequestPath(filename, c) : filename
|
||||
);
|
||||
let stats = getStats(path);
|
||||
if (stats && stats.isDirectory()) {
|
||||
const indexFile = options.index ?? "index.html";
|
||||
path = join(path, indexFile);
|
||||
stats = getStats(path);
|
||||
}
|
||||
if (!stats) {
|
||||
await options.onNotFound?.(path, c);
|
||||
return next();
|
||||
}
|
||||
const mimeType = getMimeType(path);
|
||||
c.header("Content-Type", mimeType || "application/octet-stream");
|
||||
if (options.precompressed && (!mimeType || COMPRESSIBLE_CONTENT_TYPE_REGEX.test(mimeType))) {
|
||||
const acceptEncodingSet = new Set(
|
||||
c.req.header("Accept-Encoding")?.split(",").map((encoding) => encoding.trim())
|
||||
);
|
||||
for (const encoding of ENCODINGS_ORDERED_KEYS) {
|
||||
if (!acceptEncodingSet.has(encoding)) {
|
||||
continue;
|
||||
}
|
||||
const precompressedStats = getStats(path + ENCODINGS[encoding]);
|
||||
if (precompressedStats) {
|
||||
c.header("Content-Encoding", encoding);
|
||||
c.header("Vary", "Accept-Encoding", { append: true });
|
||||
stats = precompressedStats;
|
||||
path = path + ENCODINGS[encoding];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let result;
|
||||
const size = stats.size;
|
||||
const range = c.req.header("range") || "";
|
||||
if (c.req.method == "HEAD" || c.req.method == "OPTIONS") {
|
||||
c.header("Content-Length", size.toString());
|
||||
c.status(200);
|
||||
result = c.body(null);
|
||||
} else if (!range) {
|
||||
c.header("Content-Length", size.toString());
|
||||
result = c.body(createStreamBody(createReadStream(path)), 200);
|
||||
} else {
|
||||
c.header("Accept-Ranges", "bytes");
|
||||
c.header("Date", stats.birthtime.toUTCString());
|
||||
const parts = range.replace(/bytes=/, "").split("-", 2);
|
||||
const start = parseInt(parts[0], 10) || 0;
|
||||
let end = parseInt(parts[1], 10) || size - 1;
|
||||
if (size < end - start + 1) {
|
||||
end = size - 1;
|
||||
}
|
||||
const chunksize = end - start + 1;
|
||||
const stream = createReadStream(path, { start, end });
|
||||
c.header("Content-Length", chunksize.toString());
|
||||
c.header("Content-Range", `bytes ${start}-${end}/${stats.size}`);
|
||||
result = c.body(createStreamBody(stream), 206);
|
||||
}
|
||||
await options.onFound?.(path, c);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
export {
|
||||
serveStatic
|
||||
};
|
||||
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.d.mts
generated
vendored
Normal file
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.d.mts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AddressInfo } from 'node:net';
|
||||
import { Options, ServerType } from './types.mjs';
|
||||
import 'node:http';
|
||||
import 'node:http2';
|
||||
import 'node:https';
|
||||
|
||||
declare const createAdaptorServer: (options: Options) => ServerType;
|
||||
declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType;
|
||||
|
||||
export { createAdaptorServer, serve };
|
||||
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.d.ts
generated
vendored
Normal file
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.d.ts
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { AddressInfo } from 'node:net';
|
||||
import { Options, ServerType } from './types.js';
|
||||
import 'node:http';
|
||||
import 'node:http2';
|
||||
import 'node:https';
|
||||
|
||||
declare const createAdaptorServer: (options: Options) => ServerType;
|
||||
declare const serve: (options: Options, listeningListener?: (info: AddressInfo) => void) => ServerType;
|
||||
|
||||
export { createAdaptorServer, serve };
|
||||
617
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.js
generated
vendored
Normal file
617
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.js
generated
vendored
Normal file
@@ -0,0 +1,617 @@
|
||||
"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);
|
||||
|
||||
// src/server.ts
|
||||
var server_exports = {};
|
||||
__export(server_exports, {
|
||||
createAdaptorServer: () => createAdaptorServer,
|
||||
serve: () => serve
|
||||
});
|
||||
module.exports = __toCommonJS(server_exports);
|
||||
var import_node_http = require("http");
|
||||
|
||||
// src/listener.ts
|
||||
var import_node_http22 = require("http2");
|
||||
|
||||
// src/request.ts
|
||||
var import_node_http2 = require("http2");
|
||||
var import_node_stream = require("stream");
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = import_node_stream.Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
var import_node_crypto = __toESM(require("crypto"));
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = import_node_crypto.default;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof import_node_http22.Http2ServerRequest) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/server.ts
|
||||
var createAdaptorServer = (options) => {
|
||||
const fetchCallback = options.fetch;
|
||||
const requestListener = getRequestListener(fetchCallback, {
|
||||
hostname: options.hostname,
|
||||
overrideGlobalObjects: options.overrideGlobalObjects,
|
||||
autoCleanupIncoming: options.autoCleanupIncoming
|
||||
});
|
||||
const createServer = options.createServer || import_node_http.createServer;
|
||||
const server = createServer(options.serverOptions || {}, requestListener);
|
||||
return server;
|
||||
};
|
||||
var serve = (options, listeningListener) => {
|
||||
const server = createAdaptorServer(options);
|
||||
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
||||
const serverInfo = server.address();
|
||||
listeningListener && listeningListener(serverInfo);
|
||||
});
|
||||
return server;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createAdaptorServer,
|
||||
serve
|
||||
});
|
||||
581
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.mjs
generated
vendored
Normal file
581
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/server.mjs
generated
vendored
Normal file
@@ -0,0 +1,581 @@
|
||||
// src/server.ts
|
||||
import { createServer as createServerHTTP } from "http";
|
||||
|
||||
// src/listener.ts
|
||||
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
||||
|
||||
// src/request.ts
|
||||
import { Http2ServerRequest } from "http2";
|
||||
import { Readable } from "stream";
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
import crypto from "crypto";
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = crypto;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof Http2ServerRequest2) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/server.ts
|
||||
var createAdaptorServer = (options) => {
|
||||
const fetchCallback = options.fetch;
|
||||
const requestListener = getRequestListener(fetchCallback, {
|
||||
hostname: options.hostname,
|
||||
overrideGlobalObjects: options.overrideGlobalObjects,
|
||||
autoCleanupIncoming: options.autoCleanupIncoming
|
||||
});
|
||||
const createServer = options.createServer || createServerHTTP;
|
||||
const server = createServer(options.serverOptions || {}, requestListener);
|
||||
return server;
|
||||
};
|
||||
var serve = (options, listeningListener) => {
|
||||
const server = createAdaptorServer(options);
|
||||
server.listen(options?.port ?? 3e3, options.hostname, () => {
|
||||
const serverInfo = server.address();
|
||||
listeningListener && listeningListener(serverInfo);
|
||||
});
|
||||
return server;
|
||||
};
|
||||
export {
|
||||
createAdaptorServer,
|
||||
serve
|
||||
};
|
||||
44
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.d.mts
generated
vendored
Normal file
44
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.d.mts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
|
||||
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
|
||||
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
||||
|
||||
type HttpBindings = {
|
||||
incoming: IncomingMessage;
|
||||
outgoing: ServerResponse;
|
||||
};
|
||||
type Http2Bindings = {
|
||||
incoming: Http2ServerRequest;
|
||||
outgoing: Http2ServerResponse;
|
||||
};
|
||||
type FetchCallback = (request: Request, env: HttpBindings | Http2Bindings) => Promise<unknown> | unknown;
|
||||
type NextHandlerOption = {
|
||||
fetch: FetchCallback;
|
||||
};
|
||||
type ServerType = Server | Http2Server | Http2SecureServer;
|
||||
type createHttpOptions = {
|
||||
serverOptions?: ServerOptions$1;
|
||||
createServer?: typeof createServer;
|
||||
};
|
||||
type createHttpsOptions = {
|
||||
serverOptions?: ServerOptions$2;
|
||||
createServer?: typeof createServer$1;
|
||||
};
|
||||
type createHttp2Options = {
|
||||
serverOptions?: ServerOptions$3;
|
||||
createServer?: typeof createServer$2;
|
||||
};
|
||||
type createSecureHttp2Options = {
|
||||
serverOptions?: SecureServerOptions;
|
||||
createServer?: typeof createSecureServer;
|
||||
};
|
||||
type ServerOptions = createHttpOptions | createHttpsOptions | createHttp2Options | createSecureHttp2Options;
|
||||
type Options = {
|
||||
fetch: FetchCallback;
|
||||
overrideGlobalObjects?: boolean;
|
||||
autoCleanupIncoming?: boolean;
|
||||
port?: number;
|
||||
hostname?: string;
|
||||
} & ServerOptions;
|
||||
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
||||
|
||||
export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
||||
44
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.d.ts
generated
vendored
Normal file
44
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { IncomingMessage, ServerResponse, ServerOptions as ServerOptions$1, createServer, Server } from 'node:http';
|
||||
import { Http2ServerRequest, Http2ServerResponse, ServerOptions as ServerOptions$3, createServer as createServer$2, SecureServerOptions, createSecureServer, Http2Server, Http2SecureServer } from 'node:http2';
|
||||
import { ServerOptions as ServerOptions$2, createServer as createServer$1 } from 'node:https';
|
||||
|
||||
type HttpBindings = {
|
||||
incoming: IncomingMessage;
|
||||
outgoing: ServerResponse;
|
||||
};
|
||||
type Http2Bindings = {
|
||||
incoming: Http2ServerRequest;
|
||||
outgoing: Http2ServerResponse;
|
||||
};
|
||||
type FetchCallback = (request: Request, env: HttpBindings | Http2Bindings) => Promise<unknown> | unknown;
|
||||
type NextHandlerOption = {
|
||||
fetch: FetchCallback;
|
||||
};
|
||||
type ServerType = Server | Http2Server | Http2SecureServer;
|
||||
type createHttpOptions = {
|
||||
serverOptions?: ServerOptions$1;
|
||||
createServer?: typeof createServer;
|
||||
};
|
||||
type createHttpsOptions = {
|
||||
serverOptions?: ServerOptions$2;
|
||||
createServer?: typeof createServer$1;
|
||||
};
|
||||
type createHttp2Options = {
|
||||
serverOptions?: ServerOptions$3;
|
||||
createServer?: typeof createServer$2;
|
||||
};
|
||||
type createSecureHttp2Options = {
|
||||
serverOptions?: SecureServerOptions;
|
||||
createServer?: typeof createSecureServer;
|
||||
};
|
||||
type ServerOptions = createHttpOptions | createHttpsOptions | createHttp2Options | createSecureHttp2Options;
|
||||
type Options = {
|
||||
fetch: FetchCallback;
|
||||
overrideGlobalObjects?: boolean;
|
||||
autoCleanupIncoming?: boolean;
|
||||
port?: number;
|
||||
hostname?: string;
|
||||
} & ServerOptions;
|
||||
type CustomErrorHandler = (err: unknown) => void | Response | Promise<void | Response>;
|
||||
|
||||
export type { CustomErrorHandler, FetchCallback, Http2Bindings, HttpBindings, NextHandlerOption, Options, ServerOptions, ServerType };
|
||||
18
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.js
generated
vendored
Normal file
18
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
"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/types.ts
|
||||
var types_exports = {};
|
||||
module.exports = __toCommonJS(types_exports);
|
||||
0
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.mjs
generated
vendored
Normal file
0
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/types.mjs
generated
vendored
Normal file
9
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.d.mts
generated
vendored
Normal file
9
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.d.mts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { OutgoingHttpHeaders } from 'node:http';
|
||||
import { Writable } from 'node:stream';
|
||||
|
||||
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
||||
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<undefined>;
|
||||
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
||||
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
||||
|
||||
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|
||||
9
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.d.ts
generated
vendored
Normal file
9
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.d.ts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { OutgoingHttpHeaders } from 'node:http';
|
||||
import { Writable } from 'node:stream';
|
||||
|
||||
declare function readWithoutBlocking(readPromise: Promise<ReadableStreamReadResult<Uint8Array>>): Promise<ReadableStreamReadResult<Uint8Array> | undefined>;
|
||||
declare function writeFromReadableStreamDefaultReader(reader: ReadableStreamDefaultReader<Uint8Array>, writable: Writable, currentReadPromise?: Promise<ReadableStreamReadResult<Uint8Array>> | undefined): Promise<undefined>;
|
||||
declare function writeFromReadableStream(stream: ReadableStream<Uint8Array>, writable: Writable): Promise<undefined> | undefined;
|
||||
declare const buildOutgoingHttpHeaders: (headers: Headers | HeadersInit | null | undefined) => OutgoingHttpHeaders;
|
||||
|
||||
export { buildOutgoingHttpHeaders, readWithoutBlocking, writeFromReadableStream, writeFromReadableStreamDefaultReader };
|
||||
99
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.js
generated
vendored
Normal file
99
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.js
generated
vendored
Normal file
@@ -0,0 +1,99 @@
|
||||
"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/utils.ts
|
||||
var utils_exports = {};
|
||||
__export(utils_exports, {
|
||||
buildOutgoingHttpHeaders: () => buildOutgoingHttpHeaders,
|
||||
readWithoutBlocking: () => readWithoutBlocking,
|
||||
writeFromReadableStream: () => writeFromReadableStream,
|
||||
writeFromReadableStreamDefaultReader: () => writeFromReadableStreamDefaultReader
|
||||
});
|
||||
module.exports = __toCommonJS(utils_exports);
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
buildOutgoingHttpHeaders,
|
||||
readWithoutBlocking,
|
||||
writeFromReadableStream,
|
||||
writeFromReadableStreamDefaultReader
|
||||
});
|
||||
71
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.mjs
generated
vendored
Normal file
71
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils.mjs
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
export {
|
||||
buildOutgoingHttpHeaders,
|
||||
readWithoutBlocking,
|
||||
writeFromReadableStream,
|
||||
writeFromReadableStreamDefaultReader
|
||||
};
|
||||
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.d.mts
generated
vendored
Normal file
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.d.mts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const RESPONSE_ALREADY_SENT: Response;
|
||||
|
||||
export { RESPONSE_ALREADY_SENT };
|
||||
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.d.ts
generated
vendored
Normal file
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const RESPONSE_ALREADY_SENT: Response;
|
||||
|
||||
export { RESPONSE_ALREADY_SENT };
|
||||
37
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.js
generated
vendored
Normal file
37
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.js
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
"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/utils/response.ts
|
||||
var response_exports = {};
|
||||
__export(response_exports, {
|
||||
RESPONSE_ALREADY_SENT: () => RESPONSE_ALREADY_SENT
|
||||
});
|
||||
module.exports = __toCommonJS(response_exports);
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/utils/response.ts
|
||||
var RESPONSE_ALREADY_SENT = new Response(null, {
|
||||
headers: { [X_ALREADY_SENT]: "true" }
|
||||
});
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
RESPONSE_ALREADY_SENT
|
||||
});
|
||||
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.mjs
generated
vendored
Normal file
10
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response.mjs
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/utils/response.ts
|
||||
var RESPONSE_ALREADY_SENT = new Response(null, {
|
||||
headers: { [X_ALREADY_SENT]: "true" }
|
||||
});
|
||||
export {
|
||||
RESPONSE_ALREADY_SENT
|
||||
};
|
||||
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.d.mts
generated
vendored
Normal file
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.d.mts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
export { X_ALREADY_SENT };
|
||||
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.d.ts
generated
vendored
Normal file
3
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare const X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
export { X_ALREADY_SENT };
|
||||
30
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.js
generated
vendored
Normal file
30
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"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/utils/response/constants.ts
|
||||
var constants_exports = {};
|
||||
__export(constants_exports, {
|
||||
X_ALREADY_SENT: () => X_ALREADY_SENT
|
||||
});
|
||||
module.exports = __toCommonJS(constants_exports);
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
X_ALREADY_SENT
|
||||
});
|
||||
5
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.mjs
generated
vendored
Normal file
5
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/utils/response/constants.mjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
export {
|
||||
X_ALREADY_SENT
|
||||
};
|
||||
7
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.d.mts
generated
vendored
Normal file
7
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.d.mts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as http2 from 'http2';
|
||||
import * as http from 'http';
|
||||
import { Hono } from 'hono';
|
||||
|
||||
declare const handle: (app: Hono<any, any, any>) => (incoming: http.IncomingMessage | http2.Http2ServerRequest, outgoing: http.ServerResponse | http2.Http2ServerResponse) => Promise<void>;
|
||||
|
||||
export { handle };
|
||||
7
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.d.ts
generated
vendored
Normal file
7
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as http2 from 'http2';
|
||||
import * as http from 'http';
|
||||
import { Hono } from 'hono';
|
||||
|
||||
declare const handle: (app: Hono<any, any, any>) => (incoming: http.IncomingMessage | http2.Http2ServerRequest, outgoing: http.ServerResponse | http2.Http2ServerResponse) => Promise<void>;
|
||||
|
||||
export { handle };
|
||||
598
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.js
generated
vendored
Normal file
598
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.js
generated
vendored
Normal file
@@ -0,0 +1,598 @@
|
||||
"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);
|
||||
|
||||
// src/vercel.ts
|
||||
var vercel_exports = {};
|
||||
__export(vercel_exports, {
|
||||
handle: () => handle
|
||||
});
|
||||
module.exports = __toCommonJS(vercel_exports);
|
||||
|
||||
// src/listener.ts
|
||||
var import_node_http22 = require("http2");
|
||||
|
||||
// src/request.ts
|
||||
var import_node_http2 = require("http2");
|
||||
var import_node_stream = require("stream");
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= import_node_stream.Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = import_node_stream.Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof import_node_http2.Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof import_node_http2.Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
var import_node_crypto = __toESM(require("crypto"));
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = import_node_crypto.default;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof import_node_http22.Http2ServerRequest) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/vercel.ts
|
||||
var handle = (app) => {
|
||||
return getRequestListener(app.fetch);
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
handle
|
||||
});
|
||||
561
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.mjs
generated
vendored
Normal file
561
dev-browser/skills/dev-browser/node_modules/@hono/node-server/dist/vercel.mjs
generated
vendored
Normal file
@@ -0,0 +1,561 @@
|
||||
// src/listener.ts
|
||||
import { Http2ServerRequest as Http2ServerRequest2 } from "http2";
|
||||
|
||||
// src/request.ts
|
||||
import { Http2ServerRequest } from "http2";
|
||||
import { Readable } from "stream";
|
||||
var RequestError = class extends Error {
|
||||
constructor(message, options) {
|
||||
super(message, options);
|
||||
this.name = "RequestError";
|
||||
}
|
||||
};
|
||||
var toRequestError = (e) => {
|
||||
if (e instanceof RequestError) {
|
||||
return e;
|
||||
}
|
||||
return new RequestError(e.message, { cause: e });
|
||||
};
|
||||
var GlobalRequest = global.Request;
|
||||
var Request = class extends GlobalRequest {
|
||||
constructor(input, options) {
|
||||
if (typeof input === "object" && getRequestCache in input) {
|
||||
input = input[getRequestCache]();
|
||||
}
|
||||
if (typeof options?.body?.getReader !== "undefined") {
|
||||
;
|
||||
options.duplex ??= "half";
|
||||
}
|
||||
super(input, options);
|
||||
}
|
||||
};
|
||||
var newHeadersFromIncoming = (incoming) => {
|
||||
const headerRecord = [];
|
||||
const rawHeaders = incoming.rawHeaders;
|
||||
for (let i = 0; i < rawHeaders.length; i += 2) {
|
||||
const { [i]: key, [i + 1]: value } = rawHeaders;
|
||||
if (key.charCodeAt(0) !== /*:*/
|
||||
58) {
|
||||
headerRecord.push([key, value]);
|
||||
}
|
||||
}
|
||||
return new Headers(headerRecord);
|
||||
};
|
||||
var wrapBodyStream = Symbol("wrapBodyStream");
|
||||
var newRequestFromIncoming = (method, url, headers, incoming, abortController) => {
|
||||
const init = {
|
||||
method,
|
||||
headers,
|
||||
signal: abortController.signal
|
||||
};
|
||||
if (method === "TRACE") {
|
||||
init.method = "GET";
|
||||
const req = new Request(url, init);
|
||||
Object.defineProperty(req, "method", {
|
||||
get() {
|
||||
return "TRACE";
|
||||
}
|
||||
});
|
||||
return req;
|
||||
}
|
||||
if (!(method === "GET" || method === "HEAD")) {
|
||||
if ("rawBody" in incoming && incoming.rawBody instanceof Buffer) {
|
||||
init.body = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(incoming.rawBody);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
} else if (incoming[wrapBodyStream]) {
|
||||
let reader;
|
||||
init.body = new ReadableStream({
|
||||
async pull(controller) {
|
||||
try {
|
||||
reader ||= Readable.toWeb(incoming).getReader();
|
||||
const { done, value } = await reader.read();
|
||||
if (done) {
|
||||
controller.close();
|
||||
} else {
|
||||
controller.enqueue(value);
|
||||
}
|
||||
} catch (error) {
|
||||
controller.error(error);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
init.body = Readable.toWeb(incoming);
|
||||
}
|
||||
}
|
||||
return new Request(url, init);
|
||||
};
|
||||
var getRequestCache = Symbol("getRequestCache");
|
||||
var requestCache = Symbol("requestCache");
|
||||
var incomingKey = Symbol("incomingKey");
|
||||
var urlKey = Symbol("urlKey");
|
||||
var headersKey = Symbol("headersKey");
|
||||
var abortControllerKey = Symbol("abortControllerKey");
|
||||
var getAbortController = Symbol("getAbortController");
|
||||
var requestPrototype = {
|
||||
get method() {
|
||||
return this[incomingKey].method || "GET";
|
||||
},
|
||||
get url() {
|
||||
return this[urlKey];
|
||||
},
|
||||
get headers() {
|
||||
return this[headersKey] ||= newHeadersFromIncoming(this[incomingKey]);
|
||||
},
|
||||
[getAbortController]() {
|
||||
this[getRequestCache]();
|
||||
return this[abortControllerKey];
|
||||
},
|
||||
[getRequestCache]() {
|
||||
this[abortControllerKey] ||= new AbortController();
|
||||
return this[requestCache] ||= newRequestFromIncoming(
|
||||
this.method,
|
||||
this[urlKey],
|
||||
this.headers,
|
||||
this[incomingKey],
|
||||
this[abortControllerKey]
|
||||
);
|
||||
}
|
||||
};
|
||||
[
|
||||
"body",
|
||||
"bodyUsed",
|
||||
"cache",
|
||||
"credentials",
|
||||
"destination",
|
||||
"integrity",
|
||||
"mode",
|
||||
"redirect",
|
||||
"referrer",
|
||||
"referrerPolicy",
|
||||
"signal",
|
||||
"keepalive"
|
||||
].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
get() {
|
||||
return this[getRequestCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(requestPrototype, k, {
|
||||
value: function() {
|
||||
return this[getRequestCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(requestPrototype, Request.prototype);
|
||||
var newRequest = (incoming, defaultHostname) => {
|
||||
const req = Object.create(requestPrototype);
|
||||
req[incomingKey] = incoming;
|
||||
const incomingUrl = incoming.url || "";
|
||||
if (incomingUrl[0] !== "/" && // short-circuit for performance. most requests are relative URL.
|
||||
(incomingUrl.startsWith("http://") || incomingUrl.startsWith("https://"))) {
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
throw new RequestError("Absolute URL for :path is not allowed in HTTP/2");
|
||||
}
|
||||
try {
|
||||
const url2 = new URL(incomingUrl);
|
||||
req[urlKey] = url2.href;
|
||||
} catch (e) {
|
||||
throw new RequestError("Invalid absolute URL", { cause: e });
|
||||
}
|
||||
return req;
|
||||
}
|
||||
const host = (incoming instanceof Http2ServerRequest ? incoming.authority : incoming.headers.host) || defaultHostname;
|
||||
if (!host) {
|
||||
throw new RequestError("Missing host header");
|
||||
}
|
||||
let scheme;
|
||||
if (incoming instanceof Http2ServerRequest) {
|
||||
scheme = incoming.scheme;
|
||||
if (!(scheme === "http" || scheme === "https")) {
|
||||
throw new RequestError("Unsupported scheme");
|
||||
}
|
||||
} else {
|
||||
scheme = incoming.socket && incoming.socket.encrypted ? "https" : "http";
|
||||
}
|
||||
const url = new URL(`${scheme}://${host}${incomingUrl}`);
|
||||
if (url.hostname.length !== host.length && url.hostname !== host.replace(/:\d+$/, "")) {
|
||||
throw new RequestError("Invalid host header");
|
||||
}
|
||||
req[urlKey] = url.href;
|
||||
return req;
|
||||
};
|
||||
|
||||
// src/response.ts
|
||||
var responseCache = Symbol("responseCache");
|
||||
var getResponseCache = Symbol("getResponseCache");
|
||||
var cacheKey = Symbol("cache");
|
||||
var GlobalResponse = global.Response;
|
||||
var Response2 = class _Response {
|
||||
#body;
|
||||
#init;
|
||||
[getResponseCache]() {
|
||||
delete this[cacheKey];
|
||||
return this[responseCache] ||= new GlobalResponse(this.#body, this.#init);
|
||||
}
|
||||
constructor(body, init) {
|
||||
let headers;
|
||||
this.#body = body;
|
||||
if (init instanceof _Response) {
|
||||
const cachedGlobalResponse = init[responseCache];
|
||||
if (cachedGlobalResponse) {
|
||||
this.#init = cachedGlobalResponse;
|
||||
this[getResponseCache]();
|
||||
return;
|
||||
} else {
|
||||
this.#init = init.#init;
|
||||
headers = new Headers(init.#init.headers);
|
||||
}
|
||||
} else {
|
||||
this.#init = init;
|
||||
}
|
||||
if (typeof body === "string" || typeof body?.getReader !== "undefined" || body instanceof Blob || body instanceof Uint8Array) {
|
||||
headers ||= init?.headers || { "content-type": "text/plain; charset=UTF-8" };
|
||||
this[cacheKey] = [init?.status || 200, body, headers];
|
||||
}
|
||||
}
|
||||
get headers() {
|
||||
const cache = this[cacheKey];
|
||||
if (cache) {
|
||||
if (!(cache[2] instanceof Headers)) {
|
||||
cache[2] = new Headers(cache[2]);
|
||||
}
|
||||
return cache[2];
|
||||
}
|
||||
return this[getResponseCache]().headers;
|
||||
}
|
||||
get status() {
|
||||
return this[cacheKey]?.[0] ?? this[getResponseCache]().status;
|
||||
}
|
||||
get ok() {
|
||||
const status = this.status;
|
||||
return status >= 200 && status < 300;
|
||||
}
|
||||
};
|
||||
["body", "bodyUsed", "redirected", "statusText", "trailers", "type", "url"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
get() {
|
||||
return this[getResponseCache]()[k];
|
||||
}
|
||||
});
|
||||
});
|
||||
["arrayBuffer", "blob", "clone", "formData", "json", "text"].forEach((k) => {
|
||||
Object.defineProperty(Response2.prototype, k, {
|
||||
value: function() {
|
||||
return this[getResponseCache]()[k]();
|
||||
}
|
||||
});
|
||||
});
|
||||
Object.setPrototypeOf(Response2, GlobalResponse);
|
||||
Object.setPrototypeOf(Response2.prototype, GlobalResponse.prototype);
|
||||
|
||||
// src/utils.ts
|
||||
async function readWithoutBlocking(readPromise) {
|
||||
return Promise.race([readPromise, Promise.resolve().then(() => Promise.resolve(void 0))]);
|
||||
}
|
||||
function writeFromReadableStreamDefaultReader(reader, writable, currentReadPromise) {
|
||||
const cancel = (error) => {
|
||||
reader.cancel(error).catch(() => {
|
||||
});
|
||||
};
|
||||
writable.on("close", cancel);
|
||||
writable.on("error", cancel);
|
||||
(currentReadPromise ?? reader.read()).then(flow, handleStreamError);
|
||||
return reader.closed.finally(() => {
|
||||
writable.off("close", cancel);
|
||||
writable.off("error", cancel);
|
||||
});
|
||||
function handleStreamError(error) {
|
||||
if (error) {
|
||||
writable.destroy(error);
|
||||
}
|
||||
}
|
||||
function onDrain() {
|
||||
reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
function flow({ done, value }) {
|
||||
try {
|
||||
if (done) {
|
||||
writable.end();
|
||||
} else if (!writable.write(value)) {
|
||||
writable.once("drain", onDrain);
|
||||
} else {
|
||||
return reader.read().then(flow, handleStreamError);
|
||||
}
|
||||
} catch (e) {
|
||||
handleStreamError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
function writeFromReadableStream(stream, writable) {
|
||||
if (stream.locked) {
|
||||
throw new TypeError("ReadableStream is locked.");
|
||||
} else if (writable.destroyed) {
|
||||
return;
|
||||
}
|
||||
return writeFromReadableStreamDefaultReader(stream.getReader(), writable);
|
||||
}
|
||||
var buildOutgoingHttpHeaders = (headers) => {
|
||||
const res = {};
|
||||
if (!(headers instanceof Headers)) {
|
||||
headers = new Headers(headers ?? void 0);
|
||||
}
|
||||
const cookies = [];
|
||||
for (const [k, v] of headers) {
|
||||
if (k === "set-cookie") {
|
||||
cookies.push(v);
|
||||
} else {
|
||||
res[k] = v;
|
||||
}
|
||||
}
|
||||
if (cookies.length > 0) {
|
||||
res["set-cookie"] = cookies;
|
||||
}
|
||||
res["content-type"] ??= "text/plain; charset=UTF-8";
|
||||
return res;
|
||||
};
|
||||
|
||||
// src/utils/response/constants.ts
|
||||
var X_ALREADY_SENT = "x-hono-already-sent";
|
||||
|
||||
// src/globals.ts
|
||||
import crypto from "crypto";
|
||||
var webFetch = global.fetch;
|
||||
if (typeof global.crypto === "undefined") {
|
||||
global.crypto = crypto;
|
||||
}
|
||||
global.fetch = (info, init) => {
|
||||
init = {
|
||||
// Disable compression handling so people can return the result of a fetch
|
||||
// directly in the loader without messing with the Content-Encoding header.
|
||||
compress: false,
|
||||
...init
|
||||
};
|
||||
return webFetch(info, init);
|
||||
};
|
||||
|
||||
// src/listener.ts
|
||||
var outgoingEnded = Symbol("outgoingEnded");
|
||||
var handleRequestError = () => new Response(null, {
|
||||
status: 400
|
||||
});
|
||||
var handleFetchError = (e) => new Response(null, {
|
||||
status: e instanceof Error && (e.name === "TimeoutError" || e.constructor.name === "TimeoutError") ? 504 : 500
|
||||
});
|
||||
var handleResponseError = (e, outgoing) => {
|
||||
const err = e instanceof Error ? e : new Error("unknown error", { cause: e });
|
||||
if (err.code === "ERR_STREAM_PREMATURE_CLOSE") {
|
||||
console.info("The user aborted a request.");
|
||||
} else {
|
||||
console.error(e);
|
||||
if (!outgoing.headersSent) {
|
||||
outgoing.writeHead(500, { "Content-Type": "text/plain" });
|
||||
}
|
||||
outgoing.end(`Error: ${err.message}`);
|
||||
outgoing.destroy(err);
|
||||
}
|
||||
};
|
||||
var flushHeaders = (outgoing) => {
|
||||
if ("flushHeaders" in outgoing && outgoing.writable) {
|
||||
outgoing.flushHeaders();
|
||||
}
|
||||
};
|
||||
var responseViaCache = async (res, outgoing) => {
|
||||
let [status, body, header] = res[cacheKey];
|
||||
if (header instanceof Headers) {
|
||||
header = buildOutgoingHttpHeaders(header);
|
||||
}
|
||||
if (typeof body === "string") {
|
||||
header["Content-Length"] = Buffer.byteLength(body);
|
||||
} else if (body instanceof Uint8Array) {
|
||||
header["Content-Length"] = body.byteLength;
|
||||
} else if (body instanceof Blob) {
|
||||
header["Content-Length"] = body.size;
|
||||
}
|
||||
outgoing.writeHead(status, header);
|
||||
if (typeof body === "string" || body instanceof Uint8Array) {
|
||||
outgoing.end(body);
|
||||
} else if (body instanceof Blob) {
|
||||
outgoing.end(new Uint8Array(await body.arrayBuffer()));
|
||||
} else {
|
||||
flushHeaders(outgoing);
|
||||
await writeFromReadableStream(body, outgoing)?.catch(
|
||||
(e) => handleResponseError(e, outgoing)
|
||||
);
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var isPromise = (res) => typeof res.then === "function";
|
||||
var responseViaResponseObject = async (res, outgoing, options = {}) => {
|
||||
if (isPromise(res)) {
|
||||
if (options.errorHandler) {
|
||||
try {
|
||||
res = await res;
|
||||
} catch (err) {
|
||||
const errRes = await options.errorHandler(err);
|
||||
if (!errRes) {
|
||||
return;
|
||||
}
|
||||
res = errRes;
|
||||
}
|
||||
} else {
|
||||
res = await res.catch(handleFetchError);
|
||||
}
|
||||
}
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
const resHeaderRecord = buildOutgoingHttpHeaders(res.headers);
|
||||
if (res.body) {
|
||||
const reader = res.body.getReader();
|
||||
const values = [];
|
||||
let done = false;
|
||||
let currentReadPromise = void 0;
|
||||
if (resHeaderRecord["transfer-encoding"] !== "chunked") {
|
||||
let maxReadCount = 2;
|
||||
for (let i = 0; i < maxReadCount; i++) {
|
||||
currentReadPromise ||= reader.read();
|
||||
const chunk = await readWithoutBlocking(currentReadPromise).catch((e) => {
|
||||
console.error(e);
|
||||
done = true;
|
||||
});
|
||||
if (!chunk) {
|
||||
if (i === 1) {
|
||||
await new Promise((resolve) => setTimeout(resolve));
|
||||
maxReadCount = 3;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
currentReadPromise = void 0;
|
||||
if (chunk.value) {
|
||||
values.push(chunk.value);
|
||||
}
|
||||
if (chunk.done) {
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done && !("content-length" in resHeaderRecord)) {
|
||||
resHeaderRecord["content-length"] = values.reduce((acc, value) => acc + value.length, 0);
|
||||
}
|
||||
}
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
values.forEach((value) => {
|
||||
;
|
||||
outgoing.write(value);
|
||||
});
|
||||
if (done) {
|
||||
outgoing.end();
|
||||
} else {
|
||||
if (values.length === 0) {
|
||||
flushHeaders(outgoing);
|
||||
}
|
||||
await writeFromReadableStreamDefaultReader(reader, outgoing, currentReadPromise);
|
||||
}
|
||||
} else if (resHeaderRecord[X_ALREADY_SENT]) {
|
||||
} else {
|
||||
outgoing.writeHead(res.status, resHeaderRecord);
|
||||
outgoing.end();
|
||||
}
|
||||
;
|
||||
outgoing[outgoingEnded]?.();
|
||||
};
|
||||
var getRequestListener = (fetchCallback, options = {}) => {
|
||||
const autoCleanupIncoming = options.autoCleanupIncoming ?? true;
|
||||
if (options.overrideGlobalObjects !== false && global.Request !== Request) {
|
||||
Object.defineProperty(global, "Request", {
|
||||
value: Request
|
||||
});
|
||||
Object.defineProperty(global, "Response", {
|
||||
value: Response2
|
||||
});
|
||||
}
|
||||
return async (incoming, outgoing) => {
|
||||
let res, req;
|
||||
try {
|
||||
req = newRequest(incoming, options.hostname);
|
||||
let incomingEnded = !autoCleanupIncoming || incoming.method === "GET" || incoming.method === "HEAD";
|
||||
if (!incomingEnded) {
|
||||
;
|
||||
incoming[wrapBodyStream] = true;
|
||||
incoming.on("end", () => {
|
||||
incomingEnded = true;
|
||||
});
|
||||
if (incoming instanceof Http2ServerRequest2) {
|
||||
;
|
||||
outgoing[outgoingEnded] = () => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
outgoing.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
outgoing.on("close", () => {
|
||||
const abortController = req[abortControllerKey];
|
||||
if (abortController) {
|
||||
if (incoming.errored) {
|
||||
req[abortControllerKey].abort(incoming.errored.toString());
|
||||
} else if (!outgoing.writableFinished) {
|
||||
req[abortControllerKey].abort("Client connection prematurely closed.");
|
||||
}
|
||||
}
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
if (!incomingEnded) {
|
||||
setTimeout(() => {
|
||||
incoming.destroy();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
res = fetchCallback(req, { incoming, outgoing });
|
||||
if (cacheKey in res) {
|
||||
return responseViaCache(res, outgoing);
|
||||
}
|
||||
} catch (e) {
|
||||
if (!res) {
|
||||
if (options.errorHandler) {
|
||||
res = await options.errorHandler(req ? e : toRequestError(e));
|
||||
if (!res) {
|
||||
return;
|
||||
}
|
||||
} else if (!req) {
|
||||
res = handleRequestError();
|
||||
} else {
|
||||
res = handleFetchError(e);
|
||||
}
|
||||
} else {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
}
|
||||
try {
|
||||
return await responseViaResponseObject(res, outgoing, options);
|
||||
} catch (e) {
|
||||
return handleResponseError(e, outgoing);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// src/vercel.ts
|
||||
var handle = (app) => {
|
||||
return getRequestListener(app.fetch);
|
||||
};
|
||||
export {
|
||||
handle
|
||||
};
|
||||
103
dev-browser/skills/dev-browser/node_modules/@hono/node-server/package.json
generated
vendored
Normal file
103
dev-browser/skills/dev-browser/node_modules/@hono/node-server/package.json
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
{
|
||||
"name": "@hono/node-server",
|
||||
"version": "1.19.7",
|
||||
"description": "Node.js Adapter for Hono",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"require": "./dist/index.js",
|
||||
"import": "./dist/index.mjs"
|
||||
},
|
||||
"./serve-static": {
|
||||
"types": "./dist/serve-static.d.ts",
|
||||
"require": "./dist/serve-static.js",
|
||||
"import": "./dist/serve-static.mjs"
|
||||
},
|
||||
"./vercel": {
|
||||
"types": "./dist/vercel.d.ts",
|
||||
"require": "./dist/vercel.js",
|
||||
"import": "./dist/vercel.mjs"
|
||||
},
|
||||
"./utils/*": {
|
||||
"types": "./dist/utils/*.d.ts",
|
||||
"require": "./dist/utils/*.js",
|
||||
"import": "./dist/utils/*.mjs"
|
||||
},
|
||||
"./conninfo": {
|
||||
"types": "./dist/conninfo.d.ts",
|
||||
"require": "./dist/conninfo.js",
|
||||
"import": "./dist/conninfo.mjs"
|
||||
}
|
||||
},
|
||||
"typesVersions": {
|
||||
"*": {
|
||||
".": [
|
||||
"./dist/index.d.ts"
|
||||
],
|
||||
"serve-static": [
|
||||
"./dist/serve-static.d.ts"
|
||||
],
|
||||
"vercel": [
|
||||
"./dist/vercel.d.ts"
|
||||
],
|
||||
"utils/*": [
|
||||
"./dist/utils/*.d.ts"
|
||||
],
|
||||
"conninfo": [
|
||||
"./dist/conninfo.d.ts"
|
||||
]
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node --expose-gc node_modules/jest/bin/jest.js",
|
||||
"build": "tsup --external hono",
|
||||
"watch": "tsup --watch",
|
||||
"postbuild": "publint",
|
||||
"prerelease": "bun run build && bun run test",
|
||||
"release": "np",
|
||||
"lint": "eslint src test",
|
||||
"lint:fix": "eslint src test --fix",
|
||||
"format": "prettier --check \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\"",
|
||||
"format:fix": "prettier --write \"src/**/*.{js,ts}\" \"test/**/*.{js,ts}\""
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/honojs/node-server.git"
|
||||
},
|
||||
"homepage": "https://github.com/honojs/node-server",
|
||||
"author": "Yusuke Wada <yusuke@kamawada.com> (https://github.com/yusukebe)",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org",
|
||||
"access": "public"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.14.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hono/eslint-config": "^1.0.1",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/node": "^20.10.0",
|
||||
"@types/supertest": "^2.0.12",
|
||||
"@whatwg-node/fetch": "^0.9.14",
|
||||
"eslint": "^9.10.0",
|
||||
"hono": "^4.4.10",
|
||||
"jest": "^29.6.1",
|
||||
"np": "^7.7.0",
|
||||
"prettier": "^3.2.4",
|
||||
"publint": "^0.1.16",
|
||||
"supertest": "^6.3.3",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tsup": "^7.2.0",
|
||||
"typescript": "^5.3.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"hono": "^4"
|
||||
},
|
||||
"packageManager": "bun@1.2.20"
|
||||
}
|
||||
111
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/CHANGELOG.md
generated
vendored
Normal file
111
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
# @hono/node-ws
|
||||
|
||||
## 1.2.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#1213](https://github.com/honojs/middleware/pull/1213) [`5178967931d9f9020892d69b9a929469be25c6a7`](https://github.com/honojs/middleware/commit/5178967931d9f9020892d69b9a929469be25c6a7) Thanks [@palmm](https://github.com/palmm)! - Return the WebSocketServer instance used for createNodeWebSocket
|
||||
|
||||
## 1.1.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1200](https://github.com/honojs/middleware/pull/1200) [`8303d979f18930fac906917895a2063245ac175c`](https://github.com/honojs/middleware/commit/8303d979f18930fac906917895a2063245ac175c) Thanks [@BarryThePenguin](https://github.com/BarryThePenguin)! - Add explicit `CloseEvent` type
|
||||
|
||||
## 1.1.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1187](https://github.com/honojs/middleware/pull/1187) [`69a0a586f5e144f00b1714a157fa43ff269c975a`](https://github.com/honojs/middleware/commit/69a0a586f5e144f00b1714a157fa43ff269c975a) Thanks [@nakasyou](https://github.com/nakasyou)! - use defineWebSocket helper
|
||||
|
||||
- [#1187](https://github.com/honojs/middleware/pull/1187) [`69a0a586f5e144f00b1714a157fa43ff269c975a`](https://github.com/honojs/middleware/commit/69a0a586f5e144f00b1714a157fa43ff269c975a) Thanks [@nakasyou](https://github.com/nakasyou)! - fix a bug if upgrading process uses async function
|
||||
|
||||
## 1.1.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1183](https://github.com/honojs/middleware/pull/1183) [`ccc49dd50842d578ae1aff06a1c8224462e37299`](https://github.com/honojs/middleware/commit/ccc49dd50842d578ae1aff06a1c8224462e37299) Thanks [@nakasyou](https://github.com/nakasyou)! - fix a bug if upgrading process uses async function
|
||||
|
||||
## 1.1.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1146](https://github.com/honojs/middleware/pull/1146) [`b8453438b66fc9a6af58e33593e9fa21a96c02a7`](https://github.com/honojs/middleware/commit/b8453438b66fc9a6af58e33593e9fa21a96c02a7) Thanks [@nakasyou](https://github.com/nakasyou)! - enhance WebSocket connection handling with CORS support and connection symbols
|
||||
|
||||
## 1.1.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1141](https://github.com/honojs/middleware/pull/1141) [`1765a9a3aa1ab6aa59b0efd2d161b7bfaa565ef7`](https://github.com/honojs/middleware/commit/1765a9a3aa1ab6aa59b0efd2d161b7bfaa565ef7) Thanks [@nakasyou](https://github.com/nakasyou)! - Make it uncrashable
|
||||
|
||||
## 1.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1138](https://github.com/honojs/middleware/pull/1138) [`237bff1b82f2c0adfcd015dc97538b36cfb5d418`](https://github.com/honojs/middleware/commit/237bff1b82f2c0adfcd015dc97538b36cfb5d418) Thanks [@leia-uwu](https://github.com/leia-uwu)! - Fix missing code and reason on `CloseEvent`
|
||||
|
||||
## 1.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#1094](https://github.com/honojs/middleware/pull/1094) [`519404ad2c343bcc7043d77dc6ce82217871f209`](https://github.com/honojs/middleware/commit/519404ad2c343bcc7043d77dc6ce82217871f209) Thanks [@nakasyou](https://github.com/nakasyou)! - Adapter won't send Buffer as a MessageEvent.
|
||||
|
||||
## 1.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- [#973](https://github.com/honojs/middleware/pull/973) [`6f90a574c465b4d0ecadbe605bdf434b9f3c95f3`](https://github.com/honojs/middleware/commit/6f90a574c465b4d0ecadbe605bdf434b9f3c95f3) Thanks [@dkulyk](https://github.com/dkulyk)! - Added rejection of WebSocket connections when the app does not expect them
|
||||
|
||||
## 1.0.8
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#959](https://github.com/honojs/middleware/pull/959) [`c24efa6b8af08d0d0b3315b7b5b7355b5dd7ff5a`](https://github.com/honojs/middleware/commit/c24efa6b8af08d0d0b3315b7b5b7355b5dd7ff5a) Thanks [@nakasyou](https://github.com/nakasyou)! - fix a bug of upgrading
|
||||
|
||||
## 1.0.7
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#951](https://github.com/honojs/middleware/pull/951) [`c80ffbfb4c72e8ad7e9a7f65611aa667c6776d64`](https://github.com/honojs/middleware/commit/c80ffbfb4c72e8ad7e9a7f65611aa667c6776d64) Thanks [@yusukebe](https://github.com/yusukebe)! - fix: allow `Hono` with custom Env for `createNodeWebSocket`
|
||||
|
||||
## 1.0.6
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#940](https://github.com/honojs/middleware/pull/940) [`3e2db6dc33c7ab7f471bed65004ebf8139ba7695`](https://github.com/honojs/middleware/commit/3e2db6dc33c7ab7f471bed65004ebf8139ba7695) Thanks [@Ryiski](https://github.com/Ryiski)! - fix: Added missing WSContext raw type
|
||||
|
||||
## 1.0.5
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#876](https://github.com/honojs/middleware/pull/876) [`a092ffaadb3a265a207acc558e6cd021fc3bb6d9`](https://github.com/honojs/middleware/commit/a092ffaadb3a265a207acc558e6cd021fc3bb6d9) Thanks [@HusamElbashir](https://github.com/HusamElbashir)! - Fixed case-sensitivity of the WebSocket "Upgrade" header value
|
||||
|
||||
## 1.0.4
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#648](https://github.com/honojs/middleware/pull/648) [`139e34a90775d25a61002baeb84d7927b9d75b70`](https://github.com/honojs/middleware/commit/139e34a90775d25a61002baeb84d7927b9d75b70) Thanks [@Yovach](https://github.com/Yovach)! - Add a `CloseEvent` class to avoid exception "CloseEvent is not defined"
|
||||
|
||||
## 1.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#639](https://github.com/honojs/middleware/pull/639) [`2f307e687797feaf68de4579cf14c230f239fa2b`](https://github.com/honojs/middleware/commit/2f307e687797feaf68de4579cf14c230f239fa2b) Thanks [@Yovach](https://github.com/Yovach)! - Fixed wrong byteLength on binary messages
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#605](https://github.com/honojs/middleware/pull/605) [`967fd48d5b2b1dc0291e8df49dffd79cbdf09c0c`](https://github.com/honojs/middleware/commit/967fd48d5b2b1dc0291e8df49dffd79cbdf09c0c) Thanks [@inaridiy](https://github.com/inaridiy)! - Fixed bug with multiple connections in node-ws
|
||||
|
||||
## 1.0.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- [#539](https://github.com/honojs/middleware/pull/539) [`ec6ec4ec02f8db46e3151e7334535e562dfc47e3`](https://github.com/honojs/middleware/commit/ec6ec4ec02f8db46e3151e7334535e562dfc47e3) Thanks [@mikestopcontinues](https://github.com/mikestopcontinues)! - create only one WebSocketServer instead of per websocket request
|
||||
|
||||
## 1.0.0
|
||||
|
||||
### Major Changes
|
||||
|
||||
- [#503](https://github.com/honojs/middleware/pull/503) [`d11c3a565f47f26b6882cef416d86f3f7d9c214c`](https://github.com/honojs/middleware/commit/d11c3a565f47f26b6882cef416d86f3f7d9c214c) Thanks [@nakasyou](https://github.com/nakasyou)! - Inited @hono/node-ws
|
||||
35
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/README.md
generated
vendored
Normal file
35
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/README.md
generated
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
# WebSocket helper for Node.js
|
||||
|
||||
[](https://codecov.io/github/honojs/middleware)
|
||||
|
||||
A WebSocket helper for Node.js
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import { createNodeWebSocket } from '@hono/node-ws'
|
||||
import { Hono } from 'hono'
|
||||
import { serve } from '@hono/node-server'
|
||||
|
||||
const app = new Hono()
|
||||
|
||||
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app })
|
||||
|
||||
app.get(
|
||||
'/ws',
|
||||
upgradeWebSocket((c) => ({
|
||||
// https://hono.dev/helpers/websocket
|
||||
}))
|
||||
)
|
||||
|
||||
const server = serve(app)
|
||||
injectWebSocket(server)
|
||||
```
|
||||
|
||||
## Author
|
||||
|
||||
Shotaro Nakamura <https://github.com/nakasyou>
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
184
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.cjs
generated
vendored
Normal file
184
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
"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/index.ts
|
||||
var index_exports = {};
|
||||
__export(index_exports, {
|
||||
createNodeWebSocket: () => createNodeWebSocket
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
var import_ws = require("hono/ws");
|
||||
var import_ws2 = require("ws");
|
||||
|
||||
// src/events.ts
|
||||
var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
||||
#eventInitDict;
|
||||
constructor(type, eventInitDict = {}) {
|
||||
super(type, eventInitDict);
|
||||
this.#eventInitDict = eventInitDict;
|
||||
}
|
||||
get wasClean() {
|
||||
return this.#eventInitDict.wasClean ?? false;
|
||||
}
|
||||
get code() {
|
||||
return this.#eventInitDict.code ?? 0;
|
||||
}
|
||||
get reason() {
|
||||
return this.#eventInitDict.reason ?? "";
|
||||
}
|
||||
};
|
||||
|
||||
// src/index.ts
|
||||
var generateConnectionSymbol = () => Symbol("connection");
|
||||
var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
|
||||
var createNodeWebSocket = (init) => {
|
||||
const wss = new import_ws2.WebSocketServer({ noServer: true });
|
||||
const waiterMap = /* @__PURE__ */ new Map();
|
||||
wss.on("connection", (ws, request) => {
|
||||
const waiter = waiterMap.get(request);
|
||||
if (waiter) {
|
||||
waiter.resolve(ws);
|
||||
waiterMap.delete(request);
|
||||
}
|
||||
});
|
||||
const nodeUpgradeWebSocket = (request, connectionSymbol) => {
|
||||
return new Promise((resolve) => {
|
||||
waiterMap.set(request, { resolve, connectionSymbol });
|
||||
});
|
||||
};
|
||||
return {
|
||||
wss,
|
||||
injectWebSocket(server) {
|
||||
server.on("upgrade", async (request, socket, head) => {
|
||||
const url = new URL(request.url ?? "/", init.baseUrl ?? "http://localhost");
|
||||
const headers = new Headers();
|
||||
for (const key in request.headers) {
|
||||
const value = request.headers[key];
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
headers.append(key, Array.isArray(value) ? value[0] : value);
|
||||
}
|
||||
const env = {
|
||||
incoming: request,
|
||||
outgoing: void 0
|
||||
};
|
||||
await init.app.request(url, { headers }, env);
|
||||
const waiter = waiterMap.get(request);
|
||||
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY]) {
|
||||
socket.end(
|
||||
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
|
||||
);
|
||||
waiterMap.delete(request);
|
||||
return;
|
||||
}
|
||||
wss.handleUpgrade(request, socket, head, (ws) => {
|
||||
wss.emit("connection", ws, request);
|
||||
});
|
||||
});
|
||||
},
|
||||
upgradeWebSocket: (0, import_ws.defineWebSocketHelper)(async (c, events, options) => {
|
||||
if (c.req.header("upgrade")?.toLowerCase() !== "websocket") {
|
||||
return;
|
||||
}
|
||||
const connectionSymbol = generateConnectionSymbol();
|
||||
c.env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
|
||||
(async () => {
|
||||
const ws = await nodeUpgradeWebSocket(c.env.incoming, connectionSymbol);
|
||||
const messagesReceivedInStarting = [];
|
||||
const bufferMessage = (data, isBinary) => {
|
||||
messagesReceivedInStarting.push([data, isBinary]);
|
||||
};
|
||||
ws.on("message", bufferMessage);
|
||||
const ctx = {
|
||||
binaryType: "arraybuffer",
|
||||
close(code, reason) {
|
||||
ws.close(code, reason);
|
||||
},
|
||||
protocol: ws.protocol,
|
||||
raw: ws,
|
||||
get readyState() {
|
||||
return ws.readyState;
|
||||
},
|
||||
send(source, opts) {
|
||||
ws.send(source, {
|
||||
compress: opts?.compress
|
||||
});
|
||||
},
|
||||
url: new URL(c.req.url)
|
||||
};
|
||||
try {
|
||||
events?.onOpen?.(new Event("open"), ctx);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
const handleMessage = (data, isBinary) => {
|
||||
const datas = Array.isArray(data) ? data : [data];
|
||||
for (const data2 of datas) {
|
||||
try {
|
||||
events?.onMessage?.(
|
||||
new MessageEvent("message", {
|
||||
data: isBinary ? data2 instanceof ArrayBuffer ? data2 : data2.buffer.slice(data2.byteOffset, data2.byteOffset + data2.byteLength) : data2.toString("utf-8")
|
||||
}),
|
||||
ctx
|
||||
);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
ws.off("message", bufferMessage);
|
||||
for (const message of messagesReceivedInStarting) {
|
||||
handleMessage(...message);
|
||||
}
|
||||
ws.on("message", (data, isBinary) => {
|
||||
handleMessage(data, isBinary);
|
||||
});
|
||||
ws.on("close", (code, reason) => {
|
||||
try {
|
||||
events?.onClose?.(new CloseEvent("close", { code, reason: reason.toString() }), ctx);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
});
|
||||
ws.on("error", (error) => {
|
||||
try {
|
||||
events?.onError?.(
|
||||
new ErrorEvent("error", {
|
||||
error
|
||||
}),
|
||||
ctx
|
||||
);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
});
|
||||
})();
|
||||
return new Response();
|
||||
})
|
||||
};
|
||||
};
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
createNodeWebSocket
|
||||
});
|
||||
25
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.d.cts
generated
vendored
Normal file
25
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Hono } from 'hono';
|
||||
import { UpgradeWebSocket } from 'hono/ws';
|
||||
import { WebSocket, WebSocketServer } from 'ws';
|
||||
import { Server } from 'node:http';
|
||||
import { Http2Server, Http2SecureServer } from 'node:http2';
|
||||
|
||||
interface NodeWebSocket {
|
||||
upgradeWebSocket: UpgradeWebSocket<WebSocket, {
|
||||
onError: (err: unknown) => void;
|
||||
}>;
|
||||
injectWebSocket(server: Server | Http2Server | Http2SecureServer): void;
|
||||
wss: WebSocketServer;
|
||||
}
|
||||
interface NodeWebSocketInit {
|
||||
app: Hono<any, any, any>;
|
||||
baseUrl?: string | URL;
|
||||
}
|
||||
/**
|
||||
* Create WebSockets for Node.js
|
||||
* @param init Options
|
||||
* @returns NodeWebSocket
|
||||
*/
|
||||
declare const createNodeWebSocket: (init: NodeWebSocketInit) => NodeWebSocket;
|
||||
|
||||
export { type NodeWebSocket, type NodeWebSocketInit, createNodeWebSocket };
|
||||
25
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.d.ts
generated
vendored
Normal file
25
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
import { Hono } from 'hono';
|
||||
import { UpgradeWebSocket } from 'hono/ws';
|
||||
import { WebSocket, WebSocketServer } from 'ws';
|
||||
import { Server } from 'node:http';
|
||||
import { Http2Server, Http2SecureServer } from 'node:http2';
|
||||
|
||||
interface NodeWebSocket {
|
||||
upgradeWebSocket: UpgradeWebSocket<WebSocket, {
|
||||
onError: (err: unknown) => void;
|
||||
}>;
|
||||
injectWebSocket(server: Server | Http2Server | Http2SecureServer): void;
|
||||
wss: WebSocketServer;
|
||||
}
|
||||
interface NodeWebSocketInit {
|
||||
app: Hono<any, any, any>;
|
||||
baseUrl?: string | URL;
|
||||
}
|
||||
/**
|
||||
* Create WebSockets for Node.js
|
||||
* @param init Options
|
||||
* @returns NodeWebSocket
|
||||
*/
|
||||
declare const createNodeWebSocket: (init: NodeWebSocketInit) => NodeWebSocket;
|
||||
|
||||
export { type NodeWebSocket, type NodeWebSocketInit, createNodeWebSocket };
|
||||
159
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.js
generated
vendored
Normal file
159
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
// src/index.ts
|
||||
import { defineWebSocketHelper } from "hono/ws";
|
||||
import { WebSocketServer } from "ws";
|
||||
|
||||
// src/events.ts
|
||||
var CloseEvent = globalThis.CloseEvent ?? class extends Event {
|
||||
#eventInitDict;
|
||||
constructor(type, eventInitDict = {}) {
|
||||
super(type, eventInitDict);
|
||||
this.#eventInitDict = eventInitDict;
|
||||
}
|
||||
get wasClean() {
|
||||
return this.#eventInitDict.wasClean ?? false;
|
||||
}
|
||||
get code() {
|
||||
return this.#eventInitDict.code ?? 0;
|
||||
}
|
||||
get reason() {
|
||||
return this.#eventInitDict.reason ?? "";
|
||||
}
|
||||
};
|
||||
|
||||
// src/index.ts
|
||||
var generateConnectionSymbol = () => Symbol("connection");
|
||||
var CONNECTION_SYMBOL_KEY = Symbol("CONNECTION_SYMBOL_KEY");
|
||||
var createNodeWebSocket = (init) => {
|
||||
const wss = new WebSocketServer({ noServer: true });
|
||||
const waiterMap = /* @__PURE__ */ new Map();
|
||||
wss.on("connection", (ws, request) => {
|
||||
const waiter = waiterMap.get(request);
|
||||
if (waiter) {
|
||||
waiter.resolve(ws);
|
||||
waiterMap.delete(request);
|
||||
}
|
||||
});
|
||||
const nodeUpgradeWebSocket = (request, connectionSymbol) => {
|
||||
return new Promise((resolve) => {
|
||||
waiterMap.set(request, { resolve, connectionSymbol });
|
||||
});
|
||||
};
|
||||
return {
|
||||
wss,
|
||||
injectWebSocket(server) {
|
||||
server.on("upgrade", async (request, socket, head) => {
|
||||
const url = new URL(request.url ?? "/", init.baseUrl ?? "http://localhost");
|
||||
const headers = new Headers();
|
||||
for (const key in request.headers) {
|
||||
const value = request.headers[key];
|
||||
if (!value) {
|
||||
continue;
|
||||
}
|
||||
headers.append(key, Array.isArray(value) ? value[0] : value);
|
||||
}
|
||||
const env = {
|
||||
incoming: request,
|
||||
outgoing: void 0
|
||||
};
|
||||
await init.app.request(url, { headers }, env);
|
||||
const waiter = waiterMap.get(request);
|
||||
if (!waiter || waiter.connectionSymbol !== env[CONNECTION_SYMBOL_KEY]) {
|
||||
socket.end(
|
||||
"HTTP/1.1 400 Bad Request\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
|
||||
);
|
||||
waiterMap.delete(request);
|
||||
return;
|
||||
}
|
||||
wss.handleUpgrade(request, socket, head, (ws) => {
|
||||
wss.emit("connection", ws, request);
|
||||
});
|
||||
});
|
||||
},
|
||||
upgradeWebSocket: defineWebSocketHelper(async (c, events, options) => {
|
||||
if (c.req.header("upgrade")?.toLowerCase() !== "websocket") {
|
||||
return;
|
||||
}
|
||||
const connectionSymbol = generateConnectionSymbol();
|
||||
c.env[CONNECTION_SYMBOL_KEY] = connectionSymbol;
|
||||
(async () => {
|
||||
const ws = await nodeUpgradeWebSocket(c.env.incoming, connectionSymbol);
|
||||
const messagesReceivedInStarting = [];
|
||||
const bufferMessage = (data, isBinary) => {
|
||||
messagesReceivedInStarting.push([data, isBinary]);
|
||||
};
|
||||
ws.on("message", bufferMessage);
|
||||
const ctx = {
|
||||
binaryType: "arraybuffer",
|
||||
close(code, reason) {
|
||||
ws.close(code, reason);
|
||||
},
|
||||
protocol: ws.protocol,
|
||||
raw: ws,
|
||||
get readyState() {
|
||||
return ws.readyState;
|
||||
},
|
||||
send(source, opts) {
|
||||
ws.send(source, {
|
||||
compress: opts?.compress
|
||||
});
|
||||
},
|
||||
url: new URL(c.req.url)
|
||||
};
|
||||
try {
|
||||
events?.onOpen?.(new Event("open"), ctx);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
const handleMessage = (data, isBinary) => {
|
||||
const datas = Array.isArray(data) ? data : [data];
|
||||
for (const data2 of datas) {
|
||||
try {
|
||||
events?.onMessage?.(
|
||||
new MessageEvent("message", {
|
||||
data: isBinary ? data2 instanceof ArrayBuffer ? data2 : data2.buffer.slice(data2.byteOffset, data2.byteOffset + data2.byteLength) : data2.toString("utf-8")
|
||||
}),
|
||||
ctx
|
||||
);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
ws.off("message", bufferMessage);
|
||||
for (const message of messagesReceivedInStarting) {
|
||||
handleMessage(...message);
|
||||
}
|
||||
ws.on("message", (data, isBinary) => {
|
||||
handleMessage(data, isBinary);
|
||||
});
|
||||
ws.on("close", (code, reason) => {
|
||||
try {
|
||||
events?.onClose?.(new CloseEvent("close", { code, reason: reason.toString() }), ctx);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
});
|
||||
ws.on("error", (error) => {
|
||||
try {
|
||||
events?.onError?.(
|
||||
new ErrorEvent("error", {
|
||||
error
|
||||
}),
|
||||
ctx
|
||||
);
|
||||
} catch (e) {
|
||||
;
|
||||
(options?.onError ?? console.error)(e);
|
||||
}
|
||||
});
|
||||
})();
|
||||
return new Response();
|
||||
})
|
||||
};
|
||||
};
|
||||
export {
|
||||
createNodeWebSocket
|
||||
};
|
||||
60
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/package.json
generated
vendored
Normal file
60
dev-browser/skills/dev-browser/node_modules/@hono/node-ws/package.json
generated
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
{
|
||||
"name": "@hono/node-ws",
|
||||
"version": "1.2.0",
|
||||
"description": "WebSocket helper for Node.js",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"module": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup ./src/index.ts",
|
||||
"prepack": "yarn build",
|
||||
"publint": "attw --pack && publint",
|
||||
"typecheck": "tsc -b tsconfig.json",
|
||||
"test": "vitest"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/index.d.ts",
|
||||
"default": "./dist/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/index.d.cts",
|
||||
"default": "./dist/index.cjs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"registry": "https://registry.npmjs.org",
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/honojs/middleware.git",
|
||||
"directory": "packages/node-ws"
|
||||
},
|
||||
"homepage": "https://github.com/honojs/middleware",
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.4",
|
||||
"@hono/node-server": "^1.11.1",
|
||||
"publint": "^0.3.9",
|
||||
"tsup": "^8.4.0",
|
||||
"typescript": "^5.8.2",
|
||||
"vitest": "^3.2.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"ws": "^8.17.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@hono/node-server": "^1.11.1",
|
||||
"hono": "^4.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.14.1"
|
||||
}
|
||||
}
|
||||
19
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/LICENSE
generated
vendored
Normal file
19
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2024 Justin Ridgewell <justin@ridgewell.name>
|
||||
|
||||
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.
|
||||
264
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/README.md
generated
vendored
Normal file
264
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/README.md
generated
vendored
Normal file
@@ -0,0 +1,264 @@
|
||||
# @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
|
||||
423
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
generated
vendored
Normal file
423
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
generated
vendored
Normal file
@@ -0,0 +1,423 @@
|
||||
// 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
|
||||
6
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
generated
vendored
Normal file
6
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
464
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
generated
vendored
Normal file
464
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js
generated
vendored
Normal file
@@ -0,0 +1,464 @@
|
||||
(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
|
||||
6
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
generated
vendored
Normal file
6
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
63
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/package.json
generated
vendored
Normal file
63
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/package.json
generated
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"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 <justin@ridgewell.name>",
|
||||
"license": "MIT"
|
||||
}
|
||||
345
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts
generated
vendored
Normal file
345
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/scopes.ts
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
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, B, O> = (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);
|
||||
}
|
||||
111
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts
generated
vendored
Normal file
111
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts
generated
vendored
Normal file
@@ -0,0 +1,111 @@
|
||||
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<SourceMapMappings>): string;
|
||||
export function encode(decoded: Readonly<SourceMapMappings>): 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();
|
||||
}
|
||||
65
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/strings.ts
generated
vendored
Normal file
65
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/strings.ts
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
55
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts
generated
vendored
Normal file
55
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/src/vlq.ts
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
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;
|
||||
}
|
||||
50
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts
generated
vendored
Normal file
50
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
type Line = number;
|
||||
type Column = number;
|
||||
type Kind = number;
|
||||
type Name = number;
|
||||
type Var = number;
|
||||
type SourcesIndex = number;
|
||||
type ScopesIndex = number;
|
||||
type Mix<A, B, O> = (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
|
||||
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map
generated
vendored
Normal file
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.cts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"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"}
|
||||
50
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts
generated
vendored
Normal file
50
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts
generated
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
type Line = number;
|
||||
type Column = number;
|
||||
type Kind = number;
|
||||
type Name = number;
|
||||
type Var = number;
|
||||
type SourcesIndex = number;
|
||||
type ScopesIndex = number;
|
||||
type Mix<A, B, O> = (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
|
||||
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map
generated
vendored
Normal file
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/scopes.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"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"}
|
||||
9
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts
generated
vendored
Normal file
9
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
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<SourceMapMappings>): string;
|
||||
//# sourceMappingURL=sourcemap-codec.d.ts.map
|
||||
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map
generated
vendored
Normal file
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.cts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"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"}
|
||||
9
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts
generated
vendored
Normal file
9
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
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<SourceMapMappings>): string;
|
||||
//# sourceMappingURL=sourcemap-codec.d.ts.map
|
||||
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map
generated
vendored
Normal file
1
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/sourcemap-codec.d.mts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"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"}
|
||||
16
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts
generated
vendored
Normal file
16
dev-browser/skills/dev-browser/node_modules/@jridgewell/sourcemap-codec/types/strings.d.cts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
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
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user