updating frontend
This commit is contained in:
parent
d537be902c
commit
9bfd91d39f
640 changed files with 368 additions and 98358 deletions
78
README.md
78
README.md
|
|
@ -1,6 +1,6 @@
|
|||
# 🚀 ElatoAI: Realtime AI Speech for ESP32
|
||||
|
||||
**Realtime AI Speech powered by OpenAI Realtime API, ESP32, Secure WebSockets, and Deno Edge Functions for >10-minute uninterrupted global conversations!**
|
||||
**Realtime AI Speech powered by OpenAI Realtime API, ESP32, Secure WebSockets, and Deno Edge Functions for >10-minute uninterrupted global conversations**
|
||||
|
||||
## 📺 Demo Video
|
||||
|
||||
|
|
@ -10,41 +10,69 @@ https://github.com/user-attachments/assets/aa60e54c-5847-4a68-80b5-5d6b1a5b9328
|
|||
<img src="https://img.shields.io/badge/Watch%20Demo-YouTube-red?style=for-the-badge&logo=youtube" alt="Watch Demo on YouTube">
|
||||
</a>
|
||||
|
||||
---
|
||||
|
||||
## Getting Started
|
||||
|
||||
1. Set up your Local Supabase Backend. From the root directory, run:
|
||||
```bash
|
||||
supabase start # Starts your local Supabase server with the default migrations and seed data.
|
||||
```
|
||||
|
||||
2. Set up your NextJS Frontend. From the `frontend-nextjs` directory, run:
|
||||
```bash
|
||||
npm install
|
||||
npm run dev
|
||||
```
|
||||
|
||||
3. Add your ESP32-S3 Device MAC Address to the Settings page in the NextJS Frontend. (Remove colons and convert to lowercase, useful for adding friendly user codes when registering multiple devices)
|
||||
```bash
|
||||
# Example
|
||||
|
||||
# 12:34:56:78:9A:BC -> 123456789abc
|
||||
# 12:34:56:78:9A:BD -> 123456789abd
|
||||
```
|
||||
> **Tip:** To find your ESP32-S3 Device's MAC Address, build and upload `test/print_mac_address_test.cpp` using PlatformIO.
|
||||
|
||||
4. Add your OpenAI API Key in the `server-deno/.env` and `frontend-nextjs/.env.local` file.
|
||||
```
|
||||
OPENAI_API_KEY=your_openai_api_key
|
||||
```
|
||||
|
||||
5. Set up your ESP32 Arduino Client. On PlatformIO, first `Build` the project, then `Upload` the project to your ESP32.
|
||||
|
||||
|
||||
## 🌟 Features
|
||||
|
||||
- **Realtime Speech-to-Speech**: Instant speech conversion powered by OpenAI's Realtime APIs.
|
||||
- **Create Custom AI Agents**: Create custom agents with different personalities and voices.
|
||||
- **Secure WebSockets**: Reliable, encrypted WebSocket communication.
|
||||
- **Server Turn Detection**: Intelligent conversation flow handling for smooth interactions.
|
||||
- **Opus Audio Compression**: High-quality audio streaming with minimal bandwidth.
|
||||
- **Global Edge Performance**: Low latency Deno Edge Functions ensuring seamless global conversations.
|
||||
- **ESP32 Arduino Framework**: Optimized and easy-to-use hardware integration.
|
||||
|
||||
---
|
||||
|
||||
## 📌 Project Architecture
|
||||
|
||||
ElatoAI consists of three main components:
|
||||
|
||||
1. **Frontend Client** (`Next.js` hosted on Vercel)
|
||||
2. **Edge Server Functions** (`Deno` running on Supabase Edge)
|
||||
2. **Edge Server Functions** (`Deno` running on Deno/Supabase Edge)
|
||||
3. **ESP32 IoT Client** (`PlatformIO/Arduino`)
|
||||
|
||||
---
|
||||
|
||||
## 🛠 Tech Stack
|
||||
|
||||
| Component | Technology Used |
|
||||
|-----------------|------------------------------------------|
|
||||
| Frontend | Next.js, Vercel, Supabase DB |
|
||||
| Edge Functions | Deno Edge Functions on Supabase |
|
||||
| Frontend | Next.js, Vercel |
|
||||
| Backend | Supabase DB |
|
||||
| Edge Functions | Deno Edge Functions on Deno/Supabase |
|
||||
| IoT Client | PlatformIO, Arduino Framework, ESP32-S3 |
|
||||
| Audio Codec | Opus |
|
||||
| Communication | Secure WebSockets |
|
||||
| Libraries | ArduinoJson, WebSockets, AsyncTCP |
|
||||
| Libraries | ArduinoJson, WebSockets, AsyncWebServer, ESP32_Button, Arduino Audio Tools, ArduinoLibOpus |
|
||||
|
||||
---
|
||||
|
||||
## 🗺️ High-Level Flow
|
||||
|
||||
|
|
@ -58,7 +86,6 @@ flowchart TD
|
|||
ESP32 --> User[AI Generated Speech]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📂 Project Structure
|
||||
|
||||
|
|
@ -75,8 +102,6 @@ graph TD
|
|||
esp32 --> audio_tools[arduino-audio-tools]
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ PlatformIO Configuration
|
||||
|
||||
```ini
|
||||
|
|
@ -89,42 +114,37 @@ monitor_speed = 115200
|
|||
lib_deps =
|
||||
bblanchon/ArduinoJson@^7.1.0
|
||||
links2004/WebSockets@^2.4.1
|
||||
https://github.com/esp-arduino-libs/ESP32_Button.git
|
||||
ESP32Async/ESPAsyncWebServer@^3.7.6
|
||||
https://github.com/esp-arduino-libs/ESP32_Button.git#v0.0.1
|
||||
https://github.com/pschatzmann/arduino-audio-tools.git#v1.0.1
|
||||
https://github.com/pschatzmann/arduino-libopus.git
|
||||
ESP32Async/AsyncTCP
|
||||
ESP32Async/ESPAsyncWebServer
|
||||
https://github.com/pschatzmann/arduino-libopus.git#a1.1.0
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📊 Important Stats
|
||||
|
||||
- ⚡️ **Latency**: <150ms round-trip globally
|
||||
- ⚡️ **Latency**: <1s round-trip globally
|
||||
- 🎧 **Audio Quality**: Opus codec at 24kbps (high clarity)
|
||||
- ⏳ **Uninterrupted Conversations**: Over 10 minutes continuous conversations
|
||||
- 🌎 **Global Availability**: Optimized with edge computing via Supabase
|
||||
- ⏳ **Uninterrupted Conversations**: Up to 10 minutes continuous conversations
|
||||
- 🌎 **Global Availability**: Optimized with edge computing with Deno
|
||||
|
||||
---
|
||||
|
||||
## 🛡 Security
|
||||
|
||||
- Secure WebSockets (WSS) for encrypted data transfers
|
||||
- Edge validation and error handling for robust, secure deployment
|
||||
|
||||
---
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
We welcome contributions!
|
||||
We welcome contributions
|
||||
|
||||
- Fork this repository.
|
||||
- Create your feature branch (`git checkout -b feature/AmazingFeature`).
|
||||
- Commit your changes (`git commit -m 'Add AmazingFeature'`).
|
||||
- Push to the branch (`git push origin feature/AmazingFeature`).
|
||||
- Open a pull request!
|
||||
- Create your feature branch (`git checkout -b feature/EpicFeature`).
|
||||
- Commit your changes (`git commit -m 'Add EpicFeature'`).
|
||||
- Push to the branch (`git push origin feature/EpicFeature`).
|
||||
- Open a PR
|
||||
|
||||
---
|
||||
|
||||
## 📜 License
|
||||
|
||||
|
|
@ -132,5 +152,5 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
|
|||
|
||||
---
|
||||
|
||||
🎉 **Give a ⭐️ if you found this project interesting!**
|
||||
🎉 **Give a ⭐️ if you found this project interesting :)**
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
# Update these with your Supabase details from your project settings > API
|
||||
# https://app.supabase.com/project/_/settings/api
|
||||
NEXT_PUBLIC_SUPABASE_URL=<YOUR_SUPABASE_URL>
|
||||
NEXT_PUBLIC_SUPABASE_URL=http://127.0.0.1:54321
|
||||
NEXT_PUBLIC_SUPABASE_ANON_KEY=<YOUR_SUPABASE_ANON_KEY>
|
||||
JWT_SECRET_KEY=<YOUR_JWT_SECRET_KEY>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
import { redirect } from "next/navigation";
|
||||
|
||||
export default async function Home() {
|
||||
redirect("/healthcare");
|
||||
}
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
"use client";
|
||||
|
||||
// install (please try to align the version of installed @nivo packages)
|
||||
// yarn add @nivo/bar
|
||||
import { ResponsiveBar } from "@nivo/bar";
|
||||
import { FC } from "react";
|
||||
|
||||
// make sure parent container have a defined height when using
|
||||
// responsive component, otherwise height will be 0 and
|
||||
// no chart will be rendered.
|
||||
// website examples showcase many properties,
|
||||
// you'll often use just a few of them.
|
||||
|
||||
type MyResponsiveBarProps = {
|
||||
data: BarData[];
|
||||
filter: string;
|
||||
};
|
||||
|
||||
export const MyResponsiveBar: FC<MyResponsiveBarProps> = ({ data, filter }) => {
|
||||
// Determine the keys based on the filter
|
||||
let currentPeriodLabel = "Current Period";
|
||||
let previousPeriodLabel = "Previous Period";
|
||||
|
||||
if (filter === "days") {
|
||||
currentPeriodLabel = "Today";
|
||||
previousPeriodLabel = "Yesterday";
|
||||
} else if (filter === "weeks") {
|
||||
currentPeriodLabel = "This month";
|
||||
previousPeriodLabel = "Last month";
|
||||
}
|
||||
|
||||
const keys = [currentPeriodLabel, previousPeriodLabel];
|
||||
|
||||
return (
|
||||
<ResponsiveBar
|
||||
data={data}
|
||||
keys={keys}
|
||||
indexBy="emotion"
|
||||
margin={{ top: 20, right: 54, bottom: 80, left: 55 }}
|
||||
padding={0.3}
|
||||
groupMode="grouped"
|
||||
valueScale={{ type: "linear" }}
|
||||
indexScale={{ type: "band", round: true }}
|
||||
// // colors={{ scheme: "nivo" }}
|
||||
colors={["#fbbf24", "#c084fc"]}
|
||||
borderRadius={5}
|
||||
borderColor={{
|
||||
from: "color",
|
||||
modifiers: [["darker", 1.6]],
|
||||
}}
|
||||
axisTop={null}
|
||||
axisRight={null}
|
||||
axisBottom={{
|
||||
tickSize: 5,
|
||||
tickPadding: 5,
|
||||
tickRotation: 30,
|
||||
// legend: "country",
|
||||
legendPosition: "middle",
|
||||
legendOffset: 32,
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
axisLeft={{
|
||||
tickSize: 5,
|
||||
tickPadding: 5,
|
||||
tickRotation: 0,
|
||||
legend: "Score (%)",
|
||||
legendPosition: "middle",
|
||||
legendOffset: -50,
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
enableGridY={true}
|
||||
labelSkipWidth={20}
|
||||
labelSkipHeight={12}
|
||||
labelTextColor="white"
|
||||
// // labelTextColor={{
|
||||
// // from: "color",
|
||||
// // modifiers: [["brighter", 3]],
|
||||
// // }}
|
||||
legends={[
|
||||
{
|
||||
dataFrom: "keys",
|
||||
anchor: "bottom",
|
||||
direction: "row",
|
||||
justify: false,
|
||||
translateX: 0,
|
||||
translateY: 80,
|
||||
itemsSpacing: 0,
|
||||
itemWidth: 100,
|
||||
itemHeight: 20,
|
||||
itemDirection: "left-to-right",
|
||||
itemOpacity: 1,
|
||||
symbolSize: 16,
|
||||
symbolShape: "circle",
|
||||
effects: [
|
||||
{
|
||||
on: "hover",
|
||||
style: {
|
||||
itemTextColor: "#000",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
// role="application"
|
||||
// ariaLabel="Nivo bar chart demo"
|
||||
barAriaLabel={(e) =>
|
||||
`${e.id}: ${e.formattedValue} in emotion: ${e.indexValue}`
|
||||
}
|
||||
theme={{
|
||||
axis: {
|
||||
legend: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
ticks: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 500,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
},
|
||||
legends: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -1,107 +0,0 @@
|
|||
"use client";
|
||||
|
||||
// install (please try to align the version of installed @nivo packages)
|
||||
// yarn add @nivo/heatmap
|
||||
import { ResponsiveHeatMap } from "@nivo/heatmap";
|
||||
import { FC } from "react";
|
||||
|
||||
// make sure parent container have a defined height when using
|
||||
// responsive component, otherwise height will be 0 and
|
||||
// no chart will be rendered.
|
||||
// website examples showcase many properties,
|
||||
// you'll often use just a few of them.
|
||||
|
||||
type MyResponsiveHeatMapProps = {
|
||||
data: HeatMapData[];
|
||||
};
|
||||
|
||||
export const MyResponsiveHeatMap: FC<MyResponsiveHeatMapProps> = ({ data }) => (
|
||||
<ResponsiveHeatMap
|
||||
data={data}
|
||||
margin={{ top: 60, right: 10, bottom: 10, left: 70 }}
|
||||
valueFormat=">-.2s"
|
||||
axisTop={{
|
||||
tickSize: 5,
|
||||
tickPadding: 8,
|
||||
tickRotation: -45,
|
||||
legend: "",
|
||||
legendOffset: 46,
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
// axisRight={{
|
||||
// tickSize: 5,
|
||||
// tickPadding: 5,
|
||||
// tickRotation: 0,
|
||||
// // legend: "country",
|
||||
// // legendPosition: "middle",
|
||||
// legendOffset: 70,
|
||||
// truncateTickAt: 0,
|
||||
// }}
|
||||
axisLeft={{
|
||||
tickSize: 5,
|
||||
tickPadding: 5,
|
||||
tickRotation: 0,
|
||||
// legend: "country",
|
||||
// legendPosition: "middle",
|
||||
legendOffset: -70,
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
colors={{
|
||||
type: "diverging",
|
||||
scheme: "yellow_green",
|
||||
minValue: -100000,
|
||||
maxValue: 100000,
|
||||
divergeAt: 0.82,
|
||||
}}
|
||||
emptyColor="#555555"
|
||||
cellComponent="circle"
|
||||
sizeVariation={{
|
||||
sizes: [0.3, 0.97],
|
||||
}}
|
||||
// forceSquare
|
||||
enableGridX={true}
|
||||
enableGridY={true}
|
||||
borderWidth={3}
|
||||
borderColor="#fdba74"
|
||||
// borderColor={{
|
||||
// from: "color",
|
||||
// modifiers: [["darker", 0.5]],
|
||||
// }}
|
||||
// legends={[
|
||||
// {
|
||||
// anchor: "bottom",
|
||||
// translateX: 0,
|
||||
// translateY: 40,
|
||||
// length: 400,
|
||||
// thickness: 15,
|
||||
// direction: "row",
|
||||
// tickPosition: "after",
|
||||
// tickSize: 3,
|
||||
// tickSpacing: 4,
|
||||
// tickOverlap: false,
|
||||
// tickFormat: ">-.2s",
|
||||
// title: "Value →",
|
||||
// titleAlign: "start",
|
||||
// titleOffset: 4,
|
||||
// },
|
||||
// ]}
|
||||
theme={{
|
||||
axis: {
|
||||
ticks: {
|
||||
text: {
|
||||
fontSize: 12, // Change this to your desired font size
|
||||
fontWeight: 600,
|
||||
fill: "#4b5563", // Change this to your desired text color
|
||||
},
|
||||
},
|
||||
legend: {
|
||||
text: {
|
||||
fontSize: 12, // Change this to your desired font size
|
||||
fontWeight: 600,
|
||||
fill: "#1f2937", // Change this to your desired text color
|
||||
},
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
@ -1,128 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import { ResponsiveLine } from "@nivo/line";
|
||||
import { FC } from "react";
|
||||
|
||||
// make sure parent container have a defined height when using
|
||||
// responsive component, otherwise height will be 0 and
|
||||
// no chart will be rendered.
|
||||
// website examples showcase many properties,
|
||||
// you'll often use just a few of them.
|
||||
|
||||
type MyResponsiveLineProps = {
|
||||
data: LineChartData[];
|
||||
};
|
||||
|
||||
export const MyResponsiveLine: FC<MyResponsiveLineProps> = ({ data }) => (
|
||||
<ResponsiveLine
|
||||
curve="monotoneX"
|
||||
lineWidth={3}
|
||||
margin={{ top: 20, right: 54, bottom: 68, left: 50 }}
|
||||
data={data}
|
||||
xFormat="time:%Y-%m-%d"
|
||||
yScale={{
|
||||
type: "linear",
|
||||
}}
|
||||
yFormat=" >-.2f"
|
||||
axisTop={null}
|
||||
axisRight={null}
|
||||
axisBottom={{
|
||||
// format: "%b %d",
|
||||
tickSize: 5,
|
||||
tickPadding: 5,
|
||||
tickRotation: 30,
|
||||
// legend: "Date",
|
||||
legendOffset: 36,
|
||||
legendPosition: "middle",
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
axisLeft={{
|
||||
tickSize: 5,
|
||||
tickPadding: 5,
|
||||
tickRotation: 0,
|
||||
legend: "Score (%)",
|
||||
legendOffset: -45,
|
||||
legendPosition: "middle",
|
||||
truncateTickAt: 0,
|
||||
}}
|
||||
enableTouchCrosshair={true}
|
||||
pointSize={10}
|
||||
pointColor={{ from: "color", modifiers: [] }}
|
||||
pointBorderWidth={2}
|
||||
pointBorderColor={{ from: "serieColor" }}
|
||||
pointLabel="data.yFormatted"
|
||||
pointLabelYOffset={-12}
|
||||
useMesh={true}
|
||||
colors={[
|
||||
"#fb7185",
|
||||
// "#FCCCD4",
|
||||
"#a8a29e",
|
||||
// "#e7e5e4",
|
||||
"#22c55e",
|
||||
// "#CCFBDD",
|
||||
]}
|
||||
legends={[
|
||||
{
|
||||
anchor: "bottom",
|
||||
direction: "row",
|
||||
justify: false,
|
||||
translateX: -20,
|
||||
translateY: 70,
|
||||
itemsSpacing: 10,
|
||||
itemDirection: "left-to-right",
|
||||
itemWidth: 65,
|
||||
itemHeight: 20,
|
||||
itemOpacity: 1,
|
||||
symbolSize: 16,
|
||||
symbolShape: "circle",
|
||||
symbolBorderColor: "rgba(0, 0, 0, .9)",
|
||||
effects: [
|
||||
{
|
||||
on: "hover",
|
||||
style: {
|
||||
itemBackground: "rgba(0, 0, 0, .03)",
|
||||
itemOpacity: 1,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
tooltip={({ point }) => {
|
||||
const series = data.find((serie) => serie.id === point.serieId);
|
||||
return (
|
||||
<div className="bg-white p-2 rounded-lg shadow-md text-sm border">
|
||||
<strong>{series?.name}</strong>
|
||||
<br />
|
||||
{/* <strong>id:</strong> {point.data.xFormatted} */}
|
||||
{/* <br /> */}
|
||||
<strong>score:</strong> {point.data.yFormatted}
|
||||
</div>
|
||||
);
|
||||
}}
|
||||
theme={{
|
||||
axis: {
|
||||
legend: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
ticks: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 500,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
},
|
||||
legends: {
|
||||
text: {
|
||||
fontSize: 12,
|
||||
fontWeight: 600,
|
||||
fill: "#4b5563",
|
||||
},
|
||||
},
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
|
@ -1,125 +0,0 @@
|
|||
"use client";
|
||||
// install (please try to align the version of installed @nivo packages)
|
||||
// yarn add @nivo/bar
|
||||
import { ResponsivePie } from "@nivo/pie";
|
||||
import { FC } from "react";
|
||||
|
||||
// make sure parent container have a defined height when using
|
||||
// responsive component, otherwise height will be 0 and
|
||||
// no chart will be rendered.
|
||||
// website examples showcase many properties,
|
||||
// you'll often use just a few of them.
|
||||
|
||||
// const favorit = localFont({
|
||||
// src: "./fonts/ABCFavorit-Bold.woff2",
|
||||
// variable: "--font-favorit",
|
||||
// });
|
||||
|
||||
// const fonts = `${favorit.variable}`;
|
||||
|
||||
type MyResponsivePieProps = {
|
||||
data: PieData[];
|
||||
};
|
||||
|
||||
// Define the theme object
|
||||
const theme = {
|
||||
legends: {
|
||||
text: {
|
||||
fontSize: 12, // Change this value to your desired font size
|
||||
fontWeight: 600,
|
||||
// fontFamily: fonts,
|
||||
},
|
||||
},
|
||||
labels: {
|
||||
text: {
|
||||
fontSize: 16, // Change this value to your desired font size for the labels inside the pie
|
||||
fontWeight: 700,
|
||||
// fontFamily: fonts,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const MyResponsivePie: FC<MyResponsivePieProps> = ({ data }) => (
|
||||
<ResponsivePie
|
||||
data={data}
|
||||
margin={{ top: 15, right: 5, bottom: 40, left: 5 }}
|
||||
innerRadius={0.5}
|
||||
padAngle={0.7}
|
||||
cornerRadius={3}
|
||||
activeOuterRadiusOffset={4}
|
||||
borderWidth={1}
|
||||
borderColor={{
|
||||
from: "color",
|
||||
modifiers: [["darker", 0.2]],
|
||||
}}
|
||||
enableArcLinkLabels={false}
|
||||
arcLinkLabelsSkipAngle={10}
|
||||
arcLinkLabelsTextColor="#333333"
|
||||
arcLinkLabelsThickness={2}
|
||||
arcLinkLabelsColor={{ from: "color" }}
|
||||
arcLabelsSkipAngle={10}
|
||||
arcLabelsTextColor="#fff"
|
||||
arcLabel={(d) => `${d.value.toFixed(2)}%`} // Display value in percentage
|
||||
// defs={[
|
||||
// {
|
||||
// id: "dots",
|
||||
// type: "patternDots",
|
||||
// background: "inherit",
|
||||
// color: "rgba(255, 255, 255, 0.3)",
|
||||
// size: 4,
|
||||
// padding: 1,
|
||||
// stagger: true,
|
||||
// },
|
||||
// {
|
||||
// id: "lines",
|
||||
// type: "patternLines",
|
||||
// background: "inherit",
|
||||
// color: "rgba(255, 255, 255, 0.3)",
|
||||
// rotation: -45,
|
||||
// lineWidth: 6,
|
||||
// spacing: 10,
|
||||
// },
|
||||
// ]}
|
||||
fill={[
|
||||
{
|
||||
match: {
|
||||
id: "Negative",
|
||||
},
|
||||
id: "dots",
|
||||
},
|
||||
{
|
||||
match: {
|
||||
id: "Positive",
|
||||
},
|
||||
id: "lines",
|
||||
},
|
||||
]}
|
||||
legends={[
|
||||
{
|
||||
anchor: "bottom",
|
||||
direction: "row",
|
||||
justify: false,
|
||||
translateX: 2,
|
||||
translateY: 40,
|
||||
itemsSpacing: 4,
|
||||
itemWidth: 80,
|
||||
itemHeight: 18,
|
||||
itemTextColor: "#4b5563",
|
||||
itemDirection: "left-to-right",
|
||||
itemOpacity: 1,
|
||||
symbolSize: 16,
|
||||
symbolShape: "circle",
|
||||
effects: [
|
||||
{
|
||||
on: "hover",
|
||||
style: {
|
||||
itemTextColor: "#000",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
theme={theme} // Apply the theme here
|
||||
colors={["#4ade80", "#d6d3d1", "#fb7185"]}
|
||||
/>
|
||||
);
|
||||
|
|
@ -1,79 +0,0 @@
|
|||
"use client";
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardFooter,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { TrendingUp } from "lucide-react";
|
||||
import { TrendingDown } from "lucide-react";
|
||||
|
||||
interface CardProps {
|
||||
title: string | null;
|
||||
value: number | string | null;
|
||||
delta: number | null;
|
||||
filter: string;
|
||||
type: string | null;
|
||||
}
|
||||
|
||||
const TopCard: React.FC<CardProps> = ({
|
||||
title,
|
||||
value,
|
||||
delta,
|
||||
filter,
|
||||
type,
|
||||
}) => {
|
||||
const isPositiveDelta = delta !== null && delta >= 0;
|
||||
// get the user data from the selected user and period
|
||||
|
||||
const bgColor = type === "top" ? "bg-amber-500" : "bg-violet-500";
|
||||
const titleColor = type === "top" ? "text-amber-50" : "text-violet-50";
|
||||
const footerColor = type === "top" ? "text-amber-100" : "text-violet-100";
|
||||
|
||||
const getTimePeriod = (filter: string): string => {
|
||||
if (filter === "weeks") return "last week";
|
||||
if (filter === "days") return "yesterday";
|
||||
if (filter === "months") return "last month";
|
||||
return ""; // Default case, can be adjusted based on your needs
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<Card className={`${bgColor}`}>
|
||||
<CardHeader className="pt-4 pb-2 ">
|
||||
<CardTitle
|
||||
className={`text-base font-medium ${titleColor}`}
|
||||
>
|
||||
<div className="flex justify-between items-center w-full">
|
||||
{title}
|
||||
</div>
|
||||
</CardTitle>
|
||||
{/* <CardDescription className="text-2xl font-bold text-gray-800">
|
||||
+ 1.8%
|
||||
</CardDescription> */}
|
||||
</CardHeader>
|
||||
<CardContent className="py-1 text-2xl font-bold text-white">
|
||||
<p>{value}</p>
|
||||
</CardContent>
|
||||
|
||||
<CardFooter
|
||||
className={`text-sm ${footerColor} flex items-start`}
|
||||
>
|
||||
{delta !== null &&
|
||||
(isPositiveDelta ? (
|
||||
<TrendingUp className="h-[20px] text-green-500 mr-1" />
|
||||
) : (
|
||||
<TrendingDown className="h-[20px] text-rose-500 mr-1" />
|
||||
))}
|
||||
<p>
|
||||
{delta}% from {getTimePeriod(filter)}
|
||||
</p>
|
||||
</CardFooter>
|
||||
</Card>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export default TopCard;
|
||||
|
|
@ -1,204 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import Usecase from "./Usecase";
|
||||
import TopCard from "../Insights/TopCard";
|
||||
import { MyResponsiveLine } from "../Insights/LineChart";
|
||||
import { MyResponsivePie } from "../Insights/PieChart";
|
||||
import { MyResponsiveBar } from "../Insights/BarChart";
|
||||
|
||||
const suggestions =
|
||||
"Based on the recent data, maintaining a neutral emotional state is predominant. Although there is a slight emergence of negative emotions like disgust, sadness, and anger, they are balanced by an equal presence of joy and surprise. Encourage positive interactions and activities to enhance the joy and neutral emotions further.";
|
||||
|
||||
const cardData = {
|
||||
main_emotion_1: { title: "Joy", value: 28.8, change: 28 },
|
||||
main_emotion_2: { title: "Suprise", value: 19.2, change: -12 },
|
||||
change_1: { title: "Anger", value: 12.1, change: 69 },
|
||||
change_2: { title: "Fear", value: 5.9, change: -52 },
|
||||
};
|
||||
|
||||
const barData = [
|
||||
{ emotion: "Surprise", Today: 0.28, Yesterday: 0.25 },
|
||||
{ emotion: "Joy", Today: 0.13, Yesterday: 0.22 },
|
||||
{ emotion: "Sadness", Today: 0.12, Yesterday: 0.18 },
|
||||
{ emotion: "Anger", Today: 0.12, Yesterday: 0.12 },
|
||||
{ emotion: "Neutral", Today: 0.12, Yesterday: 0.1 },
|
||||
{ emotion: "Fear", Today: 0.12, Yesterday: 0.1 },
|
||||
{ emotion: "Disgust", Today: 0.12, Yesterday: 0.09 },
|
||||
];
|
||||
|
||||
const lineData = [
|
||||
{
|
||||
id: "Negative",
|
||||
name: "Negative",
|
||||
data: [
|
||||
{ x: "2024-09-4", y: 0.23122093090355336 },
|
||||
{ x: "2024-09-5", y: 0.21122093090355345 },
|
||||
{ x: "2024-09-6", y: 0.13122093090355345 },
|
||||
{ x: "2024-09-7", y: 0.18122093090355345 },
|
||||
{ x: "2024-09-8", y: 0.43122093090355345 },
|
||||
{ x: "2024-09-9", y: 0.23122093090355345 },
|
||||
{ x: "2024-09-10", y: 0.13122093090355345 },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "Neutral",
|
||||
name: "Neutral",
|
||||
data: [
|
||||
{ x: "2024-09-4", y: 0.2433541552767576 },
|
||||
{ x: "2024-09-5", y: 0.1433541552767577 },
|
||||
{ x: "2024-09-6", y: 0.11122093090355345 },
|
||||
{ x: "2024-09-7", y: 0.20122093090355345 },
|
||||
{ x: "2024-09-8", y: 0.23122093090355345 },
|
||||
{ x: "2024-09-9", y: 0.20122093090355345 },
|
||||
{ x: "2024-09-10", y: 0.23122093090355345 },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "Positive",
|
||||
name: "Positive",
|
||||
data: [
|
||||
{ x: "2024-09-4", y: 0.3233541552767576 },
|
||||
{ x: "2024-09-5", y: 0.2433541552767577 },
|
||||
{ x: "2024-09-6", y: 0.23122093090355345 },
|
||||
{ x: "2024-09-7", y: 0.23122093090355345 },
|
||||
{ x: "2024-09-8", y: 0.13122093090355345 },
|
||||
{ x: "2024-09-9", y: 0.28122093090355345 },
|
||||
{ x: "2024-09-10", y: 0.33122093090355345 },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const pieData = [
|
||||
{ id: "Positive", label: "Positive", value: 0.43 },
|
||||
{ id: "Neutral", label: "Neutral", value: 0.34 },
|
||||
{ id: "Negative", label: "Negative", value: 0.23 },
|
||||
];
|
||||
|
||||
export default function InsightsDemo() {
|
||||
const isEmpty = (data: any) => {
|
||||
return !data || data.length === 0;
|
||||
};
|
||||
|
||||
const placeholder = (
|
||||
<div className="my-4 bg-gray-50 text-center w-full h-full rounded-lg flex items-center justify-center">
|
||||
<p className="text-lg font-medium text-gray-500">
|
||||
Talk to a character to view your trends
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
|
||||
// console.log(cardData?.["change_1"]);
|
||||
return (
|
||||
<div className="">
|
||||
{/* <div className="text-3xl font-medium mb-8 text-gray-800">Insights</div>
|
||||
<div className="mt-2 mb-4 text-gray-800">{suggestions}</div> */}
|
||||
<div className="flex flex-col md:flex-row md:space-x-3">
|
||||
<div className="w-full">
|
||||
<h2 className="mb-4 text-lg font-bold text-gray-700">
|
||||
Daily emotion highlights
|
||||
</h2>
|
||||
<div className="flex space-x-3">
|
||||
<div className="flex-grow">
|
||||
<TopCard
|
||||
title={
|
||||
cardData?.["main_emotion_1"]?.title ??
|
||||
"Emotion"
|
||||
}
|
||||
value={`${cardData?.["main_emotion_1"]?.value ?? "0"}%`}
|
||||
delta={
|
||||
cardData?.["main_emotion_1"]?.change ?? 0
|
||||
}
|
||||
filter={"days"}
|
||||
type="top"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-grow">
|
||||
<TopCard
|
||||
title={
|
||||
cardData?.["main_emotion_2"]?.title ??
|
||||
"Emotion"
|
||||
}
|
||||
value={`${cardData?.["main_emotion_2"]?.value ?? "0"}%`}
|
||||
delta={
|
||||
cardData?.["main_emotion_2"]?.change ?? 0
|
||||
}
|
||||
filter={"days"}
|
||||
type="top"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full mt-2 md:mt-0">
|
||||
<h2 className="mb-4 text-lg font-bold text-gray-700">
|
||||
Significant emotion shifts
|
||||
</h2>
|
||||
<div className="flex space-x-3">
|
||||
<div className="flex-grow">
|
||||
<TopCard
|
||||
title={
|
||||
cardData?.["change_1"]?.title ?? "Emotion"
|
||||
}
|
||||
value={`${cardData?.["change_1"]?.value ?? "0"}%`}
|
||||
delta={cardData?.["change_1"]?.change ?? 0}
|
||||
filter={"days"}
|
||||
type="shift"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-grow">
|
||||
<TopCard
|
||||
title={
|
||||
cardData?.["change_2"]?.title ?? "Emotion"
|
||||
}
|
||||
value={`${cardData?.["change_2"]?.value ?? "0"}%`}
|
||||
delta={cardData?.["change_2"]?.change ?? 0}
|
||||
filter={"days"}
|
||||
type="shift"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-col md:flex-row md:space-x-8 mx-6-">
|
||||
<div className="w-full order-2 md:order-1 md:flex-grow">
|
||||
<h2 className="mt-6 text-lg font-bold text-gray-700">
|
||||
{/* Sentiment Over Time and Forecast */}
|
||||
Sentiment over time
|
||||
</h2>
|
||||
<div className="h-[300px] lg:h-96">
|
||||
{isEmpty(lineData) ? (
|
||||
placeholder
|
||||
) : (
|
||||
<MyResponsiveLine data={lineData} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full order-1 md:order-2 md:w-72 md:flex-shrink-0">
|
||||
<h2 className="mt-6 text-lg font-bold text-gray-700">
|
||||
Daily sentiment proportions
|
||||
</h2>
|
||||
<div className="h-[300px] lg:h-96">
|
||||
{isEmpty(pieData) ? (
|
||||
placeholder
|
||||
) : (
|
||||
<MyResponsivePie data={pieData} />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/* <div className="w-full">
|
||||
<h2 className="mt-6 text-lg font-bold text-gray-700">
|
||||
Emotions Breakdown
|
||||
</h2>
|
||||
<div className="h-[350px] lg:h-[450px]">
|
||||
{isEmpty(barData) ? (
|
||||
placeholder
|
||||
) : (
|
||||
<MyResponsiveBar data={barData} filter={"days"} />
|
||||
)}
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
"use client";
|
||||
|
||||
import IllustrationInsights from "@/public/insights_section.svg";
|
||||
|
||||
import InsightsDemo from "./InsightsDemo";
|
||||
|
||||
export default function InsightsDemoSection() {
|
||||
return (
|
||||
<section className="">
|
||||
<div className="relative w-full max-w-[1440px] mx-auto">
|
||||
<div
|
||||
className="absolute -top-[85px] pointer-events-none -z-10 opacity-90 w-full h-[650px] bg-cover bg-center bg-no-repeat blur-xl"
|
||||
style={{
|
||||
backgroundImage: `url(${IllustrationInsights.src})`,
|
||||
transform: "scaleX(-1)",
|
||||
}}
|
||||
aria-hidden="true"
|
||||
></div>
|
||||
</div>
|
||||
|
||||
<div className="py-8 px-4 md:py-12">
|
||||
<div className="max-w-3xl mx-auto text-center pb-12 md:pb-20">
|
||||
<h2 className="text-3xl font-medium tracking-tighter sm:text-5xl text-center ">
|
||||
Get trends and insights
|
||||
</h2>
|
||||
<p className="font-light mt-12 text-lg sm:text-xl leading-8 text-stone-800">
|
||||
Our AI platform can analyse human-speech and emotion,
|
||||
and respond with empathy, offering supportive
|
||||
conversations and personalized learning assistance.
|
||||
</p>
|
||||
</div>
|
||||
<div className="max-w-[1120px] mx-auto px-6 sm:px-20 py-6 sm:py-12 bg-white shadow-custom_focus rounded-[40px] md:border-[22px] border-[12px] border-zinc-800">
|
||||
<InsightsDemo />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
|
@ -49,79 +49,6 @@ export default function LeftNavbarButtons({ user }: LeftNavbarButtonsProps) {
|
|||
)}
|
||||
</p>
|
||||
</a>
|
||||
{/* {!isHome && (
|
||||
<DropdownMenu
|
||||
onOpenChange={(open) => {
|
||||
if (!open) {
|
||||
// Remove focus from any active element when dropdown closes
|
||||
document.activeElement instanceof HTMLElement &&
|
||||
document.activeElement.blur();
|
||||
}
|
||||
}}
|
||||
>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className="flex flex-row gap-2 items-center rounded-full hover:bg-stone-100 dark:hover:bg-stone-800"
|
||||
>
|
||||
<span className="font-medium text-md hidden sm:flex">
|
||||
Use cases
|
||||
</span>
|
||||
<ChevronDown size={18} />
|
||||
</Button>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent
|
||||
className="w-56 p-2 sm:mt-2 rounded-lg"
|
||||
side="bottom"
|
||||
align="start"
|
||||
>
|
||||
<DropdownMenuLabel>Use Cases</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuGroup>
|
||||
<DropdownMenuItem asChild>
|
||||
<a
|
||||
href="/"
|
||||
className={`flex flex-row gap-2 w-full items-center justify-between ${
|
||||
isRoot
|
||||
? "bg-amber-50 dark:bg-amber-950/30 text-amber-600 dark:text-amber-400"
|
||||
: ""
|
||||
}`}
|
||||
>
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<Gamepad2 size={ICON_SIZE - 6} />
|
||||
<span>Elato for Hobbyists</span>
|
||||
</div>
|
||||
{isRoot && (
|
||||
<div className="h-2 w-2 rounded-full bg-amber-500" />
|
||||
)}
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem asChild>
|
||||
<a
|
||||
href="/kids"
|
||||
className={`flex flex-row gap-2 w-full items-center justify-between ${
|
||||
!isRoot
|
||||
? "bg-amber-50 dark:bg-amber-950/30 text-amber-600 dark:text-amber-400"
|
||||
: ""
|
||||
}`}
|
||||
>
|
||||
<div className="flex flex-row gap-2 items-center">
|
||||
<Blocks
|
||||
size={ICON_SIZE - 6}
|
||||
// fill="currentColor"
|
||||
/>
|
||||
<span>Elato for Kids</span>
|
||||
</div>
|
||||
{!isRoot && (
|
||||
<div className="h-2 w-2 rounded-full bg-amber-500" />
|
||||
)}
|
||||
</a>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuGroup>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
)} */}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ const NavbarButtons: React.FC<NavbarButtonsProps> = ({
|
|||
isHome,
|
||||
}) => {
|
||||
const isMobile = useMediaQuery("(max-width: 768px)");
|
||||
const isHealthcare = usePathname().includes("/healthcare");
|
||||
|
||||
return (
|
||||
<div
|
||||
|
|
@ -37,12 +36,6 @@ const NavbarButtons: React.FC<NavbarButtonsProps> = ({
|
|||
<PremiumBadge currentUserId={user.user_id} />
|
||||
</div>
|
||||
)}
|
||||
{/* {isHealthcare ? (
|
||||
<GetInTouchButton size="sm" iconOnMobile={isMobile} />
|
||||
) : (
|
||||
<PreorderButton size="sm" buttonText="Buy" className="font-normal" iconOnMobile />
|
||||
)} */}
|
||||
|
||||
{!isHome && (
|
||||
<Link
|
||||
href={githubPublicLink}
|
||||
|
|
@ -62,7 +55,7 @@ const NavbarButtons: React.FC<NavbarButtonsProps> = ({
|
|||
</Button>
|
||||
</Link>
|
||||
)}
|
||||
{!isHome && !isHealthcare && !isMobile && (
|
||||
{!isHome && !isMobile && (
|
||||
<Link href={businessDemoLink} passHref tabIndex={-1}>
|
||||
<Button
|
||||
size="sm"
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@ DropdownMenuContent,
|
|||
import { FaDiscord, FaGithub } from "react-icons/fa";
|
||||
import { User } from "@supabase/supabase-js";
|
||||
import {
|
||||
businessDemoLink,
|
||||
discordInviteLink,
|
||||
docsLink,
|
||||
feedbackFormLink,
|
||||
githubPublicLink,
|
||||
} from "@/lib/data";
|
||||
|
|
@ -45,8 +43,6 @@ export function NavbarDropdownMenu({ user, stars }: NavbarMenuButtonProps) {
|
|||
const [premiumUser, setPremiumUser] = useState(false);
|
||||
const pathname = usePathname();
|
||||
|
||||
const isKids = pathname.includes("/kids");
|
||||
|
||||
useEffect(() => {
|
||||
const setUserPremium = async () => {
|
||||
if (user) {
|
||||
|
|
@ -124,17 +120,6 @@ export function NavbarDropdownMenu({ user, stars }: NavbarMenuButtonProps) {
|
|||
<DropdownMenuGroup>
|
||||
{user ? <LoggedInItems /> : <LoggedOutItems />}
|
||||
<DropdownMenuSeparator />
|
||||
|
||||
{/* <DropdownMenuItem>
|
||||
<Link
|
||||
href={isKids ? "/" : "/kids"}
|
||||
passHref
|
||||
className="flex flex-row gap-2 w-full"
|
||||
>
|
||||
{isKids ? <Gamepad2 size={ICON_SIZE} /> : <Blocks size={ICON_SIZE} />}
|
||||
<span>{isKids ? "Elato for Hobbyists" : "Elato for Kids"}</span>
|
||||
</Link>
|
||||
</DropdownMenuItem> */}
|
||||
</DropdownMenuGroup>
|
||||
<DropdownMenuItem>
|
||||
<Link
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ import { checkIfUserHasApiKey, registerDevice, signOutAction } from "@/app/actio
|
|||
import { Button } from "@/components/ui/button";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Check, Cog, LogOut, RefreshCw } from "lucide-react";
|
||||
import AuthTokenModal from "../AuthTokenModal";
|
||||
import { LogOut } from "lucide-react";
|
||||
import DoctorForm from "./DoctorForm";
|
||||
import GeneralUserForm from "./UserForm";
|
||||
import { Slider } from "@/components/ui/slider";
|
||||
|
|
@ -138,7 +137,7 @@ const AppSettings: React.FC<AppSettingsProps> = ({
|
|||
Device settings
|
||||
</h2>
|
||||
<div className="flex flex-col gap-6">
|
||||
<div className="flex flex-col gap-2">
|
||||
{/* <div className="flex flex-col gap-2">
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<Label className="text-sm font-medium text-gray-700">
|
||||
Set your OpenAI API Key
|
||||
|
|
@ -155,7 +154,7 @@ const AppSettings: React.FC<AppSettingsProps> = ({
|
|||
<p className="text-xs text-gray-400">
|
||||
Your keys are E2E encrypted and never stored on our servers as plain text.
|
||||
</p>
|
||||
</div>
|
||||
</div> */}
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<Label className="text-sm font-medium text-gray-700">
|
||||
|
|
@ -167,7 +166,7 @@ const AppSettings: React.FC<AppSettingsProps> = ({
|
|||
?
|
||||
</TooltipTrigger>
|
||||
<TooltipContent>
|
||||
<p>For simplicity, you can register your ESP32 MAC address without the colons</p>
|
||||
<p>For simplicity, you can register your ESP32 MAC address here without colons</p>
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
</TooltipProvider>
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
import { docsLink } from "@/lib/data";
|
||||
import { getOpenGraphMetadata } from "@/lib/utils";
|
||||
import { Metadata } from "next";
|
||||
import { permanentRedirect } from "next/navigation";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Docs",
|
||||
...getOpenGraphMetadata("Docs"),
|
||||
};
|
||||
|
||||
export default async function RootLayout() {
|
||||
permanentRedirect(docsLink);
|
||||
}
|
||||
|
|
@ -1,157 +0,0 @@
|
|||
import LandingPageSection from "../components/LandingPage/LandingPageSection";
|
||||
import { Stethoscope } from "lucide-react";
|
||||
import { Metadata } from "next";
|
||||
import { getOpenGraphMetadata } from "@/lib/utils";
|
||||
import ToyPicker from "../components/LandingPage/ToyPicker";
|
||||
import GetInTouchButton from "../components/GetInTouch";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { redirect } from "next/navigation";
|
||||
export const metadata: Metadata = {
|
||||
title: "Pediatric Care",
|
||||
...getOpenGraphMetadata("Pediatric Care"),
|
||||
};
|
||||
|
||||
const Sections = [
|
||||
{
|
||||
title: "A friendly face in unfamiliar places",
|
||||
progress: "Making hospital visits feel less scary",
|
||||
description:
|
||||
"Our AI companion helps children feel more at ease during medical procedures by explaining things in a friendly, age-appropriate way they can understand.",
|
||||
imageSrc: "/growth.jpg",
|
||||
},
|
||||
{
|
||||
title: "Speaking their language",
|
||||
progress: "Complex procedures made simple",
|
||||
description:
|
||||
"Through playful conversation and familiar superhero voices, we help children understand medical procedures in ways that make sense to them.",
|
||||
imageSrc: "/learning.jpg",
|
||||
isImageRight: true,
|
||||
},
|
||||
{
|
||||
title: "Always there to listen",
|
||||
progress: "24/7 emotional support for little warriors",
|
||||
description:
|
||||
"Whether it's pre-procedure jitters or recovery time, our companion provides constant emotional support and encouragement when children need it most.",
|
||||
imageSrc: "/safety.jpg",
|
||||
},
|
||||
{
|
||||
title: "Teamwork with healthcare heroes",
|
||||
progress: "Building trust between kids and medical staff",
|
||||
description:
|
||||
"We help create positive associations with health-play staff, making it easier for children to form trusting relationships with their medical team.",
|
||||
imageSrc: "/privacy.jpg",
|
||||
isImageRight: true,
|
||||
},
|
||||
];
|
||||
|
||||
export default async function Healthcare() {
|
||||
redirect("/");
|
||||
return (
|
||||
<main className="isolate flex-1 flex flex-col mx-auto w-full max-w-[1440px] gap-6 px-4 my-8">
|
||||
<Badge
|
||||
variant="outline"
|
||||
className="text-xs w-fit self-center font-normal text-stone-600 border-stone-800"
|
||||
>
|
||||
This product is currently in Beta testing and is not yet
|
||||
certified for clinical use.
|
||||
</Badge>
|
||||
<div className="relative pt-2 flex flex-col items-center gap-8">
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="absolute inset-x-0 -top-40 -z-10 transform-gpu overflow-hidden blur-3xl sm:-top-80"
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
clipPath:
|
||||
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)",
|
||||
}}
|
||||
className="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 rotate-[30deg] bg-gradient-to-tr from-[#ffae00] to-[#ce96ff] opacity-35 sm:left-[calc(50%-30rem)] sm:w-[72.1875rem]"
|
||||
/>
|
||||
</div>
|
||||
<div className="py-4 sm:py-6">
|
||||
<div className="mx-auto max-w-7xl">
|
||||
<div className="mx-auto max-w-4xl text-center">
|
||||
<h1
|
||||
style={{
|
||||
lineHeight: "1.25",
|
||||
}}
|
||||
className="font-inter text-4xl font-bold inline tracking-tight text-stone-800 sm:text-6xl"
|
||||
>
|
||||
An AI-enabled healthcare{" "}
|
||||
<span className="text-yellow-500">
|
||||
{"companion toy"}
|
||||
</span>
|
||||
</h1>
|
||||
<p className="mt-6 text-2xl leading-8 text-stone-600">
|
||||
The Elato device makes toys
|
||||
conversational using familiar superhero voices
|
||||
to explain procedures and provide comfort{" "}
|
||||
<Stethoscope
|
||||
size={28}
|
||||
strokeWidth={2}
|
||||
className="inline-block rotate-12"
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-row justify-center">
|
||||
<GetInTouchButton size="lg" />
|
||||
</div>
|
||||
<ToyPicker
|
||||
imageSize={280}
|
||||
buttonText={"Play voice"}
|
||||
showHelpText={true}
|
||||
/>
|
||||
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden blur-3xl sm:top-[calc(100%-30rem)]"
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
clipPath:
|
||||
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)",
|
||||
}}
|
||||
className="relative left-[calc(50%+3rem)] aspect-[1155/678] w-[36.125rem] -translate-x-1/2 bg-gradient-to-tr from-[#ffc038] to-[#f596ff] opacity-20 sm:left-[calc(50%+36rem)] sm:w-[72.1875rem]"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* <Preorder /> */}
|
||||
|
||||
<div className="relative -z-10 px-6 lg:px-8 mt-16">
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="absolute inset-x-0 top-0 -z-10 flex -translate-y-1/2 transform-gpu justify-center overflow-hidden blur-3xl sm:bottom-0 sm:right-[calc(50%-6rem)] sm:top-auto sm:translate-y-0 sm:transform-gpu sm:justify-end"
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
clipPath:
|
||||
"polygon(73.6% 48.6%, 91.7% 88.5%, 100% 53.9%, 97.4% 18.1%, 92.5% 15.4%, 75.7% 36.3%, 55.3% 52.8%, 46.5% 50.9%, 45% 37.4%, 50.3% 13.1%, 21.3% 36.2%, 0.1% 0.1%, 5.4% 49.1%, 21.4% 36.4%, 58.9% 100%, 73.6% 48.6%)",
|
||||
}}
|
||||
className="aspect-[1108/632] w-[69.25rem] flex-none bg-gradient-to-r from-[#ffc038] to-[#f596ff] opacity-25"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className="absolute left-1/2 right-0 top-1/2 -z-10 hidden-translate-y-1/2 transform-gpu overflow-hidden blur-3xl sm:block"
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
clipPath:
|
||||
"polygon(74.1% 44.1%, 100% 61.6%, 97.5% 26.9%, 85.5% 0.1%, 80.7% 2%, 72.5% 32.5%, 60.2% 62.4%, 52.4% 68.1%, 47.5% 58.3%, 45.2% 34.5%, 27.5% 76.7%, 0.1% 64.9%, 17.9% 100%, 27.6% 76.8%, 76.1% 97.7%, 74.1% 44.1%)",
|
||||
}}
|
||||
className="aspect-[1155/678] w-[72.1875rem] bg-gradient-to-tr from-[#ffc038] to-[#f596ff] opacity-30"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col">
|
||||
{Sections.map((section, index) => (
|
||||
<LandingPageSection key={index} {...section} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,115 +0,0 @@
|
|||
import { createClient } from "@/utils/supabase/server";
|
||||
import { getAllPersonalities } from "@/db/personalities";
|
||||
import EndingSection from "../components/LandingPage/EndingSection";
|
||||
import FrontPage from "../components/LandingPage/FrontPage";
|
||||
import Personalities from "../components/LandingPage/Personalities";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Gamepad2, SmilePlus, Command, MessagesSquare, Bookmark, Share2, MessageCircle, Heart, Share, Wand } from "lucide-react";
|
||||
import PreorderButton from "../components/PreorderButton";
|
||||
import Link from "next/link";
|
||||
import Usecases from "../components/LandingPage/Usecases";
|
||||
import VideoPlayer from "../components/LandingPage/VideoPlayer";
|
||||
import { videoSrc, videoSrc2, videoSrc3, videoSrc4 } from "@/lib/data";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
const steps = [
|
||||
{
|
||||
title: "1. Pick their favorite story",
|
||||
description: "Select from a wide range of AI characters, each with unique personalities, stories and knowledge bases.",
|
||||
icon: <SmilePlus size={40} />,
|
||||
color: "text-amber-400"
|
||||
},
|
||||
{
|
||||
title: "2. Connect the toy",
|
||||
description: "Easily set up your Elato device with your home Wi-Fi network or Personal hotspot.",
|
||||
icon: <Command size={40} />,
|
||||
color: "text-amber-500"
|
||||
},
|
||||
{
|
||||
title: "3. Begin a new adventure",
|
||||
description: "Your characters are now always ready to chat. Watch your child's imagination come to life as they interact with (and create!) their own stories.",
|
||||
icon: <MessagesSquare size={40} />,
|
||||
color: "text-amber-600"
|
||||
},
|
||||
]
|
||||
export default async function Index() {
|
||||
redirect("/");
|
||||
const supabase = createClient();
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
} = await supabase.auth.getUser();
|
||||
|
||||
const allPersonalities = await getAllPersonalities(supabase);
|
||||
|
||||
|
||||
return (
|
||||
<main className="flex flex-1 flex-col mx-auto w-full gap-10 sm:py-4 py-0">
|
||||
<div className="flex flex-col md:flex-row gap-8 items-start justify-between max-w-screen-lg mx-auto px-4">
|
||||
<div className="md:w-1/2">
|
||||
<FrontPage
|
||||
user={user ?? undefined}
|
||||
allPersonalities={allPersonalities}
|
||||
/>
|
||||
|
||||
<div className="flex flex-row gap-4 items-center justify-center mt-8">
|
||||
<PreorderButton
|
||||
size="lg"
|
||||
buttonText="Buy Now — $69"
|
||||
className="h-10 font-normal"
|
||||
/>
|
||||
<Link href={user ? "/home" : "/login"}>
|
||||
<Button className="flex flex-row items-center bg-white gap-2 font-medium text-base text-stone-800 leading-8 rounded-full border-2 border-stone-900 hover:bg-gray-100">
|
||||
<Gamepad2 size={20} />
|
||||
<span>Sign Up</span>
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="w-full md:w-1/2 mt-6 md:mt-0">
|
||||
<VideoPlayer sources={[videoSrc, videoSrc2, videoSrc3, videoSrc4]} />
|
||||
</div>
|
||||
</div>
|
||||
<h1 className="font-normal text-xl text-gray-500 px-4 max-w-screen-md mx-auto">
|
||||
{"The Elato toy combines AI-powered creative storytelling with a screen-free experience where children become the stars of their own adventures."}
|
||||
</h1>
|
||||
<Personalities allPersonalities={allPersonalities} />
|
||||
|
||||
{/* <CharacterCarousel /> */}
|
||||
|
||||
{/* <div className="max-w-4xl text-center mx-8 mt-20 md:mx-auto">
|
||||
<h1 className="text-lg font-normal text-gray-700 mb-2">
|
||||
With a character for every occasion including
|
||||
</h1>
|
||||
|
||||
<AnimatedText />
|
||||
</div>
|
||||
<Personalities allPersonalities={allPersonalities} /> */}
|
||||
|
||||
{/* <InteractiveView /> */}
|
||||
{/* <Demo /> */}
|
||||
<section
|
||||
id="how-it-works"
|
||||
className="w-full max-w-screen-lg mx-auto py-12"
|
||||
>
|
||||
<div className="space-y-6 sm:max-w-sm max-w-[300px] mx-auto">
|
||||
{steps.map((step, index) => (
|
||||
<div key={index} className="flex flex-col gap-6">
|
||||
<h3 className={`text-3xl font-semibold flex flex-row items-center gap-2 justify-between ${step.color}`}>
|
||||
<span>{step.title} </span>{step.icon}
|
||||
</h3>
|
||||
<p className="text-gray-500 dark:text-gray-400 font-normal text-xl">
|
||||
{step.description}
|
||||
</p>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
{/* <CharacterPicker allPersonalities={allPersonalities} /> */}
|
||||
<Usecases />
|
||||
{/* <FeaturesSection /> */}
|
||||
<EndingSection />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
|
@ -302,7 +302,7 @@ export default async function RootLayout({
|
|||
}) {
|
||||
const supabase = createClient();
|
||||
|
||||
const { stars } = await fetchGithubStars("StarmoonAI/Starmoon");
|
||||
const { stars } = await fetchGithubStars("akdeb/ElatoAI");
|
||||
|
||||
const {
|
||||
data: { user },
|
||||
|
|
|
|||
|
|
@ -16,11 +16,5 @@ export default function sitemap(): MetadataRoute.Sitemap {
|
|||
changeFrequency: "weekly",
|
||||
priority: 0.9,
|
||||
},
|
||||
{
|
||||
url: "https://elatoai.com/healthcare",
|
||||
lastModified: new Date(),
|
||||
changeFrequency: "monthly",
|
||||
priority: 0.8,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,82 +0,0 @@
|
|||
const { AzureOpenAI } = require("openai");
|
||||
import OpenAI from "openai";
|
||||
|
||||
// Load the .env file if it exists
|
||||
const dotenv = require("dotenv");
|
||||
dotenv.config();
|
||||
|
||||
export const generateSuggestion = async (
|
||||
cardData: CardData | null,
|
||||
barData: BarData[],
|
||||
lineData: LineData[],
|
||||
pieData: PieData[]
|
||||
): Promise<string | undefined> => {
|
||||
// You will need to set these environment variables or edit the following values
|
||||
// if OPENAI_API_KEY exists, use it, otherwise use AZURE_OPENAI_API_KEY
|
||||
|
||||
const cardDataString = JSON.stringify(cardData);
|
||||
const barDatatring = JSON.stringify(barData);
|
||||
const lineDataString = JSON.stringify(lineData);
|
||||
const pieDataString = JSON.stringify(pieData);
|
||||
|
||||
let client: any;
|
||||
let result: any;
|
||||
const deployment = process.env["LLM_MODEL_NAME"] || "gpt-4o";
|
||||
const messages = [
|
||||
{
|
||||
role: "system",
|
||||
content: `You are an assistant who provides insight based on children's emotional data.`,
|
||||
},
|
||||
{
|
||||
role: "user",
|
||||
content: `Please provide a 50-word of suggestion of the below data:
|
||||
|
||||
Main emotions today & Significant Emotional Shifts with today's and yesterday's data:\n
|
||||
${cardDataString}
|
||||
|
||||
Sentiment Over Time:
|
||||
${lineDataString}
|
||||
|
||||
Sentiment Proportions Today:
|
||||
${pieDataString}
|
||||
|
||||
Current Emotions Breakdown:
|
||||
${barDatatring}`,
|
||||
},
|
||||
];
|
||||
|
||||
if (process.env.OPENAI_API_KEY) {
|
||||
client = new OpenAI();
|
||||
result = await client.chat.completions.create({
|
||||
model: deployment,
|
||||
messages,
|
||||
});
|
||||
} else {
|
||||
const endpoint = process.env["AZURE_OPENAI_ENDPOINT"];
|
||||
const apiKey = process.env["AZURE_OPENAI_API_KEY"];
|
||||
const apiVersion = "2024-02-01"; //"2024-02-01"
|
||||
|
||||
client = new AzureOpenAI({
|
||||
endpoint,
|
||||
apiKey,
|
||||
apiVersion,
|
||||
deployment,
|
||||
});
|
||||
result = await client.chat.completions.create({
|
||||
model: deployment,
|
||||
messages,
|
||||
});
|
||||
}
|
||||
|
||||
// if cardData is null
|
||||
if (
|
||||
cardData === null &&
|
||||
barData.length === 0 &&
|
||||
lineData.length === 0 &&
|
||||
pieData.length === 0
|
||||
) {
|
||||
return "Talk to a character in the Playground or on your Elato device to view your trends.";
|
||||
}
|
||||
|
||||
return result.choices[0].message.content;
|
||||
};
|
||||
|
|
@ -2,8 +2,7 @@ export const defaultToyId: string = "56224f7f-250d-4351-84ee-e4a13b881c7b";
|
|||
export const defaultPersonalityId: string =
|
||||
"a1c073e6-653d-40cf-acc1-891331689409";
|
||||
|
||||
export const paymentLink = "https://buy.stripe.com/bIY0033Dc7LB28o9AJ";
|
||||
export const starmoonProductsLink = "https://elatoai.com/products";
|
||||
export const paymentLink = "https://buy.stripe.com/bIY0033Dc7LB28o9AJ";
|
||||
export const discordInviteLink = "https://discord.gg/KJWxDPBRUj";
|
||||
export const tiktokLink = "https://www.tiktok.com/@elatoai";
|
||||
export const githubPublicLink = "https://github.com/akdeb/ElatoAI";
|
||||
|
|
@ -20,7 +19,6 @@ export const videoSrc4 = `${r2Url}/IMG_1677.mov`;
|
|||
|
||||
export const voiceSampleUrl =
|
||||
"https://xygbupeczfhwamhqnucy.supabase.co/storage/v1/object/public/voices/";
|
||||
export const docsLink = "https://starmoonai.notion.site/doc?pvs=4";
|
||||
|
||||
export const userFormPersonaLabel =
|
||||
"Briefly describe yourself and your interests, personality, and learning style";
|
||||
|
|
@ -39,21 +37,79 @@ export const ORIGINAL_COST = 111;
|
|||
export const SUBSCRIPTION_COST = 10;
|
||||
|
||||
export const voices = [
|
||||
{ id: 'alloy', name: 'Alloy', description: 'Neutral and balanced', color: 'bg-blue-100', emoji: '🧑' },
|
||||
{ id: 'echo', name: 'Echo', description: 'Warm and melodic', color: 'bg-purple-100', emoji: '👩🎤' },
|
||||
{ id: 'shimmer', name: 'Shimmer', description: 'Clear and bright', color: 'bg-cyan-100', emoji: '👱♀️' },
|
||||
{ id: 'ash', name: 'Ash', description: 'Soft and thoughtful', color: 'bg-gray-100', emoji: '🧔' },
|
||||
{ id: 'ballad', name: 'Ballad', description: 'Melodic and emotive', color: 'bg-indigo-100', emoji: '🎭' },
|
||||
{ id: 'coral', name: 'Coral', description: 'Warm and friendly', color: 'bg-orange-100', emoji: '👩' },
|
||||
{ id: 'sage', name: 'Sage', description: 'Wise and measured', color: 'bg-green-100', emoji: '🧓' },
|
||||
{ id: 'verse', name: 'Verse', description: 'Poetic and expressive', color: 'bg-rose-100', emoji: '👨🎨' }
|
||||
{
|
||||
id: "alloy",
|
||||
name: "Alloy",
|
||||
description: "Neutral and balanced",
|
||||
color: "bg-blue-100",
|
||||
emoji: "🧑",
|
||||
},
|
||||
{
|
||||
id: "echo",
|
||||
name: "Echo",
|
||||
description: "Warm and melodic",
|
||||
color: "bg-purple-100",
|
||||
emoji: "👩🎤",
|
||||
},
|
||||
{
|
||||
id: "shimmer",
|
||||
name: "Shimmer",
|
||||
description: "Clear and bright",
|
||||
color: "bg-cyan-100",
|
||||
emoji: "👱♀️",
|
||||
},
|
||||
{
|
||||
id: "ash",
|
||||
name: "Ash",
|
||||
description: "Soft and thoughtful",
|
||||
color: "bg-gray-100",
|
||||
emoji: "🧔",
|
||||
},
|
||||
{
|
||||
id: "ballad",
|
||||
name: "Ballad",
|
||||
description: "Melodic and emotive",
|
||||
color: "bg-indigo-100",
|
||||
emoji: "🎭",
|
||||
},
|
||||
{
|
||||
id: "coral",
|
||||
name: "Coral",
|
||||
description: "Warm and friendly",
|
||||
color: "bg-orange-100",
|
||||
emoji: "👩",
|
||||
},
|
||||
{
|
||||
id: "sage",
|
||||
name: "Sage",
|
||||
description: "Wise and measured",
|
||||
color: "bg-green-100",
|
||||
emoji: "🧓",
|
||||
},
|
||||
{
|
||||
id: "verse",
|
||||
name: "Verse",
|
||||
description: "Poetic and expressive",
|
||||
color: "bg-rose-100",
|
||||
emoji: "👨🎨",
|
||||
},
|
||||
];
|
||||
|
||||
export const emotionOptions = [
|
||||
{ value: 'neutral', label: 'Neutral', icon: '😐', color: 'bg-red-100' },
|
||||
{ value: 'cheerful', label: 'Cheerful', icon: '😊', color: 'bg-yellow-100' },
|
||||
{ value: 'serious', label: 'Serious', icon: '🧐', color: 'bg-blue-100' },
|
||||
{ value: 'calm', label: 'Calm', icon: '😌', color: 'bg-teal-100' },
|
||||
{ value: 'excited', label: 'Excited', icon: '😃', color: 'bg-orange-100' },
|
||||
{ value: 'professional', label: 'Professional', icon: '👔', color: 'bg-green-100' }
|
||||
{ value: "neutral", label: "Neutral", icon: "😐", color: "bg-red-100" },
|
||||
{
|
||||
value: "cheerful",
|
||||
label: "Cheerful",
|
||||
icon: "😊",
|
||||
color: "bg-yellow-100",
|
||||
},
|
||||
{ value: "serious", label: "Serious", icon: "🧐", color: "bg-blue-100" },
|
||||
{ value: "calm", label: "Calm", icon: "😌", color: "bg-teal-100" },
|
||||
{ value: "excited", label: "Excited", icon: "😃", color: "bg-orange-100" },
|
||||
{
|
||||
value: "professional",
|
||||
label: "Professional",
|
||||
icon: "👔",
|
||||
color: "bg-green-100",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
1
node_modules/.bin/mkdirp
generated
vendored
1
node_modules/.bin/mkdirp
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
../mkdirp/dist/cjs/src/bin.js
|
||||
1
node_modules/.bin/supabase
generated
vendored
1
node_modules/.bin/supabase
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
../supabase/bin/supabase
|
||||
356
node_modules/.package-lock.json
generated
vendored
356
node_modules/.package-lock.json
generated
vendored
|
|
@ -1,356 +0,0 @@
|
|||
{
|
||||
"name": "ElatoAI",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@isaacs/fs-minipass": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz",
|
||||
"integrity": "sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz",
|
||||
"integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/bin-links": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bin-links/-/bin-links-5.0.0.tgz",
|
||||
"integrity": "sha512-sdleLVfCjBtgO5cNjA2HVRvWBJAHs4zwenaCPMNJAJU0yNxpzj80IpjOIimkpkr+mhlA+how5poQtt53PygbHA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cmd-shim": "^7.0.0",
|
||||
"npm-normalize-package-bin": "^4.0.0",
|
||||
"proc-log": "^5.0.0",
|
||||
"read-cmd-shim": "^5.0.0",
|
||||
"write-file-atomic": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz",
|
||||
"integrity": "sha512-+IxzY9BZOQd/XuYPRmrvEVjF/nqj5kgT4kEq7VofrDoM1MxoRjEWkrCC3EtLi59TVawxTAn+orJwFQcrqEN1+g==",
|
||||
"dev": true,
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/cmd-shim": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cmd-shim/-/cmd-shim-7.0.0.tgz",
|
||||
"integrity": "sha512-rtpaCbr164TPPh+zFdkWpCyZuKkjpAzODfaZCf/SVJZzJN+4bHQb/LP3Jzq5/+84um3XXY8r548XiWKSborwVw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz",
|
||||
"integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz",
|
||||
"integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fetch-blob": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz",
|
||||
"integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "paypal",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"node-domexception": "^1.0.0",
|
||||
"web-streams-polyfill": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20 || >= 14.13"
|
||||
}
|
||||
},
|
||||
"node_modules/formdata-polyfill": {
|
||||
"version": "4.0.10",
|
||||
"resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz",
|
||||
"integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fetch-blob": "^3.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
"version": "7.0.6",
|
||||
"resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
|
||||
"integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/imurmurhash": {
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
|
||||
"integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.8.19"
|
||||
}
|
||||
},
|
||||
"node_modules/minipass": {
|
||||
"version": "7.1.2",
|
||||
"resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz",
|
||||
"integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=16 || 14 >=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/minizlib": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.2.tgz",
|
||||
"integrity": "sha512-oG62iEk+CYt5Xj2YqI5Xi9xWUeZhDI8jjQmC5oThVH5JGCTgIjr7ciJDzC7MBzYd//WvR1OTmP5Q38Q8ShQtVA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"minipass": "^7.1.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 18"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz",
|
||||
"integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"mkdirp": "dist/cjs/src/bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/ms": {
|
||||
"version": "2.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/node-domexception": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz",
|
||||
"integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/jimmywarting"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://paypal.me/jimmywarting"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz",
|
||||
"integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"data-uri-to-buffer": "^4.0.0",
|
||||
"fetch-blob": "^3.1.4",
|
||||
"formdata-polyfill": "^4.0.10"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/node-fetch"
|
||||
}
|
||||
},
|
||||
"node_modules/npm-normalize-package-bin": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/npm-normalize-package-bin/-/npm-normalize-package-bin-4.0.0.tgz",
|
||||
"integrity": "sha512-TZKxPvItzai9kN9H/TkmCtx/ZN/hvr3vUycjlfmH0ootY9yFBzNOpiXAdIn1Iteqsvk4lQn6B5PTrt+n6h8k/w==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proc-log": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz",
|
||||
"integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/read-cmd-shim": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/read-cmd-shim/-/read-cmd-shim-5.0.0.tgz",
|
||||
"integrity": "sha512-SEbJV7tohp3DAAILbEMPXavBjAnMN0tVnh4+9G8ihV4Pq3HYF9h8QNez9zkJ1ILkv9G2BjdzwctznGZXgu/HGw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/signal-exit": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
|
||||
"integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/isaacs"
|
||||
}
|
||||
},
|
||||
"node_modules/supabase": {
|
||||
"version": "2.20.12",
|
||||
"resolved": "https://registry.npmjs.org/supabase/-/supabase-2.20.12.tgz",
|
||||
"integrity": "sha512-8UTRRvQdMsfs7jcHPDfv6cFYwrar5OyqidtB8GSdPCaKfEP+0n4TwCVwu7H0tDCbCYs28HDZDzQAZ8Ox+aVIiA==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"bin-links": "^5.0.0",
|
||||
"https-proxy-agent": "^7.0.2",
|
||||
"node-fetch": "^3.3.2",
|
||||
"tar": "7.4.3"
|
||||
},
|
||||
"bin": {
|
||||
"supabase": "bin/supabase"
|
||||
},
|
||||
"engines": {
|
||||
"npm": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tar": {
|
||||
"version": "7.4.3",
|
||||
"resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz",
|
||||
"integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@isaacs/fs-minipass": "^4.0.0",
|
||||
"chownr": "^3.0.0",
|
||||
"minipass": "^7.1.2",
|
||||
"minizlib": "^3.0.1",
|
||||
"mkdirp": "^3.0.1",
|
||||
"yallist": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/web-streams-polyfill": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz",
|
||||
"integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/write-file-atomic": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-6.0.0.tgz",
|
||||
"integrity": "sha512-GmqrO8WJ1NuzJ2DrziEI2o57jKAVIQNf8a18W3nCYU3H7PNWqCCVTeH6/NQE93CIllIgQS98rrmVkYgTX9fFJQ==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"imurmurhash": "^0.1.4",
|
||||
"signal-exit": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
}
|
||||
},
|
||||
"node_modules/yallist": {
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz",
|
||||
"integrity": "sha512-YgvUTfwqyc7UXVMrB+SImsVYSmTS8X/tSrtdNZMImM+n7+QTriRXyXim0mBrTXNeqzVF0KWGgHPeiyViFFrNDw==",
|
||||
"dev": true,
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
node_modules/@isaacs/fs-minipass/LICENSE
generated
vendored
15
node_modules/@isaacs/fs-minipass/LICENSE
generated
vendored
|
|
@ -1,15 +0,0 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
71
node_modules/@isaacs/fs-minipass/README.md
generated
vendored
71
node_modules/@isaacs/fs-minipass/README.md
generated
vendored
|
|
@ -1,71 +0,0 @@
|
|||
# fs-minipass
|
||||
|
||||
Filesystem streams based on [minipass](http://npm.im/minipass).
|
||||
|
||||
4 classes are exported:
|
||||
|
||||
- ReadStream
|
||||
- ReadStreamSync
|
||||
- WriteStream
|
||||
- WriteStreamSync
|
||||
|
||||
When using `ReadStreamSync`, all of the data is made available
|
||||
immediately upon consuming the stream. Nothing is buffered in memory
|
||||
when the stream is constructed. If the stream is piped to a writer,
|
||||
then it will synchronously `read()` and emit data into the writer as
|
||||
fast as the writer can consume it. (That is, it will respect
|
||||
backpressure.) If you call `stream.read()` then it will read the
|
||||
entire file and return the contents.
|
||||
|
||||
When using `WriteStreamSync`, every write is flushed to the file
|
||||
synchronously. If your writes all come in a single tick, then it'll
|
||||
write it all out in a single tick. It's as synchronous as you are.
|
||||
|
||||
The async versions work much like their node builtin counterparts,
|
||||
with the exception of introducing significantly less Stream machinery
|
||||
overhead.
|
||||
|
||||
## USAGE
|
||||
|
||||
It's just streams, you pipe them or read() them or write() to them.
|
||||
|
||||
```js
|
||||
import { ReadStream, WriteStream } from 'fs-minipass'
|
||||
// or: const { ReadStream, WriteStream } = require('fs-minipass')
|
||||
const readStream = new ReadStream('file.txt')
|
||||
const writeStream = new WriteStream('output.txt')
|
||||
writeStream.write('some file header or whatever\n')
|
||||
readStream.pipe(writeStream)
|
||||
```
|
||||
|
||||
## ReadStream(path, options)
|
||||
|
||||
Path string is required, but somewhat irrelevant if an open file
|
||||
descriptor is passed in as an option.
|
||||
|
||||
Options:
|
||||
|
||||
- `fd` Pass in a numeric file descriptor, if the file is already open.
|
||||
- `readSize` The size of reads to do, defaults to 16MB
|
||||
- `size` The size of the file, if known. Prevents zero-byte read()
|
||||
call at the end.
|
||||
- `autoClose` Set to `false` to prevent the file descriptor from being
|
||||
closed when the file is done being read.
|
||||
|
||||
## WriteStream(path, options)
|
||||
|
||||
Path string is required, but somewhat irrelevant if an open file
|
||||
descriptor is passed in as an option.
|
||||
|
||||
Options:
|
||||
|
||||
- `fd` Pass in a numeric file descriptor, if the file is already open.
|
||||
- `mode` The mode to create the file with. Defaults to `0o666`.
|
||||
- `start` The position in the file to start reading. If not
|
||||
specified, then the file will start writing at position zero, and be
|
||||
truncated by default.
|
||||
- `autoClose` Set to `false` to prevent the file descriptor from being
|
||||
closed when the stream is ended.
|
||||
- `flags` Flags to use when opening the file. Irrelevant if `fd` is
|
||||
passed in, since file won't be opened in that case. Defaults to
|
||||
`'a'` if a `pos` is specified, or `'w'` otherwise.
|
||||
118
node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
generated
vendored
118
node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts
generated
vendored
|
|
@ -1,118 +0,0 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import EE from 'events';
|
||||
import { Minipass } from 'minipass';
|
||||
declare const _autoClose: unique symbol;
|
||||
declare const _close: unique symbol;
|
||||
declare const _ended: unique symbol;
|
||||
declare const _fd: unique symbol;
|
||||
declare const _finished: unique symbol;
|
||||
declare const _flags: unique symbol;
|
||||
declare const _flush: unique symbol;
|
||||
declare const _handleChunk: unique symbol;
|
||||
declare const _makeBuf: unique symbol;
|
||||
declare const _mode: unique symbol;
|
||||
declare const _needDrain: unique symbol;
|
||||
declare const _onerror: unique symbol;
|
||||
declare const _onopen: unique symbol;
|
||||
declare const _onread: unique symbol;
|
||||
declare const _onwrite: unique symbol;
|
||||
declare const _open: unique symbol;
|
||||
declare const _path: unique symbol;
|
||||
declare const _pos: unique symbol;
|
||||
declare const _queue: unique symbol;
|
||||
declare const _read: unique symbol;
|
||||
declare const _readSize: unique symbol;
|
||||
declare const _reading: unique symbol;
|
||||
declare const _remain: unique symbol;
|
||||
declare const _size: unique symbol;
|
||||
declare const _write: unique symbol;
|
||||
declare const _writing: unique symbol;
|
||||
declare const _defaultFlag: unique symbol;
|
||||
declare const _errored: unique symbol;
|
||||
export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
fd?: number;
|
||||
readSize?: number;
|
||||
size?: number;
|
||||
autoClose?: boolean;
|
||||
};
|
||||
export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
|
||||
open: [fd: number];
|
||||
};
|
||||
export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
|
||||
[_errored]: boolean;
|
||||
[_fd]?: number;
|
||||
[_path]: string;
|
||||
[_readSize]: number;
|
||||
[_reading]: boolean;
|
||||
[_size]: number;
|
||||
[_remain]: number;
|
||||
[_autoClose]: boolean;
|
||||
constructor(path: string, opt: ReadStreamOptions);
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
write(): void;
|
||||
end(): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
|
||||
[_makeBuf](): Buffer;
|
||||
[_read](): void;
|
||||
[_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
|
||||
[_close](): void;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_handleChunk](br: number, buf: Buffer): boolean;
|
||||
emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
|
||||
}
|
||||
export declare class ReadStreamSync extends ReadStream {
|
||||
[_open](): void;
|
||||
[_read](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export type WriteStreamOptions = {
|
||||
fd?: number;
|
||||
autoClose?: boolean;
|
||||
mode?: number;
|
||||
captureRejections?: boolean;
|
||||
start?: number;
|
||||
flags?: string;
|
||||
};
|
||||
export declare class WriteStream extends EE {
|
||||
readable: false;
|
||||
writable: boolean;
|
||||
[_errored]: boolean;
|
||||
[_writing]: boolean;
|
||||
[_ended]: boolean;
|
||||
[_queue]: Buffer[];
|
||||
[_needDrain]: boolean;
|
||||
[_path]: string;
|
||||
[_mode]: number;
|
||||
[_autoClose]: boolean;
|
||||
[_fd]?: number;
|
||||
[_defaultFlag]: boolean;
|
||||
[_flags]: string;
|
||||
[_finished]: boolean;
|
||||
[_pos]?: number;
|
||||
constructor(path: string, opt: WriteStreamOptions);
|
||||
emit(ev: string, ...args: any[]): boolean;
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
|
||||
end(buf: string, enc?: BufferEncoding): this;
|
||||
end(buf?: Buffer, enc?: undefined): this;
|
||||
write(buf: string, enc?: BufferEncoding): boolean;
|
||||
write(buf: Buffer, enc?: undefined): boolean;
|
||||
[_write](buf: Buffer): void;
|
||||
[_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
|
||||
[_flush](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export declare class WriteStreamSync extends WriteStream {
|
||||
[_open](): void;
|
||||
[_close](): void;
|
||||
[_write](buf: Buffer): void;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map
generated
vendored
1
node_modules/@isaacs/fs-minipass/dist/commonjs/index.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
||||
430
node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
generated
vendored
430
node_modules/@isaacs/fs-minipass/dist/commonjs/index.js
generated
vendored
|
|
@ -1,430 +0,0 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.WriteStreamSync = exports.WriteStream = exports.ReadStreamSync = exports.ReadStream = void 0;
|
||||
const events_1 = __importDefault(require("events"));
|
||||
const fs_1 = __importDefault(require("fs"));
|
||||
const minipass_1 = require("minipass");
|
||||
const writev = fs_1.default.writev;
|
||||
const _autoClose = Symbol('_autoClose');
|
||||
const _close = Symbol('_close');
|
||||
const _ended = Symbol('_ended');
|
||||
const _fd = Symbol('_fd');
|
||||
const _finished = Symbol('_finished');
|
||||
const _flags = Symbol('_flags');
|
||||
const _flush = Symbol('_flush');
|
||||
const _handleChunk = Symbol('_handleChunk');
|
||||
const _makeBuf = Symbol('_makeBuf');
|
||||
const _mode = Symbol('_mode');
|
||||
const _needDrain = Symbol('_needDrain');
|
||||
const _onerror = Symbol('_onerror');
|
||||
const _onopen = Symbol('_onopen');
|
||||
const _onread = Symbol('_onread');
|
||||
const _onwrite = Symbol('_onwrite');
|
||||
const _open = Symbol('_open');
|
||||
const _path = Symbol('_path');
|
||||
const _pos = Symbol('_pos');
|
||||
const _queue = Symbol('_queue');
|
||||
const _read = Symbol('_read');
|
||||
const _readSize = Symbol('_readSize');
|
||||
const _reading = Symbol('_reading');
|
||||
const _remain = Symbol('_remain');
|
||||
const _size = Symbol('_size');
|
||||
const _write = Symbol('_write');
|
||||
const _writing = Symbol('_writing');
|
||||
const _defaultFlag = Symbol('_defaultFlag');
|
||||
const _errored = Symbol('_errored');
|
||||
class ReadStream extends minipass_1.Minipass {
|
||||
[_errored] = false;
|
||||
[_fd];
|
||||
[_path];
|
||||
[_readSize];
|
||||
[_reading] = false;
|
||||
[_size];
|
||||
[_remain];
|
||||
[_autoClose];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this.readable = true;
|
||||
this.writable = false;
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('path must be a string');
|
||||
}
|
||||
this[_errored] = false;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_path] = path;
|
||||
this[_readSize] = opt.readSize || 16 * 1024 * 1024;
|
||||
this[_reading] = false;
|
||||
this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
|
||||
this[_remain] = this[_size];
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
else {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
//@ts-ignore
|
||||
write() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
//@ts-ignore
|
||||
end() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
[_open]() {
|
||||
fs_1.default.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_makeBuf]() {
|
||||
return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
|
||||
}
|
||||
[_read]() {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
if (buf.length === 0) {
|
||||
return process.nextTick(() => this[_onread](null, 0, buf));
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
fs_1.default.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
|
||||
}
|
||||
}
|
||||
[_onread](er, br, buf) {
|
||||
this[_reading] = false;
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else if (this[_handleChunk](br, buf)) {
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_reading] = true;
|
||||
this[_close]();
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_handleChunk](br, buf) {
|
||||
let ret = false;
|
||||
// no effect if infinite
|
||||
this[_remain] -= br;
|
||||
if (br > 0) {
|
||||
ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
|
||||
}
|
||||
if (br === 0 || this[_remain] <= 0) {
|
||||
ret = false;
|
||||
this[_close]();
|
||||
super.end();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
switch (ev) {
|
||||
case 'prefinish':
|
||||
case 'finish':
|
||||
return false;
|
||||
case 'drain':
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
return false;
|
||||
case 'error':
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
return super.emit(ev, ...args);
|
||||
default:
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReadStream = ReadStream;
|
||||
class ReadStreamSync extends ReadStream {
|
||||
[_open]() {
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onopen](null, fs_1.default.openSync(this[_path], 'r'));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_read]() {
|
||||
let threw = true;
|
||||
try {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
do {
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
const br = buf.length === 0
|
||||
? 0
|
||||
: fs_1.default.readSync(this[_fd], buf, 0, buf.length, null);
|
||||
/* c8 ignore stop */
|
||||
if (!this[_handleChunk](br, buf)) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
this[_reading] = false;
|
||||
}
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ReadStreamSync = ReadStreamSync;
|
||||
class WriteStream extends events_1.default {
|
||||
readable = false;
|
||||
writable = true;
|
||||
[_errored] = false;
|
||||
[_writing] = false;
|
||||
[_ended] = false;
|
||||
[_queue] = [];
|
||||
[_needDrain] = false;
|
||||
[_path];
|
||||
[_mode];
|
||||
[_autoClose];
|
||||
[_fd];
|
||||
[_defaultFlag];
|
||||
[_flags];
|
||||
[_finished] = false;
|
||||
[_pos];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this[_path] = path;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
|
||||
this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
// truncating makes no sense when writing into the middle
|
||||
const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
|
||||
this[_defaultFlag] = opt.flags === undefined;
|
||||
this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
|
||||
if (this[_fd] === undefined) {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
if (ev === 'error') {
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
}
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_close]();
|
||||
this[_writing] = true;
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_open]() {
|
||||
fs_1.default.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (this[_defaultFlag] &&
|
||||
this[_flags] === 'r+' &&
|
||||
er &&
|
||||
er.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
this[_open]();
|
||||
}
|
||||
else if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
if (!this[_writing]) {
|
||||
this[_flush]();
|
||||
}
|
||||
}
|
||||
}
|
||||
end(buf, enc) {
|
||||
if (buf) {
|
||||
//@ts-ignore
|
||||
this.write(buf, enc);
|
||||
}
|
||||
this[_ended] = true;
|
||||
// synthetic after-write logic, where drain/finish live
|
||||
if (!this[_writing] &&
|
||||
!this[_queue].length &&
|
||||
typeof this[_fd] === 'number') {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
write(buf, enc) {
|
||||
if (typeof buf === 'string') {
|
||||
buf = Buffer.from(buf, enc);
|
||||
}
|
||||
if (this[_ended]) {
|
||||
this.emit('error', new Error('write() after end()'));
|
||||
return false;
|
||||
}
|
||||
if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
|
||||
this[_queue].push(buf);
|
||||
this[_needDrain] = true;
|
||||
return false;
|
||||
}
|
||||
this[_writing] = true;
|
||||
this[_write](buf);
|
||||
return true;
|
||||
}
|
||||
[_write](buf) {
|
||||
fs_1.default.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
[_onwrite](er, bw) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
if (this[_pos] !== undefined && typeof bw === 'number') {
|
||||
this[_pos] += bw;
|
||||
}
|
||||
if (this[_queue].length) {
|
||||
this[_flush]();
|
||||
}
|
||||
else {
|
||||
this[_writing] = false;
|
||||
if (this[_ended] && !this[_finished]) {
|
||||
this[_finished] = true;
|
||||
this[_close]();
|
||||
this.emit('finish');
|
||||
}
|
||||
else if (this[_needDrain]) {
|
||||
this[_needDrain] = false;
|
||||
this.emit('drain');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[_flush]() {
|
||||
if (this[_queue].length === 0) {
|
||||
if (this[_ended]) {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
}
|
||||
else if (this[_queue].length === 1) {
|
||||
this[_write](this[_queue].pop());
|
||||
}
|
||||
else {
|
||||
const iovec = this[_queue];
|
||||
this[_queue] = [];
|
||||
writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.WriteStream = WriteStream;
|
||||
class WriteStreamSync extends WriteStream {
|
||||
[_open]() {
|
||||
let fd;
|
||||
// only wrap in a try{} block if we know we'll retry, to avoid
|
||||
// the rethrow obscuring the error's source frame in most cases.
|
||||
if (this[_defaultFlag] && this[_flags] === 'r+') {
|
||||
try {
|
||||
fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
return this[_open]();
|
||||
}
|
||||
else {
|
||||
throw er;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fd = fs_1.default.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
this[_onopen](null, fd);
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs_1.default.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
[_write](buf) {
|
||||
// throw the original, but try to close if it fails
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onwrite](null, fs_1.default.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
try {
|
||||
this[_close]();
|
||||
}
|
||||
catch {
|
||||
// ok error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.WriteStreamSync = WriteStreamSync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map
generated
vendored
1
node_modules/@isaacs/fs-minipass/dist/commonjs/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
generated
vendored
3
node_modules/@isaacs/fs-minipass/dist/commonjs/package.json
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
118
node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
generated
vendored
118
node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts
generated
vendored
|
|
@ -1,118 +0,0 @@
|
|||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
/// <reference types="node" resolution-mode="require"/>
|
||||
import EE from 'events';
|
||||
import { Minipass } from 'minipass';
|
||||
declare const _autoClose: unique symbol;
|
||||
declare const _close: unique symbol;
|
||||
declare const _ended: unique symbol;
|
||||
declare const _fd: unique symbol;
|
||||
declare const _finished: unique symbol;
|
||||
declare const _flags: unique symbol;
|
||||
declare const _flush: unique symbol;
|
||||
declare const _handleChunk: unique symbol;
|
||||
declare const _makeBuf: unique symbol;
|
||||
declare const _mode: unique symbol;
|
||||
declare const _needDrain: unique symbol;
|
||||
declare const _onerror: unique symbol;
|
||||
declare const _onopen: unique symbol;
|
||||
declare const _onread: unique symbol;
|
||||
declare const _onwrite: unique symbol;
|
||||
declare const _open: unique symbol;
|
||||
declare const _path: unique symbol;
|
||||
declare const _pos: unique symbol;
|
||||
declare const _queue: unique symbol;
|
||||
declare const _read: unique symbol;
|
||||
declare const _readSize: unique symbol;
|
||||
declare const _reading: unique symbol;
|
||||
declare const _remain: unique symbol;
|
||||
declare const _size: unique symbol;
|
||||
declare const _write: unique symbol;
|
||||
declare const _writing: unique symbol;
|
||||
declare const _defaultFlag: unique symbol;
|
||||
declare const _errored: unique symbol;
|
||||
export type ReadStreamOptions = Minipass.Options<Minipass.ContiguousData> & {
|
||||
fd?: number;
|
||||
readSize?: number;
|
||||
size?: number;
|
||||
autoClose?: boolean;
|
||||
};
|
||||
export type ReadStreamEvents = Minipass.Events<Minipass.ContiguousData> & {
|
||||
open: [fd: number];
|
||||
};
|
||||
export declare class ReadStream extends Minipass<Minipass.ContiguousData, Buffer, ReadStreamEvents> {
|
||||
[_errored]: boolean;
|
||||
[_fd]?: number;
|
||||
[_path]: string;
|
||||
[_readSize]: number;
|
||||
[_reading]: boolean;
|
||||
[_size]: number;
|
||||
[_remain]: number;
|
||||
[_autoClose]: boolean;
|
||||
constructor(path: string, opt: ReadStreamOptions);
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
write(): void;
|
||||
end(): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: NodeJS.ErrnoException | null, fd?: number): void;
|
||||
[_makeBuf](): Buffer;
|
||||
[_read](): void;
|
||||
[_onread](er?: NodeJS.ErrnoException | null, br?: number, buf?: Buffer): void;
|
||||
[_close](): void;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_handleChunk](br: number, buf: Buffer): boolean;
|
||||
emit<Event extends keyof ReadStreamEvents>(ev: Event, ...args: ReadStreamEvents[Event]): boolean;
|
||||
}
|
||||
export declare class ReadStreamSync extends ReadStream {
|
||||
[_open](): void;
|
||||
[_read](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export type WriteStreamOptions = {
|
||||
fd?: number;
|
||||
autoClose?: boolean;
|
||||
mode?: number;
|
||||
captureRejections?: boolean;
|
||||
start?: number;
|
||||
flags?: string;
|
||||
};
|
||||
export declare class WriteStream extends EE {
|
||||
readable: false;
|
||||
writable: boolean;
|
||||
[_errored]: boolean;
|
||||
[_writing]: boolean;
|
||||
[_ended]: boolean;
|
||||
[_queue]: Buffer[];
|
||||
[_needDrain]: boolean;
|
||||
[_path]: string;
|
||||
[_mode]: number;
|
||||
[_autoClose]: boolean;
|
||||
[_fd]?: number;
|
||||
[_defaultFlag]: boolean;
|
||||
[_flags]: string;
|
||||
[_finished]: boolean;
|
||||
[_pos]?: number;
|
||||
constructor(path: string, opt: WriteStreamOptions);
|
||||
emit(ev: string, ...args: any[]): boolean;
|
||||
get fd(): number | undefined;
|
||||
get path(): string;
|
||||
[_onerror](er: NodeJS.ErrnoException): void;
|
||||
[_open](): void;
|
||||
[_onopen](er?: null | NodeJS.ErrnoException, fd?: number): void;
|
||||
end(buf: string, enc?: BufferEncoding): this;
|
||||
end(buf?: Buffer, enc?: undefined): this;
|
||||
write(buf: string, enc?: BufferEncoding): boolean;
|
||||
write(buf: Buffer, enc?: undefined): boolean;
|
||||
[_write](buf: Buffer): void;
|
||||
[_onwrite](er?: null | NodeJS.ErrnoException, bw?: number): void;
|
||||
[_flush](): void;
|
||||
[_close](): void;
|
||||
}
|
||||
export declare class WriteStreamSync extends WriteStream {
|
||||
[_open](): void;
|
||||
[_close](): void;
|
||||
[_write](buf: Buffer): void;
|
||||
}
|
||||
export {};
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map
generated
vendored
1
node_modules/@isaacs/fs-minipass/dist/esm/index.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"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"}
|
||||
420
node_modules/@isaacs/fs-minipass/dist/esm/index.js
generated
vendored
420
node_modules/@isaacs/fs-minipass/dist/esm/index.js
generated
vendored
|
|
@ -1,420 +0,0 @@
|
|||
import EE from 'events';
|
||||
import fs from 'fs';
|
||||
import { Minipass } from 'minipass';
|
||||
const writev = fs.writev;
|
||||
const _autoClose = Symbol('_autoClose');
|
||||
const _close = Symbol('_close');
|
||||
const _ended = Symbol('_ended');
|
||||
const _fd = Symbol('_fd');
|
||||
const _finished = Symbol('_finished');
|
||||
const _flags = Symbol('_flags');
|
||||
const _flush = Symbol('_flush');
|
||||
const _handleChunk = Symbol('_handleChunk');
|
||||
const _makeBuf = Symbol('_makeBuf');
|
||||
const _mode = Symbol('_mode');
|
||||
const _needDrain = Symbol('_needDrain');
|
||||
const _onerror = Symbol('_onerror');
|
||||
const _onopen = Symbol('_onopen');
|
||||
const _onread = Symbol('_onread');
|
||||
const _onwrite = Symbol('_onwrite');
|
||||
const _open = Symbol('_open');
|
||||
const _path = Symbol('_path');
|
||||
const _pos = Symbol('_pos');
|
||||
const _queue = Symbol('_queue');
|
||||
const _read = Symbol('_read');
|
||||
const _readSize = Symbol('_readSize');
|
||||
const _reading = Symbol('_reading');
|
||||
const _remain = Symbol('_remain');
|
||||
const _size = Symbol('_size');
|
||||
const _write = Symbol('_write');
|
||||
const _writing = Symbol('_writing');
|
||||
const _defaultFlag = Symbol('_defaultFlag');
|
||||
const _errored = Symbol('_errored');
|
||||
export class ReadStream extends Minipass {
|
||||
[_errored] = false;
|
||||
[_fd];
|
||||
[_path];
|
||||
[_readSize];
|
||||
[_reading] = false;
|
||||
[_size];
|
||||
[_remain];
|
||||
[_autoClose];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this.readable = true;
|
||||
this.writable = false;
|
||||
if (typeof path !== 'string') {
|
||||
throw new TypeError('path must be a string');
|
||||
}
|
||||
this[_errored] = false;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_path] = path;
|
||||
this[_readSize] = opt.readSize || 16 * 1024 * 1024;
|
||||
this[_reading] = false;
|
||||
this[_size] = typeof opt.size === 'number' ? opt.size : Infinity;
|
||||
this[_remain] = this[_size];
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
else {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
//@ts-ignore
|
||||
write() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
//@ts-ignore
|
||||
end() {
|
||||
throw new TypeError('this is a readable stream');
|
||||
}
|
||||
[_open]() {
|
||||
fs.open(this[_path], 'r', (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_makeBuf]() {
|
||||
return Buffer.allocUnsafe(Math.min(this[_readSize], this[_remain]));
|
||||
}
|
||||
[_read]() {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
if (buf.length === 0) {
|
||||
return process.nextTick(() => this[_onread](null, 0, buf));
|
||||
}
|
||||
/* c8 ignore stop */
|
||||
fs.read(this[_fd], buf, 0, buf.length, null, (er, br, b) => this[_onread](er, br, b));
|
||||
}
|
||||
}
|
||||
[_onread](er, br, buf) {
|
||||
this[_reading] = false;
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else if (this[_handleChunk](br, buf)) {
|
||||
this[_read]();
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_reading] = true;
|
||||
this[_close]();
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_handleChunk](br, buf) {
|
||||
let ret = false;
|
||||
// no effect if infinite
|
||||
this[_remain] -= br;
|
||||
if (br > 0) {
|
||||
ret = super.write(br < buf.length ? buf.subarray(0, br) : buf);
|
||||
}
|
||||
if (br === 0 || this[_remain] <= 0) {
|
||||
ret = false;
|
||||
this[_close]();
|
||||
super.end();
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
switch (ev) {
|
||||
case 'prefinish':
|
||||
case 'finish':
|
||||
return false;
|
||||
case 'drain':
|
||||
if (typeof this[_fd] === 'number') {
|
||||
this[_read]();
|
||||
}
|
||||
return false;
|
||||
case 'error':
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
return super.emit(ev, ...args);
|
||||
default:
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
export class ReadStreamSync extends ReadStream {
|
||||
[_open]() {
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onopen](null, fs.openSync(this[_path], 'r'));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_read]() {
|
||||
let threw = true;
|
||||
try {
|
||||
if (!this[_reading]) {
|
||||
this[_reading] = true;
|
||||
do {
|
||||
const buf = this[_makeBuf]();
|
||||
/* c8 ignore start */
|
||||
const br = buf.length === 0
|
||||
? 0
|
||||
: fs.readSync(this[_fd], buf, 0, buf.length, null);
|
||||
/* c8 ignore stop */
|
||||
if (!this[_handleChunk](br, buf)) {
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
this[_reading] = false;
|
||||
}
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
this[_close]();
|
||||
}
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
}
|
||||
export class WriteStream extends EE {
|
||||
readable = false;
|
||||
writable = true;
|
||||
[_errored] = false;
|
||||
[_writing] = false;
|
||||
[_ended] = false;
|
||||
[_queue] = [];
|
||||
[_needDrain] = false;
|
||||
[_path];
|
||||
[_mode];
|
||||
[_autoClose];
|
||||
[_fd];
|
||||
[_defaultFlag];
|
||||
[_flags];
|
||||
[_finished] = false;
|
||||
[_pos];
|
||||
constructor(path, opt) {
|
||||
opt = opt || {};
|
||||
super(opt);
|
||||
this[_path] = path;
|
||||
this[_fd] = typeof opt.fd === 'number' ? opt.fd : undefined;
|
||||
this[_mode] = opt.mode === undefined ? 0o666 : opt.mode;
|
||||
this[_pos] = typeof opt.start === 'number' ? opt.start : undefined;
|
||||
this[_autoClose] =
|
||||
typeof opt.autoClose === 'boolean' ? opt.autoClose : true;
|
||||
// truncating makes no sense when writing into the middle
|
||||
const defaultFlag = this[_pos] !== undefined ? 'r+' : 'w';
|
||||
this[_defaultFlag] = opt.flags === undefined;
|
||||
this[_flags] = opt.flags === undefined ? defaultFlag : opt.flags;
|
||||
if (this[_fd] === undefined) {
|
||||
this[_open]();
|
||||
}
|
||||
}
|
||||
emit(ev, ...args) {
|
||||
if (ev === 'error') {
|
||||
if (this[_errored]) {
|
||||
return false;
|
||||
}
|
||||
this[_errored] = true;
|
||||
}
|
||||
return super.emit(ev, ...args);
|
||||
}
|
||||
get fd() {
|
||||
return this[_fd];
|
||||
}
|
||||
get path() {
|
||||
return this[_path];
|
||||
}
|
||||
[_onerror](er) {
|
||||
this[_close]();
|
||||
this[_writing] = true;
|
||||
this.emit('error', er);
|
||||
}
|
||||
[_open]() {
|
||||
fs.open(this[_path], this[_flags], this[_mode], (er, fd) => this[_onopen](er, fd));
|
||||
}
|
||||
[_onopen](er, fd) {
|
||||
if (this[_defaultFlag] &&
|
||||
this[_flags] === 'r+' &&
|
||||
er &&
|
||||
er.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
this[_open]();
|
||||
}
|
||||
else if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
this[_fd] = fd;
|
||||
this.emit('open', fd);
|
||||
if (!this[_writing]) {
|
||||
this[_flush]();
|
||||
}
|
||||
}
|
||||
}
|
||||
end(buf, enc) {
|
||||
if (buf) {
|
||||
//@ts-ignore
|
||||
this.write(buf, enc);
|
||||
}
|
||||
this[_ended] = true;
|
||||
// synthetic after-write logic, where drain/finish live
|
||||
if (!this[_writing] &&
|
||||
!this[_queue].length &&
|
||||
typeof this[_fd] === 'number') {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
write(buf, enc) {
|
||||
if (typeof buf === 'string') {
|
||||
buf = Buffer.from(buf, enc);
|
||||
}
|
||||
if (this[_ended]) {
|
||||
this.emit('error', new Error('write() after end()'));
|
||||
return false;
|
||||
}
|
||||
if (this[_fd] === undefined || this[_writing] || this[_queue].length) {
|
||||
this[_queue].push(buf);
|
||||
this[_needDrain] = true;
|
||||
return false;
|
||||
}
|
||||
this[_writing] = true;
|
||||
this[_write](buf);
|
||||
return true;
|
||||
}
|
||||
[_write](buf) {
|
||||
fs.write(this[_fd], buf, 0, buf.length, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
[_onwrite](er, bw) {
|
||||
if (er) {
|
||||
this[_onerror](er);
|
||||
}
|
||||
else {
|
||||
if (this[_pos] !== undefined && typeof bw === 'number') {
|
||||
this[_pos] += bw;
|
||||
}
|
||||
if (this[_queue].length) {
|
||||
this[_flush]();
|
||||
}
|
||||
else {
|
||||
this[_writing] = false;
|
||||
if (this[_ended] && !this[_finished]) {
|
||||
this[_finished] = true;
|
||||
this[_close]();
|
||||
this.emit('finish');
|
||||
}
|
||||
else if (this[_needDrain]) {
|
||||
this[_needDrain] = false;
|
||||
this.emit('drain');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
[_flush]() {
|
||||
if (this[_queue].length === 0) {
|
||||
if (this[_ended]) {
|
||||
this[_onwrite](null, 0);
|
||||
}
|
||||
}
|
||||
else if (this[_queue].length === 1) {
|
||||
this[_write](this[_queue].pop());
|
||||
}
|
||||
else {
|
||||
const iovec = this[_queue];
|
||||
this[_queue] = [];
|
||||
writev(this[_fd], iovec, this[_pos], (er, bw) => this[_onwrite](er, bw));
|
||||
}
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.close(fd, er => er ? this.emit('error', er) : this.emit('close'));
|
||||
}
|
||||
}
|
||||
}
|
||||
export class WriteStreamSync extends WriteStream {
|
||||
[_open]() {
|
||||
let fd;
|
||||
// only wrap in a try{} block if we know we'll retry, to avoid
|
||||
// the rethrow obscuring the error's source frame in most cases.
|
||||
if (this[_defaultFlag] && this[_flags] === 'r+') {
|
||||
try {
|
||||
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code === 'ENOENT') {
|
||||
this[_flags] = 'w';
|
||||
return this[_open]();
|
||||
}
|
||||
else {
|
||||
throw er;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
fd = fs.openSync(this[_path], this[_flags], this[_mode]);
|
||||
}
|
||||
this[_onopen](null, fd);
|
||||
}
|
||||
[_close]() {
|
||||
if (this[_autoClose] && typeof this[_fd] === 'number') {
|
||||
const fd = this[_fd];
|
||||
this[_fd] = undefined;
|
||||
fs.closeSync(fd);
|
||||
this.emit('close');
|
||||
}
|
||||
}
|
||||
[_write](buf) {
|
||||
// throw the original, but try to close if it fails
|
||||
let threw = true;
|
||||
try {
|
||||
this[_onwrite](null, fs.writeSync(this[_fd], buf, 0, buf.length, this[_pos]));
|
||||
threw = false;
|
||||
}
|
||||
finally {
|
||||
if (threw) {
|
||||
try {
|
||||
this[_close]();
|
||||
}
|
||||
catch {
|
||||
// ok error
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@isaacs/fs-minipass/dist/esm/index.js.map
generated
vendored
1
node_modules/@isaacs/fs-minipass/dist/esm/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/@isaacs/fs-minipass/dist/esm/package.json
generated
vendored
3
node_modules/@isaacs/fs-minipass/dist/esm/package.json
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
||||
72
node_modules/@isaacs/fs-minipass/package.json
generated
vendored
72
node_modules/@isaacs/fs-minipass/package.json
generated
vendored
|
|
@ -1,72 +0,0 @@
|
|||
{
|
||||
"name": "@isaacs/fs-minipass",
|
||||
"version": "4.0.1",
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"scripts": {
|
||||
"prepare": "tshy",
|
||||
"pretest": "npm run prepare",
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"format": "prettier --write . --loglevel warn",
|
||||
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "Isaac Z. Schlueter",
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/npm/fs-minipass.git"
|
||||
},
|
||||
"description": "fs read and write streams based on minipass",
|
||||
"dependencies": {
|
||||
"minipass": "^7.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.11.30",
|
||||
"mutate-fs": "^2.1.1",
|
||||
"prettier": "^3.2.5",
|
||||
"tap": "^18.7.1",
|
||||
"tshy": "^1.12.0",
|
||||
"typedoc": "^0.25.12"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"type": "module",
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
}
|
||||
22
node_modules/agent-base/LICENSE
generated
vendored
22
node_modules/agent-base/LICENSE
generated
vendored
|
|
@ -1,22 +0,0 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
69
node_modules/agent-base/README.md
generated
vendored
69
node_modules/agent-base/README.md
generated
vendored
|
|
@ -1,69 +0,0 @@
|
|||
agent-base
|
||||
==========
|
||||
### Turn a function into an [`http.Agent`][http.Agent] instance
|
||||
|
||||
This module is a thin wrapper around the base `http.Agent` class.
|
||||
|
||||
It provides an abstract class that must define a `connect()` function,
|
||||
which is responsible for creating the underlying socket that the HTTP
|
||||
client requests will use.
|
||||
|
||||
The `connect()` function may return an arbitrary `Duplex` stream, or
|
||||
another `http.Agent` instance to delegate the request to, and may be
|
||||
asynchronous (by defining an `async` function).
|
||||
|
||||
Instances of this agent can be used with the `http` and `https`
|
||||
modules. To differentiate, the options parameter in the `connect()`
|
||||
function includes a `secureEndpoint` property, which can be checked
|
||||
to determine what type of socket should be returned.
|
||||
|
||||
#### Some subclasses:
|
||||
|
||||
Here are some more interesting uses of `agent-base`.
|
||||
Send a pull request to list yours!
|
||||
|
||||
* [`http-proxy-agent`][http-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTP endpoints
|
||||
* [`https-proxy-agent`][https-proxy-agent]: An HTTP(s) proxy `http.Agent` implementation for HTTPS endpoints
|
||||
* [`pac-proxy-agent`][pac-proxy-agent]: A PAC file proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
* [`socks-proxy-agent`][socks-proxy-agent]: A SOCKS proxy `http.Agent` implementation for HTTP and HTTPS
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
Here's a minimal example that creates a new `net.Socket` or `tls.Socket`
|
||||
based on the `secureEndpoint` property. This agent can be used with both
|
||||
the `http` and `https` modules.
|
||||
|
||||
```ts
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import * as http from 'http';
|
||||
import { Agent } from 'agent-base';
|
||||
|
||||
class MyAgent extends Agent {
|
||||
connect(req, opts) {
|
||||
// `secureEndpoint` is true when using the "https" module
|
||||
if (opts.secureEndpoint) {
|
||||
return tls.connect(opts);
|
||||
} else {
|
||||
return net.connect(opts);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Keep alive enabled means that `connect()` will only be
|
||||
// invoked when a new connection needs to be created
|
||||
const agent = new MyAgent({ keepAlive: true });
|
||||
|
||||
// Pass the `agent` option when creating the HTTP request
|
||||
http.get('http://nodejs.org/api/', { agent }, (res) => {
|
||||
console.log('"response" event!', res.headers);
|
||||
res.pipe(process.stdout);
|
||||
});
|
||||
```
|
||||
|
||||
[http-proxy-agent]: ../http-proxy-agent
|
||||
[https-proxy-agent]: ../https-proxy-agent
|
||||
[pac-proxy-agent]: ../pac-proxy-agent
|
||||
[socks-proxy-agent]: ../socks-proxy-agent
|
||||
[http.Agent]: https://nodejs.org/api/http.html#http_class_http_agent
|
||||
15
node_modules/agent-base/dist/helpers.d.ts
generated
vendored
15
node_modules/agent-base/dist/helpers.d.ts
generated
vendored
|
|
@ -1,15 +0,0 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as http from 'http';
|
||||
import * as https from 'https';
|
||||
import type { Readable } from 'stream';
|
||||
export type ThenableRequest = http.ClientRequest & {
|
||||
then: Promise<http.IncomingMessage>['then'];
|
||||
};
|
||||
export declare function toBuffer(stream: Readable): Promise<Buffer>;
|
||||
export declare function json(stream: Readable): Promise<any>;
|
||||
export declare function req(url: string | URL, opts?: https.RequestOptions): ThenableRequest;
|
||||
//# sourceMappingURL=helpers.d.ts.map
|
||||
1
node_modules/agent-base/dist/helpers.d.ts.map
generated
vendored
1
node_modules/agent-base/dist/helpers.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,aAAa,GAAG;IAClD,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,wBAAsB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAQhE;AAGD,wBAAsB,IAAI,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,CAUzD;AAED,wBAAgB,GAAG,CAClB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,IAAI,GAAE,KAAK,CAAC,cAAmB,GAC7B,eAAe,CAcjB"}
|
||||
66
node_modules/agent-base/dist/helpers.js
generated
vendored
66
node_modules/agent-base/dist/helpers.js
generated
vendored
|
|
@ -1,66 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.req = exports.json = exports.toBuffer = void 0;
|
||||
const http = __importStar(require("http"));
|
||||
const https = __importStar(require("https"));
|
||||
async function toBuffer(stream) {
|
||||
let length = 0;
|
||||
const chunks = [];
|
||||
for await (const chunk of stream) {
|
||||
length += chunk.length;
|
||||
chunks.push(chunk);
|
||||
}
|
||||
return Buffer.concat(chunks, length);
|
||||
}
|
||||
exports.toBuffer = toBuffer;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async function json(stream) {
|
||||
const buf = await toBuffer(stream);
|
||||
const str = buf.toString('utf8');
|
||||
try {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
catch (_err) {
|
||||
const err = _err;
|
||||
err.message += ` (input: ${str})`;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
exports.json = json;
|
||||
function req(url, opts = {}) {
|
||||
const href = typeof url === 'string' ? url : url.href;
|
||||
const req = (href.startsWith('https:') ? https : http).request(url, opts);
|
||||
const promise = new Promise((resolve, reject) => {
|
||||
req
|
||||
.once('response', resolve)
|
||||
.once('error', reject)
|
||||
.end();
|
||||
});
|
||||
req.then = promise.then.bind(promise);
|
||||
return req;
|
||||
}
|
||||
exports.req = req;
|
||||
//# sourceMappingURL=helpers.js.map
|
||||
1
node_modules/agent-base/dist/helpers.js.map
generated
vendored
1
node_modules/agent-base/dist/helpers.js.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA6B;AAC7B,6CAA+B;AAOxB,KAAK,UAAU,QAAQ,CAAC,MAAgB;IAC9C,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;QACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACnB;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACtC,CAAC;AARD,4BAQC;AAED,8DAA8D;AACvD,KAAK,UAAU,IAAI,CAAC,MAAgB;IAC1C,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,IAAI;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACvB;IAAC,OAAO,IAAa,EAAE;QACvB,MAAM,GAAG,GAAG,IAAa,CAAC;QAC1B,GAAG,CAAC,OAAO,IAAI,YAAY,GAAG,GAAG,CAAC;QAClC,MAAM,GAAG,CAAC;KACV;AACF,CAAC;AAVD,oBAUC;AAED,SAAgB,GAAG,CAClB,GAAiB,EACjB,OAA6B,EAAE;IAE/B,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACtD,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAC7D,GAAG,EACH,IAAI,CACe,CAAC;IACrB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAuB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrE,GAAG;aACD,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC;aACzB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC;aACrB,GAAG,EAAqB,CAAC;IAC5B,CAAC,CAAC,CAAC;IACH,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,GAAG,CAAC;AACZ,CAAC;AAjBD,kBAiBC"}
|
||||
41
node_modules/agent-base/dist/index.d.ts
generated
vendored
41
node_modules/agent-base/dist/index.d.ts
generated
vendored
|
|
@ -1,41 +0,0 @@
|
|||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
/// <reference types="node" />
|
||||
import * as net from 'net';
|
||||
import * as tls from 'tls';
|
||||
import * as http from 'http';
|
||||
import type { Duplex } from 'stream';
|
||||
export * from './helpers';
|
||||
interface HttpConnectOpts extends net.TcpNetConnectOpts {
|
||||
secureEndpoint: false;
|
||||
protocol?: string;
|
||||
}
|
||||
interface HttpsConnectOpts extends tls.ConnectionOptions {
|
||||
secureEndpoint: true;
|
||||
protocol?: string;
|
||||
port: number;
|
||||
}
|
||||
export type AgentConnectOpts = HttpConnectOpts | HttpsConnectOpts;
|
||||
declare const INTERNAL: unique symbol;
|
||||
export declare abstract class Agent extends http.Agent {
|
||||
private [INTERNAL];
|
||||
options: Partial<net.TcpNetConnectOpts & tls.ConnectionOptions>;
|
||||
keepAlive: boolean;
|
||||
constructor(opts?: http.AgentOptions);
|
||||
abstract connect(req: http.ClientRequest, options: AgentConnectOpts): Promise<Duplex | http.Agent> | Duplex | http.Agent;
|
||||
/**
|
||||
* Determine whether this is an `http` or `https` request.
|
||||
*/
|
||||
isSecureEndpoint(options?: AgentConnectOpts): boolean;
|
||||
private incrementSockets;
|
||||
private decrementSockets;
|
||||
getName(options: AgentConnectOpts): string;
|
||||
createSocket(req: http.ClientRequest, options: AgentConnectOpts, cb: (err: Error | null, s?: Duplex) => void): void;
|
||||
createConnection(): Duplex;
|
||||
get defaultPort(): number;
|
||||
set defaultPort(v: number);
|
||||
get protocol(): string;
|
||||
set protocol(v: string);
|
||||
}
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/agent-base/dist/index.d.ts.map
generated
vendored
1
node_modules/agent-base/dist/index.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,GAAG,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,cAAc,WAAW,CAAC;AAE1B,UAAU,eAAgB,SAAQ,GAAG,CAAC,iBAAiB;IACtD,cAAc,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,gBAAiB,SAAQ,GAAG,CAAC,iBAAiB;IACvD,cAAc,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAElE,QAAA,MAAM,QAAQ,eAAmC,CAAC;AAQlD,8BAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAC7C,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAgB;IAGlC,OAAO,EAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,GAAG,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACjE,SAAS,EAAG,OAAO,CAAC;gBAER,IAAI,CAAC,EAAE,IAAI,CAAC,YAAY;IAKpC,QAAQ,CAAC,OAAO,CACf,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK;IAErD;;OAEG;IACH,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO;IAqCrD,OAAO,CAAC,gBAAgB;IAqBxB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM;IAa1C,YAAY,CACX,GAAG,EAAE,IAAI,CAAC,aAAa,EACvB,OAAO,EAAE,gBAAgB,EACzB,EAAE,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;IAgC5C,gBAAgB,IAAI,MAAM;IAW1B,IAAI,WAAW,IAAI,MAAM,CAKxB;IAED,IAAI,WAAW,CAAC,CAAC,EAAE,MAAM,EAIxB;IAED,IAAI,QAAQ,IAAI,MAAM,CAKrB;IAED,IAAI,QAAQ,CAAC,CAAC,EAAE,MAAM,EAIrB;CACD"}
|
||||
180
node_modules/agent-base/dist/index.js
generated
vendored
180
node_modules/agent-base/dist/index.js
generated
vendored
|
|
@ -1,180 +0,0 @@
|
|||
"use strict";
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Agent = void 0;
|
||||
const net = __importStar(require("net"));
|
||||
const http = __importStar(require("http"));
|
||||
const https_1 = require("https");
|
||||
__exportStar(require("./helpers"), exports);
|
||||
const INTERNAL = Symbol('AgentBaseInternalState');
|
||||
class Agent extends http.Agent {
|
||||
constructor(opts) {
|
||||
super(opts);
|
||||
this[INTERNAL] = {};
|
||||
}
|
||||
/**
|
||||
* Determine whether this is an `http` or `https` request.
|
||||
*/
|
||||
isSecureEndpoint(options) {
|
||||
if (options) {
|
||||
// First check the `secureEndpoint` property explicitly, since this
|
||||
// means that a parent `Agent` is "passing through" to this instance.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if (typeof options.secureEndpoint === 'boolean') {
|
||||
return options.secureEndpoint;
|
||||
}
|
||||
// If no explicit `secure` endpoint, check if `protocol` property is
|
||||
// set. This will usually be the case since using a full string URL
|
||||
// or `URL` instance should be the most common usage.
|
||||
if (typeof options.protocol === 'string') {
|
||||
return options.protocol === 'https:';
|
||||
}
|
||||
}
|
||||
// Finally, if no `protocol` property was set, then fall back to
|
||||
// checking the stack trace of the current call stack, and try to
|
||||
// detect the "https" module.
|
||||
const { stack } = new Error();
|
||||
if (typeof stack !== 'string')
|
||||
return false;
|
||||
return stack
|
||||
.split('\n')
|
||||
.some((l) => l.indexOf('(https.js:') !== -1 ||
|
||||
l.indexOf('node:https:') !== -1);
|
||||
}
|
||||
// In order to support async signatures in `connect()` and Node's native
|
||||
// connection pooling in `http.Agent`, the array of sockets for each origin
|
||||
// has to be updated synchronously. This is so the length of the array is
|
||||
// accurate when `addRequest()` is next called. We achieve this by creating a
|
||||
// fake socket and adding it to `sockets[origin]` and incrementing
|
||||
// `totalSocketCount`.
|
||||
incrementSockets(name) {
|
||||
// If `maxSockets` and `maxTotalSockets` are both Infinity then there is no
|
||||
// need to create a fake socket because Node.js native connection pooling
|
||||
// will never be invoked.
|
||||
if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
|
||||
return null;
|
||||
}
|
||||
// All instances of `sockets` are expected TypeScript errors. The
|
||||
// alternative is to add it as a private property of this class but that
|
||||
// will break TypeScript subclassing.
|
||||
if (!this.sockets[name]) {
|
||||
// @ts-expect-error `sockets` is readonly in `@types/node`
|
||||
this.sockets[name] = [];
|
||||
}
|
||||
const fakeSocket = new net.Socket({ writable: false });
|
||||
this.sockets[name].push(fakeSocket);
|
||||
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
|
||||
this.totalSocketCount++;
|
||||
return fakeSocket;
|
||||
}
|
||||
decrementSockets(name, socket) {
|
||||
if (!this.sockets[name] || socket === null) {
|
||||
return;
|
||||
}
|
||||
const sockets = this.sockets[name];
|
||||
const index = sockets.indexOf(socket);
|
||||
if (index !== -1) {
|
||||
sockets.splice(index, 1);
|
||||
// @ts-expect-error `totalSocketCount` isn't defined in `@types/node`
|
||||
this.totalSocketCount--;
|
||||
if (sockets.length === 0) {
|
||||
// @ts-expect-error `sockets` is readonly in `@types/node`
|
||||
delete this.sockets[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
// In order to properly update the socket pool, we need to call `getName()` on
|
||||
// the core `https.Agent` if it is a secureEndpoint.
|
||||
getName(options) {
|
||||
const secureEndpoint = typeof options.secureEndpoint === 'boolean'
|
||||
? options.secureEndpoint
|
||||
: this.isSecureEndpoint(options);
|
||||
if (secureEndpoint) {
|
||||
// @ts-expect-error `getName()` isn't defined in `@types/node`
|
||||
return https_1.Agent.prototype.getName.call(this, options);
|
||||
}
|
||||
// @ts-expect-error `getName()` isn't defined in `@types/node`
|
||||
return super.getName(options);
|
||||
}
|
||||
createSocket(req, options, cb) {
|
||||
const connectOpts = {
|
||||
...options,
|
||||
secureEndpoint: this.isSecureEndpoint(options),
|
||||
};
|
||||
const name = this.getName(connectOpts);
|
||||
const fakeSocket = this.incrementSockets(name);
|
||||
Promise.resolve()
|
||||
.then(() => this.connect(req, connectOpts))
|
||||
.then((socket) => {
|
||||
this.decrementSockets(name, fakeSocket);
|
||||
if (socket instanceof http.Agent) {
|
||||
try {
|
||||
// @ts-expect-error `addRequest()` isn't defined in `@types/node`
|
||||
return socket.addRequest(req, connectOpts);
|
||||
}
|
||||
catch (err) {
|
||||
return cb(err);
|
||||
}
|
||||
}
|
||||
this[INTERNAL].currentSocket = socket;
|
||||
// @ts-expect-error `createSocket()` isn't defined in `@types/node`
|
||||
super.createSocket(req, options, cb);
|
||||
}, (err) => {
|
||||
this.decrementSockets(name, fakeSocket);
|
||||
cb(err);
|
||||
});
|
||||
}
|
||||
createConnection() {
|
||||
const socket = this[INTERNAL].currentSocket;
|
||||
this[INTERNAL].currentSocket = undefined;
|
||||
if (!socket) {
|
||||
throw new Error('No socket was returned in the `connect()` function');
|
||||
}
|
||||
return socket;
|
||||
}
|
||||
get defaultPort() {
|
||||
return (this[INTERNAL].defaultPort ??
|
||||
(this.protocol === 'https:' ? 443 : 80));
|
||||
}
|
||||
set defaultPort(v) {
|
||||
if (this[INTERNAL]) {
|
||||
this[INTERNAL].defaultPort = v;
|
||||
}
|
||||
}
|
||||
get protocol() {
|
||||
return (this[INTERNAL].protocol ??
|
||||
(this.isSecureEndpoint() ? 'https:' : 'http:'));
|
||||
}
|
||||
set protocol(v) {
|
||||
if (this[INTERNAL]) {
|
||||
this[INTERNAL].protocol = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.Agent = Agent;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/agent-base/dist/index.js.map
generated
vendored
1
node_modules/agent-base/dist/index.js.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA2B;AAE3B,2CAA6B;AAC7B,iCAA4C;AAG5C,4CAA0B;AAe1B,MAAM,QAAQ,GAAG,MAAM,CAAC,wBAAwB,CAAC,CAAC;AAQlD,MAAsB,KAAM,SAAQ,IAAI,CAAC,KAAK;IAO7C,YAAY,IAAwB;QACnC,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IACrB,CAAC;IAOD;;OAEG;IACH,gBAAgB,CAAC,OAA0B;QAC1C,IAAI,OAAO,EAAE;YACZ,mEAAmE;YACnE,qEAAqE;YACrE,8DAA8D;YAC9D,IAAI,OAAQ,OAAe,CAAC,cAAc,KAAK,SAAS,EAAE;gBACzD,OAAO,OAAO,CAAC,cAAc,CAAC;aAC9B;YAED,oEAAoE;YACpE,mEAAmE;YACnE,qDAAqD;YACrD,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACzC,OAAO,OAAO,CAAC,QAAQ,KAAK,QAAQ,CAAC;aACrC;SACD;QAED,gEAAgE;QAChE,iEAAiE;QACjE,6BAA6B;QAC7B,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,KAAK,EAAE,CAAC;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,OAAO,KAAK;aACV,KAAK,CAAC,IAAI,CAAC;aACX,IAAI,CACJ,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YAC9B,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAChC,CAAC;IACJ,CAAC;IAED,wEAAwE;IACxE,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,kEAAkE;IAClE,sBAAsB;IACd,gBAAgB,CAAC,IAAY;QACpC,2EAA2E;QAC3E,yEAAyE;QACzE,yBAAyB;QACzB,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,IAAI,CAAC,eAAe,KAAK,QAAQ,EAAE;YACtE,OAAO,IAAI,CAAC;SACZ;QACD,iEAAiE;QACjE,wEAAwE;QACxE,qCAAqC;QACrC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;YACxB,0DAA0D;YAC1D,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;SACxB;QACD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;QACtD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtD,qEAAqE;QACrE,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,gBAAgB,CAAC,IAAY,EAAE,MAAyB;QAC/D,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,MAAM,KAAK,IAAI,EAAE;YAC3C,OAAO;SACP;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAiB,CAAC;QACnD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE;YACjB,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;YACzB,sEAAsE;YACtE,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;gBACzB,0DAA0D;gBAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;aAC1B;SACD;IACF,CAAC;IAED,8EAA8E;IAC9E,oDAAoD;IACpD,OAAO,CAAC,OAAyB;QAChC,MAAM,cAAc,GACnB,OAAO,OAAO,CAAC,cAAc,KAAK,SAAS;YAC1C,CAAC,CAAC,OAAO,CAAC,cAAc;YACxB,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QACnC,IAAI,cAAc,EAAE;YACnB,8DAA8D;YAC9D,OAAO,aAAU,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SACxD;QACD,8DAA8D;QAC9D,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY,CACX,GAAuB,EACvB,OAAyB,EACzB,EAA2C;QAE3C,MAAM,WAAW,GAAG;YACnB,GAAG,OAAO;YACV,cAAc,EAAE,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;SAC9C,CAAC;QACF,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAC,OAAO,EAAE;aACf,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;aAC1C,IAAI,CACJ,CAAC,MAAM,EAAE,EAAE;YACV,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACxC,IAAI,MAAM,YAAY,IAAI,CAAC,KAAK,EAAE;gBACjC,IAAI;oBACH,iEAAiE;oBACjE,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;iBAC3C;gBAAC,OAAO,GAAY,EAAE;oBACtB,OAAO,EAAE,CAAC,GAAY,CAAC,CAAC;iBACxB;aACD;YACD,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,GAAG,MAAM,CAAC;YACtC,mEAAmE;YACnE,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACtC,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACP,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;YACxC,EAAE,CAAC,GAAG,CAAC,CAAC;QACT,CAAC,CACD,CAAC;IACJ,CAAC;IAED,gBAAgB;QACf,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,CAAC;QAC5C,IAAI,CAAC,QAAQ,CAAC,CAAC,aAAa,GAAG,SAAS,CAAC;QACzC,IAAI,CAAC,MAAM,EAAE;YACZ,MAAM,IAAI,KAAK,CACd,oDAAoD,CACpD,CAAC;SACF;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,IAAI,WAAW;QACd,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW;YAC1B,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CACvC,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,CAAS;QACxB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,WAAW,GAAG,CAAC,CAAC;SAC/B;IACF,CAAC;IAED,IAAI,QAAQ;QACX,OAAO,CACN,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ;YACvB,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAC9C,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,CAAS;QACrB,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;YACnB,IAAI,CAAC,QAAQ,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC;SAC5B;IACF,CAAC;CACD;AArLD,sBAqLC"}
|
||||
46
node_modules/agent-base/package.json
generated
vendored
46
node_modules/agent-base/package.json
generated
vendored
|
|
@ -1,46 +0,0 @@
|
|||
{
|
||||
"name": "agent-base",
|
||||
"version": "7.1.3",
|
||||
"description": "Turn a function into an `http.Agent` instance",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/TooTallNate/proxy-agents.git",
|
||||
"directory": "packages/agent-base"
|
||||
},
|
||||
"keywords": [
|
||||
"http",
|
||||
"agent",
|
||||
"base",
|
||||
"barebones",
|
||||
"https"
|
||||
],
|
||||
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/debug": "^4.1.7",
|
||||
"@types/jest": "^29.5.1",
|
||||
"@types/node": "^14.18.45",
|
||||
"@types/semver": "^7.3.13",
|
||||
"@types/ws": "^6.0.4",
|
||||
"async-listen": "^3.0.0",
|
||||
"jest": "^29.5.0",
|
||||
"ts-jest": "^29.1.0",
|
||||
"typescript": "^5.0.4",
|
||||
"ws": "^5.2.4",
|
||||
"tsconfig": "0.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "jest --env node --verbose --bail",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"pack": "node ../../scripts/pack.mjs"
|
||||
}
|
||||
}
|
||||
15
node_modules/bin-links/LICENSE
generated
vendored
15
node_modules/bin-links/LICENSE
generated
vendored
|
|
@ -1,15 +0,0 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) npm, Inc.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
90
node_modules/bin-links/README.md
generated
vendored
90
node_modules/bin-links/README.md
generated
vendored
|
|
@ -1,90 +0,0 @@
|
|||
# bin-links [](https://npm.im/bin-links) [](https://npm.im/bin-links) [](https://travis-ci.org/npm/bin-links) [](https://ci.appveyor.com/project/npm/bin-links) [](https://coveralls.io/github/npm/bin-links?branch=latest)
|
||||
|
||||
[`bin-links`](https://github.com/npm/bin-links) is a standalone library that links
|
||||
binaries and man pages for JavaScript packages
|
||||
|
||||
## Install
|
||||
|
||||
`$ npm install bin-links`
|
||||
|
||||
## Table of Contents
|
||||
|
||||
* [Example](#example)
|
||||
* [Features](#features)
|
||||
* [Contributing](#contributing)
|
||||
* [API](#api)
|
||||
* [`binLinks`](#binLinks)
|
||||
* [`binLinks.getPaths()`](#getPaths)
|
||||
* [`binLinks.checkBins()`](#checkBins)
|
||||
|
||||
### Example
|
||||
|
||||
```javascript
|
||||
const binLinks = require('bin-links')
|
||||
const readPackageJson = require('read-package-json-fast')
|
||||
binLinks({
|
||||
path: '/path/to/node_modules/some-package',
|
||||
pkg: readPackageJson('/path/to/node_modules/some-package/package.json'),
|
||||
|
||||
// true if it's a global install, false for local. default: false
|
||||
global: true,
|
||||
|
||||
// true if it's the top level package being installed, false otherwise
|
||||
top: true,
|
||||
|
||||
// true if you'd like to recklessly overwrite files.
|
||||
force: true,
|
||||
})
|
||||
```
|
||||
|
||||
### Features
|
||||
|
||||
* Links bin files listed under the `bin` property of pkg to the
|
||||
`node_modules/.bin` directory of the installing environment. (Or
|
||||
`${prefix}/bin` for top level global packages on unix, and `${prefix}`
|
||||
for top level global packages on Windows.)
|
||||
* Links man files listed under the `man` property of pkg to the share/man
|
||||
directory. (This is only done for top-level global packages on Unix
|
||||
systems.)
|
||||
|
||||
### Contributing
|
||||
|
||||
The npm team enthusiastically welcomes contributions and project participation!
|
||||
There's a bunch of things you can do if you want to contribute! The [Contributor
|
||||
Guide](CONTRIBUTING.md) has all the information you need for everything from
|
||||
reporting bugs to contributing entire new features. Please don't hesitate to
|
||||
jump in if you'd like to, or even ask us questions if something isn't clear.
|
||||
|
||||
### API
|
||||
|
||||
#### <a name="binLinks"></a> `> binLinks({path, pkg, force, global, top})`
|
||||
|
||||
Returns a Promise that resolves when the requisite things have been linked.
|
||||
|
||||
#### <a name="getPaths"></a> `> binLinks.getPaths({path, pkg, global, top })`
|
||||
|
||||
Returns an array of all the paths of links and shims that _might_ be
|
||||
created (assuming that they exist!) for the package at the specified path.
|
||||
|
||||
Does not touch the filesystem.
|
||||
|
||||
#### <a name="checkBins"></a> `> binLinks.checkBins({path, pkg, global, top, force })`
|
||||
|
||||
Checks if there are any conflicting bins which will prevent the linking of
|
||||
bins for the given package. Returns a Promise that resolves with no value
|
||||
if the way is clear, and rejects if there's something in the way.
|
||||
|
||||
Always returns successfully if `global` or `top` are false, or if `force`
|
||||
is true, or if the `pkg` object does not contain any bins to link.
|
||||
|
||||
Note that changes to the file system _may_ still cause the `binLinks`
|
||||
method to fail even if this method succeeds. Does not check for
|
||||
conflicting `man` links.
|
||||
|
||||
Reads from the filesystem but does not make any changes.
|
||||
|
||||
##### Example
|
||||
|
||||
```javascript
|
||||
binLinks({path, pkg, force, global, top}).then(() => console.log('bins linked!'))
|
||||
```
|
||||
9
node_modules/bin-links/lib/bin-target.js
generated
vendored
9
node_modules/bin-links/lib/bin-target.js
generated
vendored
|
|
@ -1,9 +0,0 @@
|
|||
const isWindows = require('./is-windows.js')
|
||||
const getPrefix = require('./get-prefix.js')
|
||||
const getNodeModules = require('./get-node-modules.js')
|
||||
const { dirname } = require('path')
|
||||
|
||||
module.exports = ({ top, path }) =>
|
||||
!top ? getNodeModules(path) + '/.bin'
|
||||
: isWindows ? getPrefix(path)
|
||||
: dirname(getPrefix(path)) + '/bin'
|
||||
74
node_modules/bin-links/lib/check-bin.js
generated
vendored
74
node_modules/bin-links/lib/check-bin.js
generated
vendored
|
|
@ -1,74 +0,0 @@
|
|||
// check to see if a bin is allowed to be overwritten
|
||||
// either rejects or resolves to nothing. return value not relevant.
|
||||
const isWindows = require('./is-windows.js')
|
||||
const binTarget = require('./bin-target.js')
|
||||
const { resolve, dirname } = require('path')
|
||||
const readCmdShim = require('read-cmd-shim')
|
||||
const { readlink } = require('fs/promises')
|
||||
|
||||
const checkBin = async ({ bin, path, top, global, force }) => {
|
||||
// always ok to clobber when forced
|
||||
// always ok to clobber local bins, or when forced
|
||||
if (force || !global || !top) {
|
||||
return
|
||||
}
|
||||
|
||||
// ok, need to make sure, then
|
||||
const target = resolve(binTarget({ path, top }), bin)
|
||||
path = resolve(path)
|
||||
return isWindows ? checkShim({ target, path }) : checkLink({ target, path })
|
||||
}
|
||||
|
||||
// only enoent is allowed. anything else is a problem.
|
||||
const handleReadLinkError = async ({ er, target }) =>
|
||||
er.code === 'ENOENT' ? null
|
||||
: failEEXIST({ target })
|
||||
|
||||
const checkLink = async ({ target, path }) => {
|
||||
const current = await readlink(target)
|
||||
.catch(er => handleReadLinkError({ er, target }))
|
||||
|
||||
if (!current) {
|
||||
return
|
||||
}
|
||||
|
||||
const resolved = resolve(dirname(target), current)
|
||||
|
||||
if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) {
|
||||
return failEEXIST({ target })
|
||||
}
|
||||
}
|
||||
|
||||
const handleReadCmdShimError = ({ er, target }) =>
|
||||
er.code === 'ENOENT' ? null
|
||||
: failEEXIST({ target })
|
||||
|
||||
const failEEXIST = ({ target }) =>
|
||||
Promise.reject(Object.assign(new Error('EEXIST: file already exists'), {
|
||||
path: target,
|
||||
code: 'EEXIST',
|
||||
}))
|
||||
|
||||
const checkShim = async ({ target, path }) => {
|
||||
const shims = [
|
||||
target,
|
||||
target + '.cmd',
|
||||
target + '.ps1',
|
||||
]
|
||||
await Promise.all(shims.map(async shim => {
|
||||
const current = await readCmdShim(shim)
|
||||
.catch(er => handleReadCmdShimError({ er, target: shim }))
|
||||
|
||||
if (!current) {
|
||||
return
|
||||
}
|
||||
|
||||
const resolved = resolve(dirname(shim), current.replace(/\\/g, '/'))
|
||||
|
||||
if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) {
|
||||
return failEEXIST({ target: shim })
|
||||
}
|
||||
}))
|
||||
}
|
||||
|
||||
module.exports = checkBin
|
||||
18
node_modules/bin-links/lib/check-bins.js
generated
vendored
18
node_modules/bin-links/lib/check-bins.js
generated
vendored
|
|
@ -1,18 +0,0 @@
|
|||
const checkBin = require('./check-bin.js')
|
||||
const normalize = require('npm-normalize-package-bin')
|
||||
const checkBins = async ({ pkg, path, top, global, force }) => {
|
||||
// always ok to clobber when forced
|
||||
// always ok to clobber local bins, or when forced
|
||||
if (force || !global || !top) {
|
||||
return
|
||||
}
|
||||
|
||||
pkg = normalize(pkg)
|
||||
if (!pkg.bin) {
|
||||
return
|
||||
}
|
||||
|
||||
await Promise.all(Object.keys(pkg.bin)
|
||||
.map(bin => checkBin({ bin, path, top, global, force })))
|
||||
}
|
||||
module.exports = checkBins
|
||||
42
node_modules/bin-links/lib/fix-bin.js
generated
vendored
42
node_modules/bin-links/lib/fix-bin.js
generated
vendored
|
|
@ -1,42 +0,0 @@
|
|||
// make sure that bins are executable, and that they don't have
|
||||
// windows line-endings on the hashbang line.
|
||||
const {
|
||||
chmod,
|
||||
open,
|
||||
readFile,
|
||||
} = require('fs/promises')
|
||||
|
||||
const execMode = 0o777 & (~process.umask())
|
||||
|
||||
const writeFileAtomic = require('write-file-atomic')
|
||||
|
||||
const isWindowsHashBang = buf =>
|
||||
buf[0] === '#'.charCodeAt(0) &&
|
||||
buf[1] === '!'.charCodeAt(0) &&
|
||||
/^#![^\n]+\r\n/.test(buf.toString())
|
||||
|
||||
const isWindowsHashbangFile = file => {
|
||||
const FALSE = () => false
|
||||
return open(file, 'r').then(fh => {
|
||||
const buf = Buffer.alloc(2048)
|
||||
return fh.read(buf, 0, 2048, 0)
|
||||
.then(
|
||||
() => {
|
||||
const isWHB = isWindowsHashBang(buf)
|
||||
return fh.close().then(() => isWHB, () => isWHB)
|
||||
},
|
||||
// don't leak FD if read() fails
|
||||
() => fh.close().then(FALSE, FALSE)
|
||||
)
|
||||
}, FALSE)
|
||||
}
|
||||
|
||||
const dos2Unix = file =>
|
||||
readFile(file, 'utf8').then(content =>
|
||||
writeFileAtomic(file, content.replace(/^(#![^\n]+)\r\n/, '$1\n')))
|
||||
|
||||
const fixBin = (file, mode = execMode) => chmod(file, mode)
|
||||
.then(() => isWindowsHashbangFile(file))
|
||||
.then(isWHB => isWHB ? dos2Unix(file) : null)
|
||||
|
||||
module.exports = fixBin
|
||||
19
node_modules/bin-links/lib/get-node-modules.js
generated
vendored
19
node_modules/bin-links/lib/get-node-modules.js
generated
vendored
|
|
@ -1,19 +0,0 @@
|
|||
// we know it's global and/or not top, so the path has to be
|
||||
// {prefix}/node_modules/{name}. Can't rely on pkg.name, because
|
||||
// it might be installed as an alias.
|
||||
|
||||
const { dirname, basename } = require('path')
|
||||
// this gets called a lot and can't change, so memoize it
|
||||
const memo = new Map()
|
||||
module.exports = path => {
|
||||
if (memo.has(path)) {
|
||||
return memo.get(path)
|
||||
}
|
||||
|
||||
const scopeOrNm = dirname(path)
|
||||
const nm = basename(scopeOrNm) === 'node_modules' ? scopeOrNm
|
||||
: dirname(scopeOrNm)
|
||||
|
||||
memo.set(path, nm)
|
||||
return nm
|
||||
}
|
||||
42
node_modules/bin-links/lib/get-paths.js
generated
vendored
42
node_modules/bin-links/lib/get-paths.js
generated
vendored
|
|
@ -1,42 +0,0 @@
|
|||
// get all the paths that are (or might be) installed for a given pkg
|
||||
// There's no guarantee that all of these will be installed, but if they
|
||||
// are present, then we can assume that they're associated.
|
||||
const binTarget = require('./bin-target.js')
|
||||
const manTarget = require('./man-target.js')
|
||||
const { resolve, basename, extname } = require('path')
|
||||
const isWindows = require('./is-windows.js')
|
||||
module.exports = ({ path, pkg, global, top }) => {
|
||||
if (top && !global) {
|
||||
return []
|
||||
}
|
||||
|
||||
const binSet = []
|
||||
const binTarg = binTarget({ path, top })
|
||||
if (pkg.bin) {
|
||||
for (const bin of Object.keys(pkg.bin)) {
|
||||
const b = resolve(binTarg, bin)
|
||||
binSet.push(b)
|
||||
if (isWindows) {
|
||||
binSet.push(b + '.cmd')
|
||||
binSet.push(b + '.ps1')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const manTarg = manTarget({ path, top })
|
||||
const manSet = []
|
||||
if (manTarg && pkg.man && Array.isArray(pkg.man) && pkg.man.length) {
|
||||
for (const man of pkg.man) {
|
||||
if (!/.\.[0-9]+(\.gz)?$/.test(man)) {
|
||||
return binSet
|
||||
}
|
||||
|
||||
const section = extname(basename(man, '.gz')).slice(1)
|
||||
const base = basename(man)
|
||||
|
||||
manSet.push(resolve(manTarg, 'man' + section, base))
|
||||
}
|
||||
}
|
||||
|
||||
return manSet.length ? [...binSet, ...manSet] : binSet
|
||||
}
|
||||
3
node_modules/bin-links/lib/get-prefix.js
generated
vendored
3
node_modules/bin-links/lib/get-prefix.js
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
const { dirname } = require('path')
|
||||
const getNodeModules = require('./get-node-modules.js')
|
||||
module.exports = path => dirname(getNodeModules(path))
|
||||
44
node_modules/bin-links/lib/index.js
generated
vendored
44
node_modules/bin-links/lib/index.js
generated
vendored
|
|
@ -1,44 +0,0 @@
|
|||
const linkBins = require('./link-bins.js')
|
||||
const linkMans = require('./link-mans.js')
|
||||
|
||||
const binLinks = opts => {
|
||||
const { path, pkg, force, global, top } = opts
|
||||
// global top pkgs on windows get bins installed in {prefix}, and no mans
|
||||
//
|
||||
// unix global top pkgs get their bins installed in {prefix}/bin,
|
||||
// and mans in {prefix}/share/man
|
||||
//
|
||||
// non-top pkgs get their bins installed in {prefix}/node_modules/.bin,
|
||||
// and do not install mans
|
||||
//
|
||||
// non-global top pkgs don't have any bins or mans linked. From here on
|
||||
// out, if it's top, we know that it's global, so no need to pass that
|
||||
// option further down the stack.
|
||||
if (top && !global) {
|
||||
return Promise.resolve()
|
||||
}
|
||||
|
||||
return Promise.all([
|
||||
// allow clobbering within the local node_modules/.bin folder.
|
||||
// only global bins are protected in this way, or else it is
|
||||
// yet another vector for excessive dependency conflicts.
|
||||
linkBins({ path, pkg, top, force: force || !top }),
|
||||
linkMans({ path, pkg, top, force }),
|
||||
])
|
||||
}
|
||||
|
||||
const shimBin = require('./shim-bin.js')
|
||||
const linkGently = require('./link-gently.js')
|
||||
const resetSeen = () => {
|
||||
shimBin.resetSeen()
|
||||
linkGently.resetSeen()
|
||||
}
|
||||
|
||||
const checkBins = require('./check-bins.js')
|
||||
const getPaths = require('./get-paths.js')
|
||||
|
||||
module.exports = Object.assign(binLinks, {
|
||||
checkBins,
|
||||
resetSeen,
|
||||
getPaths,
|
||||
})
|
||||
2
node_modules/bin-links/lib/is-windows.js
generated
vendored
2
node_modules/bin-links/lib/is-windows.js
generated
vendored
|
|
@ -1,2 +0,0 @@
|
|||
const platform = process.env.__TESTING_BIN_LINKS_PLATFORM__ || process.platform
|
||||
module.exports = platform === 'win32'
|
||||
9
node_modules/bin-links/lib/link-bin.js
generated
vendored
9
node_modules/bin-links/lib/link-bin.js
generated
vendored
|
|
@ -1,9 +0,0 @@
|
|||
const linkGently = require('./link-gently.js')
|
||||
const fixBin = require('./fix-bin.js')
|
||||
|
||||
// linking bins is simple. just symlink, and if we linked it, fix the bin up
|
||||
const linkBin = ({ path, to, from, absFrom, force }) =>
|
||||
linkGently({ path, to, from, absFrom, force })
|
||||
.then(linked => linked && fixBin(absFrom))
|
||||
|
||||
module.exports = linkBin
|
||||
23
node_modules/bin-links/lib/link-bins.js
generated
vendored
23
node_modules/bin-links/lib/link-bins.js
generated
vendored
|
|
@ -1,23 +0,0 @@
|
|||
const isWindows = require('./is-windows.js')
|
||||
const binTarget = require('./bin-target.js')
|
||||
const { dirname, resolve, relative } = require('path')
|
||||
const linkBin = isWindows ? require('./shim-bin.js') : require('./link-bin.js')
|
||||
const normalize = require('npm-normalize-package-bin')
|
||||
|
||||
const linkBins = ({ path, pkg, top, force }) => {
|
||||
pkg = normalize(pkg)
|
||||
if (!pkg.bin) {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
const promises = []
|
||||
const target = binTarget({ path, top })
|
||||
for (const [key, val] of Object.entries(pkg.bin)) {
|
||||
const to = resolve(target, key)
|
||||
const absFrom = resolve(path, val)
|
||||
const from = relative(dirname(to), absFrom)
|
||||
promises.push(linkBin({ path, from, to, absFrom, force }))
|
||||
}
|
||||
return Promise.all(promises)
|
||||
}
|
||||
|
||||
module.exports = linkBins
|
||||
96
node_modules/bin-links/lib/link-gently.js
generated
vendored
96
node_modules/bin-links/lib/link-gently.js
generated
vendored
|
|
@ -1,96 +0,0 @@
|
|||
// if the thing isn't there, skip it
|
||||
// if there's a non-symlink there already, eexist
|
||||
// if there's a symlink already, pointing somewhere else, eexist
|
||||
// if there's a symlink already, pointing into our pkg, remove it first
|
||||
// then create the symlink
|
||||
|
||||
const { resolve, dirname } = require('path')
|
||||
const { lstat, mkdir, readlink, rm, symlink } = require('fs/promises')
|
||||
const { log } = require('proc-log')
|
||||
const throwSignificant = er => {
|
||||
if (er.code === 'ENOENT') {
|
||||
return
|
||||
}
|
||||
if (er.code === 'EACCES') {
|
||||
log.warn('error adding file', er.message)
|
||||
return
|
||||
}
|
||||
throw er
|
||||
}
|
||||
|
||||
const rmOpts = {
|
||||
recursive: true,
|
||||
force: true,
|
||||
}
|
||||
|
||||
// even in --force mode, we never create a link over a link we've
|
||||
// already created. you can have multiple packages in a tree trying
|
||||
// to contend for the same bin, or the same manpage listed multiple times,
|
||||
// which creates a race condition and nondeterminism.
|
||||
const seen = new Set()
|
||||
|
||||
const SKIP = Symbol('skip - missing or already installed')
|
||||
const CLOBBER = Symbol('clobber - ours or in forceful mode')
|
||||
|
||||
const linkGently = async ({ path, to, from, absFrom, force }) => {
|
||||
if (seen.has(to)) {
|
||||
return false
|
||||
}
|
||||
seen.add(to)
|
||||
|
||||
// if the script or manpage isn't there, just ignore it.
|
||||
// this arguably *should* be an install error of some sort,
|
||||
// or at least a warning, but npm has always behaved this
|
||||
// way in the past, so it'd be a breaking change
|
||||
return Promise.all([
|
||||
lstat(absFrom).catch(throwSignificant),
|
||||
lstat(to).catch(throwSignificant),
|
||||
]).then(([stFrom, stTo]) => {
|
||||
// not present in package, skip it
|
||||
if (!stFrom) {
|
||||
return SKIP
|
||||
}
|
||||
|
||||
// exists! maybe clobber if we can
|
||||
if (stTo) {
|
||||
if (!stTo.isSymbolicLink()) {
|
||||
return force && rm(to, rmOpts).then(() => CLOBBER)
|
||||
}
|
||||
|
||||
return readlink(to).then(target => {
|
||||
if (target === from) {
|
||||
return SKIP
|
||||
} // skip it, already set up like we want it.
|
||||
|
||||
target = resolve(dirname(to), target)
|
||||
if (target.indexOf(path) === 0 || force) {
|
||||
return rm(to, rmOpts).then(() => CLOBBER)
|
||||
}
|
||||
// neither skip nor clobber
|
||||
return false
|
||||
})
|
||||
} else {
|
||||
// doesn't exist, dir might not either
|
||||
return mkdir(dirname(to), { recursive: true })
|
||||
}
|
||||
})
|
||||
.then(skipOrClobber => {
|
||||
if (skipOrClobber === SKIP) {
|
||||
return false
|
||||
}
|
||||
return symlink(from, to, 'file').catch(er => {
|
||||
if (skipOrClobber === CLOBBER || force) {
|
||||
return rm(to, rmOpts).then(() => symlink(from, to, 'file'))
|
||||
}
|
||||
throw er
|
||||
}).then(() => true)
|
||||
})
|
||||
}
|
||||
|
||||
const resetSeen = () => {
|
||||
for (const p of seen) {
|
||||
seen.delete(p)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Object.assign(linkGently, { resetSeen })
|
||||
53
node_modules/bin-links/lib/link-mans.js
generated
vendored
53
node_modules/bin-links/lib/link-mans.js
generated
vendored
|
|
@ -1,53 +0,0 @@
|
|||
const { dirname, relative, join, resolve, basename } = require('path')
|
||||
const linkGently = require('./link-gently.js')
|
||||
const manTarget = require('./man-target.js')
|
||||
|
||||
const linkMans = async ({ path, pkg, top, force }) => {
|
||||
const target = manTarget({ path, top })
|
||||
if (!target || !Array.isArray(pkg?.man) || !pkg.man.length) {
|
||||
return []
|
||||
}
|
||||
|
||||
const links = []
|
||||
// `new Set` to filter out duplicates
|
||||
for (let man of new Set(pkg.man)) {
|
||||
if (!man || typeof man !== 'string') {
|
||||
continue
|
||||
}
|
||||
// break any links to c:\\blah or /foo/blah or ../blah
|
||||
man = join('/', man).replace(/\\|:/g, '/').slice(1)
|
||||
const parseMan = man.match(/\.([0-9]+)(\.gz)?$/)
|
||||
if (!parseMan) {
|
||||
throw Object.assign(new Error('invalid man entry name\n' +
|
||||
'Man files must end with a number, ' +
|
||||
'and optionally a .gz suffix if they are compressed.'
|
||||
), {
|
||||
code: 'EBADMAN',
|
||||
path,
|
||||
pkgid: pkg._id,
|
||||
man,
|
||||
})
|
||||
}
|
||||
|
||||
const section = parseMan[1]
|
||||
const base = basename(man)
|
||||
const absFrom = resolve(path, man)
|
||||
/* istanbul ignore if - that unpossible */
|
||||
if (absFrom.indexOf(path) !== 0) {
|
||||
throw Object.assign(new Error('invalid man entry'), {
|
||||
code: 'EBADMAN',
|
||||
path,
|
||||
pkgid: pkg._id,
|
||||
man,
|
||||
})
|
||||
}
|
||||
|
||||
const to = resolve(target, 'man' + section, base)
|
||||
const from = relative(dirname(to), absFrom)
|
||||
|
||||
links.push(linkGently({ from, to, path, absFrom, force }))
|
||||
}
|
||||
return Promise.all(links)
|
||||
}
|
||||
|
||||
module.exports = linkMans
|
||||
6
node_modules/bin-links/lib/man-target.js
generated
vendored
6
node_modules/bin-links/lib/man-target.js
generated
vendored
|
|
@ -1,6 +0,0 @@
|
|||
const isWindows = require('./is-windows.js')
|
||||
const getPrefix = require('./get-prefix.js')
|
||||
const { dirname } = require('path')
|
||||
|
||||
module.exports = ({ top, path }) => !top || isWindows ? null
|
||||
: dirname(getPrefix(path)) + '/share/man'
|
||||
86
node_modules/bin-links/lib/shim-bin.js
generated
vendored
86
node_modules/bin-links/lib/shim-bin.js
generated
vendored
|
|
@ -1,86 +0,0 @@
|
|||
const { resolve, dirname } = require('path')
|
||||
const { lstat } = require('fs/promises')
|
||||
const throwNonEnoent = er => {
|
||||
if (er.code !== 'ENOENT') {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
|
||||
const cmdShim = require('cmd-shim')
|
||||
const readCmdShim = require('read-cmd-shim')
|
||||
|
||||
const fixBin = require('./fix-bin.js')
|
||||
|
||||
// even in --force mode, we never create a shim over a shim we've
|
||||
// already created. you can have multiple packages in a tree trying
|
||||
// to contend for the same bin, which creates a race condition and
|
||||
// nondeterminism.
|
||||
const seen = new Set()
|
||||
|
||||
const failEEXIST = ({ to, from }) =>
|
||||
Promise.reject(Object.assign(new Error('EEXIST: file already exists'), {
|
||||
path: to,
|
||||
dest: from,
|
||||
code: 'EEXIST',
|
||||
}))
|
||||
|
||||
const handleReadCmdShimError = ({ er, from, to }) =>
|
||||
er.code === 'ENOENT' ? null
|
||||
: er.code === 'ENOTASHIM' ? failEEXIST({ from, to })
|
||||
: Promise.reject(er)
|
||||
|
||||
const SKIP = Symbol('skip - missing or already installed')
|
||||
const shimBin = ({ path, to, from, absFrom, force }) => {
|
||||
const shims = [
|
||||
to,
|
||||
to + '.cmd',
|
||||
to + '.ps1',
|
||||
]
|
||||
|
||||
for (const shim of shims) {
|
||||
if (seen.has(shim)) {
|
||||
return true
|
||||
}
|
||||
seen.add(shim)
|
||||
}
|
||||
|
||||
return Promise.all([
|
||||
...shims,
|
||||
absFrom,
|
||||
].map(f => lstat(f).catch(throwNonEnoent))).then((stats) => {
|
||||
const [, , , stFrom] = stats
|
||||
if (!stFrom) {
|
||||
return SKIP
|
||||
}
|
||||
|
||||
if (force) {
|
||||
return false
|
||||
}
|
||||
|
||||
return Promise.all(shims.map((s, i) => [s, stats[i]]).map(([s, st]) => {
|
||||
if (!st) {
|
||||
return false
|
||||
}
|
||||
return readCmdShim(s)
|
||||
.then(target => {
|
||||
target = resolve(dirname(to), target)
|
||||
if (target.indexOf(resolve(path)) !== 0) {
|
||||
return failEEXIST({ from, to, path })
|
||||
}
|
||||
return false
|
||||
}, er => handleReadCmdShimError({ er, from, to }))
|
||||
}))
|
||||
})
|
||||
.then(skip => skip !== SKIP && doShim(absFrom, to))
|
||||
}
|
||||
|
||||
const doShim = (absFrom, to) =>
|
||||
cmdShim(absFrom, to).then(() => fixBin(absFrom))
|
||||
|
||||
const resetSeen = () => {
|
||||
for (const p of seen) {
|
||||
seen.delete(p)
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Object.assign(shimBin, { resetSeen })
|
||||
61
node_modules/bin-links/package.json
generated
vendored
61
node_modules/bin-links/package.json
generated
vendored
|
|
@ -1,61 +0,0 @@
|
|||
{
|
||||
"name": "bin-links",
|
||||
"version": "5.0.0",
|
||||
"description": "JavaScript package binary linker",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
"snap": "tap",
|
||||
"test": "tap",
|
||||
"lint": "npm run eslint",
|
||||
"postlint": "template-oss-check",
|
||||
"lintfix": "npm run eslint -- --fix",
|
||||
"posttest": "npm run lint",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/bin-links.git"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"link",
|
||||
"bins"
|
||||
],
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"cmd-shim": "^7.0.0",
|
||||
"npm-normalize-package-bin": "^4.0.0",
|
||||
"proc-log": "^5.0.0",
|
||||
"read-cmd-shim": "^5.0.0",
|
||||
"write-file-atomic": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^5.0.0",
|
||||
"@npmcli/template-oss": "4.23.3",
|
||||
"require-inject": "^1.4.4",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"tap": {
|
||||
"check-coverage": true,
|
||||
"coverage-map": "map.js",
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
},
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"windowsCI": false,
|
||||
"version": "4.23.3",
|
||||
"publish": true
|
||||
}
|
||||
}
|
||||
63
node_modules/chownr/LICENSE.md
generated
vendored
63
node_modules/chownr/LICENSE.md
generated
vendored
|
|
@ -1,63 +0,0 @@
|
|||
All packages under `src/` are licensed according to the terms in
|
||||
their respective `LICENSE` or `LICENSE.md` files.
|
||||
|
||||
The remainder of this project is licensed under the Blue Oak
|
||||
Model License, as follows:
|
||||
|
||||
-----
|
||||
|
||||
# Blue Oak Model License
|
||||
|
||||
Version 1.0.0
|
||||
|
||||
## Purpose
|
||||
|
||||
This license gives everyone as much permission to work with
|
||||
this software as possible, while protecting contributors
|
||||
from liability.
|
||||
|
||||
## Acceptance
|
||||
|
||||
In order to receive this license, you must agree to its
|
||||
rules. The rules of this license are both obligations
|
||||
under that agreement and conditions to your license.
|
||||
You must not do anything with this software that triggers
|
||||
a rule that you cannot or will not follow.
|
||||
|
||||
## Copyright
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe that contributor's
|
||||
copyright in it.
|
||||
|
||||
## Notices
|
||||
|
||||
You must ensure that everyone who gets a copy of
|
||||
any part of this software from you, with or without
|
||||
changes, also gets the text of this license or a link to
|
||||
<https://blueoakcouncil.org/license/1.0.0>.
|
||||
|
||||
## Excuse
|
||||
|
||||
If anyone notifies you in writing that you have not
|
||||
complied with [Notices](#notices), you can keep your
|
||||
license by taking all practical steps to comply within 30
|
||||
days after the notice. If you do not do so, your license
|
||||
ends immediately.
|
||||
|
||||
## Patent
|
||||
|
||||
Each contributor licenses you to do everything with this
|
||||
software that would otherwise infringe any patent claims
|
||||
they can license or become able to license.
|
||||
|
||||
## Reliability
|
||||
|
||||
No contributor can revoke this license.
|
||||
|
||||
## No Liability
|
||||
|
||||
***As far as the law allows, this software comes as is,
|
||||
without any warranty or condition, and no contributor
|
||||
will be liable to anyone for any damages related to this
|
||||
software or this license, under any kind of legal claim.***
|
||||
3
node_modules/chownr/README.md
generated
vendored
3
node_modules/chownr/README.md
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
Like `chown -R`.
|
||||
|
||||
Takes the same arguments as `fs.chown()`
|
||||
3
node_modules/chownr/dist/commonjs/index.d.ts
generated
vendored
3
node_modules/chownr/dist/commonjs/index.d.ts
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void;
|
||||
export declare const chownrSync: (p: string, uid: number, gid: number) => void;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/chownr/dist/commonjs/index.d.ts.map
generated
vendored
1
node_modules/chownr/dist/commonjs/index.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,MAAM,MACd,MAAM,OACJ,MAAM,OACN,MAAM,YACD,OAAO,KAAK,GAAG,SA0B1B,CAAA;AAcD,eAAO,MAAM,UAAU,MAAO,MAAM,OAAO,MAAM,OAAO,MAAM,SAiB7D,CAAA"}
|
||||
93
node_modules/chownr/dist/commonjs/index.js
generated
vendored
93
node_modules/chownr/dist/commonjs/index.js
generated
vendored
|
|
@ -1,93 +0,0 @@
|
|||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.chownrSync = exports.chownr = void 0;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const lchownSync = (path, uid, gid) => {
|
||||
try {
|
||||
return node_fs_1.default.lchownSync(path, uid, gid);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code !== 'ENOENT')
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
const chown = (cpath, uid, gid, cb) => {
|
||||
node_fs_1.default.lchown(cpath, uid, gid, er => {
|
||||
// Skip ENOENT error
|
||||
cb(er && er?.code !== 'ENOENT' ? er : null);
|
||||
});
|
||||
};
|
||||
const chownrKid = (p, child, uid, gid, cb) => {
|
||||
if (child.isDirectory()) {
|
||||
(0, exports.chownr)(node_path_1.default.resolve(p, child.name), uid, gid, (er) => {
|
||||
if (er)
|
||||
return cb(er);
|
||||
const cpath = node_path_1.default.resolve(p, child.name);
|
||||
chown(cpath, uid, gid, cb);
|
||||
});
|
||||
}
|
||||
else {
|
||||
const cpath = node_path_1.default.resolve(p, child.name);
|
||||
chown(cpath, uid, gid, cb);
|
||||
}
|
||||
};
|
||||
const chownr = (p, uid, gid, cb) => {
|
||||
node_fs_1.default.readdir(p, { withFileTypes: true }, (er, children) => {
|
||||
// any error other than ENOTDIR or ENOTSUP means it's not readable,
|
||||
// or doesn't exist. give up.
|
||||
if (er) {
|
||||
if (er.code === 'ENOENT')
|
||||
return cb();
|
||||
else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
|
||||
return cb(er);
|
||||
}
|
||||
if (er || !children.length)
|
||||
return chown(p, uid, gid, cb);
|
||||
let len = children.length;
|
||||
let errState = null;
|
||||
const then = (er) => {
|
||||
/* c8 ignore start */
|
||||
if (errState)
|
||||
return;
|
||||
/* c8 ignore stop */
|
||||
if (er)
|
||||
return cb((errState = er));
|
||||
if (--len === 0)
|
||||
return chown(p, uid, gid, cb);
|
||||
};
|
||||
for (const child of children) {
|
||||
chownrKid(p, child, uid, gid, then);
|
||||
}
|
||||
});
|
||||
};
|
||||
exports.chownr = chownr;
|
||||
const chownrKidSync = (p, child, uid, gid) => {
|
||||
if (child.isDirectory())
|
||||
(0, exports.chownrSync)(node_path_1.default.resolve(p, child.name), uid, gid);
|
||||
lchownSync(node_path_1.default.resolve(p, child.name), uid, gid);
|
||||
};
|
||||
const chownrSync = (p, uid, gid) => {
|
||||
let children;
|
||||
try {
|
||||
children = node_fs_1.default.readdirSync(p, { withFileTypes: true });
|
||||
}
|
||||
catch (er) {
|
||||
const e = er;
|
||||
if (e?.code === 'ENOENT')
|
||||
return;
|
||||
else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
|
||||
return lchownSync(p, uid, gid);
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
for (const child of children) {
|
||||
chownrKidSync(p, child, uid, gid);
|
||||
}
|
||||
return lchownSync(p, uid, gid);
|
||||
};
|
||||
exports.chownrSync = chownrSync;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/chownr/dist/commonjs/index.js.map
generated
vendored
1
node_modules/chownr/dist/commonjs/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/chownr/dist/commonjs/package.json
generated
vendored
3
node_modules/chownr/dist/commonjs/package.json
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"type": "commonjs"
|
||||
}
|
||||
3
node_modules/chownr/dist/esm/index.d.ts
generated
vendored
3
node_modules/chownr/dist/esm/index.d.ts
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
export declare const chownr: (p: string, uid: number, gid: number, cb: (er?: unknown) => any) => void;
|
||||
export declare const chownrSync: (p: string, uid: number, gid: number) => void;
|
||||
//# sourceMappingURL=index.d.ts.map
|
||||
1
node_modules/chownr/dist/esm/index.d.ts.map
generated
vendored
1
node_modules/chownr/dist/esm/index.d.ts.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,MAAM,MACd,MAAM,OACJ,MAAM,OACN,MAAM,YACD,OAAO,KAAK,GAAG,SA0B1B,CAAA;AAcD,eAAO,MAAM,UAAU,MAAO,MAAM,OAAO,MAAM,OAAO,MAAM,SAiB7D,CAAA"}
|
||||
85
node_modules/chownr/dist/esm/index.js
generated
vendored
85
node_modules/chownr/dist/esm/index.js
generated
vendored
|
|
@ -1,85 +0,0 @@
|
|||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
const lchownSync = (path, uid, gid) => {
|
||||
try {
|
||||
return fs.lchownSync(path, uid, gid);
|
||||
}
|
||||
catch (er) {
|
||||
if (er?.code !== 'ENOENT')
|
||||
throw er;
|
||||
}
|
||||
};
|
||||
const chown = (cpath, uid, gid, cb) => {
|
||||
fs.lchown(cpath, uid, gid, er => {
|
||||
// Skip ENOENT error
|
||||
cb(er && er?.code !== 'ENOENT' ? er : null);
|
||||
});
|
||||
};
|
||||
const chownrKid = (p, child, uid, gid, cb) => {
|
||||
if (child.isDirectory()) {
|
||||
chownr(path.resolve(p, child.name), uid, gid, (er) => {
|
||||
if (er)
|
||||
return cb(er);
|
||||
const cpath = path.resolve(p, child.name);
|
||||
chown(cpath, uid, gid, cb);
|
||||
});
|
||||
}
|
||||
else {
|
||||
const cpath = path.resolve(p, child.name);
|
||||
chown(cpath, uid, gid, cb);
|
||||
}
|
||||
};
|
||||
export const chownr = (p, uid, gid, cb) => {
|
||||
fs.readdir(p, { withFileTypes: true }, (er, children) => {
|
||||
// any error other than ENOTDIR or ENOTSUP means it's not readable,
|
||||
// or doesn't exist. give up.
|
||||
if (er) {
|
||||
if (er.code === 'ENOENT')
|
||||
return cb();
|
||||
else if (er.code !== 'ENOTDIR' && er.code !== 'ENOTSUP')
|
||||
return cb(er);
|
||||
}
|
||||
if (er || !children.length)
|
||||
return chown(p, uid, gid, cb);
|
||||
let len = children.length;
|
||||
let errState = null;
|
||||
const then = (er) => {
|
||||
/* c8 ignore start */
|
||||
if (errState)
|
||||
return;
|
||||
/* c8 ignore stop */
|
||||
if (er)
|
||||
return cb((errState = er));
|
||||
if (--len === 0)
|
||||
return chown(p, uid, gid, cb);
|
||||
};
|
||||
for (const child of children) {
|
||||
chownrKid(p, child, uid, gid, then);
|
||||
}
|
||||
});
|
||||
};
|
||||
const chownrKidSync = (p, child, uid, gid) => {
|
||||
if (child.isDirectory())
|
||||
chownrSync(path.resolve(p, child.name), uid, gid);
|
||||
lchownSync(path.resolve(p, child.name), uid, gid);
|
||||
};
|
||||
export const chownrSync = (p, uid, gid) => {
|
||||
let children;
|
||||
try {
|
||||
children = fs.readdirSync(p, { withFileTypes: true });
|
||||
}
|
||||
catch (er) {
|
||||
const e = er;
|
||||
if (e?.code === 'ENOENT')
|
||||
return;
|
||||
else if (e?.code === 'ENOTDIR' || e?.code === 'ENOTSUP')
|
||||
return lchownSync(p, uid, gid);
|
||||
else
|
||||
throw e;
|
||||
}
|
||||
for (const child of children) {
|
||||
chownrKidSync(p, child, uid, gid);
|
||||
}
|
||||
return lchownSync(p, uid, gid);
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/chownr/dist/esm/index.js.map
generated
vendored
1
node_modules/chownr/dist/esm/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
3
node_modules/chownr/dist/esm/package.json
generated
vendored
3
node_modules/chownr/dist/esm/package.json
generated
vendored
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"type": "module"
|
||||
}
|
||||
69
node_modules/chownr/package.json
generated
vendored
69
node_modules/chownr/package.json
generated
vendored
|
|
@ -1,69 +0,0 @@
|
|||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"name": "chownr",
|
||||
"description": "like `chown -R`",
|
||||
"version": "3.0.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/chownr.git"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.12.5",
|
||||
"mkdirp": "^3.0.1",
|
||||
"prettier": "^3.2.5",
|
||||
"rimraf": "^5.0.5",
|
||||
"tap": "^18.7.2",
|
||||
"tshy": "^1.13.1",
|
||||
"typedoc": "^0.25.12"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "tshy",
|
||||
"pretest": "npm run prepare",
|
||||
"test": "tap",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"prepublishOnly": "git push origin --follow-tags",
|
||||
"format": "prettier --write . --loglevel warn",
|
||||
"typedoc": "typedoc --tsconfig .tshy/esm.json ./src/*.ts"
|
||||
},
|
||||
"license": "BlueOak-1.0.0",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
},
|
||||
"tshy": {
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": "./src/index.ts"
|
||||
}
|
||||
},
|
||||
"exports": {
|
||||
"./package.json": "./package.json",
|
||||
".": {
|
||||
"import": {
|
||||
"types": "./dist/esm/index.d.ts",
|
||||
"default": "./dist/esm/index.js"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"default": "./dist/commonjs/index.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"main": "./dist/commonjs/index.js",
|
||||
"types": "./dist/commonjs/index.d.ts",
|
||||
"type": "module",
|
||||
"prettier": {
|
||||
"semi": false,
|
||||
"printWidth": 75,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"singleQuote": true,
|
||||
"jsxSingleQuote": false,
|
||||
"bracketSameLine": true,
|
||||
"arrowParens": "avoid",
|
||||
"endOfLine": "lf"
|
||||
}
|
||||
}
|
||||
15
node_modules/cmd-shim/LICENSE
generated
vendored
15
node_modules/cmd-shim/LICENSE
generated
vendored
|
|
@ -1,15 +0,0 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) npm, Inc. and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
34
node_modules/cmd-shim/README.md
generated
vendored
34
node_modules/cmd-shim/README.md
generated
vendored
|
|
@ -1,34 +0,0 @@
|
|||
# cmd-shim
|
||||
|
||||
The cmd-shim used in npm to create executable scripts on Windows,
|
||||
since symlinks are not suitable for this purpose there.
|
||||
|
||||
On Unix systems, you should use a symbolic link instead.
|
||||
|
||||
[](https://github.com/npm/cmd-shim)
|
||||
[](https://libraries.io/npm/cmd-shim)
|
||||
[](https://www.npmjs.com/package/cmd-shim)
|
||||
|
||||
## Installation
|
||||
|
||||
```
|
||||
npm install cmd-shim
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cmdShim(from, to) -> Promise
|
||||
|
||||
Create a cmd shim at `to` for the command line program at `from`.
|
||||
e.g.
|
||||
|
||||
```javascript
|
||||
var cmdShim = require('cmd-shim');
|
||||
cmdShim(__dirname + '/cli.js', '/usr/bin/command-name').then(() => {
|
||||
// shims are created!
|
||||
})
|
||||
```
|
||||
|
||||
### cmdShim.ifExists(from, to) -> Promise
|
||||
|
||||
The same as above, but will just continue if the file does not exist.
|
||||
247
node_modules/cmd-shim/lib/index.js
generated
vendored
247
node_modules/cmd-shim/lib/index.js
generated
vendored
|
|
@ -1,247 +0,0 @@
|
|||
// On windows, create a .cmd file.
|
||||
// Read the #! in the file to see what it uses. The vast majority
|
||||
// of the time, this will be either:
|
||||
// "#!/usr/bin/env <prog> <args...>"
|
||||
// or:
|
||||
// "#!<prog> <args...>"
|
||||
//
|
||||
// Write a binroot/pkg.bin + ".cmd" file that has this line in it:
|
||||
// @<prog> <args...> %dp0%<target> %*
|
||||
|
||||
const {
|
||||
chmod,
|
||||
mkdir,
|
||||
readFile,
|
||||
stat,
|
||||
unlink,
|
||||
writeFile,
|
||||
} = require('fs/promises')
|
||||
|
||||
const { dirname, relative } = require('path')
|
||||
const toBatchSyntax = require('./to-batch-syntax')
|
||||
// linting disabled because this regex is really long
|
||||
// eslint-disable-next-line max-len
|
||||
const shebangExpr = /^#!\s*(?:\/usr\/bin\/env\s+(?:-S\s+)?((?:[^ \t=]+=[^ \t=]+\s+)*))?([^ \t]+)(.*)$/
|
||||
|
||||
const cmdShimIfExists = (from, to) =>
|
||||
stat(from).then(() => cmdShim(from, to), () => {})
|
||||
|
||||
// Try to unlink, but ignore errors.
|
||||
// Any problems will surface later.
|
||||
const rm = path => unlink(path).catch(() => {})
|
||||
|
||||
const cmdShim = (from, to) =>
|
||||
stat(from).then(() => cmdShim_(from, to))
|
||||
|
||||
const cmdShim_ = (from, to) => Promise.all([
|
||||
rm(to),
|
||||
rm(to + '.cmd'),
|
||||
rm(to + '.ps1'),
|
||||
]).then(() => writeShim(from, to))
|
||||
|
||||
const writeShim = (from, to) =>
|
||||
// make a cmd file and a sh script
|
||||
// First, check if the bin is a #! of some sort.
|
||||
// If not, then assume it's something that'll be compiled, or some other
|
||||
// sort of script, and just call it directly.
|
||||
mkdir(dirname(to), { recursive: true })
|
||||
.then(() => readFile(from, 'utf8'))
|
||||
.then(data => {
|
||||
const firstLine = data.trim().split(/\r*\n/)[0]
|
||||
const shebang = firstLine.match(shebangExpr)
|
||||
if (!shebang) {
|
||||
return writeShim_(from, to)
|
||||
}
|
||||
const vars = shebang[1] || ''
|
||||
const prog = shebang[2]
|
||||
const args = shebang[3] || ''
|
||||
return writeShim_(from, to, prog, args, vars)
|
||||
}, () => writeShim_(from, to))
|
||||
|
||||
const writeShim_ = (from, to, prog, args, variables) => {
|
||||
let shTarget = relative(dirname(to), from)
|
||||
let target = shTarget.split('/').join('\\')
|
||||
let longProg
|
||||
let shProg = prog && prog.split('\\').join('/')
|
||||
let shLongProg
|
||||
let pwshProg = shProg && `"${shProg}$exe"`
|
||||
let pwshLongProg
|
||||
shTarget = shTarget.split('\\').join('/')
|
||||
args = args || ''
|
||||
variables = variables || ''
|
||||
if (!prog) {
|
||||
prog = `"%dp0%\\${target}"`
|
||||
shProg = `"$basedir/${shTarget}"`
|
||||
pwshProg = shProg
|
||||
args = ''
|
||||
target = ''
|
||||
shTarget = ''
|
||||
} else {
|
||||
longProg = `"%dp0%\\${prog}.exe"`
|
||||
shLongProg = `"$basedir/${prog}"`
|
||||
pwshLongProg = `"$basedir/${prog}$exe"`
|
||||
target = `"%dp0%\\${target}"`
|
||||
shTarget = `"$basedir/${shTarget}"`
|
||||
}
|
||||
|
||||
// Subroutine trick to fix https://github.com/npm/cmd-shim/issues/10
|
||||
// and https://github.com/npm/cli/issues/969
|
||||
const head = '@ECHO off\r\n' +
|
||||
'GOTO start\r\n' +
|
||||
':find_dp0\r\n' +
|
||||
'SET dp0=%~dp0\r\n' +
|
||||
'EXIT /b\r\n' +
|
||||
':start\r\n' +
|
||||
'SETLOCAL\r\n' +
|
||||
'CALL :find_dp0\r\n'
|
||||
|
||||
let cmd
|
||||
if (longProg) {
|
||||
shLongProg = shLongProg.trim()
|
||||
args = args.trim()
|
||||
const variablesBatch = toBatchSyntax.convertToSetCommands(variables)
|
||||
cmd = head
|
||||
+ variablesBatch
|
||||
+ '\r\n'
|
||||
+ `IF EXIST ${longProg} (\r\n`
|
||||
+ ` SET "_prog=${longProg.replace(/(^")|("$)/g, '')}"\r\n`
|
||||
+ ') ELSE (\r\n'
|
||||
+ ` SET "_prog=${prog.replace(/(^")|("$)/g, '')}"\r\n`
|
||||
+ ' SET PATHEXT=%PATHEXT:;.JS;=;%\r\n'
|
||||
+ ')\r\n'
|
||||
+ '\r\n'
|
||||
// prevent "Terminate Batch Job? (Y/n)" message
|
||||
// https://github.com/npm/cli/issues/969#issuecomment-737496588
|
||||
+ 'endLocal & goto #_undefined_# 2>NUL || title %COMSPEC% & '
|
||||
+ `"%_prog%" ${args} ${target} %*\r\n`
|
||||
} else {
|
||||
cmd = `${head}${prog} ${args} ${target} %*\r\n`
|
||||
}
|
||||
|
||||
// #!/bin/sh
|
||||
// basedir=`dirname "$0"`
|
||||
//
|
||||
// case `uname` in
|
||||
// *CYGWIN*|*MINGW*|*MSYS*)
|
||||
// if command -v cygpath > /dev/null 2>&1; then
|
||||
// basedir=`cygpath -w "$basedir"`
|
||||
// fi
|
||||
// ;;
|
||||
// esac
|
||||
//
|
||||
// if [ -x "$basedir/node.exe" ]; then
|
||||
// exec "$basedir/node.exe" "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
||||
// else
|
||||
// exec node "$basedir/node_modules/npm/bin/npm-cli.js" "$@"
|
||||
// fi
|
||||
|
||||
let sh = '#!/bin/sh\n'
|
||||
|
||||
sh = sh
|
||||
+ `basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")\n`
|
||||
+ '\n'
|
||||
+ 'case `uname` in\n'
|
||||
+ ' *CYGWIN*|*MINGW*|*MSYS*)\n'
|
||||
+ ' if command -v cygpath > /dev/null 2>&1; then\n'
|
||||
+ ' basedir=`cygpath -w "$basedir"`\n'
|
||||
+ ' fi\n'
|
||||
+ ' ;;\n'
|
||||
+ 'esac\n'
|
||||
+ '\n'
|
||||
|
||||
if (shLongProg) {
|
||||
sh = sh
|
||||
+ `if [ -x ${shLongProg} ]; then\n`
|
||||
+ ` exec ${variables}${shLongProg} ${args} ${shTarget} "$@"\n`
|
||||
+ 'else \n'
|
||||
+ ` exec ${variables}${shProg} ${args} ${shTarget} "$@"\n`
|
||||
+ 'fi\n'
|
||||
} else {
|
||||
sh = sh
|
||||
+ `exec ${shProg} ${args} ${shTarget} "$@"\n`
|
||||
}
|
||||
|
||||
// #!/usr/bin/env pwsh
|
||||
// $basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
|
||||
//
|
||||
// $ret=0
|
||||
// $exe = ""
|
||||
// if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
|
||||
// # Fix case when both the Windows and Linux builds of Node
|
||||
// # are installed in the same directory
|
||||
// $exe = ".exe"
|
||||
// }
|
||||
// if (Test-Path "$basedir/node") {
|
||||
// # Suport pipeline input
|
||||
// if ($MyInvocation.ExpectingInput) {
|
||||
// input | & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
||||
// } else {
|
||||
// & "$basedir/node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
||||
// }
|
||||
// $ret=$LASTEXITCODE
|
||||
// } else {
|
||||
// # Support pipeline input
|
||||
// if ($MyInvocation.ExpectingInput) {
|
||||
// $input | & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
||||
// } else {
|
||||
// & "node$exe" "$basedir/node_modules/npm/bin/npm-cli.js" $args
|
||||
// }
|
||||
// $ret=$LASTEXITCODE
|
||||
// }
|
||||
// exit $ret
|
||||
let pwsh = '#!/usr/bin/env pwsh\n'
|
||||
+ '$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent\n'
|
||||
+ '\n'
|
||||
+ '$exe=""\n'
|
||||
+ 'if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {\n'
|
||||
+ ' # Fix case when both the Windows and Linux builds of Node\n'
|
||||
+ ' # are installed in the same directory\n'
|
||||
+ ' $exe=".exe"\n'
|
||||
+ '}\n'
|
||||
if (shLongProg) {
|
||||
pwsh = pwsh
|
||||
+ '$ret=0\n'
|
||||
+ `if (Test-Path ${pwshLongProg}) {\n`
|
||||
+ ' # Support pipeline input\n'
|
||||
+ ' if ($MyInvocation.ExpectingInput) {\n'
|
||||
+ ` $input | & ${pwshLongProg} ${args} ${shTarget} $args\n`
|
||||
+ ' } else {\n'
|
||||
+ ` & ${pwshLongProg} ${args} ${shTarget} $args\n`
|
||||
+ ' }\n'
|
||||
+ ' $ret=$LASTEXITCODE\n'
|
||||
+ '} else {\n'
|
||||
+ ' # Support pipeline input\n'
|
||||
+ ' if ($MyInvocation.ExpectingInput) {\n'
|
||||
+ ` $input | & ${pwshProg} ${args} ${shTarget} $args\n`
|
||||
+ ' } else {\n'
|
||||
+ ` & ${pwshProg} ${args} ${shTarget} $args\n`
|
||||
+ ' }\n'
|
||||
+ ' $ret=$LASTEXITCODE\n'
|
||||
+ '}\n'
|
||||
+ 'exit $ret\n'
|
||||
} else {
|
||||
pwsh = pwsh
|
||||
+ '# Support pipeline input\n'
|
||||
+ 'if ($MyInvocation.ExpectingInput) {\n'
|
||||
+ ` $input | & ${pwshProg} ${args} ${shTarget} $args\n`
|
||||
+ '} else {\n'
|
||||
+ ` & ${pwshProg} ${args} ${shTarget} $args\n`
|
||||
+ '}\n'
|
||||
+ 'exit $LASTEXITCODE\n'
|
||||
}
|
||||
|
||||
return Promise.all([
|
||||
writeFile(to + '.ps1', pwsh, 'utf8'),
|
||||
writeFile(to + '.cmd', cmd, 'utf8'),
|
||||
writeFile(to, sh, 'utf8'),
|
||||
]).then(() => chmodShim(to))
|
||||
}
|
||||
|
||||
const chmodShim = to => Promise.all([
|
||||
chmod(to, 0o755),
|
||||
chmod(to + '.cmd', 0o755),
|
||||
chmod(to + '.ps1', 0o755),
|
||||
])
|
||||
|
||||
module.exports = cmdShim
|
||||
cmdShim.ifExists = cmdShimIfExists
|
||||
49
node_modules/cmd-shim/lib/to-batch-syntax.js
generated
vendored
49
node_modules/cmd-shim/lib/to-batch-syntax.js
generated
vendored
|
|
@ -1,49 +0,0 @@
|
|||
exports.replaceDollarWithPercentPair = replaceDollarWithPercentPair
|
||||
exports.convertToSetCommand = convertToSetCommand
|
||||
exports.convertToSetCommands = convertToSetCommands
|
||||
|
||||
function convertToSetCommand (key, value) {
|
||||
var line = ''
|
||||
key = key || ''
|
||||
key = key.trim()
|
||||
value = value || ''
|
||||
value = value.trim()
|
||||
if (key && value && value.length > 0) {
|
||||
line = '@SET ' + key + '=' + replaceDollarWithPercentPair(value) + '\r\n'
|
||||
}
|
||||
return line
|
||||
}
|
||||
|
||||
function extractVariableValuePairs (declarations) {
|
||||
var pairs = {}
|
||||
declarations.map(function (declaration) {
|
||||
var split = declaration.split('=')
|
||||
pairs[split[0]] = split[1]
|
||||
})
|
||||
return pairs
|
||||
}
|
||||
|
||||
function convertToSetCommands (variableString) {
|
||||
var variableValuePairs = extractVariableValuePairs(variableString.split(' '))
|
||||
var variableDeclarationsAsBatch = ''
|
||||
Object.keys(variableValuePairs).forEach(function (key) {
|
||||
variableDeclarationsAsBatch += convertToSetCommand(key, variableValuePairs[key])
|
||||
})
|
||||
return variableDeclarationsAsBatch
|
||||
}
|
||||
|
||||
function replaceDollarWithPercentPair (value) {
|
||||
var dollarExpressions = /\$\{?([^$@#?\- \t{}:]+)\}?/g
|
||||
var result = ''
|
||||
var startIndex = 0
|
||||
do {
|
||||
var match = dollarExpressions.exec(value)
|
||||
if (match) {
|
||||
var betweenMatches = value.substring(startIndex, match.index) || ''
|
||||
result += betweenMatches + '%' + match[1] + '%'
|
||||
startIndex = dollarExpressions.lastIndex
|
||||
}
|
||||
} while (dollarExpressions.lastIndex > 0)
|
||||
result += value.slice(startIndex)
|
||||
return result
|
||||
}
|
||||
48
node_modules/cmd-shim/package.json
generated
vendored
48
node_modules/cmd-shim/package.json
generated
vendored
|
|
@ -1,48 +0,0 @@
|
|||
{
|
||||
"name": "cmd-shim",
|
||||
"version": "7.0.0",
|
||||
"description": "Used in npm for command line application support",
|
||||
"scripts": {
|
||||
"test": "tap",
|
||||
"snap": "tap",
|
||||
"lint": "npm run eslint",
|
||||
"postlint": "template-oss-check",
|
||||
"template-oss-apply": "template-oss-apply --force",
|
||||
"lintfix": "npm run eslint -- --fix",
|
||||
"posttest": "npm run lint",
|
||||
"eslint": "eslint \"**/*.{js,cjs,ts,mjs,jsx,tsx}\""
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/npm/cmd-shim.git"
|
||||
},
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"@npmcli/eslint-config": "^5.0.0",
|
||||
"@npmcli/template-oss": "4.23.1",
|
||||
"tap": "^16.0.1"
|
||||
},
|
||||
"files": [
|
||||
"bin/",
|
||||
"lib/"
|
||||
],
|
||||
"main": "lib/index.js",
|
||||
"tap": {
|
||||
"before": "test/00-setup.js",
|
||||
"after": "test/zz-cleanup.js",
|
||||
"check-coverage": true,
|
||||
"nyc-arg": [
|
||||
"--exclude",
|
||||
"tap-snapshots/**"
|
||||
]
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.17.0 || >=20.5.0"
|
||||
},
|
||||
"author": "GitHub Inc.",
|
||||
"templateOSS": {
|
||||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
|
||||
"version": "4.23.1",
|
||||
"publish": true
|
||||
}
|
||||
}
|
||||
88
node_modules/data-uri-to-buffer/README.md
generated
vendored
88
node_modules/data-uri-to-buffer/README.md
generated
vendored
|
|
@ -1,88 +0,0 @@
|
|||
data-uri-to-buffer
|
||||
==================
|
||||
### Generate a Buffer instance from a [Data URI][rfc] string
|
||||
[](https://travis-ci.org/TooTallNate/node-data-uri-to-buffer)
|
||||
|
||||
This module accepts a ["data" URI][rfc] String of data, and returns a
|
||||
node.js `Buffer` instance with the decoded data.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install data-uri-to-buffer
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
``` js
|
||||
import dataUriToBuffer from 'data-uri-to-buffer';
|
||||
|
||||
// plain-text data is supported
|
||||
let uri = 'data:,Hello%2C%20World!';
|
||||
let decoded = dataUriToBuffer(uri);
|
||||
console.log(decoded.toString());
|
||||
// 'Hello, World!'
|
||||
|
||||
// base64-encoded data is supported
|
||||
uri = 'data:text/plain;base64,SGVsbG8sIFdvcmxkIQ%3D%3D';
|
||||
decoded = dataUriToBuffer(uri);
|
||||
console.log(decoded.toString());
|
||||
// 'Hello, World!'
|
||||
```
|
||||
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
### dataUriToBuffer(String uri) → Buffer
|
||||
|
||||
The `type` property on the Buffer instance gets set to the main type portion of
|
||||
the "mediatype" portion of the "data" URI, or defaults to `"text/plain"` if not
|
||||
specified.
|
||||
|
||||
The `typeFull` property on the Buffer instance gets set to the entire
|
||||
"mediatype" portion of the "data" URI (including all parameters), or defaults
|
||||
to `"text/plain;charset=US-ASCII"` if not specified.
|
||||
|
||||
The `charset` property on the Buffer instance gets set to the Charset portion of
|
||||
the "mediatype" portion of the "data" URI, or defaults to `"US-ASCII"` if the
|
||||
entire type is not specified, or defaults to `""` otherwise.
|
||||
|
||||
*Note*: If the only the main type is specified but not the charset, e.g.
|
||||
`"data:text/plain,abc"`, the charset is set to the empty string. The spec only
|
||||
defaults to US-ASCII as charset if the entire type is not specified.
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
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.
|
||||
|
||||
[rfc]: http://tools.ietf.org/html/rfc2397
|
||||
15
node_modules/data-uri-to-buffer/dist/index.d.ts
generated
vendored
15
node_modules/data-uri-to-buffer/dist/index.d.ts
generated
vendored
|
|
@ -1,15 +0,0 @@
|
|||
/// <reference types="node" />
|
||||
export interface MimeBuffer extends Buffer {
|
||||
type: string;
|
||||
typeFull: string;
|
||||
charset: string;
|
||||
}
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
* @returns {Buffer} Buffer instance from Data URI
|
||||
* @api public
|
||||
*/
|
||||
export declare function dataUriToBuffer(uri: string): MimeBuffer;
|
||||
export default dataUriToBuffer;
|
||||
53
node_modules/data-uri-to-buffer/dist/index.js
generated
vendored
53
node_modules/data-uri-to-buffer/dist/index.js
generated
vendored
|
|
@ -1,53 +0,0 @@
|
|||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
* @returns {Buffer} Buffer instance from Data URI
|
||||
* @api public
|
||||
*/
|
||||
export function dataUriToBuffer(uri) {
|
||||
if (!/^data:/i.test(uri)) {
|
||||
throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');
|
||||
}
|
||||
// strip newlines
|
||||
uri = uri.replace(/\r?\n/g, '');
|
||||
// split the URI up into the "metadata" and the "data" portions
|
||||
const firstComma = uri.indexOf(',');
|
||||
if (firstComma === -1 || firstComma <= 4) {
|
||||
throw new TypeError('malformed data: URI');
|
||||
}
|
||||
// remove the "data:" scheme and parse the metadata
|
||||
const meta = uri.substring(5, firstComma).split(';');
|
||||
let charset = '';
|
||||
let base64 = false;
|
||||
const type = meta[0] || 'text/plain';
|
||||
let typeFull = type;
|
||||
for (let i = 1; i < meta.length; i++) {
|
||||
if (meta[i] === 'base64') {
|
||||
base64 = true;
|
||||
}
|
||||
else if (meta[i]) {
|
||||
typeFull += `;${meta[i]}`;
|
||||
if (meta[i].indexOf('charset=') === 0) {
|
||||
charset = meta[i].substring(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
// defaults to US-ASCII only if type is not provided
|
||||
if (!meta[0] && !charset.length) {
|
||||
typeFull += ';charset=US-ASCII';
|
||||
charset = 'US-ASCII';
|
||||
}
|
||||
// get the encoded data portion and decode URI-encoded chars
|
||||
const encoding = base64 ? 'base64' : 'ascii';
|
||||
const data = unescape(uri.substring(firstComma + 1));
|
||||
const buffer = Buffer.from(data, encoding);
|
||||
// set `.type` and `.typeFull` properties to MIME type
|
||||
buffer.type = type;
|
||||
buffer.typeFull = typeFull;
|
||||
// set the `.charset` property
|
||||
buffer.charset = charset;
|
||||
return buffer;
|
||||
}
|
||||
export default dataUriToBuffer;
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/data-uri-to-buffer/dist/index.js.map
generated
vendored
1
node_modules/data-uri-to-buffer/dist/index.js.map
generated
vendored
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IAC1C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QACzB,MAAM,IAAI,SAAS,CAClB,kEAAkE,CAClE,CAAC;KACF;IAED,iBAAiB;IACjB,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEhC,+DAA+D;IAC/D,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,IAAI,UAAU,KAAK,CAAC,CAAC,IAAI,UAAU,IAAI,CAAC,EAAE;QACzC,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAC3C;IAED,mDAAmD;IACnD,MAAM,IAAI,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAErD,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC;IACrC,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;YACzB,MAAM,GAAG,IAAI,CAAC;SACd;aAAM,IAAG,IAAI,CAAC,CAAC,CAAC,EAAE;YAClB,QAAQ,IAAI,IAAM,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5B,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;gBACtC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;aAC/B;SACD;KACD;IACD,oDAAoD;IACpD,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,QAAQ,IAAI,mBAAmB,CAAC;QAChC,OAAO,GAAG,UAAU,CAAC;KACrB;IAED,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IAC7C,MAAM,IAAI,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC;IACrD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAe,CAAC;IAEzD,sDAAsD;IACtD,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAE3B,8BAA8B;IAC9B,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC;IAEzB,OAAO,MAAM,CAAC;AACf,CAAC;AAED,eAAe,eAAe,CAAC"}
|
||||
62
node_modules/data-uri-to-buffer/package.json
generated
vendored
62
node_modules/data-uri-to-buffer/package.json
generated
vendored
|
|
@ -1,62 +0,0 @@
|
|||
{
|
||||
"name": "data-uri-to-buffer",
|
||||
"version": "4.0.1",
|
||||
"description": "Generate a Buffer instance from a Data URI string",
|
||||
"type": "module",
|
||||
"exports": "./dist/index.js",
|
||||
"main": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts",
|
||||
"files": [
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"test": "jest",
|
||||
"prepublishOnly": "npm run build"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/node-data-uri-to-buffer.git"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
},
|
||||
"keywords": [
|
||||
"data",
|
||||
"uri",
|
||||
"datauri",
|
||||
"data-uri",
|
||||
"buffer",
|
||||
"convert",
|
||||
"rfc2397",
|
||||
"2397"
|
||||
],
|
||||
"author": "Nathan Rajlich <nathan@tootallnate.net> (http://n8.io/)",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/node-data-uri-to-buffer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TooTallNate/node-data-uri-to-buffer",
|
||||
"devDependencies": {
|
||||
"@types/jest": "^27.0.2",
|
||||
"@types/node": "^12.20.36",
|
||||
"jest": "^27.3.1",
|
||||
"ts-jest": "^27.0.7",
|
||||
"typescript": "^4.4.4"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "ts-jest",
|
||||
"globals": {
|
||||
"ts-jest": {
|
||||
"diagnostics": false,
|
||||
"isolatedModules": true
|
||||
}
|
||||
},
|
||||
"verbose": false,
|
||||
"testEnvironment": "node",
|
||||
"testMatch": [
|
||||
"<rootDir>/test/**/*.test.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
68
node_modules/data-uri-to-buffer/src/index.ts
generated
vendored
68
node_modules/data-uri-to-buffer/src/index.ts
generated
vendored
|
|
@ -1,68 +0,0 @@
|
|||
export interface MimeBuffer extends Buffer {
|
||||
type: string;
|
||||
typeFull: string;
|
||||
charset: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a `Buffer` instance from the given data URI `uri`.
|
||||
*
|
||||
* @param {String} uri Data URI to turn into a Buffer instance
|
||||
* @returns {Buffer} Buffer instance from Data URI
|
||||
* @api public
|
||||
*/
|
||||
export function dataUriToBuffer(uri: string): MimeBuffer {
|
||||
if (!/^data:/i.test(uri)) {
|
||||
throw new TypeError(
|
||||
'`uri` does not appear to be a Data URI (must begin with "data:")'
|
||||
);
|
||||
}
|
||||
|
||||
// strip newlines
|
||||
uri = uri.replace(/\r?\n/g, '');
|
||||
|
||||
// split the URI up into the "metadata" and the "data" portions
|
||||
const firstComma = uri.indexOf(',');
|
||||
if (firstComma === -1 || firstComma <= 4) {
|
||||
throw new TypeError('malformed data: URI');
|
||||
}
|
||||
|
||||
// remove the "data:" scheme and parse the metadata
|
||||
const meta = uri.substring(5, firstComma).split(';');
|
||||
|
||||
let charset = '';
|
||||
let base64 = false;
|
||||
const type = meta[0] || 'text/plain';
|
||||
let typeFull = type;
|
||||
for (let i = 1; i < meta.length; i++) {
|
||||
if (meta[i] === 'base64') {
|
||||
base64 = true;
|
||||
} else if(meta[i]) {
|
||||
typeFull += `;${ meta[i]}`;
|
||||
if (meta[i].indexOf('charset=') === 0) {
|
||||
charset = meta[i].substring(8);
|
||||
}
|
||||
}
|
||||
}
|
||||
// defaults to US-ASCII only if type is not provided
|
||||
if (!meta[0] && !charset.length) {
|
||||
typeFull += ';charset=US-ASCII';
|
||||
charset = 'US-ASCII';
|
||||
}
|
||||
|
||||
// get the encoded data portion and decode URI-encoded chars
|
||||
const encoding = base64 ? 'base64' : 'ascii';
|
||||
const data = unescape(uri.substring(firstComma + 1));
|
||||
const buffer = Buffer.from(data, encoding) as MimeBuffer;
|
||||
|
||||
// set `.type` and `.typeFull` properties to MIME type
|
||||
buffer.type = type;
|
||||
buffer.typeFull = typeFull;
|
||||
|
||||
// set the `.charset` property
|
||||
buffer.charset = charset;
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
export default dataUriToBuffer;
|
||||
20
node_modules/debug/LICENSE
generated
vendored
20
node_modules/debug/LICENSE
generated
vendored
|
|
@ -1,20 +0,0 @@
|
|||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2018-2021 Josh Junon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the 'Software'), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
||||
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
481
node_modules/debug/README.md
generated
vendored
481
node_modules/debug/README.md
generated
vendored
|
|
@ -1,481 +0,0 @@
|
|||
# debug
|
||||
[](#backers)
|
||||
[](#sponsors)
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
A tiny JavaScript debugging utility modelled after Node.js core's debugging
|
||||
technique. Works in Node.js and web browsers.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
$ npm install debug
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole.
|
||||
|
||||
Example [_app.js_](./examples/node/app.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug')('http')
|
||||
, http = require('http')
|
||||
, name = 'My App';
|
||||
|
||||
// fake app
|
||||
|
||||
debug('booting %o', name);
|
||||
|
||||
http.createServer(function(req, res){
|
||||
debug(req.method + ' ' + req.url);
|
||||
res.end('hello\n');
|
||||
}).listen(3000, function(){
|
||||
debug('listening');
|
||||
});
|
||||
|
||||
// fake worker of some kind
|
||||
|
||||
require('./worker');
|
||||
```
|
||||
|
||||
Example [_worker.js_](./examples/node/worker.js):
|
||||
|
||||
```js
|
||||
var a = require('debug')('worker:a')
|
||||
, b = require('debug')('worker:b');
|
||||
|
||||
function work() {
|
||||
a('doing lots of uninteresting work');
|
||||
setTimeout(work, Math.random() * 1000);
|
||||
}
|
||||
|
||||
work();
|
||||
|
||||
function workb() {
|
||||
b('doing some work');
|
||||
setTimeout(workb, Math.random() * 2000);
|
||||
}
|
||||
|
||||
workb();
|
||||
```
|
||||
|
||||
The `DEBUG` environment variable is then used to enable these based on space or
|
||||
comma-delimited names.
|
||||
|
||||
Here are some examples:
|
||||
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 04 pm" src="https://user-images.githubusercontent.com/71256/29091703-a6302cdc-7c38-11e7-8304-7c0b3bc600cd.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 38 pm" src="https://user-images.githubusercontent.com/71256/29091700-a62a6888-7c38-11e7-800b-db911291ca2b.png">
|
||||
<img width="647" alt="screen shot 2017-08-08 at 12 53 25 pm" src="https://user-images.githubusercontent.com/71256/29091701-a62ea114-7c38-11e7-826a-2692bedca740.png">
|
||||
|
||||
#### Windows command prompt notes
|
||||
|
||||
##### CMD
|
||||
|
||||
On Windows the environment variable is set using the `set` command.
|
||||
|
||||
```cmd
|
||||
set DEBUG=*,-not_this
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
set DEBUG=* & node app.js
|
||||
```
|
||||
|
||||
##### PowerShell (VS Code default)
|
||||
|
||||
PowerShell uses different syntax to set environment variables.
|
||||
|
||||
```cmd
|
||||
$env:DEBUG = "*,-not_this"
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```cmd
|
||||
$env:DEBUG='app';node app.js
|
||||
```
|
||||
|
||||
Then, run the program to be debugged as usual.
|
||||
|
||||
npm script example:
|
||||
```js
|
||||
"windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js",
|
||||
```
|
||||
|
||||
## Namespace Colors
|
||||
|
||||
Every debug instance has a color generated for it based on its namespace name.
|
||||
This helps when visually parsing the debug output to identify which debug instance
|
||||
a debug line belongs to.
|
||||
|
||||
#### Node.js
|
||||
|
||||
In Node.js, colors are enabled when stderr is a TTY. You also _should_ install
|
||||
the [`supports-color`](https://npmjs.org/supports-color) module alongside debug,
|
||||
otherwise debug will only use a small handful of basic colors.
|
||||
|
||||
<img width="521" src="https://user-images.githubusercontent.com/71256/29092181-47f6a9e6-7c3a-11e7-9a14-1928d8a711cd.png">
|
||||
|
||||
#### Web Browser
|
||||
|
||||
Colors are also enabled on "Web Inspectors" that understand the `%c` formatting
|
||||
option. These are WebKit web inspectors, Firefox ([since version
|
||||
31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/))
|
||||
and the Firebug plugin for Firefox (any version).
|
||||
|
||||
<img width="524" src="https://user-images.githubusercontent.com/71256/29092033-b65f9f2e-7c39-11e7-8e32-f6f0d8e865c1.png">
|
||||
|
||||
|
||||
## Millisecond diff
|
||||
|
||||
When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls.
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091486-fa38524c-7c37-11e7-895f-e7ec8e1039b6.png">
|
||||
|
||||
When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below:
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/71256/29091956-6bd78372-7c39-11e7-8c55-c948396d6edd.png">
|
||||
|
||||
|
||||
## Conventions
|
||||
|
||||
If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output.
|
||||
|
||||
## Wildcards
|
||||
|
||||
The `*` character may be used as a wildcard. Suppose for example your library has
|
||||
debuggers named "connect:bodyParser", "connect:compress", "connect:session",
|
||||
instead of listing all three with
|
||||
`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do
|
||||
`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`.
|
||||
|
||||
You can also exclude specific debuggers by prefixing them with a "-" character.
|
||||
For example, `DEBUG=*,-connect:*` would include all debuggers except those
|
||||
starting with "connect:".
|
||||
|
||||
## Environment Variables
|
||||
|
||||
When running through Node.js, you can set a few environment variables that will
|
||||
change the behavior of the debug logging:
|
||||
|
||||
| Name | Purpose |
|
||||
|-----------|-------------------------------------------------|
|
||||
| `DEBUG` | Enables/disables specific debugging namespaces. |
|
||||
| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). |
|
||||
| `DEBUG_COLORS`| Whether or not to use colors in the debug output. |
|
||||
| `DEBUG_DEPTH` | Object inspection depth. |
|
||||
| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. |
|
||||
|
||||
|
||||
__Note:__ The environment variables beginning with `DEBUG_` end up being
|
||||
converted into an Options object that gets used with `%o`/`%O` formatters.
|
||||
See the Node.js documentation for
|
||||
[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options)
|
||||
for the complete list.
|
||||
|
||||
## Formatters
|
||||
|
||||
Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting.
|
||||
Below are the officially supported formatters:
|
||||
|
||||
| Formatter | Representation |
|
||||
|-----------|----------------|
|
||||
| `%O` | Pretty-print an Object on multiple lines. |
|
||||
| `%o` | Pretty-print an Object all on a single line. |
|
||||
| `%s` | String. |
|
||||
| `%d` | Number (both integer and float). |
|
||||
| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. |
|
||||
| `%%` | Single percent sign ('%'). This does not consume an argument. |
|
||||
|
||||
|
||||
### Custom formatters
|
||||
|
||||
You can add custom formatters by extending the `debug.formatters` object.
|
||||
For example, if you wanted to add support for rendering a Buffer as hex with
|
||||
`%h`, you could do something like:
|
||||
|
||||
```js
|
||||
const createDebug = require('debug')
|
||||
createDebug.formatters.h = (v) => {
|
||||
return v.toString('hex')
|
||||
}
|
||||
|
||||
// …elsewhere
|
||||
const debug = createDebug('foo')
|
||||
debug('this is hex: %h', new Buffer('hello world'))
|
||||
// foo this is hex: 68656c6c6f20776f726c6421 +0ms
|
||||
```
|
||||
|
||||
|
||||
## Browser Support
|
||||
|
||||
You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify),
|
||||
or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest),
|
||||
if you don't want to build it yourself.
|
||||
|
||||
Debug's enable state is currently persisted by `localStorage`.
|
||||
Consider the situation shown below where you have `worker:a` and `worker:b`,
|
||||
and wish to debug both. You can enable this using `localStorage.debug`:
|
||||
|
||||
```js
|
||||
localStorage.debug = 'worker:*'
|
||||
```
|
||||
|
||||
And then refresh the page.
|
||||
|
||||
```js
|
||||
a = debug('worker:a');
|
||||
b = debug('worker:b');
|
||||
|
||||
setInterval(function(){
|
||||
a('doing some work');
|
||||
}, 1000);
|
||||
|
||||
setInterval(function(){
|
||||
b('doing some work');
|
||||
}, 1200);
|
||||
```
|
||||
|
||||
In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_.
|
||||
|
||||
<img width="647" src="https://user-images.githubusercontent.com/7143133/152083257-29034707-c42c-4959-8add-3cee850e6fcf.png">
|
||||
|
||||
## Output streams
|
||||
|
||||
By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method:
|
||||
|
||||
Example [_stdout.js_](./examples/node/stdout.js):
|
||||
|
||||
```js
|
||||
var debug = require('debug');
|
||||
var error = debug('app:error');
|
||||
|
||||
// by default stderr is used
|
||||
error('goes to stderr!');
|
||||
|
||||
var log = debug('app:log');
|
||||
// set this namespace to log via console.log
|
||||
log.log = console.log.bind(console); // don't forget to bind to console!
|
||||
log('goes to stdout');
|
||||
error('still goes to stderr!');
|
||||
|
||||
// set all output to go via console.info
|
||||
// overrides all per-namespace log settings
|
||||
debug.log = console.info.bind(console);
|
||||
error('now goes to stdout via console.info');
|
||||
log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
//creates new debug instance with extended namespace
|
||||
const logSign = log.extend('sign');
|
||||
const logLogin = log.extend('login');
|
||||
|
||||
log('hello'); // auth hello
|
||||
logSign('hello'); //auth:sign hello
|
||||
logLogin('hello'); //auth:login hello
|
||||
```
|
||||
|
||||
## Set dynamically
|
||||
|
||||
You can also enable debug dynamically by calling the `enable()` method :
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
|
||||
console.log(1, debug.enabled('test'));
|
||||
|
||||
debug.enable('test');
|
||||
console.log(2, debug.enabled('test'));
|
||||
|
||||
debug.disable();
|
||||
console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
`disable()`
|
||||
|
||||
Will disable all namespaces. The functions returns the namespaces currently
|
||||
enabled (and skipped). This can be useful if you want to disable debugging
|
||||
temporarily without knowing what was enabled to begin with.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
debug.enable('foo:*,-foo:bar');
|
||||
let namespaces = debug.disable();
|
||||
debug.enable(namespaces);
|
||||
```
|
||||
|
||||
Note: There is no guarantee that the string will be identical to the initial
|
||||
enable string, but semantically they will be identical.
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
enabled by checking the `enabled` property:
|
||||
|
||||
```javascript
|
||||
const debug = require('debug')('http');
|
||||
|
||||
if (debug.enabled) {
|
||||
// do stuff...
|
||||
}
|
||||
```
|
||||
|
||||
You can also manually toggle this property to force the debug instance to be
|
||||
enabled or disabled.
|
||||
|
||||
## Usage in child processes
|
||||
|
||||
Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process.
|
||||
For example:
|
||||
|
||||
```javascript
|
||||
worker = fork(WORKER_WRAP_PATH, [workerPath], {
|
||||
stdio: [
|
||||
/* stdin: */ 0,
|
||||
/* stdout: */ 'pipe',
|
||||
/* stderr: */ 'pipe',
|
||||
'ipc',
|
||||
],
|
||||
env: Object.assign({}, process.env, {
|
||||
DEBUG_COLORS: 1 // without this settings, colors won't be shown
|
||||
}),
|
||||
});
|
||||
|
||||
worker.stderr.pipe(process.stderr, { end: false });
|
||||
```
|
||||
|
||||
|
||||
## Authors
|
||||
|
||||
- TJ Holowaychuk
|
||||
- Nathan Rajlich
|
||||
- Andrew Rhyne
|
||||
- Josh Junon
|
||||
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)]
|
||||
|
||||
<a href="https://opencollective.com/debug/backer/0/website" target="_blank"><img src="https://opencollective.com/debug/backer/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/1/website" target="_blank"><img src="https://opencollective.com/debug/backer/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/2/website" target="_blank"><img src="https://opencollective.com/debug/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/3/website" target="_blank"><img src="https://opencollective.com/debug/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/4/website" target="_blank"><img src="https://opencollective.com/debug/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/5/website" target="_blank"><img src="https://opencollective.com/debug/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/6/website" target="_blank"><img src="https://opencollective.com/debug/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/7/website" target="_blank"><img src="https://opencollective.com/debug/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/8/website" target="_blank"><img src="https://opencollective.com/debug/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/9/website" target="_blank"><img src="https://opencollective.com/debug/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/10/website" target="_blank"><img src="https://opencollective.com/debug/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/11/website" target="_blank"><img src="https://opencollective.com/debug/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/12/website" target="_blank"><img src="https://opencollective.com/debug/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/13/website" target="_blank"><img src="https://opencollective.com/debug/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/14/website" target="_blank"><img src="https://opencollective.com/debug/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/15/website" target="_blank"><img src="https://opencollective.com/debug/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/16/website" target="_blank"><img src="https://opencollective.com/debug/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/17/website" target="_blank"><img src="https://opencollective.com/debug/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/18/website" target="_blank"><img src="https://opencollective.com/debug/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/19/website" target="_blank"><img src="https://opencollective.com/debug/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/20/website" target="_blank"><img src="https://opencollective.com/debug/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/21/website" target="_blank"><img src="https://opencollective.com/debug/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/22/website" target="_blank"><img src="https://opencollective.com/debug/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/23/website" target="_blank"><img src="https://opencollective.com/debug/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/24/website" target="_blank"><img src="https://opencollective.com/debug/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/25/website" target="_blank"><img src="https://opencollective.com/debug/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/26/website" target="_blank"><img src="https://opencollective.com/debug/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/27/website" target="_blank"><img src="https://opencollective.com/debug/backer/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/28/website" target="_blank"><img src="https://opencollective.com/debug/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/backer/29/website" target="_blank"><img src="https://opencollective.com/debug/backer/29/avatar.svg"></a>
|
||||
|
||||
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)]
|
||||
|
||||
<a href="https://opencollective.com/debug/sponsor/0/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/0/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/1/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/1/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/2/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/3/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/4/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/5/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/6/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/7/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/8/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/9/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/10/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/11/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/12/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/13/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/14/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/15/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/16/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/17/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/18/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/19/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/20/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/21/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/22/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/23/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/24/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/25/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/26/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/27/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/28/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/debug/sponsor/29/website" target="_blank"><img src="https://opencollective.com/debug/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca>
|
||||
Copyright (c) 2018-2021 Josh Junon
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
65
node_modules/debug/package.json
generated
vendored
65
node_modules/debug/package.json
generated
vendored
|
|
@ -1,65 +0,0 @@
|
|||
{
|
||||
"name": "debug",
|
||||
"version": "4.4.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/debug-js/debug.git"
|
||||
},
|
||||
"description": "Lightweight debugging utility for Node.js and the browser",
|
||||
"keywords": [
|
||||
"debug",
|
||||
"log",
|
||||
"debugger"
|
||||
],
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"author": "Josh Junon (https://github.com/qix-)",
|
||||
"contributors": [
|
||||
"TJ Holowaychuk <tj@vision-media.ca>",
|
||||
"Nathan Rajlich <nathan@tootallnate.net> (http://n8.io)",
|
||||
"Andrew Rhyne <rhyneandrew@gmail.com>"
|
||||
],
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"lint": "xo",
|
||||
"test": "npm run test:node && npm run test:browser && npm run lint",
|
||||
"test:node": "istanbul cover _mocha -- test.js test.node.js",
|
||||
"test:browser": "karma start --single-run",
|
||||
"test:coverage": "cat ./coverage/lcov.info | coveralls"
|
||||
},
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"brfs": "^2.0.1",
|
||||
"browserify": "^16.2.3",
|
||||
"coveralls": "^3.0.2",
|
||||
"istanbul": "^0.4.5",
|
||||
"karma": "^3.1.4",
|
||||
"karma-browserify": "^6.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-mocha": "^1.3.0",
|
||||
"mocha": "^5.2.0",
|
||||
"mocha-lcov-reporter": "^1.2.0",
|
||||
"sinon": "^14.0.0",
|
||||
"xo": "^0.23.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"browser": "./src/browser.js",
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"xo": {
|
||||
"rules": {
|
||||
"import/extensions": "off"
|
||||
}
|
||||
}
|
||||
}
|
||||
272
node_modules/debug/src/browser.js
generated
vendored
272
node_modules/debug/src/browser.js
generated
vendored
|
|
@ -1,272 +0,0 @@
|
|||
/* eslint-env browser */
|
||||
|
||||
/**
|
||||
* This is the web browser implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.storage = localstorage();
|
||||
exports.destroy = (() => {
|
||||
let warned = false;
|
||||
|
||||
return () => {
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [
|
||||
'#0000CC',
|
||||
'#0000FF',
|
||||
'#0033CC',
|
||||
'#0033FF',
|
||||
'#0066CC',
|
||||
'#0066FF',
|
||||
'#0099CC',
|
||||
'#0099FF',
|
||||
'#00CC00',
|
||||
'#00CC33',
|
||||
'#00CC66',
|
||||
'#00CC99',
|
||||
'#00CCCC',
|
||||
'#00CCFF',
|
||||
'#3300CC',
|
||||
'#3300FF',
|
||||
'#3333CC',
|
||||
'#3333FF',
|
||||
'#3366CC',
|
||||
'#3366FF',
|
||||
'#3399CC',
|
||||
'#3399FF',
|
||||
'#33CC00',
|
||||
'#33CC33',
|
||||
'#33CC66',
|
||||
'#33CC99',
|
||||
'#33CCCC',
|
||||
'#33CCFF',
|
||||
'#6600CC',
|
||||
'#6600FF',
|
||||
'#6633CC',
|
||||
'#6633FF',
|
||||
'#66CC00',
|
||||
'#66CC33',
|
||||
'#9900CC',
|
||||
'#9900FF',
|
||||
'#9933CC',
|
||||
'#9933FF',
|
||||
'#99CC00',
|
||||
'#99CC33',
|
||||
'#CC0000',
|
||||
'#CC0033',
|
||||
'#CC0066',
|
||||
'#CC0099',
|
||||
'#CC00CC',
|
||||
'#CC00FF',
|
||||
'#CC3300',
|
||||
'#CC3333',
|
||||
'#CC3366',
|
||||
'#CC3399',
|
||||
'#CC33CC',
|
||||
'#CC33FF',
|
||||
'#CC6600',
|
||||
'#CC6633',
|
||||
'#CC9900',
|
||||
'#CC9933',
|
||||
'#CCCC00',
|
||||
'#CCCC33',
|
||||
'#FF0000',
|
||||
'#FF0033',
|
||||
'#FF0066',
|
||||
'#FF0099',
|
||||
'#FF00CC',
|
||||
'#FF00FF',
|
||||
'#FF3300',
|
||||
'#FF3333',
|
||||
'#FF3366',
|
||||
'#FF3399',
|
||||
'#FF33CC',
|
||||
'#FF33FF',
|
||||
'#FF6600',
|
||||
'#FF6633',
|
||||
'#FF9900',
|
||||
'#FF9933',
|
||||
'#FFCC00',
|
||||
'#FFCC33'
|
||||
];
|
||||
|
||||
/**
|
||||
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
||||
* and the Firebug extension (any Firefox version) are known
|
||||
* to support "%c" CSS customizations.
|
||||
*
|
||||
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line complexity
|
||||
function useColors() {
|
||||
// NB: In an Electron preload script, document will be defined but not fully
|
||||
// initialized. Since we know we're in Chrome, we'll just detect this case
|
||||
// explicitly
|
||||
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Internet Explorer and Edge do not support colors.
|
||||
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let m;
|
||||
|
||||
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
||||
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
||||
// eslint-disable-next-line no-return-assign
|
||||
return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||
|
||||
// Is firebug? http://stackoverflow.com/a/398120/376773
|
||||
(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||
|
||||
// Is firefox >= v31?
|
||||
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) ||
|
||||
// Double check webkit in userAgent just in case we are in a worker
|
||||
(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
||||
}
|
||||
|
||||
/**
|
||||
* Colorize log arguments if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
args[0] = (this.useColors ? '%c' : '') +
|
||||
this.namespace +
|
||||
(this.useColors ? ' %c' : ' ') +
|
||||
args[0] +
|
||||
(this.useColors ? '%c ' : ' ') +
|
||||
'+' + module.exports.humanize(this.diff);
|
||||
|
||||
if (!this.useColors) {
|
||||
return;
|
||||
}
|
||||
|
||||
const c = 'color: ' + this.color;
|
||||
args.splice(1, 0, c, 'color: inherit');
|
||||
|
||||
// The final "%c" is somewhat tricky, because there could be other
|
||||
// arguments passed either before or after the %c, so we need to
|
||||
// figure out the correct index to insert the CSS into
|
||||
let index = 0;
|
||||
let lastC = 0;
|
||||
args[0].replace(/%[a-zA-Z%]/g, match => {
|
||||
if (match === '%%') {
|
||||
return;
|
||||
}
|
||||
index++;
|
||||
if (match === '%c') {
|
||||
// We only are interested in the *last* %c
|
||||
// (the user may have provided their own)
|
||||
lastC = index;
|
||||
}
|
||||
});
|
||||
|
||||
args.splice(lastC, 0, c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `console.debug()` when available.
|
||||
* No-op when `console.debug` is not a "function".
|
||||
* If `console.debug` is not available, falls back
|
||||
* to `console.log`.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
exports.log = console.debug || console.log || (() => {});
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
try {
|
||||
if (namespaces) {
|
||||
exports.storage.setItem('debug', namespaces);
|
||||
} else {
|
||||
exports.storage.removeItem('debug');
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
function load() {
|
||||
let r;
|
||||
try {
|
||||
r = exports.storage.getItem('debug');
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
|
||||
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
||||
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
||||
r = process.env.DEBUG;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* Localstorage attempts to return the localstorage.
|
||||
*
|
||||
* This is necessary because safari throws
|
||||
* when a user disables cookies/localstorage
|
||||
* and you attempt to access it.
|
||||
*
|
||||
* @return {LocalStorage}
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function localstorage() {
|
||||
try {
|
||||
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
||||
// The Browser also has localStorage in the global context.
|
||||
return localStorage;
|
||||
} catch (error) {
|
||||
// Swallow
|
||||
// XXX (@Qix-) should we be logging these?
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
||||
*/
|
||||
|
||||
formatters.j = function (v) {
|
||||
try {
|
||||
return JSON.stringify(v);
|
||||
} catch (error) {
|
||||
return '[UnexpectedJSONParseError]: ' + error.message;
|
||||
}
|
||||
};
|
||||
292
node_modules/debug/src/common.js
generated
vendored
292
node_modules/debug/src/common.js
generated
vendored
|
|
@ -1,292 +0,0 @@
|
|||
|
||||
/**
|
||||
* This is the common logic for both the Node.js and web browser
|
||||
* implementations of `debug()`.
|
||||
*/
|
||||
|
||||
function setup(env) {
|
||||
createDebug.debug = createDebug;
|
||||
createDebug.default = createDebug;
|
||||
createDebug.coerce = coerce;
|
||||
createDebug.disable = disable;
|
||||
createDebug.enable = enable;
|
||||
createDebug.enabled = enabled;
|
||||
createDebug.humanize = require('ms');
|
||||
createDebug.destroy = destroy;
|
||||
|
||||
Object.keys(env).forEach(key => {
|
||||
createDebug[key] = env[key];
|
||||
});
|
||||
|
||||
/**
|
||||
* The currently active debug mode names, and names to skip.
|
||||
*/
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
/**
|
||||
* Map of special "%n" handling functions, for the debug "format" argument.
|
||||
*
|
||||
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
||||
*/
|
||||
createDebug.formatters = {};
|
||||
|
||||
/**
|
||||
* Selects a color for a debug namespace
|
||||
* @param {String} namespace The namespace string for the debug instance to be colored
|
||||
* @return {Number|String} An ANSI color code for the given namespace
|
||||
* @api private
|
||||
*/
|
||||
function selectColor(namespace) {
|
||||
let hash = 0;
|
||||
|
||||
for (let i = 0; i < namespace.length; i++) {
|
||||
hash = ((hash << 5) - hash) + namespace.charCodeAt(i);
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
|
||||
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
||||
}
|
||||
createDebug.selectColor = selectColor;
|
||||
|
||||
/**
|
||||
* Create a debugger with the given `namespace`.
|
||||
*
|
||||
* @param {String} namespace
|
||||
* @return {Function}
|
||||
* @api public
|
||||
*/
|
||||
function createDebug(namespace) {
|
||||
let prevTime;
|
||||
let enableOverride = null;
|
||||
let namespacesCache;
|
||||
let enabledCache;
|
||||
|
||||
function debug(...args) {
|
||||
// Disabled?
|
||||
if (!debug.enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const self = debug;
|
||||
|
||||
// Set `diff` timestamp
|
||||
const curr = Number(new Date());
|
||||
const ms = curr - (prevTime || curr);
|
||||
self.diff = ms;
|
||||
self.prev = prevTime;
|
||||
self.curr = curr;
|
||||
prevTime = curr;
|
||||
|
||||
args[0] = createDebug.coerce(args[0]);
|
||||
|
||||
if (typeof args[0] !== 'string') {
|
||||
// Anything else let's inspect with %O
|
||||
args.unshift('%O');
|
||||
}
|
||||
|
||||
// Apply any `formatters` transformations
|
||||
let index = 0;
|
||||
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
||||
// If we encounter an escaped % then don't increase the array index
|
||||
if (match === '%%') {
|
||||
return '%';
|
||||
}
|
||||
index++;
|
||||
const formatter = createDebug.formatters[format];
|
||||
if (typeof formatter === 'function') {
|
||||
const val = args[index];
|
||||
match = formatter.call(self, val);
|
||||
|
||||
// Now we need to remove `args[index]` since it's inlined in the `format`
|
||||
args.splice(index, 1);
|
||||
index--;
|
||||
}
|
||||
return match;
|
||||
});
|
||||
|
||||
// Apply env-specific formatting (colors, etc.)
|
||||
createDebug.formatArgs.call(self, args);
|
||||
|
||||
const logFn = self.log || createDebug.log;
|
||||
logFn.apply(self, args);
|
||||
}
|
||||
|
||||
debug.namespace = namespace;
|
||||
debug.useColors = createDebug.useColors();
|
||||
debug.color = createDebug.selectColor(namespace);
|
||||
debug.extend = extend;
|
||||
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
||||
|
||||
Object.defineProperty(debug, 'enabled', {
|
||||
enumerable: true,
|
||||
configurable: false,
|
||||
get: () => {
|
||||
if (enableOverride !== null) {
|
||||
return enableOverride;
|
||||
}
|
||||
if (namespacesCache !== createDebug.namespaces) {
|
||||
namespacesCache = createDebug.namespaces;
|
||||
enabledCache = createDebug.enabled(namespace);
|
||||
}
|
||||
|
||||
return enabledCache;
|
||||
},
|
||||
set: v => {
|
||||
enableOverride = v;
|
||||
}
|
||||
});
|
||||
|
||||
// Env-specific initialization logic for debug instances
|
||||
if (typeof createDebug.init === 'function') {
|
||||
createDebug.init(debug);
|
||||
}
|
||||
|
||||
return debug;
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
newDebug.log = this.log;
|
||||
return newDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
* separated by a colon and wildcards.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function enable(namespaces) {
|
||||
createDebug.save(namespaces);
|
||||
createDebug.namespaces = namespaces;
|
||||
|
||||
createDebug.names = [];
|
||||
createDebug.skips = [];
|
||||
|
||||
const split = (typeof namespaces === 'string' ? namespaces : '')
|
||||
.trim()
|
||||
.replace(' ', ',')
|
||||
.split(',')
|
||||
.filter(Boolean);
|
||||
|
||||
for (const ns of split) {
|
||||
if (ns[0] === '-') {
|
||||
createDebug.skips.push(ns.slice(1));
|
||||
} else {
|
||||
createDebug.names.push(ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given string matches a namespace template, honoring
|
||||
* asterisks as wildcards.
|
||||
*
|
||||
* @param {String} search
|
||||
* @param {String} template
|
||||
* @return {Boolean}
|
||||
*/
|
||||
function matchesTemplate(search, template) {
|
||||
let searchIndex = 0;
|
||||
let templateIndex = 0;
|
||||
let starIndex = -1;
|
||||
let matchIndex = 0;
|
||||
|
||||
while (searchIndex < search.length) {
|
||||
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
||||
// Match character or proceed with wildcard
|
||||
if (template[templateIndex] === '*') {
|
||||
starIndex = templateIndex;
|
||||
matchIndex = searchIndex;
|
||||
templateIndex++; // Skip the '*'
|
||||
} else {
|
||||
searchIndex++;
|
||||
templateIndex++;
|
||||
}
|
||||
} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition
|
||||
// Backtrack to the last '*' and try to match more characters
|
||||
templateIndex = starIndex + 1;
|
||||
matchIndex++;
|
||||
searchIndex = matchIndex;
|
||||
} else {
|
||||
return false; // No match
|
||||
}
|
||||
}
|
||||
|
||||
// Handle trailing '*' in template
|
||||
while (templateIndex < template.length && template[templateIndex] === '*') {
|
||||
templateIndex++;
|
||||
}
|
||||
|
||||
return templateIndex === template.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @return {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names,
|
||||
...createDebug.skips.map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
*
|
||||
* @param {String} name
|
||||
* @return {Boolean}
|
||||
* @api public
|
||||
*/
|
||||
function enabled(name) {
|
||||
for (const skip of createDebug.skips) {
|
||||
if (matchesTemplate(name, skip)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (const ns of createDebug.names) {
|
||||
if (matchesTemplate(name, ns)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
* @return {Mixed}
|
||||
* @api private
|
||||
*/
|
||||
function coerce(val) {
|
||||
if (val instanceof Error) {
|
||||
return val.stack || val.message;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* XXX DO NOT USE. This is a temporary stub function.
|
||||
* XXX It WILL be removed in the next major release.
|
||||
*/
|
||||
function destroy() {
|
||||
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
||||
}
|
||||
|
||||
createDebug.enable(createDebug.load());
|
||||
|
||||
return createDebug;
|
||||
}
|
||||
|
||||
module.exports = setup;
|
||||
10
node_modules/debug/src/index.js
generated
vendored
10
node_modules/debug/src/index.js
generated
vendored
|
|
@ -1,10 +0,0 @@
|
|||
/**
|
||||
* Detect Electron renderer / nwjs process, which is node, but we should
|
||||
* treat as a browser.
|
||||
*/
|
||||
|
||||
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
||||
module.exports = require('./browser.js');
|
||||
} else {
|
||||
module.exports = require('./node.js');
|
||||
}
|
||||
263
node_modules/debug/src/node.js
generated
vendored
263
node_modules/debug/src/node.js
generated
vendored
|
|
@ -1,263 +0,0 @@
|
|||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
const tty = require('tty');
|
||||
const util = require('util');
|
||||
|
||||
/**
|
||||
* This is the Node.js implementation of `debug()`.
|
||||
*/
|
||||
|
||||
exports.init = init;
|
||||
exports.log = log;
|
||||
exports.formatArgs = formatArgs;
|
||||
exports.save = save;
|
||||
exports.load = load;
|
||||
exports.useColors = useColors;
|
||||
exports.destroy = util.deprecate(
|
||||
() => {},
|
||||
'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'
|
||||
);
|
||||
|
||||
/**
|
||||
* Colors.
|
||||
*/
|
||||
|
||||
exports.colors = [6, 2, 3, 4, 5, 1];
|
||||
|
||||
try {
|
||||
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
const supportsColor = require('supports-color');
|
||||
|
||||
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
||||
exports.colors = [
|
||||
20,
|
||||
21,
|
||||
26,
|
||||
27,
|
||||
32,
|
||||
33,
|
||||
38,
|
||||
39,
|
||||
40,
|
||||
41,
|
||||
42,
|
||||
43,
|
||||
44,
|
||||
45,
|
||||
56,
|
||||
57,
|
||||
62,
|
||||
63,
|
||||
68,
|
||||
69,
|
||||
74,
|
||||
75,
|
||||
76,
|
||||
77,
|
||||
78,
|
||||
79,
|
||||
80,
|
||||
81,
|
||||
92,
|
||||
93,
|
||||
98,
|
||||
99,
|
||||
112,
|
||||
113,
|
||||
128,
|
||||
129,
|
||||
134,
|
||||
135,
|
||||
148,
|
||||
149,
|
||||
160,
|
||||
161,
|
||||
162,
|
||||
163,
|
||||
164,
|
||||
165,
|
||||
166,
|
||||
167,
|
||||
168,
|
||||
169,
|
||||
170,
|
||||
171,
|
||||
172,
|
||||
173,
|
||||
178,
|
||||
179,
|
||||
184,
|
||||
185,
|
||||
196,
|
||||
197,
|
||||
198,
|
||||
199,
|
||||
200,
|
||||
201,
|
||||
202,
|
||||
203,
|
||||
204,
|
||||
205,
|
||||
206,
|
||||
207,
|
||||
208,
|
||||
209,
|
||||
214,
|
||||
215,
|
||||
220,
|
||||
221
|
||||
];
|
||||
}
|
||||
} catch (error) {
|
||||
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
||||
}
|
||||
|
||||
/**
|
||||
* Build up the default `inspectOpts` object from the environment variables.
|
||||
*
|
||||
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
||||
*/
|
||||
|
||||
exports.inspectOpts = Object.keys(process.env).filter(key => {
|
||||
return /^debug_/i.test(key);
|
||||
}).reduce((obj, key) => {
|
||||
// Camel-case
|
||||
const prop = key
|
||||
.substring(6)
|
||||
.toLowerCase()
|
||||
.replace(/_([a-z])/g, (_, k) => {
|
||||
return k.toUpperCase();
|
||||
});
|
||||
|
||||
// Coerce string value into JS value
|
||||
let val = process.env[key];
|
||||
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
||||
val = true;
|
||||
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
||||
val = false;
|
||||
} else if (val === 'null') {
|
||||
val = null;
|
||||
} else {
|
||||
val = Number(val);
|
||||
}
|
||||
|
||||
obj[prop] = val;
|
||||
return obj;
|
||||
}, {});
|
||||
|
||||
/**
|
||||
* Is stdout a TTY? Colored output is enabled when `true`.
|
||||
*/
|
||||
|
||||
function useColors() {
|
||||
return 'colors' in exports.inspectOpts ?
|
||||
Boolean(exports.inspectOpts.colors) :
|
||||
tty.isatty(process.stderr.fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds ANSI color escape codes if enabled.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
function formatArgs(args) {
|
||||
const {namespace: name, useColors} = this;
|
||||
|
||||
if (useColors) {
|
||||
const c = this.color;
|
||||
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
||||
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
||||
|
||||
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
||||
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
||||
} else {
|
||||
args[0] = getDate() + name + ' ' + args[0];
|
||||
}
|
||||
}
|
||||
|
||||
function getDate() {
|
||||
if (exports.inspectOpts.hideDate) {
|
||||
return '';
|
||||
}
|
||||
return new Date().toISOString() + ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
||||
*/
|
||||
|
||||
function log(...args) {
|
||||
return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n');
|
||||
}
|
||||
|
||||
/**
|
||||
* Save `namespaces`.
|
||||
*
|
||||
* @param {String} namespaces
|
||||
* @api private
|
||||
*/
|
||||
function save(namespaces) {
|
||||
if (namespaces) {
|
||||
process.env.DEBUG = namespaces;
|
||||
} else {
|
||||
// If you set a process.env field to null or undefined, it gets cast to the
|
||||
// string 'null' or 'undefined'. Just delete instead.
|
||||
delete process.env.DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load `namespaces`.
|
||||
*
|
||||
* @return {String} returns the previously persisted debug modes
|
||||
* @api private
|
||||
*/
|
||||
|
||||
function load() {
|
||||
return process.env.DEBUG;
|
||||
}
|
||||
|
||||
/**
|
||||
* Init logic for `debug` instances.
|
||||
*
|
||||
* Create a new `inspectOpts` object in case `useColors` is set
|
||||
* differently for a particular `debug` instance.
|
||||
*/
|
||||
|
||||
function init(debug) {
|
||||
debug.inspectOpts = {};
|
||||
|
||||
const keys = Object.keys(exports.inspectOpts);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = require('./common')(exports);
|
||||
|
||||
const {formatters} = module.exports;
|
||||
|
||||
/**
|
||||
* Map %o to `util.inspect()`, all on a single line.
|
||||
*/
|
||||
|
||||
formatters.o = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts)
|
||||
.split('\n')
|
||||
.map(str => str.trim())
|
||||
.join(' ');
|
||||
};
|
||||
|
||||
/**
|
||||
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
||||
*/
|
||||
|
||||
formatters.O = function (v) {
|
||||
this.inspectOpts.colors = this.useColors;
|
||||
return util.inspect(v, this.inspectOpts);
|
||||
};
|
||||
21
node_modules/fetch-blob/LICENSE
generated
vendored
21
node_modules/fetch-blob/LICENSE
generated
vendored
|
|
@ -1,21 +0,0 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2019 David Frank
|
||||
|
||||
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.
|
||||
106
node_modules/fetch-blob/README.md
generated
vendored
106
node_modules/fetch-blob/README.md
generated
vendored
|
|
@ -1,106 +0,0 @@
|
|||
# fetch-blob
|
||||
|
||||
[![npm version][npm-image]][npm-url]
|
||||
[![build status][ci-image]][ci-url]
|
||||
[![coverage status][codecov-image]][codecov-url]
|
||||
[![install size][install-size-image]][install-size-url]
|
||||
|
||||
A Blob implementation in Node.js, originally from [node-fetch](https://github.com/node-fetch/node-fetch).
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install fetch-blob
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>Upgrading from 2x to 3x</summary>
|
||||
|
||||
Updating from 2 to 3 should be a breeze since there is not many changes to the blob specification.
|
||||
The major cause of a major release is coding standards.
|
||||
- internal WeakMaps was replaced with private fields
|
||||
- internal Buffer.from was replaced with TextEncoder/Decoder
|
||||
- internal buffers was replaced with Uint8Arrays
|
||||
- CommonJS was replaced with ESM
|
||||
- The node stream returned by calling `blob.stream()` was replaced with whatwg streams
|
||||
- (Read "Differences from other blobs" for more info.)
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Differences from other Blobs</summary>
|
||||
|
||||
- Unlike NodeJS `buffer.Blob` (Added in: v15.7.0) and browser native Blob this polyfilled version can't be sent via PostMessage
|
||||
- This blob version is more arbitrary, it can be constructed with blob parts that isn't a instance of itself
|
||||
it has to look and behave as a blob to be accepted as a blob part.
|
||||
- The benefit of this is that you can create other types of blobs that don't contain any internal data that has to be read in other ways, such as the `BlobDataItem` created in `from.js` that wraps a file path into a blob-like item and read lazily (nodejs plans to [implement this][fs-blobs] as well)
|
||||
- The `blob.stream()` is the most noticeable differences. It returns a WHATWG stream now. to keep it as a node stream you would have to do:
|
||||
|
||||
```js
|
||||
import {Readable} from 'stream'
|
||||
const stream = Readable.from(blob.stream())
|
||||
```
|
||||
</details>
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
// Ways to import
|
||||
// (PS it's dependency free ESM package so regular http-import from CDN works too)
|
||||
import Blob from 'fetch-blob'
|
||||
import File from 'fetch-blob/file.js'
|
||||
|
||||
import {Blob} from 'fetch-blob'
|
||||
import {File} from 'fetch-blob/file.js'
|
||||
|
||||
const {Blob} = await import('fetch-blob')
|
||||
|
||||
|
||||
// Ways to read the blob:
|
||||
const blob = new Blob(['hello, world'])
|
||||
|
||||
await blob.text()
|
||||
await blob.arrayBuffer()
|
||||
for await (let chunk of blob.stream()) { ... }
|
||||
blob.stream().getReader().read()
|
||||
blob.stream().getReader({mode: 'byob'}).read(view)
|
||||
```
|
||||
|
||||
### Blob part backed up by filesystem
|
||||
|
||||
`fetch-blob/from.js` comes packed with tools to convert any filepath into either a Blob or a File
|
||||
It will not read the content into memory. It will only stat the file for last modified date and file size.
|
||||
|
||||
```js
|
||||
// The default export is sync and use fs.stat to retrieve size & last modified as a blob
|
||||
import blobFromSync from 'fetch-blob/from.js'
|
||||
import {File, Blob, blobFrom, blobFromSync, fileFrom, fileFromSync} from 'fetch-blob/from.js'
|
||||
|
||||
const fsFile = fileFromSync('./2-GiB-file.bin', 'application/octet-stream')
|
||||
const fsBlob = await blobFrom('./2-GiB-file.mp4')
|
||||
|
||||
// Not a 4 GiB memory snapshot, just holds references
|
||||
// points to where data is located on the disk
|
||||
const blob = new Blob([fsFile, fsBlob, 'memory', new Uint8Array(10)])
|
||||
console.log(blob.size) // ~4 GiB
|
||||
```
|
||||
|
||||
`blobFrom|blobFromSync|fileFrom|fileFromSync(path, [mimetype])`
|
||||
|
||||
### Creating Blobs backed up by other async sources
|
||||
Our Blob & File class are more generic then any other polyfills in the way that it can accept any blob look-a-like item
|
||||
An example of this is that our blob implementation can be constructed with parts coming from [BlobDataItem](https://github.com/node-fetch/fetch-blob/blob/8ef89adad40d255a3bbd55cf38b88597c1cd5480/from.js#L32) (aka a filepath) or from [buffer.Blob](https://nodejs.org/api/buffer.html#buffer_new_buffer_blob_sources_options), It dose not have to implement all the methods - just enough that it can be read/understood by our Blob implementation. The minium requirements is that it has `Symbol.toStringTag`, `size`, `slice()` and either a `stream()` or a `arrayBuffer()` method. If you then wrap it in our Blob or File `new Blob([blobDataItem])` then you get all of the other methods that should be implemented in a blob or file
|
||||
|
||||
An example of this could be to create a file or blob like item coming from a remote HTTP request. Or from a DataBase
|
||||
|
||||
See the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Blob) and [tests](https://github.com/node-fetch/fetch-blob/blob/master/test.js) for more details of how to use the Blob.
|
||||
|
||||
[npm-image]: https://flat.badgen.net/npm/v/fetch-blob
|
||||
[npm-url]: https://www.npmjs.com/package/fetch-blob
|
||||
[ci-image]: https://github.com/node-fetch/fetch-blob/workflows/CI/badge.svg
|
||||
[ci-url]: https://github.com/node-fetch/fetch-blob/actions
|
||||
[codecov-image]: https://flat.badgen.net/codecov/c/github/node-fetch/fetch-blob/master
|
||||
[codecov-url]: https://codecov.io/gh/node-fetch/fetch-blob
|
||||
[install-size-image]: https://flat.badgen.net/packagephobia/install/fetch-blob
|
||||
[install-size-url]: https://packagephobia.now.sh/result?p=fetch-blob
|
||||
[fs-blobs]: https://github.com/nodejs/node/issues/37340
|
||||
2
node_modules/fetch-blob/file.d.ts
generated
vendored
2
node_modules/fetch-blob/file.d.ts
generated
vendored
|
|
@ -1,2 +0,0 @@
|
|||
/** @type {typeof globalThis.File} */ export const File: typeof globalThis.File;
|
||||
export default File;
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue