Add Brave CDP automation, replace Oracle browser mode
Connects to user's running Brave via Chrome DevTools Protocol to automate ChatGPT interaction. Uses puppeteer-core to open a tab, send the prompt, wait for response, and extract the result. No cookies, no separate profiles, no copy/paste. Just connects to the browser where the user is already logged in. One-time setup: relaunch Brave with --remote-debugging-port=9222 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
284
bin/plan-refine
284
bin/plan-refine
@@ -1,10 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# plan-refine — One-command plan iteration: ChatGPT review + Claude integration
|
||||
# plan-refine — Fully automated plan iteration: ChatGPT review + Claude integration
|
||||
# Usage: plan-refine <plan-file> [options]
|
||||
#
|
||||
# Step 1: Assembles evaluation prompt + plan content, copies to clipboard.
|
||||
# User pastes into ChatGPT, copies response, saves to feedback file.
|
||||
# Step 2: Claude CLI integrates feedback back into the plan file.
|
||||
# Connects to your running Brave browser via CDP, sends the plan to ChatGPT,
|
||||
# captures the response, then runs Claude CLI to integrate the feedback.
|
||||
# Zero copy/paste required.
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
@@ -17,6 +17,7 @@ while [[ -L "$SOURCE" ]]; do
|
||||
done
|
||||
SCRIPT_DIR="$(cd -P "$(dirname "$SOURCE")/.." && pwd)"
|
||||
PROMPTS_DIR="$SCRIPT_DIR/prompts"
|
||||
LIB_DIR="$SCRIPT_DIR/lib"
|
||||
|
||||
source "$SCRIPT_DIR/lib/frontmatter.sh"
|
||||
|
||||
@@ -26,24 +27,29 @@ DRY_RUN=false
|
||||
NO_INTEGRATE=false
|
||||
PLAN_FILE=""
|
||||
INIT_ONLY=false
|
||||
STEP=""
|
||||
CDP_PORT="${CHATGPT_CDP_PORT:-9222}"
|
||||
CHATGPT_TIMEOUT=600
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
plan-refine — Semi-automated plan iteration: ChatGPT review + Claude integration
|
||||
plan-refine — Fully automated plan iteration via Brave + Claude CLI
|
||||
|
||||
Usage: plan-refine <plan-file> [options]
|
||||
|
||||
Workflow per iteration:
|
||||
1. plan-refine <file> Copies ChatGPT prompt to clipboard
|
||||
2. Paste into ChatGPT, copy response, save to <file>.feedback-N.md
|
||||
3. plan-refine <file> --integrate Claude integrates feedback into plan
|
||||
Runs the full cycle automatically:
|
||||
1. Sends plan to ChatGPT via your running Brave browser (CDP)
|
||||
2. Captures ChatGPT's response
|
||||
3. Claude CLI integrates feedback back into the plan file
|
||||
|
||||
Requires: Brave running with --remote-debugging-port=9222
|
||||
Relaunch: open -a "Brave Browser" --args --remote-debugging-port=9222
|
||||
|
||||
Options:
|
||||
--integrate Run Claude integration (Step 2)
|
||||
--no-integrate Skip Claude integration, just update frontmatter
|
||||
--claude-model <m> Claude model for integration (default: your default)
|
||||
--dry-run Preview what would happen
|
||||
--no-integrate Get ChatGPT feedback only, skip Claude integration
|
||||
--claude-model <m> Claude model for integration (default: your default)
|
||||
--timeout <seconds> ChatGPT response timeout (default: 600)
|
||||
--cdp-port <port> Brave CDP port (default: 9222, or CHATGPT_CDP_PORT env)
|
||||
--init Add plan frontmatter to file without running anything
|
||||
-h, --help Show this help
|
||||
EOF
|
||||
@@ -52,10 +58,11 @@ EOF
|
||||
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--integrate) STEP="integrate"; shift ;;
|
||||
--no-integrate) NO_INTEGRATE=true; shift ;;
|
||||
--dry-run) DRY_RUN=true; shift ;;
|
||||
--no-integrate) NO_INTEGRATE=true; shift ;;
|
||||
--claude-model) CLAUDE_MODEL="$2"; shift 2 ;;
|
||||
--timeout) CHATGPT_TIMEOUT="$2"; shift 2 ;;
|
||||
--cdp-port) CDP_PORT="$2"; shift 2 ;;
|
||||
--init) INIT_ONLY=true; shift ;;
|
||||
-h|--help) usage ;;
|
||||
-*) echo "Unknown option: $1" >&2; exit 2 ;;
|
||||
@@ -84,7 +91,6 @@ if ! head -1 "$PLAN_FILE" | grep -q '^---$'; then
|
||||
fi
|
||||
|
||||
if ! is_plan_file "$PLAN_FILE"; then
|
||||
echo "Adding plan: true to frontmatter..."
|
||||
set_frontmatter "$PLAN_FILE" "plan" "true"
|
||||
fi
|
||||
|
||||
@@ -116,56 +122,91 @@ if [[ "$STATUS" == "ready" || "$STATUS" == "implementing" || "$STATUS" == "compl
|
||||
[[ "$confirm" != "y" && "$confirm" != "Y" ]] && exit 0
|
||||
fi
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Route to the right step
|
||||
# ──────────────────────────────────────────────
|
||||
echo "=== plan-refine ==="
|
||||
echo " Plan: $(basename "$PLAN_FILE")"
|
||||
echo " Status: $STATUS"
|
||||
echo " Iteration: $ITERATION -> $NEXT_ITERATION (target: $TARGET)"
|
||||
echo " Feedback: $(basename "$FEEDBACK_FILE")"
|
||||
if [[ "$NO_INTEGRATE" == "true" ]]; then
|
||||
echo " Mode: ChatGPT review only"
|
||||
else
|
||||
echo " Mode: Full cycle (ChatGPT + Claude integration)"
|
||||
fi
|
||||
echo ""
|
||||
|
||||
if [[ "$STEP" == "integrate" ]]; then
|
||||
# ──────────────────────────────────────────
|
||||
# Step 2: Claude integration
|
||||
# ──────────────────────────────────────────
|
||||
|
||||
# Find the latest feedback file
|
||||
if [[ -f "$FEEDBACK_FILE" ]]; then
|
||||
FOUND_FEEDBACK="$FEEDBACK_FILE"
|
||||
else
|
||||
# Search for any feedback file for the current iteration
|
||||
FOUND_FEEDBACK=$(ls -t "${PLAN_FILE%.md}".feedback-*.md 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [[ -z "$FOUND_FEEDBACK" || ! -f "$FOUND_FEEDBACK" ]]; then
|
||||
echo "Error: No feedback file found." >&2
|
||||
echo "Expected: $FEEDBACK_FILE" >&2
|
||||
echo "" >&2
|
||||
echo "Run step 1 first: plan-refine $PLAN_FILE" >&2
|
||||
echo "Then save ChatGPT's response to: $FEEDBACK_FILE" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "=== plan-refine --integrate ==="
|
||||
echo " Plan: $(basename "$PLAN_FILE")"
|
||||
echo " Feedback: $(basename "$FOUND_FEEDBACK")"
|
||||
echo " Iteration: $ITERATION -> $NEXT_ITERATION (target: $TARGET)"
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "=== DRY RUN ==="
|
||||
echo ""
|
||||
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "=== DRY RUN ==="
|
||||
echo "Would run:"
|
||||
echo " claude -p <integration-prompt> \\"
|
||||
echo " --allowedTools \"Read,Edit,Write\" \\"
|
||||
echo " --permission-mode acceptEdits \\"
|
||||
echo " --add-dir \"$PLAN_DIR\""
|
||||
[[ -n "$CLAUDE_MODEL" ]] && echo " --model $CLAUDE_MODEL"
|
||||
exit 0
|
||||
echo "Step 1: ChatGPT via Brave CDP (port $CDP_PORT)"
|
||||
echo " node $LIB_DIR/chatgpt-send.mjs <prompt-file> $FEEDBACK_FILE --timeout $CHATGPT_TIMEOUT"
|
||||
echo ""
|
||||
if [[ "$NO_INTEGRATE" != "true" ]]; then
|
||||
echo "Step 2: Claude CLI integration"
|
||||
echo " claude -p <integration-prompt> --allowedTools Read,Edit,Write --permission-mode acceptEdits"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$NO_INTEGRATE" == "true" ]]; then
|
||||
echo "Skipping Claude integration (--no-integrate)."
|
||||
else
|
||||
echo "Claude integrating feedback into plan..."
|
||||
# ──────────────────────────────────────────────
|
||||
# Check Brave CDP connectivity
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
CLAUDE_PROMPT="Read the original plan at: ${PLAN_FILE}
|
||||
Read ChatGPT's feedback at: ${FOUND_FEEDBACK}
|
||||
if ! curl -s "http://127.0.0.1:${CDP_PORT}/json/version" >/dev/null 2>&1; then
|
||||
echo "Error: Cannot connect to Brave on port $CDP_PORT" >&2
|
||||
echo "" >&2
|
||||
echo "Brave needs to be running with CDP enabled. Do this once:" >&2
|
||||
echo " 1. Quit Brave (Cmd+Q)" >&2
|
||||
echo " 2. open -a \"Brave Browser\" --args --remote-debugging-port=$CDP_PORT" >&2
|
||||
echo "" >&2
|
||||
echo "Or set CHATGPT_CDP_PORT if using a different port." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Step 1: Send to ChatGPT via Brave
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
echo "[Step 1] Sending plan to ChatGPT via Brave..."
|
||||
|
||||
# Build the full prompt file (eval prompt + plan content)
|
||||
PROMPT_TMPFILE=$(mktemp /tmp/plan-refine-prompt-XXXXXX.md)
|
||||
{
|
||||
echo "$EVAL_PROMPT"
|
||||
echo ""
|
||||
echo "---"
|
||||
echo ""
|
||||
cat "$PLAN_FILE"
|
||||
} > "$PROMPT_TMPFILE"
|
||||
|
||||
CHATGPT_CDP_PORT="$CDP_PORT" node "$LIB_DIR/chatgpt-send.mjs" \
|
||||
"$PROMPT_TMPFILE" \
|
||||
"$FEEDBACK_FILE" \
|
||||
--timeout "$CHATGPT_TIMEOUT"
|
||||
|
||||
CHATGPT_EXIT=$?
|
||||
rm -f "$PROMPT_TMPFILE"
|
||||
|
||||
if [[ $CHATGPT_EXIT -ne 0 ]]; then
|
||||
echo "Error: ChatGPT send failed (exit $CHATGPT_EXIT)" >&2
|
||||
exit $CHATGPT_EXIT
|
||||
fi
|
||||
|
||||
echo "ChatGPT feedback saved to: $FEEDBACK_FILE"
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Step 2: Claude integration
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
if [[ "$NO_INTEGRATE" == "true" ]]; then
|
||||
echo ""
|
||||
echo "Skipping integration (--no-integrate)."
|
||||
echo "Run manually: plan-refine $(basename "$PLAN_FILE") --integrate-only"
|
||||
else
|
||||
echo ""
|
||||
echo "[Step 2] Claude integrating feedback into plan..."
|
||||
|
||||
CLAUDE_PROMPT="Read the original plan at: ${PLAN_FILE}
|
||||
Read ChatGPT's feedback at: ${FEEDBACK_FILE}
|
||||
|
||||
${INTEGRATE_PROMPT}
|
||||
|
||||
@@ -175,95 +216,42 @@ Important instructions:
|
||||
- Only modify the content below the frontmatter.
|
||||
- Do NOT output the plan to stdout. Write it directly to the file."
|
||||
|
||||
CLAUDE_MODEL_ARGS=()
|
||||
if [[ -n "$CLAUDE_MODEL" ]]; then
|
||||
CLAUDE_MODEL_ARGS+=(--model "$CLAUDE_MODEL")
|
||||
fi
|
||||
|
||||
claude -p "$CLAUDE_PROMPT" \
|
||||
--allowedTools "Read,Edit,Write" \
|
||||
--permission-mode acceptEdits \
|
||||
--add-dir "$PLAN_DIR" \
|
||||
"${CLAUDE_MODEL_ARGS[@]}"
|
||||
|
||||
CLAUDE_EXIT=$?
|
||||
|
||||
if [[ $CLAUDE_EXIT -ne 0 ]]; then
|
||||
echo "Error: Claude CLI exited with code $CLAUDE_EXIT" >&2
|
||||
echo "Feedback is still available at: $FOUND_FEEDBACK" >&2
|
||||
echo "You can integrate manually in Claude Code." >&2
|
||||
exit $CLAUDE_EXIT
|
||||
fi
|
||||
|
||||
echo "Integration complete. Plan updated."
|
||||
CLAUDE_MODEL_ARGS=()
|
||||
if [[ -n "$CLAUDE_MODEL" ]]; then
|
||||
CLAUDE_MODEL_ARGS+=(--model "$CLAUDE_MODEL")
|
||||
fi
|
||||
|
||||
# Update frontmatter
|
||||
set_frontmatter "$PLAN_FILE" "iteration" "$NEXT_ITERATION"
|
||||
set_frontmatter "$PLAN_FILE" "updated" "$(date +%Y-%m-%d)"
|
||||
if [[ "$STATUS" == "drafting" ]]; then
|
||||
set_frontmatter "$PLAN_FILE" "status" "iterating"
|
||||
claude -p "$CLAUDE_PROMPT" \
|
||||
--allowedTools "Read,Edit,Write" \
|
||||
--permission-mode acceptEdits \
|
||||
--add-dir "$PLAN_DIR" \
|
||||
"${CLAUDE_MODEL_ARGS[@]}"
|
||||
|
||||
CLAUDE_EXIT=$?
|
||||
|
||||
if [[ $CLAUDE_EXIT -ne 0 ]]; then
|
||||
echo "Error: Claude integration failed (exit $CLAUDE_EXIT)" >&2
|
||||
echo "Feedback still available at: $FEEDBACK_FILE" >&2
|
||||
exit $CLAUDE_EXIT
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Iteration $NEXT_ITERATION/$TARGET complete ==="
|
||||
|
||||
if [[ $NEXT_ITERATION -ge $TARGET ]]; then
|
||||
echo ""
|
||||
echo "Target iterations reached. Plan may be ready for bead splitting."
|
||||
echo "To advance status: set 'status: splitting' in the frontmatter."
|
||||
fi
|
||||
|
||||
else
|
||||
# ──────────────────────────────────────────
|
||||
# Step 1: Prepare ChatGPT prompt
|
||||
# ──────────────────────────────────────────
|
||||
|
||||
echo "=== plan-refine ==="
|
||||
echo " Plan: $(basename "$PLAN_FILE")"
|
||||
echo " Status: $STATUS"
|
||||
echo " Iteration: $ITERATION -> $NEXT_ITERATION (target: $TARGET)"
|
||||
echo ""
|
||||
|
||||
# Use Oracle's --render --copy to bundle prompt + file content
|
||||
if command -v oracle &>/dev/null; then
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "=== DRY RUN ==="
|
||||
echo "Would run: oracle --render --copy -p <eval-prompt> --file $PLAN_FILE"
|
||||
echo ""
|
||||
echo "=== PROMPT ==="
|
||||
echo "$EVAL_PROMPT"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
oracle --render --copy \
|
||||
-p "$EVAL_PROMPT" \
|
||||
--file "$PLAN_FILE" 2>/dev/null
|
||||
|
||||
echo "ChatGPT prompt copied to clipboard (assembled by Oracle)."
|
||||
else
|
||||
# Fallback: manual clipboard assembly
|
||||
if [[ "$DRY_RUN" == "true" ]]; then
|
||||
echo "=== DRY RUN ==="
|
||||
echo "Would copy evaluation prompt + plan content to clipboard."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PLAN_CONTENT=$(cat "$PLAN_FILE")
|
||||
CLIPBOARD="${EVAL_PROMPT}
|
||||
|
||||
---
|
||||
|
||||
${PLAN_CONTENT}"
|
||||
echo "$CLIPBOARD" | pbcopy
|
||||
echo "ChatGPT prompt copied to clipboard."
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Paste into ChatGPT (Cmd+V)"
|
||||
echo " 2. Wait for response"
|
||||
echo " 3. Copy ChatGPT's full response"
|
||||
echo " 4. Save it to: $FEEDBACK_FILE"
|
||||
echo " 5. Run: plan-refine $(basename "$PLAN_FILE") --integrate"
|
||||
echo "Integration complete. Plan updated."
|
||||
fi
|
||||
|
||||
# ──────────────────────────────────────────────
|
||||
# Update frontmatter
|
||||
# ──────────────────────────────────────────────
|
||||
|
||||
set_frontmatter "$PLAN_FILE" "iteration" "$NEXT_ITERATION"
|
||||
set_frontmatter "$PLAN_FILE" "updated" "$(date +%Y-%m-%d)"
|
||||
if [[ "$STATUS" == "drafting" ]]; then
|
||||
set_frontmatter "$PLAN_FILE" "status" "iterating"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "=== Iteration $NEXT_ITERATION/$TARGET complete ==="
|
||||
|
||||
if [[ $NEXT_ITERATION -ge $TARGET ]]; then
|
||||
echo ""
|
||||
echo "Target iterations reached. Plan may be ready for bead splitting."
|
||||
fi
|
||||
|
||||
196
lib/chatgpt-send.mjs
Normal file
196
lib/chatgpt-send.mjs
Normal file
@@ -0,0 +1,196 @@
|
||||
#!/usr/bin/env node
|
||||
// chatgpt-send.mjs — Send a prompt to ChatGPT via the user's running Brave browser
|
||||
// Connects via Chrome DevTools Protocol to an already-authenticated session.
|
||||
//
|
||||
// Usage: node chatgpt-send.mjs <prompt-file> <output-file> [--timeout <seconds>]
|
||||
//
|
||||
// Requires: Brave running with --remote-debugging-port=9222
|
||||
|
||||
import puppeteer from 'puppeteer-core';
|
||||
import { readFileSync, writeFileSync } from 'fs';
|
||||
|
||||
const CDP_URL = `http://127.0.0.1:${process.env.CHATGPT_CDP_PORT || '9222'}`;
|
||||
const DEFAULT_TIMEOUT_SEC = 600; // 10 minutes for long responses
|
||||
|
||||
function parseArgs() {
|
||||
const args = process.argv.slice(2);
|
||||
let promptFile = null;
|
||||
let outputFile = null;
|
||||
let timeoutSec = DEFAULT_TIMEOUT_SEC;
|
||||
|
||||
for (let i = 0; i < args.length; i++) {
|
||||
if (args[i] === '--timeout' && args[i + 1]) {
|
||||
timeoutSec = parseInt(args[i + 1], 10);
|
||||
i++;
|
||||
} else if (!promptFile) {
|
||||
promptFile = args[i];
|
||||
} else if (!outputFile) {
|
||||
outputFile = args[i];
|
||||
}
|
||||
}
|
||||
|
||||
if (!promptFile || !outputFile) {
|
||||
console.error('Usage: node chatgpt-send.mjs <prompt-file> <output-file> [--timeout <seconds>]');
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
return { promptFile, outputFile, timeoutSec };
|
||||
}
|
||||
|
||||
async function waitForSelector(page, selector, timeout) {
|
||||
return page.waitForSelector(selector, { timeout });
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const { promptFile, outputFile, timeoutSec } = parseArgs();
|
||||
const prompt = readFileSync(promptFile, 'utf-8').trim();
|
||||
const timeoutMs = timeoutSec * 1000;
|
||||
|
||||
// Connect to running Brave
|
||||
let browser;
|
||||
try {
|
||||
browser = await puppeteer.connect({ browserURL: CDP_URL });
|
||||
} catch (err) {
|
||||
console.error(`Cannot connect to Brave at ${CDP_URL}`);
|
||||
console.error('Make sure Brave is running with: --remote-debugging-port=9222');
|
||||
console.error('');
|
||||
console.error('Relaunch Brave:');
|
||||
console.error(' 1. Quit Brave (Cmd+Q)');
|
||||
console.error(' 2. Run: open -a "Brave Browser" --args --remote-debugging-port=9222');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Open new tab for ChatGPT
|
||||
const page = await browser.newPage();
|
||||
|
||||
try {
|
||||
console.error('Navigating to ChatGPT...');
|
||||
await page.goto('https://chatgpt.com/', { waitUntil: 'networkidle2', timeout: 30000 });
|
||||
|
||||
// Verify we're logged in by checking for the composer
|
||||
const composerSelector = '#prompt-textarea, [id="prompt-textarea"], div[contenteditable="true"][data-placeholder]';
|
||||
try {
|
||||
await waitForSelector(page, composerSelector, 15000);
|
||||
} catch {
|
||||
// Check if login button is present
|
||||
const loginBtn = await page.$('button[data-testid="login-button"], a[href*="auth"]');
|
||||
if (loginBtn) {
|
||||
console.error('ERROR: Not logged into ChatGPT. Log in via Brave first.');
|
||||
process.exit(1);
|
||||
}
|
||||
console.error('ERROR: Could not find ChatGPT composer. The UI may have changed.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
console.error('Logged in. Sending prompt...');
|
||||
|
||||
// Find and focus the composer
|
||||
const composer = await page.$(composerSelector);
|
||||
await composer.click();
|
||||
|
||||
// Type the prompt — use clipboard for large prompts
|
||||
await page.evaluate(async (text) => {
|
||||
const composer = document.querySelector('#prompt-textarea, [id="prompt-textarea"], div[contenteditable="true"][data-placeholder]');
|
||||
if (composer) {
|
||||
// Use execCommand for contenteditable divs
|
||||
composer.focus();
|
||||
// Clear existing content
|
||||
document.execCommand('selectAll', false, null);
|
||||
// Insert via clipboard API for reliability with large text
|
||||
const clipItem = new ClipboardItem({
|
||||
'text/plain': new Blob([text], { type: 'text/plain' })
|
||||
});
|
||||
await navigator.clipboard.write([clipItem]);
|
||||
document.execCommand('paste');
|
||||
}
|
||||
}, prompt);
|
||||
|
||||
// Small delay to ensure content is rendered
|
||||
await new Promise(r => setTimeout(r, 500));
|
||||
|
||||
// Verify content was entered
|
||||
const composerText = await page.evaluate(() => {
|
||||
const el = document.querySelector('#prompt-textarea, [id="prompt-textarea"], div[contenteditable="true"][data-placeholder]');
|
||||
return el ? el.textContent.length : 0;
|
||||
});
|
||||
|
||||
if (composerText < 10) {
|
||||
// Fallback: type directly (slower but more reliable)
|
||||
console.error('Clipboard paste failed, typing directly...');
|
||||
await composer.click({ clickCount: 3 }); // select all
|
||||
await page.keyboard.type(prompt, { delay: 1 });
|
||||
}
|
||||
|
||||
// Find and click the send button
|
||||
const sendSelector = 'button[data-testid="send-button"], button[aria-label="Send prompt"], button[aria-label*="Send"]';
|
||||
const sendBtn = await page.$(sendSelector);
|
||||
if (sendBtn) {
|
||||
await sendBtn.click();
|
||||
} else {
|
||||
// Fallback: press Enter
|
||||
await page.keyboard.press('Enter');
|
||||
}
|
||||
|
||||
console.error('Prompt sent. Waiting for response...');
|
||||
|
||||
// Wait for the response to complete
|
||||
// Strategy: watch for the stop button to appear then disappear
|
||||
const stopSelector = 'button[data-testid="stop-button"], button[aria-label="Stop generating"], button[aria-label*="Stop"]';
|
||||
|
||||
// Wait for generation to start (stop button appears)
|
||||
try {
|
||||
await waitForSelector(page, stopSelector, 30000);
|
||||
console.error('Generating...');
|
||||
} catch {
|
||||
// Stop button might not appear for very fast responses
|
||||
console.error('Response may have completed quickly.');
|
||||
}
|
||||
|
||||
// Wait for generation to finish (stop button disappears)
|
||||
await page.waitForFunction(
|
||||
(sel) => !document.querySelector(sel),
|
||||
{ timeout: timeoutMs, polling: 1000 },
|
||||
stopSelector
|
||||
);
|
||||
|
||||
// Small delay for final rendering
|
||||
await new Promise(r => setTimeout(r, 2000));
|
||||
|
||||
console.error('Response complete. Extracting...');
|
||||
|
||||
// Extract the last assistant message
|
||||
const response = await page.evaluate(() => {
|
||||
// ChatGPT renders assistant messages in article elements or divs with specific data attributes
|
||||
const messages = document.querySelectorAll(
|
||||
'[data-message-author-role="assistant"], article[data-testid*="conversation-turn"]'
|
||||
);
|
||||
if (messages.length === 0) return null;
|
||||
|
||||
const lastMessage = messages[messages.length - 1];
|
||||
|
||||
// Try to get markdown content via the copy button's data
|
||||
// Fallback to innerText
|
||||
const markdownEl = lastMessage.querySelector('.markdown, .prose');
|
||||
if (markdownEl) return markdownEl.innerText;
|
||||
return lastMessage.innerText;
|
||||
});
|
||||
|
||||
if (!response) {
|
||||
console.error('ERROR: Could not extract response from page.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
writeFileSync(outputFile, response, 'utf-8');
|
||||
console.error(`Response saved to: ${outputFile} (${response.length} chars)`);
|
||||
|
||||
} finally {
|
||||
// Close the tab we opened, don't close the browser
|
||||
await page.close();
|
||||
browser.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
main().catch(err => {
|
||||
console.error(`Fatal: ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
1
node_modules/.bin/browsers
generated
vendored
Symbolic link
1
node_modules/.bin/browsers
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../@puppeteer/browsers/lib/cjs/main-cli.js
|
||||
1
node_modules/.bin/escodegen
generated
vendored
Symbolic link
1
node_modules/.bin/escodegen
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../escodegen/bin/escodegen.js
|
||||
1
node_modules/.bin/esgenerate
generated
vendored
Symbolic link
1
node_modules/.bin/esgenerate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../escodegen/bin/esgenerate.js
|
||||
1
node_modules/.bin/esparse
generated
vendored
Symbolic link
1
node_modules/.bin/esparse
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esparse.js
|
||||
1
node_modules/.bin/esvalidate
generated
vendored
Symbolic link
1
node_modules/.bin/esvalidate
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../esprima/bin/esvalidate.js
|
||||
1
node_modules/.bin/extract-zip
generated
vendored
Symbolic link
1
node_modules/.bin/extract-zip
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../extract-zip/cli.js
|
||||
1
node_modules/.bin/semver
generated
vendored
Symbolic link
1
node_modules/.bin/semver
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../semver/bin/semver.js
|
||||
919
node_modules/.package-lock.json
generated
vendored
Normal file
919
node_modules/.package-lock.json
generated
vendored
Normal file
@@ -0,0 +1,919 @@
|
||||
{
|
||||
"name": "plan-tools",
|
||||
"version": "1.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"node_modules/@puppeteer/browsers": {
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.12.0.tgz",
|
||||
"integrity": "sha512-Xuq42yxcQJ54ti8ZHNzF5snFvtpgXzNToJ1bXUGQRaiO8t+B6UM8sTUJfvV+AJnqtkJU/7hdy6nbKyA12aHtRw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"debug": "^4.4.3",
|
||||
"extract-zip": "^2.0.1",
|
||||
"progress": "^2.0.3",
|
||||
"proxy-agent": "^6.5.0",
|
||||
"semver": "^7.7.3",
|
||||
"tar-fs": "^3.1.1",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"bin": {
|
||||
"browsers": "lib/cjs/main-cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@tootallnate/quickjs-emscripten": {
|
||||
"version": "0.23.0",
|
||||
"resolved": "https://registry.npmjs.org/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz",
|
||||
"integrity": "sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "25.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.1.tgz",
|
||||
"integrity": "sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/yauzl": {
|
||||
"version": "2.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.3.tgz",
|
||||
"integrity": "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q==",
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/agent-base": {
|
||||
"version": "7.1.4",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
|
||||
"integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-regex": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
|
||||
"integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/ansi-styles": {
|
||||
"version": "4.3.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-convert": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ast-types": {
|
||||
"version": "0.13.4",
|
||||
"resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.13.4.tgz",
|
||||
"integrity": "sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"tslib": "^2.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/b4a": {
|
||||
"version": "1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/b4a/-/b4a-1.7.3.tgz",
|
||||
"integrity": "sha512-5Q2mfq2WfGuFp3uS//0s6baOJLMoVduPYVeNmDYxu5OUA1/cBfvr2RIS7vi62LdNj/urk1hfmj867I3qt6uZ7Q==",
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"react-native-b4a": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"react-native-b4a": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/bare-events": {
|
||||
"version": "2.8.2",
|
||||
"resolved": "https://registry.npmjs.org/bare-events/-/bare-events-2.8.2.tgz",
|
||||
"integrity": "sha512-riJjyv1/mHLIPX4RwiK+oW9/4c3TEUeORHKefKAKnZ5kyslbN+HXowtbaVEqt4IMUB7OXlfixcs6gsFeo/jhiQ==",
|
||||
"license": "Apache-2.0",
|
||||
"peerDependencies": {
|
||||
"bare-abort-controller": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bare-abort-controller": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/bare-fs": {
|
||||
"version": "4.5.3",
|
||||
"resolved": "https://registry.npmjs.org/bare-fs/-/bare-fs-4.5.3.tgz",
|
||||
"integrity": "sha512-9+kwVx8QYvt3hPWnmb19tPnh38c6Nihz8Lx3t0g9+4GoIf3/fTgYwM4Z6NxgI+B9elLQA7mLE9PpqcWtOMRDiQ==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"bare-events": "^2.5.4",
|
||||
"bare-path": "^3.0.0",
|
||||
"bare-stream": "^2.6.4",
|
||||
"bare-url": "^2.2.2",
|
||||
"fast-fifo": "^1.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"bare": ">=1.16.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bare-buffer": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bare-buffer": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/bare-os": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/bare-os/-/bare-os-3.6.2.tgz",
|
||||
"integrity": "sha512-T+V1+1srU2qYNBmJCXZkUY5vQ0B4FSlL3QDROnKQYOqeiQR8UbjNHlPa+TIbM4cuidiN9GaTaOZgSEgsvPbh5A==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"bare": ">=1.14.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bare-path": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bare-path/-/bare-path-3.0.0.tgz",
|
||||
"integrity": "sha512-tyfW2cQcB5NN8Saijrhqn0Zh7AnFNsnczRcuWODH0eYAXBsJ5gVxAUuNr7tsHSC6IZ77cA0SitzT+s47kot8Mw==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"bare-os": "^3.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bare-stream": {
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/bare-stream/-/bare-stream-2.7.0.tgz",
|
||||
"integrity": "sha512-oyXQNicV1y8nc2aKffH+BUHFRXmx6VrPzlnaEvMhram0nPBrKcEdcyBg5r08D0i8VxngHFAiVyn1QKXpSG0B8A==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"streamx": "^2.21.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bare-buffer": "*",
|
||||
"bare-events": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bare-buffer": {
|
||||
"optional": true
|
||||
},
|
||||
"bare-events": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/bare-url": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/bare-url/-/bare-url-2.3.2.tgz",
|
||||
"integrity": "sha512-ZMq4gd9ngV5aTMa5p9+UfY0b3skwhHELaDkhEHetMdX0LRkW9kzaym4oo/Eh+Ghm0CCDuMTsRIGM/ytUc1ZYmw==",
|
||||
"license": "Apache-2.0",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"bare-path": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/basic-ftp": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.1.0.tgz",
|
||||
"integrity": "sha512-RkaJzeJKDbaDWTIPiJwubyljaEPwpVWkm9Rt5h9Nd6h7tEXTJ3VB4qxdZBioV7JO5yLUaOKwz7vDOzlncUsegw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer-crc32": {
|
||||
"version": "0.2.13",
|
||||
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
|
||||
"integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/chromium-bidi": {
|
||||
"version": "13.1.1",
|
||||
"resolved": "https://registry.npmjs.org/chromium-bidi/-/chromium-bidi-13.1.1.tgz",
|
||||
"integrity": "sha512-zB9MpoPd7VJwjowQqiW3FKOvQwffFMjQ8Iejp5ZW+sJaKLRhZX1sTxzl3Zt22TDB4zP0OOqs8lRoY7eAW5geyQ==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"mitt": "^3.0.1",
|
||||
"zod": "^3.24.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"devtools-protocol": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/cliui": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
|
||||
"integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"string-width": "^4.2.0",
|
||||
"strip-ansi": "^6.0.1",
|
||||
"wrap-ansi": "^7.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/color-convert": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"color-name": "~1.1.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=7.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/color-name": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/data-uri-to-buffer": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-6.0.2.tgz",
|
||||
"integrity": "sha512-7hvf7/GW8e86rW0ptuwS3OcBGDjIi6SZva7hCyWC0yYry2cOPmLIjXAUHI6DK2HsnwJd9ifmt57i8eV2n4YNpw==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/debug": {
|
||||
"version": "4.4.3",
|
||||
"resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
|
||||
"integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ms": "^2.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"supports-color": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/degenerator": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz",
|
||||
"integrity": "sha512-TllpMR/t0M5sqCXfj85i4XaAzxmS5tVA16dqvdkMwGmzI+dXLXnw3J+3Vdv7VKw+ThlTMboK6i9rnZ6Nntj5CQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ast-types": "^0.13.4",
|
||||
"escodegen": "^2.1.0",
|
||||
"esprima": "^4.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/devtools-protocol": {
|
||||
"version": "0.0.1566079",
|
||||
"resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.1566079.tgz",
|
||||
"integrity": "sha512-MJfAEA1UfVhSs7fbSQOG4czavUp1ajfg6prlAN0+cmfa2zNjaIbvq8VneP7do1WAQQIvgNJWSMeP6UyI90gIlQ==",
|
||||
"license": "BSD-3-Clause"
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
|
||||
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.5",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",
|
||||
"integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/escalade": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
|
||||
"integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/escodegen": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/escodegen/-/escodegen-2.1.0.tgz",
|
||||
"integrity": "sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"esprima": "^4.0.1",
|
||||
"estraverse": "^5.2.0",
|
||||
"esutils": "^2.0.2"
|
||||
},
|
||||
"bin": {
|
||||
"escodegen": "bin/escodegen.js",
|
||||
"esgenerate": "bin/esgenerate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"source-map": "~0.6.1"
|
||||
}
|
||||
},
|
||||
"node_modules/esprima": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||
"license": "BSD-2-Clause",
|
||||
"bin": {
|
||||
"esparse": "bin/esparse.js",
|
||||
"esvalidate": "bin/esvalidate.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/estraverse": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
|
||||
"integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/esutils": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
|
||||
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/events-universal": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/events-universal/-/events-universal-1.0.1.tgz",
|
||||
"integrity": "sha512-LUd5euvbMLpwOF8m6ivPCbhQeSiYVNb8Vs0fQ8QjXo0JTkEHpz8pxdQf0gStltaPpw0Cca8b39KxvK9cfKRiAw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"bare-events": "^2.7.0"
|
||||
}
|
||||
},
|
||||
"node_modules/extract-zip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz",
|
||||
"integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==",
|
||||
"license": "BSD-2-Clause",
|
||||
"dependencies": {
|
||||
"debug": "^4.1.1",
|
||||
"get-stream": "^5.1.0",
|
||||
"yauzl": "^2.10.0"
|
||||
},
|
||||
"bin": {
|
||||
"extract-zip": "cli.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.17.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@types/yauzl": "^2.9.1"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-fifo": {
|
||||
"version": "1.3.2",
|
||||
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
|
||||
"integrity": "sha512-/d9sfos4yxzpwkDkuN7k2SqFKtYNmCTzgfEpz82x34IM9/zc8KGxQoXg1liNC/izpRM/MBdt44Nmx41ZWqk+FQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/fd-slicer": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz",
|
||||
"integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pend": "~1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/get-caller-file": {
|
||||
"version": "2.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
|
||||
"integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": "6.* || 8.* || >= 10.*"
|
||||
}
|
||||
},
|
||||
"node_modules/get-stream": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
|
||||
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/get-uri": {
|
||||
"version": "6.0.5",
|
||||
"resolved": "https://registry.npmjs.org/get-uri/-/get-uri-6.0.5.tgz",
|
||||
"integrity": "sha512-b1O07XYq8eRuVzBNgJLstU6FYc1tS6wnMtF1I1D9lE8LxZSOGZ7LhxN54yPP6mGw5f2CkXY2BQUL9Fx41qvcIg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"basic-ftp": "^5.0.2",
|
||||
"data-uri-to-buffer": "^6.0.2",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/http-proxy-agent": {
|
||||
"version": "7.0.2",
|
||||
"resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
|
||||
"integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.0",
|
||||
"debug": "^4.3.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/ip-address": {
|
||||
"version": "10.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz",
|
||||
"integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 12"
|
||||
}
|
||||
},
|
||||
"node_modules/is-fullwidth-code-point": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
|
||||
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/lru-cache": {
|
||||
"version": "7.18.3",
|
||||
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
|
||||
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/mitt": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mitt/-/mitt-3.0.1.tgz",
|
||||
"integrity": "sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"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==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/netmask": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/netmask/-/netmask-2.0.2.tgz",
|
||||
"integrity": "sha512-dBpDMdxv9Irdq66304OLfEmQ9tbNRFnFTuZiLo+bD+r332bBmMJ8GBLXklIXXgxd3+v9+KUnZaUR5PJMa75Gsg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/pac-proxy-agent": {
|
||||
"version": "7.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pac-proxy-agent/-/pac-proxy-agent-7.2.0.tgz",
|
||||
"integrity": "sha512-TEB8ESquiLMc0lV8vcd5Ql/JAKAoyzHFXaStwjkzpOpC5Yv+pIzLfHvjTSdf3vpa2bMiUQrg9i6276yn8666aA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@tootallnate/quickjs-emscripten": "^0.23.0",
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "^4.3.4",
|
||||
"get-uri": "^6.0.1",
|
||||
"http-proxy-agent": "^7.0.0",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"pac-resolver": "^7.0.1",
|
||||
"socks-proxy-agent": "^8.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/pac-resolver": {
|
||||
"version": "7.0.1",
|
||||
"resolved": "https://registry.npmjs.org/pac-resolver/-/pac-resolver-7.0.1.tgz",
|
||||
"integrity": "sha512-5NPgf87AT2STgwa2ntRMr45jTKrYBGkVU36yT0ig/n/GMAa3oPqhZfIQ2kMEimReg0+t9kZViDVZ83qfVUlckg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"degenerator": "^5.0.0",
|
||||
"netmask": "^2.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/pend": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz",
|
||||
"integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/progress": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz",
|
||||
"integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-agent": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-agent/-/proxy-agent-6.5.0.tgz",
|
||||
"integrity": "sha512-TmatMXdr2KlRiA2CyDu8GqR8EjahTG3aY3nXjdzFyoZbmB8hrBsTyMezhULIXKnC0jpfjlmiZ3+EaCzoInSu/A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "^4.3.4",
|
||||
"http-proxy-agent": "^7.0.1",
|
||||
"https-proxy-agent": "^7.0.6",
|
||||
"lru-cache": "^7.14.1",
|
||||
"pac-proxy-agent": "^7.1.0",
|
||||
"proxy-from-env": "^1.1.0",
|
||||
"socks-proxy-agent": "^8.0.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/proxy-from-env": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
|
||||
"integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/pump": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz",
|
||||
"integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/puppeteer-core": {
|
||||
"version": "24.37.2",
|
||||
"resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-24.37.2.tgz",
|
||||
"integrity": "sha512-nN8qwE3TGF2vA/+xemPxbesntTuqD9vCGOiZL2uh8HES3pPzLX20MyQjB42dH2rhQ3W3TljZ4ZaKZ0yX/abQuw==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@puppeteer/browsers": "2.12.0",
|
||||
"chromium-bidi": "13.1.1",
|
||||
"debug": "^4.4.3",
|
||||
"devtools-protocol": "0.0.1566079",
|
||||
"typed-query-selector": "^2.12.0",
|
||||
"webdriver-bidi-protocol": "0.4.0",
|
||||
"ws": "^8.19.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
"integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.7.4",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz",
|
||||
"integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==",
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/smart-buffer": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz",
|
||||
"integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">= 6.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socks": {
|
||||
"version": "2.8.7",
|
||||
"resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz",
|
||||
"integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ip-address": "^10.0.1",
|
||||
"smart-buffer": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 10.0.0",
|
||||
"npm": ">= 3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/socks-proxy-agent": {
|
||||
"version": "8.0.5",
|
||||
"resolved": "https://registry.npmjs.org/socks-proxy-agent/-/socks-proxy-agent-8.0.5.tgz",
|
||||
"integrity": "sha512-HehCEsotFqbPW9sJ8WVYB6UbmIMv7kUUORIF2Nncq4VQvBfNBLibW9YZR5dlYCSUhwcD628pRllm7n+E+YTzJw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"agent-base": "^7.1.2",
|
||||
"debug": "^4.3.4",
|
||||
"socks": "^2.8.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 14"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map": {
|
||||
"version": "0.6.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
|
||||
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
|
||||
"license": "BSD-3-Clause",
|
||||
"optional": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/streamx": {
|
||||
"version": "2.23.0",
|
||||
"resolved": "https://registry.npmjs.org/streamx/-/streamx-2.23.0.tgz",
|
||||
"integrity": "sha512-kn+e44esVfn2Fa/O0CPFcex27fjIL6MkVae0Mm6q+E6f0hWv578YCERbv+4m02cjxvDsPKLnmxral/rR6lBMAg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"events-universal": "^1.0.0",
|
||||
"fast-fifo": "^1.3.2",
|
||||
"text-decoder": "^1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string-width": {
|
||||
"version": "4.2.3",
|
||||
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
|
||||
"integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"emoji-regex": "^8.0.0",
|
||||
"is-fullwidth-code-point": "^3.0.0",
|
||||
"strip-ansi": "^6.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-ansi": {
|
||||
"version": "6.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
|
||||
"integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-regex": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-fs": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-3.1.1.tgz",
|
||||
"integrity": "sha512-LZA0oaPOc2fVo82Txf3gw+AkEd38szODlptMYejQUhndHMLQ9M059uXR+AfS7DNo0NpINvSqDsvyaCrBVkptWg==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"pump": "^3.0.0",
|
||||
"tar-stream": "^3.1.5"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"bare-fs": "^4.0.1",
|
||||
"bare-path": "^3.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-stream": {
|
||||
"version": "3.1.7",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-3.1.7.tgz",
|
||||
"integrity": "sha512-qJj60CXt7IU1Ffyc3NJMjh6EkuCFej46zUqJ4J7pqYlThyd9bO0XBTmcOIhSzZJVWfsLks0+nle/j538YAW9RQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"b4a": "^1.6.4",
|
||||
"fast-fifo": "^1.2.0",
|
||||
"streamx": "^2.15.0"
|
||||
}
|
||||
},
|
||||
"node_modules/text-decoder": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/text-decoder/-/text-decoder-1.2.3.tgz",
|
||||
"integrity": "sha512-3/o9z3X0X0fTupwsYvR03pJ/DjWuqqrfwBgTQzdWDiQSm9KitAyz/9WqsT2JQW7KV2m+bC2ol/zqpW37NHxLaA==",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"b4a": "^1.6.4"
|
||||
}
|
||||
},
|
||||
"node_modules/tslib": {
|
||||
"version": "2.8.1",
|
||||
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
|
||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||
"license": "0BSD"
|
||||
},
|
||||
"node_modules/typed-query-selector": {
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/typed-query-selector/-/typed-query-selector-2.12.0.tgz",
|
||||
"integrity": "sha512-SbklCd1F0EiZOyPiW192rrHZzZ5sBijB6xM+cpmrwDqObvdtunOHHIk9fCGsoK5JVIYXoyEp4iEdE3upFH3PAg==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "7.16.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz",
|
||||
"integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==",
|
||||
"license": "MIT",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/webdriver-bidi-protocol": {
|
||||
"version": "0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/webdriver-bidi-protocol/-/webdriver-bidi-protocol-0.4.0.tgz",
|
||||
"integrity": "sha512-U9VIlNRrq94d1xxR9JrCEAx5Gv/2W7ERSv8oWRoNe/QYbfccS0V3h/H6qeNeCRJxXGMhhnkqvwNrvPAYeuP9VA==",
|
||||
"license": "Apache-2.0"
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
|
||||
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"ansi-styles": "^4.0.0",
|
||||
"string-width": "^4.1.0",
|
||||
"strip-ansi": "^6.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/ws": {
|
||||
"version": "8.19.0",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz",
|
||||
"integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bufferutil": "^4.0.1",
|
||||
"utf-8-validate": ">=5.0.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"bufferutil": {
|
||||
"optional": true
|
||||
},
|
||||
"utf-8-validate": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/y18n": {
|
||||
"version": "5.0.8",
|
||||
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
|
||||
"integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs": {
|
||||
"version": "17.7.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"cliui": "^8.0.1",
|
||||
"escalade": "^3.1.1",
|
||||
"get-caller-file": "^2.0.5",
|
||||
"require-directory": "^2.1.1",
|
||||
"string-width": "^4.2.3",
|
||||
"y18n": "^5.0.5",
|
||||
"yargs-parser": "^21.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yargs-parser": {
|
||||
"version": "21.1.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
|
||||
"integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
|
||||
"license": "ISC",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
}
|
||||
},
|
||||
"node_modules/yauzl": {
|
||||
"version": "2.10.0",
|
||||
"resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz",
|
||||
"integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"buffer-crc32": "~0.2.3",
|
||||
"fd-slicer": "~1.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "3.25.76",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-3.25.76.tgz",
|
||||
"integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
160
node_modules/@puppeteer/browsers/README.md
generated
vendored
Normal file
160
node_modules/@puppeteer/browsers/README.md
generated
vendored
Normal file
@@ -0,0 +1,160 @@
|
||||
# @puppeteer/browsers
|
||||
|
||||
Manage and launch browsers/drivers from a CLI or programmatically.
|
||||
|
||||
## System requirements
|
||||
|
||||
- A compatible Node version (see `engines` in `package.json`).
|
||||
- For Firefox downloads:
|
||||
- Linux builds: `xz` and `bzip2` utilities are required to unpack `.tar.gz` and `.tar.bz2` archives.
|
||||
- MacOS builds: `hdiutil` is required to unpack `.dmg` archives.
|
||||
|
||||
## CLI
|
||||
|
||||
Use `npx` to run the CLI:
|
||||
|
||||
```bash
|
||||
# This will install and run the @puppeteer/browsers package.
|
||||
# If it is already installed in the current directory, the installed
|
||||
# version will be used.
|
||||
npx @puppeteer/browsers --help
|
||||
```
|
||||
|
||||
Built-in per-command `help` will provide all documentation you need to use the CLI.
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers --help # help for all commands
|
||||
npx @puppeteer/browsers install --help # help for the install command
|
||||
npx @puppeteer/browsers launch --help # help for the launch command
|
||||
npx @puppeteer/browsers clear --help # help for the clear command
|
||||
npx @puppeteer/browsers list --help # help for the list command
|
||||
```
|
||||
|
||||
You can specify the version of the `@puppeteer/browsers` when using
|
||||
`npx`:
|
||||
|
||||
```bash
|
||||
# Always install and use the latest version from the registry.
|
||||
npx @puppeteer/browsers@latest --help
|
||||
# Always use a specifc version.
|
||||
npx @puppeteer/browsers@2.4.1 --help
|
||||
# Always install the latest version and automatically confirm the installation.
|
||||
npx --yes @puppeteer/browsers@latest --help
|
||||
```
|
||||
|
||||
To clear all installed browsers, use the `clear` command:
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers clear
|
||||
```
|
||||
|
||||
To list all installed browsers, use the `list` command:
|
||||
|
||||
```bash
|
||||
npx @puppeteer/browsers list
|
||||
```
|
||||
|
||||
Some example to give an idea of what the CLI looks like (use the `--help` command for more examples):
|
||||
|
||||
```sh
|
||||
# Download the latest available Chrome for Testing binary corresponding to the Stable channel.
|
||||
npx @puppeteer/browsers install chrome@stable
|
||||
|
||||
# Download a specific Chrome for Testing version.
|
||||
npx @puppeteer/browsers install chrome@116.0.5793.0
|
||||
|
||||
# Download the latest Chrome for Testing version for the given milestone.
|
||||
npx @puppeteer/browsers install chrome@117
|
||||
|
||||
# Download the latest available ChromeDriver version corresponding to the Canary channel.
|
||||
npx @puppeteer/browsers install chromedriver@canary
|
||||
|
||||
# Download a specific ChromeDriver version.
|
||||
npx @puppeteer/browsers install chromedriver@116.0.5793.0
|
||||
|
||||
# On Ubuntu/Debian and only for Chrome, install the browser and required system dependencies.
|
||||
# If the browser version has already been installed, the command
|
||||
# will still attempt to install system dependencies.
|
||||
# Requires root privileges.
|
||||
npx puppeteer browsers install chrome --install-deps
|
||||
```
|
||||
|
||||
## Known limitations
|
||||
|
||||
1. Launching the system browsers is only possible for Chrome/Chromium.
|
||||
|
||||
## Custom Providers
|
||||
|
||||
You can implement custom browser providers to download from alternative sources like corporate mirrors, private repositories, or specialized browser builds.
|
||||
|
||||
```typescript
|
||||
import {
|
||||
BrowserProvider,
|
||||
DownloadOptions,
|
||||
Browser,
|
||||
BrowserPlatform,
|
||||
} from '@puppeteer/browsers';
|
||||
|
||||
class SimpleMirrorProvider implements BrowserProvider {
|
||||
constructor(private mirrorUrl: string) {}
|
||||
|
||||
supports(options: DownloadOptions): boolean {
|
||||
return options.browser === Browser.CHROME;
|
||||
}
|
||||
|
||||
getDownloadUrl(options: DownloadOptions): URL | null {
|
||||
const {buildId, platform} = options;
|
||||
const filenameMap = {
|
||||
[BrowserPlatform.LINUX]: 'chrome-linux64.zip',
|
||||
[BrowserPlatform.MAC]: 'chrome-mac-x64.zip',
|
||||
[BrowserPlatform.MAC_ARM]: 'chrome-mac-arm64.zip',
|
||||
[BrowserPlatform.WIN32]: 'chrome-win32.zip',
|
||||
[BrowserPlatform.WIN64]: 'chrome-win64.zip',
|
||||
};
|
||||
const filename = filenameMap[platform];
|
||||
if (!filename) return null;
|
||||
return new URL(`${this.mirrorUrl}/chrome/${buildId}/${filename}`);
|
||||
}
|
||||
|
||||
getExecutablePath(options: DownloadOptions): string {
|
||||
const {platform} = options;
|
||||
if (
|
||||
platform === BrowserPlatform.MAC ||
|
||||
platform === BrowserPlatform.MAC_ARM
|
||||
) {
|
||||
return 'chrome-mac/Chromium.app/Contents/MacOS/Chromium';
|
||||
} else if (platform === BrowserPlatform.LINUX) {
|
||||
return 'chrome-linux64/chrome';
|
||||
} else if (platform.includes('win')) {
|
||||
return 'chrome-win64/chrome.exe';
|
||||
}
|
||||
throw new Error(`Unsupported platform: ${platform}`);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Use with the `install` API:
|
||||
|
||||
```typescript
|
||||
import {install} from '@puppeteer/browsers';
|
||||
|
||||
const customProvider = new SimpleMirrorProvider('https://internal.company.com');
|
||||
|
||||
await install({
|
||||
browser: Browser.CHROME,
|
||||
buildId: '120.0.6099.109',
|
||||
platform: BrowserPlatform.LINUX,
|
||||
cacheDir: '/tmp/puppeteer-cache',
|
||||
providers: [customProvider],
|
||||
});
|
||||
```
|
||||
|
||||
Multiple providers can be chained - they're tried in order until one succeeds, with a default provider such as Chrome for Testing, as an automatic fallback.
|
||||
|
||||
:::caution
|
||||
Custom providers are NOT officially supported by Puppeteer. You accept full responsibility for binary compatibility, testing, and maintenance.
|
||||
:::
|
||||
|
||||
## API
|
||||
|
||||
The programmatic API allows installing and launching browsers from your code. See the `test` folder for examples on how to use the `install`, `canInstall`, `launch`, `computeExecutablePath`, `computeSystemExecutablePath` and other methods.
|
||||
29
node_modules/@puppeteer/browsers/lib/cjs/CLI.d.ts
generated
vendored
Normal file
29
node_modules/@puppeteer/browsers/lib/cjs/CLI.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as readline from 'node:readline';
|
||||
import { Browser } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class CLI {
|
||||
#private;
|
||||
constructor(opts?: string | {
|
||||
cachePath?: string;
|
||||
scriptName?: string;
|
||||
version?: string;
|
||||
prefixCommand?: {
|
||||
cmd: string;
|
||||
description: string;
|
||||
};
|
||||
allowCachePathOverride?: boolean;
|
||||
pinnedBrowsers?: Partial<Record<Browser, {
|
||||
buildId: string;
|
||||
skipDownload: boolean;
|
||||
}>>;
|
||||
}, rl?: readline.Interface);
|
||||
run(argv: string[]): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=CLI.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/CLI.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/CLI.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../src/CLI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,OAAO,EACL,OAAO,EAIR,MAAM,gCAAgC,CAAC;AAmCxC;;GAEG;AACH,qBAAa,GAAG;;gBAkBZ,IAAI,CAAC,EACD,MAAM,GACN;QACE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAC,CAAC;QACnD,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,cAAc,CAAC,EAAE,OAAO,CACtB,MAAM,CACJ,OAAO,EACP;YACE,OAAO,EAAE,MAAM,CAAC;YAChB,YAAY,EAAE,OAAO,CAAC;SACvB,CACF,CACF,CAAC;KACH,EACL,EAAE,CAAC,EAAE,QAAQ,CAAC,SAAS;IA+EnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoYzC"}
|
||||
365
node_modules/@puppeteer/browsers/lib/cjs/CLI.js
generated
vendored
Normal file
365
node_modules/@puppeteer/browsers/lib/cjs/CLI.js
generated
vendored
Normal file
@@ -0,0 +1,365 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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 () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CLI = void 0;
|
||||
const node_process_1 = require("node:process");
|
||||
const readline = __importStar(require("node:readline"));
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
const Cache_js_1 = require("./Cache.js");
|
||||
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||
const install_js_1 = require("./install.js");
|
||||
const launch_js_1 = require("./launch.js");
|
||||
function isValidBrowser(browser) {
|
||||
return Object.values(browser_data_js_1.Browser).includes(browser);
|
||||
}
|
||||
function isValidPlatform(platform) {
|
||||
return Object.values(browser_data_js_1.BrowserPlatform).includes(platform);
|
||||
}
|
||||
// If moved update release-please config
|
||||
// x-release-please-start-version
|
||||
const packageVersion = '2.12.0';
|
||||
// x-release-please-end
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
class CLI {
|
||||
#cachePath;
|
||||
#rl;
|
||||
#scriptName;
|
||||
#version;
|
||||
#allowCachePathOverride;
|
||||
#pinnedBrowsers;
|
||||
#prefixCommand;
|
||||
constructor(opts, rl) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (typeof opts === 'string') {
|
||||
opts = {
|
||||
cachePath: opts,
|
||||
};
|
||||
}
|
||||
this.#cachePath = opts.cachePath ?? process.cwd();
|
||||
this.#rl = rl;
|
||||
this.#scriptName = opts.scriptName ?? '@puppeteer/browsers';
|
||||
this.#version = opts.version ?? packageVersion;
|
||||
this.#allowCachePathOverride = opts.allowCachePathOverride ?? true;
|
||||
this.#pinnedBrowsers = opts.pinnedBrowsers;
|
||||
this.#prefixCommand = opts.prefixCommand;
|
||||
}
|
||||
#defineBrowserParameter(yargs, required) {
|
||||
return yargs.positional('browser', {
|
||||
description: 'Which browser to install <browser>[@<buildId|latest>]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.',
|
||||
type: 'string',
|
||||
coerce: (opt) => {
|
||||
const browser = {
|
||||
name: this.#parseBrowser(opt),
|
||||
buildId: this.#parseBuildId(opt),
|
||||
};
|
||||
if (!isValidBrowser(browser.name)) {
|
||||
throw new Error(`Unsupported browser '${browser.name}'`);
|
||||
}
|
||||
return browser;
|
||||
},
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
#definePlatformParameter(yargs) {
|
||||
return yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(browser_data_js_1.BrowserPlatform),
|
||||
default: (0, detectPlatform_js_1.detectBrowserPlatform)(),
|
||||
coerce: platform => {
|
||||
if (!isValidPlatform(platform)) {
|
||||
throw new Error(`Unsupported platform '${platform}'`);
|
||||
}
|
||||
return platform;
|
||||
},
|
||||
defaultDescription: 'Auto-detected',
|
||||
});
|
||||
}
|
||||
#definePathParameter(yargs, required = false) {
|
||||
if (!this.#allowCachePathOverride) {
|
||||
return yargs;
|
||||
}
|
||||
return yargs.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.',
|
||||
defaultDescription: 'Current working directory',
|
||||
...(required ? {} : { default: process.cwd() }),
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
async run(argv) {
|
||||
const { default: yargs } = await import('yargs');
|
||||
const { hideBin } = await import('yargs/helpers');
|
||||
const yargsInstance = yargs(hideBin(argv));
|
||||
let target = yargsInstance
|
||||
.scriptName(this.#scriptName)
|
||||
.version(this.#version);
|
||||
if (this.#prefixCommand) {
|
||||
target = target.command(this.#prefixCommand.cmd, this.#prefixCommand.description, yargs => {
|
||||
return this.#build(yargs);
|
||||
});
|
||||
}
|
||||
else {
|
||||
target = this.#build(target);
|
||||
}
|
||||
await target
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
||||
.parseAsync();
|
||||
}
|
||||
#build(yargs) {
|
||||
const latestOrPinned = this.#pinnedBrowsers ? 'pinned' : 'latest';
|
||||
// If there are pinned browsers allow the positional arg to be optional
|
||||
const browserArgType = this.#pinnedBrowsers ? '[browser]' : '<browser>';
|
||||
return yargs
|
||||
.command(`install ${browserArgType}`, 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: <browser>@<buildID> <path>).', yargs => {
|
||||
if (this.#pinnedBrowsers) {
|
||||
yargs.example('$0 install', 'Install all pinned browsers');
|
||||
}
|
||||
yargs
|
||||
.example('$0 install chrome', `Install the ${latestOrPinned} available build of the Chrome browser.`)
|
||||
.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.')
|
||||
.example('$0 install chrome@stable', 'Install the latest available build for the Chrome browser from the stable channel.')
|
||||
.example('$0 install chrome@beta', 'Install the latest available build for the Chrome browser from the beta channel.')
|
||||
.example('$0 install chrome@dev', 'Install the latest available build for the Chrome browser from the dev channel.')
|
||||
.example('$0 install chrome@canary', 'Install the latest available build for the Chrome Canary browser.')
|
||||
.example('$0 install chrome@115', 'Install the latest available build for Chrome 115.')
|
||||
.example('$0 install chromedriver@canary', 'Install the latest available build for ChromeDriver Canary.')
|
||||
.example('$0 install chromedriver@115', 'Install the latest available build for ChromeDriver 115.')
|
||||
.example('$0 install chromedriver@115.0.5790', 'Install the latest available patch (115.0.5790.X) build for ChromeDriver.')
|
||||
.example('$0 install chrome-headless-shell', 'Install the latest available chrome-headless-shell build.')
|
||||
.example('$0 install chrome-headless-shell@beta', 'Install the latest available chrome-headless-shell build corresponding to the Beta channel.')
|
||||
.example('$0 install chrome-headless-shell@118', 'Install the latest available chrome-headless-shell 118 build.')
|
||||
.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.')
|
||||
.example('$0 install firefox', 'Install the latest nightly available build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable', 'Install the latest stable build of the Firefox browser.')
|
||||
.example('$0 install firefox@beta', 'Install the latest beta build of the Firefox browser.')
|
||||
.example('$0 install firefox@devedition', 'Install the latest devedition build of the Firefox browser.')
|
||||
.example('$0 install firefox@esr', 'Install the latest ESR build of the Firefox browser.')
|
||||
.example('$0 install firefox@nightly', 'Install the latest nightly build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable_111.0.1', 'Install a specific version of the Firefox browser.')
|
||||
.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.');
|
||||
}
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargs, !Boolean(this.#pinnedBrowsers));
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam, false)
|
||||
.option('base-url', {
|
||||
type: 'string',
|
||||
desc: 'Base URL to download from',
|
||||
})
|
||||
.option('install-deps', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).',
|
||||
default: false,
|
||||
});
|
||||
}, async (args) => {
|
||||
if (this.#pinnedBrowsers && !args.browser) {
|
||||
// Use allSettled to avoid scenarios that
|
||||
// a browser may fail early and leave the other
|
||||
// installation in a faulty state
|
||||
const result = await Promise.allSettled(Object.entries(this.#pinnedBrowsers).map(async ([browser, options]) => {
|
||||
if (options.skipDownload) {
|
||||
return;
|
||||
}
|
||||
await this.#install({
|
||||
...args,
|
||||
browser: {
|
||||
name: browser,
|
||||
buildId: options.buildId,
|
||||
},
|
||||
});
|
||||
}));
|
||||
for (const install of result) {
|
||||
if (install.status === 'rejected') {
|
||||
throw install.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
await this.#install(args);
|
||||
}
|
||||
})
|
||||
.command('launch <browser>', 'Launch the specified browser', yargs => {
|
||||
yargs
|
||||
.example('$0 launch chrome@115.0.5790.170', 'Launch Chrome 115.0.5790.170')
|
||||
.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.')
|
||||
.example('$0 launch chrome@115.0.5790.170 --detached', 'Launch the browser but detach the sub-processes.')
|
||||
.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.')
|
||||
.example('$0 launch chrome@115.0.5790.170 -- --version', 'Launch Chrome 115.0.5790.170 and pass custom argument to the binary.');
|
||||
const yargsWithExtraAgs = yargs.parserConfiguration({
|
||||
'populate--': true,
|
||||
// Yargs does not have the correct overload for this.
|
||||
});
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargsWithExtraAgs, true);
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam)
|
||||
.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Detach the child process.',
|
||||
default: false,
|
||||
})
|
||||
.option('system', {
|
||||
type: 'boolean',
|
||||
desc: 'Search for a browser installed on the system instead of the cache folder.',
|
||||
default: false,
|
||||
})
|
||||
.option('dumpio', {
|
||||
type: 'boolean',
|
||||
desc: "Forwards the browser's process stdout and stderr",
|
||||
default: false,
|
||||
});
|
||||
}, async (args) => {
|
||||
const extraArgs = args['--']?.filter(arg => {
|
||||
return typeof arg === 'string';
|
||||
});
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const executablePath = args.system
|
||||
? (0, launch_js_1.computeSystemExecutablePath)({
|
||||
browser: args.browser.name,
|
||||
// TODO: throw an error if not a ChromeReleaseChannel is provided.
|
||||
channel: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
})
|
||||
: (0, launch_js_1.computeExecutablePath)({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
(0, launch_js_1.launch)({
|
||||
args: extraArgs,
|
||||
executablePath,
|
||||
dumpio: args.dumpio,
|
||||
detached: args.detached,
|
||||
});
|
||||
})
|
||||
.command('clear', this.#allowCachePathOverride
|
||||
? 'Removes all installed browsers from the specified cache directory'
|
||||
: `Removes all installed browsers from ${this.#cachePath}`, yargs => {
|
||||
return this.#definePathParameter(yargs, true);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const rl = this.#rl ?? readline.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
|
||||
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => {
|
||||
rl.close();
|
||||
if (!['y', 'yes'].includes(answer.toLowerCase().trim())) {
|
||||
console.log('Cancelled.');
|
||||
return;
|
||||
}
|
||||
const cache = new Cache_js_1.Cache(cacheDir);
|
||||
cache.clear();
|
||||
console.log(`${cacheDir} cleared.`);
|
||||
});
|
||||
})
|
||||
.command('list', 'List all installed browsers in the cache directory', yargs => {
|
||||
yargs.example('$0 list', 'List all installed browsers in the cache directory');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 list --path /tmp/my-browser-cache', 'List browsers installed in the specified cache directory');
|
||||
}
|
||||
return this.#definePathParameter(yargs);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const cache = new Cache_js_1.Cache(cacheDir);
|
||||
const browsers = cache.getInstalledBrowsers();
|
||||
for (const browser of browsers) {
|
||||
console.log(`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`);
|
||||
}
|
||||
})
|
||||
.demandCommand(1)
|
||||
.help();
|
||||
}
|
||||
#parseBrowser(version) {
|
||||
return version.split('@').shift();
|
||||
}
|
||||
#parseBuildId(version) {
|
||||
const parts = version.split('@');
|
||||
return parts.length === 2
|
||||
? parts[1]
|
||||
: this.#pinnedBrowsers
|
||||
? 'pinned'
|
||||
: 'latest';
|
||||
}
|
||||
#resolvePinnedBrowserIfNeeded(buildId, browserName) {
|
||||
if (buildId === 'pinned') {
|
||||
const options = this.#pinnedBrowsers?.[browserName];
|
||||
if (!options || !options.buildId) {
|
||||
throw new Error(`No pinned version found for ${browserName}`);
|
||||
}
|
||||
return options.buildId;
|
||||
}
|
||||
return buildId;
|
||||
}
|
||||
async #install(args) {
|
||||
if (!args.browser) {
|
||||
throw new Error(`No browser arg provided`);
|
||||
}
|
||||
if (!args.platform) {
|
||||
throw new Error(`Could not resolve the current platform`);
|
||||
}
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const originalBuildId = args.browser.buildId;
|
||||
args.browser.buildId = await (0, browser_data_js_1.resolveBuildId)(args.browser.name, args.platform, args.browser.buildId);
|
||||
await (0, install_js_1.install)({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
downloadProgressCallback: 'default',
|
||||
baseUrl: args.baseUrl,
|
||||
buildIdAlias: originalBuildId !== args.browser.buildId ? originalBuildId : undefined,
|
||||
installDeps: args.installDeps,
|
||||
});
|
||||
console.log(`${args.browser.name}@${args.browser.buildId} ${(0, launch_js_1.computeExecutablePath)({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
})}`);
|
||||
}
|
||||
}
|
||||
exports.CLI = CLI;
|
||||
//# sourceMappingURL=CLI.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/CLI.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/CLI.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/@puppeteer/browsers/lib/cjs/Cache.d.ts
generated
vendored
Normal file
89
node_modules/@puppeteer/browsers/lib/cjs/Cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { Browser, type BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class InstalledBrowser {
|
||||
#private;
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
readonly executablePath: string;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache: Cache, browser: Browser, buildId: string, platform: BrowserPlatform);
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path(): string;
|
||||
readMetadata(): Metadata;
|
||||
writeMetadata(metadata: Metadata): void;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Metadata {
|
||||
aliases: Record<string, string>;
|
||||
executablePaths?: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export declare class Cache {
|
||||
#private;
|
||||
constructor(rootDir: string);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir(): string;
|
||||
browserRoot(browser: Browser): string;
|
||||
metadataFile(browser: Browser): string;
|
||||
readMetadata(browser: Browser): Metadata;
|
||||
writeMetadata(browser: Browser, metadata: Metadata): void;
|
||||
readExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string): string | null;
|
||||
writeExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string, executablePath: string): void;
|
||||
resolveAlias(browser: Browser, alias: string): string | undefined;
|
||||
installationDir(browser: Browser, platform: BrowserPlatform, buildId: string): string;
|
||||
clear(): void;
|
||||
uninstall(browser: Browser, platform: BrowserPlatform, buildId: string): void;
|
||||
getInstalledBrowsers(): InstalledBrowser[];
|
||||
computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
||||
}
|
||||
//# sourceMappingURL=Cache.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/Cache.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/Cache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAKxC;;GAEG;AACH,qBAAa,gBAAgB;;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAIhC;;OAEG;gBAED,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,eAAe;IAa3B;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,YAAY,IAAI,QAAQ;IAIxB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IAEvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,KAAK;;gBAGJ,OAAO,EAAE,MAAM;IAI3B;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIrC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAItC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ;IAaxC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAMzD,kBAAkB,CAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI;IAMhB,mBAAmB,CACjB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,IAAI;IAUP,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUjE,eAAe,CACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM;IAIT,KAAK,IAAI,IAAI;IASb,SAAS,CACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,IAAI;IAqBP,oBAAoB,IAAI,gBAAgB,EAAE;IA+B1C,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;CAqCrE"}
|
||||
216
node_modules/@puppeteer/browsers/lib/cjs/Cache.js
generated
vendored
Normal file
216
node_modules/@puppeteer/browsers/lib/cjs/Cache.js
generated
vendored
Normal file
@@ -0,0 +1,216 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.Cache = exports.InstalledBrowser = void 0;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||
const debugCache = (0, debug_1.default)('puppeteer:browsers:cache');
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
class InstalledBrowser {
|
||||
browser;
|
||||
buildId;
|
||||
platform;
|
||||
executablePath;
|
||||
#cache;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache, browser, buildId, platform) {
|
||||
this.#cache = cache;
|
||||
this.browser = browser;
|
||||
this.buildId = buildId;
|
||||
this.platform = platform;
|
||||
this.executablePath = cache.computeExecutablePath({
|
||||
browser,
|
||||
buildId,
|
||||
platform,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path() {
|
||||
return this.#cache.installationDir(this.browser, this.platform, this.buildId);
|
||||
}
|
||||
readMetadata() {
|
||||
return this.#cache.readMetadata(this.browser);
|
||||
}
|
||||
writeMetadata(metadata) {
|
||||
this.#cache.writeMetadata(this.browser, metadata);
|
||||
}
|
||||
}
|
||||
exports.InstalledBrowser = InstalledBrowser;
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
class Cache {
|
||||
#rootDir;
|
||||
constructor(rootDir) {
|
||||
this.#rootDir = rootDir;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir() {
|
||||
return this.#rootDir;
|
||||
}
|
||||
browserRoot(browser) {
|
||||
return node_path_1.default.join(this.#rootDir, browser);
|
||||
}
|
||||
metadataFile(browser) {
|
||||
return node_path_1.default.join(this.browserRoot(browser), '.metadata');
|
||||
}
|
||||
readMetadata(browser) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
if (!node_fs_1.default.existsSync(metatadaPath)) {
|
||||
return { aliases: {} };
|
||||
}
|
||||
// TODO: add type-safe parsing.
|
||||
const data = JSON.parse(node_fs_1.default.readFileSync(metatadaPath, 'utf8'));
|
||||
if (typeof data !== 'object') {
|
||||
throw new Error('.metadata is not an object');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
writeMetadata(browser, metadata) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
node_fs_1.default.mkdirSync(node_path_1.default.dirname(metatadaPath), { recursive: true });
|
||||
node_fs_1.default.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
||||
}
|
||||
readExecutablePath(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
const key = `${platform}-${buildId}`;
|
||||
return metadata.executablePaths?.[key] ?? null;
|
||||
}
|
||||
writeExecutablePath(browser, platform, buildId, executablePath) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (!metadata.executablePaths) {
|
||||
metadata.executablePaths = {};
|
||||
}
|
||||
const key = `${platform}-${buildId}`;
|
||||
metadata.executablePaths[key] = executablePath;
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
resolveAlias(browser, alias) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (alias === 'latest') {
|
||||
return Object.values(metadata.aliases || {})
|
||||
.sort((0, browser_data_js_1.getVersionComparator)(browser))
|
||||
.at(-1);
|
||||
}
|
||||
return metadata.aliases[alias];
|
||||
}
|
||||
installationDir(browser, platform, buildId) {
|
||||
return node_path_1.default.join(this.browserRoot(browser), `${platform}-${buildId}`);
|
||||
}
|
||||
clear() {
|
||||
node_fs_1.default.rmSync(this.#rootDir, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
uninstall(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
for (const alias of Object.keys(metadata.aliases)) {
|
||||
if (metadata.aliases[alias] === buildId) {
|
||||
delete metadata.aliases[alias];
|
||||
}
|
||||
}
|
||||
// Clean up executable path entry
|
||||
const key = `${platform}-${buildId}`;
|
||||
if (metadata.executablePaths?.[key]) {
|
||||
delete metadata.executablePaths[key];
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
node_fs_1.default.rmSync(this.installationDir(browser, platform, buildId), {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
getInstalledBrowsers() {
|
||||
if (!node_fs_1.default.existsSync(this.#rootDir)) {
|
||||
return [];
|
||||
}
|
||||
const types = node_fs_1.default.readdirSync(this.#rootDir);
|
||||
const browsers = types.filter((t) => {
|
||||
return Object.values(browser_data_js_1.Browser).includes(t);
|
||||
});
|
||||
return browsers.flatMap(browser => {
|
||||
const files = node_fs_1.default.readdirSync(this.browserRoot(browser));
|
||||
return files
|
||||
.map(file => {
|
||||
const result = parseFolderPath(node_path_1.default.join(this.browserRoot(browser), file));
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
return new InstalledBrowser(this, browser, result.buildId, result.platform);
|
||||
})
|
||||
.filter((item) => {
|
||||
return item !== null;
|
||||
});
|
||||
});
|
||||
}
|
||||
computeExecutablePath(options) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
try {
|
||||
options.buildId =
|
||||
this.resolveAlias(options.browser, options.buildId) ?? options.buildId;
|
||||
}
|
||||
catch {
|
||||
debugCache('could not read .metadata file for the browser');
|
||||
}
|
||||
const installationDir = this.installationDir(options.browser, options.platform, options.buildId);
|
||||
const storedExecutablePath = this.readExecutablePath(options.browser, options.platform, options.buildId);
|
||||
if (storedExecutablePath) {
|
||||
// The metadata contains a resolved relative path from the installation dir
|
||||
return node_path_1.default.join(installationDir, storedExecutablePath);
|
||||
}
|
||||
return node_path_1.default.join(installationDir, browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId));
|
||||
}
|
||||
}
|
||||
exports.Cache = Cache;
|
||||
function parseFolderPath(folderPath) {
|
||||
const name = node_path_1.default.basename(folderPath);
|
||||
const splits = name.split('-');
|
||||
if (splits.length !== 2) {
|
||||
return;
|
||||
}
|
||||
const [platform, buildId] = splits;
|
||||
if (!buildId || !platform) {
|
||||
return;
|
||||
}
|
||||
return { platform, buildId };
|
||||
}
|
||||
//# sourceMappingURL=Cache.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/Cache.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/Cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.d.ts
generated
vendored
Normal file
26
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
import type { BrowserProvider, DownloadOptions } from './provider.js';
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class DefaultProvider implements BrowserProvider {
|
||||
#private;
|
||||
constructor(baseUrl?: string);
|
||||
supports(_options: DownloadOptions): boolean;
|
||||
getDownloadUrl(options: DownloadOptions): URL;
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): string;
|
||||
getName(): string;
|
||||
}
|
||||
//# sourceMappingURL=DefaultProvider.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.d.ts","sourceRoot":"","sources":["../../src/DefaultProvider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAK7E,OAAO,KAAK,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAEpE;;;;;GAKG;AACH,qBAAa,eAAgB,YAAW,eAAe;;gBAGzC,OAAO,CAAC,EAAE,MAAM;IAI5B,QAAQ,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO;IAK5C,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,GAAG;IAgB7C,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,eAAe,CAAC;KAC3B,GAAG,MAAM;IAOV,OAAO,IAAI,MAAM;CAGlB"}
|
||||
39
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.js
generated
vendored
Normal file
39
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.DefaultProvider = void 0;
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
class DefaultProvider {
|
||||
#baseUrl;
|
||||
constructor(baseUrl) {
|
||||
this.#baseUrl = baseUrl;
|
||||
}
|
||||
supports(_options) {
|
||||
// Default provider supports all browsers
|
||||
return true;
|
||||
}
|
||||
getDownloadUrl(options) {
|
||||
return this.#getDownloadUrl(options.browser, options.platform, options.buildId);
|
||||
}
|
||||
#getDownloadUrl(browser, platform, buildId) {
|
||||
return new URL(browser_data_js_1.downloadUrls[browser](platform, buildId, this.#baseUrl));
|
||||
}
|
||||
getExecutablePath(options) {
|
||||
return browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId);
|
||||
}
|
||||
getName() {
|
||||
return 'DefaultProvider';
|
||||
}
|
||||
}
|
||||
exports.DefaultProvider = DefaultProvider;
|
||||
//# sourceMappingURL=DefaultProvider.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.js","sourceRoot":"","sources":["../../src/DefaultProvider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAGH,oEAGwC;AAGxC;;;;;GAKG;AACH,MAAa,eAAe;IAC1B,QAAQ,CAAU;IAElB,YAAY,OAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,QAAQ,CAAC,QAAyB;QAChC,yCAAyC;QACzC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,OAAwB;QACrC,OAAO,IAAI,CAAC,eAAe,CACzB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,eAAe,CACb,OAAgB,EAChB,QAAyB,EACzB,OAAe;QAEf,OAAO,IAAI,GAAG,CAAC,8BAAY,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,iBAAiB,CAAC,OAIjB;QACC,OAAO,yCAAuB,CAAC,OAAO,CAAC,OAAO,CAAC,CAC7C,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,CAChB,CAAC;IACJ,CAAC;IAED,OAAO;QACL,OAAO,iBAAiB,CAAC;IAC3B,CAAC;CACF;AA1CD,0CA0CC"}
|
||||
7
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.d.ts
generated
vendored
Normal file
7
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.d.ts
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=DefaultProvider.spec.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.spec.d.ts","sourceRoot":"","sources":["../../src/DefaultProvider.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
||||
80
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.js
generated
vendored
Normal file
80
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.js
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const node_assert_1 = __importDefault(require("node:assert"));
|
||||
const main_js_1 = require("./main.js");
|
||||
describe('DefaultProvider', () => {
|
||||
let provider;
|
||||
beforeEach(() => {
|
||||
provider = new main_js_1.DefaultProvider();
|
||||
});
|
||||
describe('constructor', () => {
|
||||
it('should create provider with default base URL', () => {
|
||||
const defaultProvider = new main_js_1.DefaultProvider();
|
||||
(0, node_assert_1.default)(defaultProvider instanceof main_js_1.DefaultProvider);
|
||||
});
|
||||
it('should create provider with custom base URL', () => {
|
||||
const customBaseUrl = 'https://custom.example.com/';
|
||||
const customProvider = new main_js_1.DefaultProvider(customBaseUrl);
|
||||
(0, node_assert_1.default)(customProvider instanceof main_js_1.DefaultProvider);
|
||||
});
|
||||
});
|
||||
describe('BrowserProvider interface compliance', () => {
|
||||
it('should implement supports method', () => {
|
||||
node_assert_1.default.strictEqual(typeof provider.supports, 'function');
|
||||
});
|
||||
it('should implement getDownloadUrl method', () => {
|
||||
node_assert_1.default.strictEqual(typeof provider.getDownloadUrl, 'function');
|
||||
});
|
||||
it('should implement getExecutablePath method', () => {
|
||||
node_assert_1.default.strictEqual(typeof provider.getExecutablePath, 'function');
|
||||
});
|
||||
});
|
||||
describe('basic functionality', () => {
|
||||
it('should handle different browsers', () => {
|
||||
// Test with a known build ID that should exist
|
||||
const result = provider.supports({
|
||||
browser: main_js_1.Browser.CHROME,
|
||||
platform: main_js_1.BrowserPlatform.LINUX,
|
||||
buildId: '120.0.6099.109',
|
||||
});
|
||||
// Chrome for Testing supports all browsers
|
||||
node_assert_1.default.strictEqual(result, true);
|
||||
});
|
||||
it('should handle different platforms', () => {
|
||||
const result = provider.supports({
|
||||
browser: main_js_1.Browser.CHROME,
|
||||
platform: main_js_1.BrowserPlatform.MAC,
|
||||
buildId: '120.0.6099.109',
|
||||
});
|
||||
// Chrome for Testing supports all platforms
|
||||
node_assert_1.default.strictEqual(result, true);
|
||||
});
|
||||
it('should handle ChromeDriver', () => {
|
||||
const result = provider.supports({
|
||||
browser: main_js_1.Browser.CHROMEDRIVER,
|
||||
platform: main_js_1.BrowserPlatform.LINUX,
|
||||
buildId: '120.0.6099.109',
|
||||
});
|
||||
// Chrome for Testing supports all browsers
|
||||
node_assert_1.default.strictEqual(result, true);
|
||||
});
|
||||
it('should return URL for valid build', () => {
|
||||
const result = provider.getDownloadUrl({
|
||||
browser: main_js_1.Browser.CHROME,
|
||||
platform: main_js_1.BrowserPlatform.LINUX,
|
||||
buildId: '120.0.6099.109',
|
||||
});
|
||||
(0, node_assert_1.default)(result instanceof URL);
|
||||
(0, node_assert_1.default)(result.toString().includes('120.0.6099.109'));
|
||||
});
|
||||
});
|
||||
});
|
||||
//# sourceMappingURL=DefaultProvider.spec.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/DefaultProvider.spec.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DefaultProvider.spec.js","sourceRoot":"","sources":["../../src/DefaultProvider.spec.ts"],"names":[],"mappings":"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"}
|
||||
77
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts
generated
vendored
Normal file
77
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as chromeHeadlessShell from './chrome-headless-shell.js';
|
||||
import * as chrome from './chrome.js';
|
||||
import * as chromedriver from './chromedriver.js';
|
||||
import * as chromium from './chromium.js';
|
||||
import * as firefox from './firefox.js';
|
||||
import { Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel, type ProfileOptions } from './types.js';
|
||||
export type { ProfileOptions };
|
||||
export declare const downloadUrls: {
|
||||
chromedriver: typeof chromedriver.resolveDownloadUrl;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadUrl;
|
||||
chrome: typeof chrome.resolveDownloadUrl;
|
||||
chromium: typeof chromium.resolveDownloadUrl;
|
||||
firefox: typeof firefox.resolveDownloadUrl;
|
||||
};
|
||||
export declare const downloadPaths: {
|
||||
chromedriver: typeof chromedriver.resolveDownloadPath;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.resolveDownloadPath;
|
||||
chrome: typeof chrome.resolveDownloadPath;
|
||||
chromium: typeof chromium.resolveDownloadPath;
|
||||
firefox: typeof firefox.resolveDownloadPath;
|
||||
};
|
||||
export declare const executablePathByBrowser: {
|
||||
chromedriver: typeof chromedriver.relativeExecutablePath;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.relativeExecutablePath;
|
||||
chrome: typeof chrome.relativeExecutablePath;
|
||||
chromium: typeof chromium.relativeExecutablePath;
|
||||
firefox: typeof firefox.relativeExecutablePath;
|
||||
};
|
||||
export declare const versionComparators: {
|
||||
chromedriver: typeof chromeHeadlessShell.compareVersions;
|
||||
"chrome-headless-shell": typeof chromeHeadlessShell.compareVersions;
|
||||
chrome: typeof chromeHeadlessShell.compareVersions;
|
||||
chromium: typeof chromium.compareVersions;
|
||||
firefox: typeof firefox.compareVersions;
|
||||
};
|
||||
export { Browser, BrowserPlatform, ChromeReleaseChannel };
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function resolveBuildId(browser: Browser, platform: BrowserPlatform, tag: string | BrowserTag): Promise<string>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function createProfile(browser: Browser, opts: ProfileOptions): Promise<void>;
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Get's the first resolved system path
|
||||
*/
|
||||
export declare function resolveSystemExecutablePath(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
/**
|
||||
* Returns the expected default user data dir for the given channel. It does not
|
||||
* check if the dir actually exists.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function resolveDefaultUserDataDir(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Returns multiple paths where the executable may be located at on the current system
|
||||
* ordered by likelihood (based on heuristics).
|
||||
*/
|
||||
export declare function resolveSystemExecutablePaths(browser: Browser, platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
|
||||
/**
|
||||
* Returns a version comparator for the given browser that can be used to sort
|
||||
* browser versions.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getVersionComparator(browser: Browser): (a: string, b: string) => number;
|
||||
//# sourceMappingURL=browser-data.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"browser-data.d.ts","sourceRoot":"","sources":["../../../src/browser-data/browser-data.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,mBAAmB,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EACL,OAAO,EACP,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAC,cAAc,EAAC,CAAC;AAE7B,eAAO,MAAM,YAAY;;;;;;CAMxB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;CAMzB,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;CAMnC,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAM9B,CAAC;AAEF,OAAO,EAAC,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAC,CAAC;AA+GxD;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,GAAG,EAAE,MAAM,GAAG,UAAU,GACvB,OAAO,CAAC,MAAM,CAAC,CA+BjB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,cAAc,GACnB,OAAO,CAAC,IAAI,CAAC,CAQf;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAYvB;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,GACf,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAElC"}
|
||||
279
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js
generated
vendored
Normal file
279
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js
generated
vendored
Normal file
@@ -0,0 +1,279 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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 () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.versionComparators = exports.executablePathByBrowser = exports.downloadPaths = exports.downloadUrls = void 0;
|
||||
exports.resolveBuildId = resolveBuildId;
|
||||
exports.createProfile = createProfile;
|
||||
exports.resolveSystemExecutablePath = resolveSystemExecutablePath;
|
||||
exports.resolveDefaultUserDataDir = resolveDefaultUserDataDir;
|
||||
exports.resolveSystemExecutablePaths = resolveSystemExecutablePaths;
|
||||
exports.getVersionComparator = getVersionComparator;
|
||||
const chromeHeadlessShell = __importStar(require("./chrome-headless-shell.js"));
|
||||
const chrome = __importStar(require("./chrome.js"));
|
||||
const chromedriver = __importStar(require("./chromedriver.js"));
|
||||
const chromium = __importStar(require("./chromium.js"));
|
||||
const firefox = __importStar(require("./firefox.js"));
|
||||
const types_js_1 = require("./types.js");
|
||||
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return types_js_1.Browser; } });
|
||||
Object.defineProperty(exports, "BrowserPlatform", { enumerable: true, get: function () { return types_js_1.BrowserPlatform; } });
|
||||
Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return types_js_1.ChromeReleaseChannel; } });
|
||||
exports.downloadUrls = {
|
||||
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl,
|
||||
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadUrl,
|
||||
[types_js_1.Browser.CHROME]: chrome.resolveDownloadUrl,
|
||||
[types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadUrl,
|
||||
[types_js_1.Browser.FIREFOX]: firefox.resolveDownloadUrl,
|
||||
};
|
||||
exports.downloadPaths = {
|
||||
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath,
|
||||
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.resolveDownloadPath,
|
||||
[types_js_1.Browser.CHROME]: chrome.resolveDownloadPath,
|
||||
[types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadPath,
|
||||
[types_js_1.Browser.FIREFOX]: firefox.resolveDownloadPath,
|
||||
};
|
||||
exports.executablePathByBrowser = {
|
||||
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath,
|
||||
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.relativeExecutablePath,
|
||||
[types_js_1.Browser.CHROME]: chrome.relativeExecutablePath,
|
||||
[types_js_1.Browser.CHROMIUM]: chromium.relativeExecutablePath,
|
||||
[types_js_1.Browser.FIREFOX]: firefox.relativeExecutablePath,
|
||||
};
|
||||
exports.versionComparators = {
|
||||
[types_js_1.Browser.CHROMEDRIVER]: chromedriver.compareVersions,
|
||||
[types_js_1.Browser.CHROMEHEADLESSSHELL]: chromeHeadlessShell.compareVersions,
|
||||
[types_js_1.Browser.CHROME]: chrome.compareVersions,
|
||||
[types_js_1.Browser.CHROMIUM]: chromium.compareVersions,
|
||||
[types_js_1.Browser.FIREFOX]: firefox.compareVersions,
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function resolveBuildIdForBrowserTag(browser, platform, tag) {
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
switch (tag) {
|
||||
case types_js_1.BrowserTag.LATEST:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case types_js_1.BrowserTag.BETA:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.BETA);
|
||||
case types_js_1.BrowserTag.NIGHTLY:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.NIGHTLY);
|
||||
case types_js_1.BrowserTag.DEVEDITION:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.DEVEDITION);
|
||||
case types_js_1.BrowserTag.STABLE:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.STABLE);
|
||||
case types_js_1.BrowserTag.ESR:
|
||||
return await firefox.resolveBuildId(firefox.FirefoxChannel.ESR);
|
||||
case types_js_1.BrowserTag.CANARY:
|
||||
case types_js_1.BrowserTag.DEV:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Firefox`);
|
||||
}
|
||||
case types_js_1.Browser.CHROME: {
|
||||
switch (tag) {
|
||||
case types_js_1.BrowserTag.LATEST:
|
||||
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
|
||||
case types_js_1.BrowserTag.BETA:
|
||||
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
|
||||
case types_js_1.BrowserTag.CANARY:
|
||||
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
|
||||
case types_js_1.BrowserTag.DEV:
|
||||
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
|
||||
case types_js_1.BrowserTag.STABLE:
|
||||
return await chrome.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
|
||||
case types_js_1.BrowserTag.NIGHTLY:
|
||||
case types_js_1.BrowserTag.DEVEDITION:
|
||||
case types_js_1.BrowserTag.ESR:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for Chrome`);
|
||||
}
|
||||
}
|
||||
case types_js_1.Browser.CHROMEDRIVER: {
|
||||
switch (tag) {
|
||||
case types_js_1.BrowserTag.LATEST:
|
||||
case types_js_1.BrowserTag.CANARY:
|
||||
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
|
||||
case types_js_1.BrowserTag.BETA:
|
||||
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
|
||||
case types_js_1.BrowserTag.DEV:
|
||||
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
|
||||
case types_js_1.BrowserTag.STABLE:
|
||||
return await chromedriver.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
|
||||
case types_js_1.BrowserTag.NIGHTLY:
|
||||
case types_js_1.BrowserTag.DEVEDITION:
|
||||
case types_js_1.BrowserTag.ESR:
|
||||
throw new Error(`${tag.toUpperCase()} is not available for ChromeDriver`);
|
||||
}
|
||||
}
|
||||
case types_js_1.Browser.CHROMEHEADLESSSHELL: {
|
||||
switch (tag) {
|
||||
case types_js_1.BrowserTag.LATEST:
|
||||
case types_js_1.BrowserTag.CANARY:
|
||||
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.CANARY);
|
||||
case types_js_1.BrowserTag.BETA:
|
||||
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.BETA);
|
||||
case types_js_1.BrowserTag.DEV:
|
||||
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.DEV);
|
||||
case types_js_1.BrowserTag.STABLE:
|
||||
return await chromeHeadlessShell.resolveBuildId(types_js_1.ChromeReleaseChannel.STABLE);
|
||||
case types_js_1.BrowserTag.NIGHTLY:
|
||||
case types_js_1.BrowserTag.DEVEDITION:
|
||||
case types_js_1.BrowserTag.ESR:
|
||||
throw new Error(`${tag} is not available for chrome-headless-shell`);
|
||||
}
|
||||
}
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
switch (tag) {
|
||||
case types_js_1.BrowserTag.LATEST:
|
||||
return await chromium.resolveBuildId(platform);
|
||||
case types_js_1.BrowserTag.NIGHTLY:
|
||||
case types_js_1.BrowserTag.CANARY:
|
||||
case types_js_1.BrowserTag.DEV:
|
||||
case types_js_1.BrowserTag.DEVEDITION:
|
||||
case types_js_1.BrowserTag.BETA:
|
||||
case types_js_1.BrowserTag.STABLE:
|
||||
case types_js_1.BrowserTag.ESR:
|
||||
throw new Error(`${tag} is not supported for Chromium. Use 'latest' instead.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
async function resolveBuildId(browser, platform, tag) {
|
||||
const browserTag = tag;
|
||||
if (Object.values(types_js_1.BrowserTag).includes(browserTag)) {
|
||||
return await resolveBuildIdForBrowserTag(browser, platform, browserTag);
|
||||
}
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
return tag;
|
||||
case types_js_1.Browser.CHROME:
|
||||
const chromeResult = await chrome.resolveBuildId(tag);
|
||||
if (chromeResult) {
|
||||
return chromeResult;
|
||||
}
|
||||
return tag;
|
||||
case types_js_1.Browser.CHROMEDRIVER:
|
||||
const chromeDriverResult = await chromedriver.resolveBuildId(tag);
|
||||
if (chromeDriverResult) {
|
||||
return chromeDriverResult;
|
||||
}
|
||||
return tag;
|
||||
case types_js_1.Browser.CHROMEHEADLESSSHELL:
|
||||
const chromeHeadlessShellResult = await chromeHeadlessShell.resolveBuildId(tag);
|
||||
if (chromeHeadlessShellResult) {
|
||||
return chromeHeadlessShellResult;
|
||||
}
|
||||
return tag;
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
async function createProfile(browser, opts) {
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
return await firefox.createProfile(opts);
|
||||
case types_js_1.Browser.CHROME:
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
throw new Error(`Profile creation is not support for ${browser} yet`);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*
|
||||
* Get's the first resolved system path
|
||||
*/
|
||||
function resolveSystemExecutablePath(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.CHROMEDRIVER:
|
||||
case types_js_1.Browser.CHROMEHEADLESSSHELL:
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
throw new Error(`System browser detection is not supported for ${browser} yet.`);
|
||||
case types_js_1.Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel)[0];
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the expected default user data dir for the given channel. It does not
|
||||
* check if the dir actually exists.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function resolveDefaultUserDataDir(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.CHROMEDRIVER:
|
||||
case types_js_1.Browser.CHROMEHEADLESSSHELL:
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
throw new Error(`Default user dir detection is not supported for ${browser} yet.`);
|
||||
case types_js_1.Browser.CHROME:
|
||||
return chrome.resolveDefaultUserDataDir(platform, channel);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* Returns multiple paths where the executable may be located at on the current system
|
||||
* ordered by likelihood (based on heuristics).
|
||||
*/
|
||||
function resolveSystemExecutablePaths(browser, platform, channel) {
|
||||
switch (browser) {
|
||||
case types_js_1.Browser.CHROMEDRIVER:
|
||||
case types_js_1.Browser.CHROMEHEADLESSSHELL:
|
||||
case types_js_1.Browser.FIREFOX:
|
||||
case types_js_1.Browser.CHROMIUM:
|
||||
throw new Error(`System browser detection is not supported for ${browser} yet.`);
|
||||
case types_js_1.Browser.CHROME:
|
||||
return chrome.resolveSystemExecutablePaths(platform, channel);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns a version comparator for the given browser that can be used to sort
|
||||
* browser versions.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getVersionComparator(browser) {
|
||||
return exports.versionComparators[browser];
|
||||
}
|
||||
//# sourceMappingURL=browser-data.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.d.ts
generated
vendored
Normal file
6
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { BrowserPlatform } from './types.js';
|
||||
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
|
||||
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
|
||||
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
|
||||
export { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chrome-headless-shell.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome-headless-shell.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAMV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAqBR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
58
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.js
generated
vendored
Normal file
58
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compareVersions = exports.resolveBuildId = void 0;
|
||||
exports.resolveDownloadUrl = resolveDownloadUrl;
|
||||
exports.resolveDownloadPath = resolveDownloadPath;
|
||||
exports.relativeExecutablePath = relativeExecutablePath;
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const types_js_1 = require("./types.js");
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
function resolveDownloadPath(platform, buildId) {
|
||||
return [
|
||||
buildId,
|
||||
folder(platform),
|
||||
`chrome-headless-shell-${folder(platform)}.zip`,
|
||||
];
|
||||
}
|
||||
function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return node_path_1.default.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('chrome-headless-shell-linux64', 'chrome-headless-shell');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('chrome-headless-shell-' + folder(platform), 'chrome-headless-shell.exe');
|
||||
}
|
||||
}
|
||||
var chrome_js_1 = require("./chrome.js");
|
||||
Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });
|
||||
Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return chrome_js_1.compareVersions; } });
|
||||
//# sourceMappingURL=chrome-headless-shell.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome-headless-shell.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome-headless-shell.js","sourceRoot":"","sources":["../../../src/browser-data/chrome-headless-shell.ts"],"names":[],"mappings":";;;;;;AAyBA,gDAMC;AAED,kDASC;AAED,wDAwBC;AApED;;;;GAIG;AACH,0DAA6B;AAE7B,yCAA2C;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO;QACL,OAAO;QACP,MAAM,CAAC,QAAQ,CAAC;QAChB,yBAAyB,MAAM,CAAC,QAAQ,CAAC,MAAM;KAChD,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,uBAAuB,CACxB,CAAC;QACJ,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CACd,+BAA+B,EAC/B,uBAAuB,CACxB,CAAC;QACJ,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CACd,wBAAwB,GAAG,MAAM,CAAC,QAAQ,CAAC,EAC3C,2BAA2B,CAC5B,CAAC;IACN,CAAC;AACH,CAAC;AAED,yCAA4D;AAApD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA"}
|
||||
33
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.d.ts
generated
vendored
Normal file
33
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform, ChromeReleaseChannel } from './types.js';
|
||||
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
|
||||
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
|
||||
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
|
||||
export declare function changeBaseVersionUrlForTesting(url: string): void;
|
||||
export declare function resetBaseVersionUrlForTesting(): void;
|
||||
export declare function getLastKnownGoodReleaseForChannel(channel: ChromeReleaseChannel): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
}>;
|
||||
export declare function getLastKnownGoodReleaseForMilestone(milestone: string): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
} | undefined>;
|
||||
export declare function getLastKnownGoodReleaseForBuild(
|
||||
/**
|
||||
* @example `112.0.23`,
|
||||
*/
|
||||
buildPrefix: string): Promise<{
|
||||
version: string;
|
||||
revision: string;
|
||||
} | undefined>;
|
||||
export declare function resolveBuildId(channel: ChromeReleaseChannel): Promise<string>;
|
||||
export declare function resolveBuildId(channel: string): Promise<string | undefined>;
|
||||
export declare function resolveSystemExecutablePaths(platform: BrowserPlatform, channel: ChromeReleaseChannel): [string, ...string[]];
|
||||
export declare function resolveDefaultUserDataDir(platform: BrowserPlatform, channel: ChromeReleaseChannel): string;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=chrome.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chrome.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chrome.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,OAAO,EAAC,eAAe,EAAE,oBAAoB,EAAC,MAAM,YAAY,CAAC;AAkBjE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AACD,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,iCAAiC,CACrD,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,CAAC,CAoB9C;AAED,wBAAsB,mCAAmC,CACvD,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,+BAA+B;AACnD;;GAEG;AACH,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAC,GAAG,SAAS,CAAC,CAS1D;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;AA2I/B,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAyCvB;AAED,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,oBAAoB,GAC5B,MAAM,CA8DR;AAoBD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAc5D"}
|
||||
313
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js
generated
vendored
Normal file
313
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js
generated
vendored
Normal file
@@ -0,0 +1,313 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveDownloadUrl = resolveDownloadUrl;
|
||||
exports.resolveDownloadPath = resolveDownloadPath;
|
||||
exports.relativeExecutablePath = relativeExecutablePath;
|
||||
exports.changeBaseVersionUrlForTesting = changeBaseVersionUrlForTesting;
|
||||
exports.resetBaseVersionUrlForTesting = resetBaseVersionUrlForTesting;
|
||||
exports.getLastKnownGoodReleaseForChannel = getLastKnownGoodReleaseForChannel;
|
||||
exports.getLastKnownGoodReleaseForMilestone = getLastKnownGoodReleaseForMilestone;
|
||||
exports.getLastKnownGoodReleaseForBuild = getLastKnownGoodReleaseForBuild;
|
||||
exports.resolveBuildId = resolveBuildId;
|
||||
exports.resolveSystemExecutablePaths = resolveSystemExecutablePaths;
|
||||
exports.resolveDefaultUserDataDir = resolveDefaultUserDataDir;
|
||||
exports.compareVersions = compareVersions;
|
||||
const node_child_process_1 = require("node:child_process");
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const semver_1 = __importDefault(require("semver"));
|
||||
const httpUtil_js_1 = require("../httpUtil.js");
|
||||
const types_js_1 = require("./types.js");
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
function resolveDownloadPath(platform, buildId) {
|
||||
return [buildId, folder(platform), `chrome-${folder(platform)}.zip`];
|
||||
}
|
||||
function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return node_path_1.default.join('chrome-' + folder(platform), 'Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('chrome-linux64', 'chrome');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('chrome-' + folder(platform), 'chrome.exe');
|
||||
}
|
||||
}
|
||||
let baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
function changeBaseVersionUrlForTesting(url) {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
function resetBaseVersionUrlForTesting() {
|
||||
baseVersionUrl = 'https://googlechromelabs.github.io/chrome-for-testing';
|
||||
}
|
||||
async function getLastKnownGoodReleaseForChannel(channel) {
|
||||
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/last-known-good-versions.json`)));
|
||||
for (const channel of Object.keys(data.channels)) {
|
||||
data.channels[channel.toLowerCase()] = data.channels[channel];
|
||||
delete data.channels[channel];
|
||||
}
|
||||
return data.channels[channel];
|
||||
}
|
||||
async function getLastKnownGoodReleaseForMilestone(milestone) {
|
||||
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/latest-versions-per-milestone.json`)));
|
||||
return data.milestones[milestone];
|
||||
}
|
||||
async function getLastKnownGoodReleaseForBuild(
|
||||
/**
|
||||
* @example `112.0.23`,
|
||||
*/
|
||||
buildPrefix) {
|
||||
const data = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/latest-patch-versions-per-build.json`)));
|
||||
return data.builds[buildPrefix];
|
||||
}
|
||||
async function resolveBuildId(channel) {
|
||||
if (Object.values(types_js_1.ChromeReleaseChannel).includes(channel)) {
|
||||
return (await getLastKnownGoodReleaseForChannel(channel)).version;
|
||||
}
|
||||
if (channel.match(/^\d+$/)) {
|
||||
// Potentially a milestone.
|
||||
return (await getLastKnownGoodReleaseForMilestone(channel))?.version;
|
||||
}
|
||||
if (channel.match(/^\d+\.\d+\.\d+$/)) {
|
||||
// Potentially a build prefix without the patch version.
|
||||
return (await getLastKnownGoodReleaseForBuild(channel))?.version;
|
||||
}
|
||||
return;
|
||||
}
|
||||
const WINDOWS_ENV_PARAM_NAMES = [
|
||||
'PROGRAMFILES',
|
||||
'ProgramW6432',
|
||||
'ProgramFiles(x86)',
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/installer/mini_installer/README.md
|
||||
'LOCALAPPDATA',
|
||||
];
|
||||
function getChromeWindowsLocation(channel, locationsPrefixes) {
|
||||
if (locationsPrefixes.size === 0) {
|
||||
throw new Error('Non of the common Windows Env variables were set');
|
||||
}
|
||||
let suffix;
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
suffix = 'Google\\Chrome\\Application\\chrome.exe';
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
suffix = 'Google\\Chrome Beta\\Application\\chrome.exe';
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
suffix = 'Google\\Chrome SxS\\Application\\chrome.exe';
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
suffix = 'Google\\Chrome Dev\\Application\\chrome.exe';
|
||||
break;
|
||||
}
|
||||
return [...locationsPrefixes.values()].map(l => {
|
||||
return node_path_1.default.win32.join(l, suffix);
|
||||
});
|
||||
}
|
||||
function getWslVariable(variable) {
|
||||
try {
|
||||
// The Windows env for the paths are not passed down
|
||||
// to WSL, so we evoke `cmd.exe` which is usually on the PATH
|
||||
// from which the env can be access with all uppercase names.
|
||||
// The return value is a Windows Path - `C:\Program Files`.
|
||||
const result = (0, node_child_process_1.execSync)(`cmd.exe /c echo %${variable.toLocaleUpperCase()}%`, {
|
||||
// We need to ignore the stderr as cmd.exe
|
||||
// prints a message about wrong UNC path not supported.
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (result) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
return;
|
||||
}
|
||||
function getWslLocation(channel) {
|
||||
const wslVersion = (0, node_child_process_1.execSync)('wslinfo --version', {
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
encoding: 'utf-8',
|
||||
}).trim();
|
||||
if (!wslVersion) {
|
||||
throw new Error('Not in WSL or unsupported version of WSL.');
|
||||
}
|
||||
const wslPrefixes = new Set();
|
||||
for (const name of WINDOWS_ENV_PARAM_NAMES) {
|
||||
const wslPrefix = getWslVariable(name);
|
||||
if (wslPrefix) {
|
||||
wslPrefixes.add(wslPrefix);
|
||||
}
|
||||
}
|
||||
const windowsPath = getChromeWindowsLocation(channel, wslPrefixes);
|
||||
return windowsPath.map(path => {
|
||||
// The above command returned the Windows paths `C:\Program Files\...\chrome.exe`
|
||||
// Use the `wslpath` utility tool to transform into the mounted disk
|
||||
return (0, node_child_process_1.execSync)(`wslpath "${path}"`).toString().trim();
|
||||
});
|
||||
}
|
||||
function getChromeLinuxOrWslLocation(channel) {
|
||||
const locations = [];
|
||||
try {
|
||||
const wslPath = getWslLocation(channel);
|
||||
if (wslPath) {
|
||||
locations.push(...wslPath);
|
||||
}
|
||||
}
|
||||
catch {
|
||||
// Ignore WSL errors
|
||||
}
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
locations.push('/opt/google/chrome/chrome');
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
locations.push('/opt/google/chrome-beta/chrome');
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
locations.push('/opt/google/chrome-canary/chrome');
|
||||
break;
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
locations.push('/opt/google/chrome-unstable/chrome');
|
||||
break;
|
||||
}
|
||||
return locations;
|
||||
}
|
||||
function resolveSystemExecutablePaths(platform, channel) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
const prefixLocation = new Set(WINDOWS_ENV_PARAM_NAMES.map(name => {
|
||||
return process.env[name];
|
||||
}).filter((l) => {
|
||||
return !!l;
|
||||
}));
|
||||
// Fallbacks in case env vars are misconfigured.
|
||||
prefixLocation.add('C:\\Program Files');
|
||||
prefixLocation.add('C:\\Program Files (x86)');
|
||||
prefixLocation.add('D:\\Program Files');
|
||||
prefixLocation.add('D:\\Program Files (x86)');
|
||||
return getChromeWindowsLocation(channel, prefixLocation);
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
return [
|
||||
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
|
||||
];
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
return [
|
||||
'/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta',
|
||||
];
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
return [
|
||||
'/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary',
|
||||
];
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
return [
|
||||
'/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev',
|
||||
];
|
||||
}
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return getChromeLinuxOrWslLocation(channel);
|
||||
}
|
||||
}
|
||||
function resolveDefaultUserDataDir(platform, channel) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_win.cc;l=42;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome', 'User Data');
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome Beta', 'User Data');
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome SxS', 'User Data');
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
return node_path_1.default.join(getLocalAppDataWin(), 'Google', 'Chrome Dev', 'User Data');
|
||||
}
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_mac.mm;l=86;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome');
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Beta');
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Dev');
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
return node_path_1.default.join(getBaseUserDataDirPathMac(), 'Chrome Canary');
|
||||
}
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
// https://source.chromium.org/chromium/chromium/src/+/main:chrome/common/chrome_paths_linux.cc;l=80;drc=4c86c7940a47c36b8bf52c134483ef2da86caa62
|
||||
switch (channel) {
|
||||
case types_js_1.ChromeReleaseChannel.STABLE:
|
||||
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome');
|
||||
case types_js_1.ChromeReleaseChannel.BETA:
|
||||
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-beta');
|
||||
case types_js_1.ChromeReleaseChannel.CANARY:
|
||||
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-canary');
|
||||
case types_js_1.ChromeReleaseChannel.DEV:
|
||||
return node_path_1.default.join(getConfigHomeLinux(), 'google-chrome-unstable');
|
||||
}
|
||||
}
|
||||
}
|
||||
function getLocalAppDataWin() {
|
||||
return (process.env['LOCALAPPDATA'] || node_path_1.default.join(node_os_1.default.homedir(), 'AppData', 'Local'));
|
||||
}
|
||||
function getConfigHomeLinux() {
|
||||
return (process.env['CHROME_CONFIG_HOME'] ||
|
||||
process.env['XDG_CONFIG_HOME'] ||
|
||||
node_path_1.default.join(node_os_1.default.homedir(), '.config'));
|
||||
}
|
||||
function getBaseUserDataDirPathMac() {
|
||||
return node_path_1.default.join(node_os_1.default.homedir(), 'Library', 'Application Support', 'Google');
|
||||
}
|
||||
function compareVersions(a, b) {
|
||||
if (!semver_1.default.valid(a)) {
|
||||
throw new Error(`Version ${a} is not a valid semver version`);
|
||||
}
|
||||
if (!semver_1.default.valid(b)) {
|
||||
throw new Error(`Version ${b} is not a valid semver version`);
|
||||
}
|
||||
if (semver_1.default.gt(a, b)) {
|
||||
return 1;
|
||||
}
|
||||
else if (semver_1.default.lt(a, b)) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=chrome.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
6
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.d.ts
generated
vendored
Normal file
6
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.d.ts
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { BrowserPlatform } from './types.js';
|
||||
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
|
||||
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
|
||||
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
|
||||
export { resolveBuildId, compareVersions } from './chrome.js';
|
||||
//# sourceMappingURL=chromedriver.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromedriver.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chromedriver.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAkB3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA6D,GACnE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAYR;AAED,OAAO,EAAC,cAAc,EAAE,eAAe,EAAC,MAAM,aAAa,CAAC"}
|
||||
54
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js
generated
vendored
Normal file
54
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js
generated
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.compareVersions = exports.resolveBuildId = void 0;
|
||||
exports.resolveDownloadUrl = resolveDownloadUrl;
|
||||
exports.resolveDownloadPath = resolveDownloadPath;
|
||||
exports.relativeExecutablePath = relativeExecutablePath;
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const types_js_1 = require("./types.js");
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return 'linux64';
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return 'mac-arm64';
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return 'mac-x64';
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
return 'win32';
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return 'win64';
|
||||
}
|
||||
}
|
||||
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chrome-for-testing-public') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
function resolveDownloadPath(platform, buildId) {
|
||||
return [buildId, folder(platform), `chromedriver-${folder(platform)}.zip`];
|
||||
}
|
||||
function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return node_path_1.default.join('chromedriver-' + folder(platform), 'chromedriver');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('chromedriver-linux64', 'chromedriver');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('chromedriver-' + folder(platform), 'chromedriver.exe');
|
||||
}
|
||||
}
|
||||
var chrome_js_1 = require("./chrome.js");
|
||||
Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return chrome_js_1.resolveBuildId; } });
|
||||
Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return chrome_js_1.compareVersions; } });
|
||||
//# sourceMappingURL=chromedriver.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromedriver.js","sourceRoot":"","sources":["../../../src/browser-data/chromedriver.ts"],"names":[],"mappings":";;;;;;AAyBA,gDAMC;AAED,kDAKC;AAED,wDAeC;AAvDD;;;;GAIG;AACH,0DAA6B;AAE7B,yCAA2C;AAE3C,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;QACjB,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,OAAO,CAAC;IACnB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,0DAA0D;IAEpE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,QAAQ,CAAC,EAAE,gBAAgB,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,cAAc,CAAC,CAAC;QACvE,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,sBAAsB,EAAE,cAAc,CAAC,CAAC;QAC3D,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED,yCAA4D;AAApD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA"}
|
||||
12
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.d.ts
generated
vendored
Normal file
12
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.d.ts
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform } from './types.js';
|
||||
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
|
||||
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
|
||||
export declare function relativeExecutablePath(platform: BrowserPlatform, _buildId: string): string;
|
||||
export declare function resolveBuildId(platform: BrowserPlatform): Promise<string>;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=chromium.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromium.d.ts","sourceRoot":"","sources":["../../../src/browser-data/chromium.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAiC3C,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,SAA8D,GACpE,MAAM,CAER;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAEV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,QAAQ,EAAE,MAAM,GACf,MAAM,CAkBR;AACD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,MAAM,CAAC,CAQjB;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5D"}
|
||||
73
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js
generated
vendored
Normal file
73
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js
generated
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.resolveDownloadUrl = resolveDownloadUrl;
|
||||
exports.resolveDownloadPath = resolveDownloadPath;
|
||||
exports.relativeExecutablePath = relativeExecutablePath;
|
||||
exports.resolveBuildId = resolveBuildId;
|
||||
exports.compareVersions = compareVersions;
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const httpUtil_js_1 = require("../httpUtil.js");
|
||||
const types_js_1 = require("./types.js");
|
||||
function archive(platform, buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return 'chrome-linux';
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return 'chrome-mac';
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
// Windows archive name changed at r591479.
|
||||
return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32';
|
||||
}
|
||||
}
|
||||
function folder(platform) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return 'Linux_x64';
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return 'Mac_Arm';
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return 'Mac';
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
return 'Win';
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return 'Win_x64';
|
||||
}
|
||||
}
|
||||
function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') {
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
function resolveDownloadPath(platform, buildId) {
|
||||
return [folder(platform), buildId, `${archive(platform, buildId)}.zip`];
|
||||
}
|
||||
function relativeExecutablePath(platform, _buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
return node_path_1.default.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('chrome-linux', 'chrome');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('chrome-win', 'chrome.exe');
|
||||
}
|
||||
}
|
||||
async function resolveBuildId(platform) {
|
||||
return await (0, httpUtil_js_1.getText)(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`));
|
||||
}
|
||||
function compareVersions(a, b) {
|
||||
return Number(a) - Number(b);
|
||||
}
|
||||
//# sourceMappingURL=chromium.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"chromium.js","sourceRoot":"","sources":["../../../src/browser-data/chromium.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AAuCH,gDAMC;AAED,kDAKC;AAED,wDAqBC;AACD,wCAUC;AAED,0CAEC;AAxFD,0DAA6B;AAE7B,gDAAuC;AAEvC,yCAA2C;AAE3C,SAAS,OAAO,CAAC,QAAyB,EAAE,OAAe;IACzD,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,cAAc,CAAC;QACxB,KAAK,0BAAe,CAAC,OAAO,CAAC;QAC7B,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,YAAY,CAAC;QACtB,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,2CAA2C;YAC3C,OAAO,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,cAAc,CAAC;IAC1E,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,QAAyB;IACvC,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,WAAW,CAAC;QACrB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,SAAS,CAAC;QACnB,KAAK,0BAAe,CAAC,GAAG;YACtB,OAAO,KAAK,CAAC;QACf,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,KAAK,CAAC;QACf,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED,SAAgB,kBAAkB,CAChC,QAAyB,EACzB,OAAe,EACf,OAAO,GAAG,2DAA2D;IAErE,OAAO,GAAG,OAAO,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,SAAgB,mBAAmB,CACjC,QAAyB,EACzB,OAAe;IAEf,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1E,CAAC;AAED,SAAgB,sBAAsB,CACpC,QAAyB,EACzB,QAAgB;IAEhB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,0BAAe,CAAC,GAAG,CAAC;QACzB,KAAK,0BAAe,CAAC,OAAO;YAC1B,OAAO,mBAAI,CAAC,IAAI,CACd,YAAY,EACZ,cAAc,EACd,UAAU,EACV,OAAO,EACP,UAAU,CACX,CAAC;QACJ,KAAK,0BAAe,CAAC,SAAS,CAAC;QAC/B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;QAC7C,KAAK,0BAAe,CAAC,KAAK,CAAC;QAC3B,KAAK,0BAAe,CAAC,KAAK;YACxB,OAAO,mBAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACjD,CAAC;AACH,CAAC;AACM,KAAK,UAAU,cAAc,CAClC,QAAyB;IAEzB,OAAO,MAAM,IAAA,qBAAO,EAClB,IAAI,GAAG,CACL,6DAA6D,MAAM,CACjE,QAAQ,CACT,cAAc,CAChB,CACF,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,CAAS,EAAE,CAAS;IAClD,OAAO,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC"}
|
||||
22
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.d.ts
generated
vendored
Normal file
22
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform, type ProfileOptions } from './types.js';
|
||||
export declare function resolveDownloadUrl(platform: BrowserPlatform, buildId: string, baseUrl?: string): string;
|
||||
export declare function resolveDownloadPath(platform: BrowserPlatform, buildId: string): string[];
|
||||
export declare function relativeExecutablePath(platform: BrowserPlatform, buildId: string): string;
|
||||
export declare enum FirefoxChannel {
|
||||
STABLE = "stable",
|
||||
ESR = "esr",
|
||||
DEVEDITION = "devedition",
|
||||
BETA = "beta",
|
||||
NIGHTLY = "nightly"
|
||||
}
|
||||
export declare function changeBaseVersionUrlForTesting(url: string): void;
|
||||
export declare function resetBaseVersionUrlForTesting(): void;
|
||||
export declare function resolveBuildId(channel?: FirefoxChannel): Promise<string>;
|
||||
export declare function createProfile(options: ProfileOptions): Promise<void>;
|
||||
export declare function compareVersions(a: string, b: string): number;
|
||||
//# sourceMappingURL=firefox.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"firefox.d.ts","sourceRoot":"","sources":["../../../src/browser-data/firefox.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH,OAAO,EAAC,eAAe,EAAE,KAAK,cAAc,EAAC,MAAM,YAAY,CAAC;AA8DhE,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAiBR;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,EAAE,CAgBV;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,CAoCR;AAED,oBAAY,cAAc;IACxB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,IAAI,SAAS;IACb,OAAO,YAAY;CACpB;AAID,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD;AAED,wBAAsB,cAAc,CAClC,OAAO,GAAE,cAAuC,GAC/C,OAAO,CAAC,MAAM,CAAC,CAgBjB;AAED,wBAAsB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAa1E;AAgQD,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5D"}
|
||||
388
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js
generated
vendored
Normal file
388
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js
generated
vendored
Normal file
@@ -0,0 +1,388 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.FirefoxChannel = void 0;
|
||||
exports.resolveDownloadUrl = resolveDownloadUrl;
|
||||
exports.resolveDownloadPath = resolveDownloadPath;
|
||||
exports.relativeExecutablePath = relativeExecutablePath;
|
||||
exports.changeBaseVersionUrlForTesting = changeBaseVersionUrlForTesting;
|
||||
exports.resetBaseVersionUrlForTesting = resetBaseVersionUrlForTesting;
|
||||
exports.resolveBuildId = resolveBuildId;
|
||||
exports.createProfile = createProfile;
|
||||
exports.compareVersions = compareVersions;
|
||||
const node_fs_1 = __importDefault(require("node:fs"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const httpUtil_js_1 = require("../httpUtil.js");
|
||||
const types_js_1 = require("./types.js");
|
||||
function getFormat(buildId) {
|
||||
const majorVersion = Number(buildId.split('.').shift());
|
||||
return majorVersion >= 135 ? 'xz' : 'bz2';
|
||||
}
|
||||
function archiveNightly(platform, buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.en-US.linux-x86_64.tar.${getFormat(buildId)}`;
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
return `firefox-${buildId}.en-US.linux-aarch64.tar.${getFormat(buildId)}`;
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return `firefox-${buildId}.en-US.mac.dmg`;
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return `firefox-${buildId}.en-US.${platform}.zip`;
|
||||
}
|
||||
}
|
||||
function archive(platform, buildId) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return `firefox-${buildId}.tar.${getFormat(buildId)}`;
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return `Firefox ${buildId}.dmg`;
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return `Firefox Setup ${buildId}.exe`;
|
||||
}
|
||||
}
|
||||
function platformName(platform) {
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return `linux-x86_64`;
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
return `linux-aarch64`;
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return `mac`;
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return platform;
|
||||
}
|
||||
}
|
||||
function parseBuildId(buildId) {
|
||||
for (const value of Object.values(FirefoxChannel)) {
|
||||
if (buildId.startsWith(value + '_')) {
|
||||
buildId = buildId.substring(value.length + 1);
|
||||
return [value, buildId];
|
||||
}
|
||||
}
|
||||
// Older versions do not have channel as the prefix.«
|
||||
return [FirefoxChannel.NIGHTLY, buildId];
|
||||
}
|
||||
function resolveDownloadUrl(platform, buildId, baseUrl) {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
baseUrl ??=
|
||||
'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central';
|
||||
break;
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/devedition/releases';
|
||||
break;
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
baseUrl ??= 'https://archive.mozilla.org/pub/firefox/releases';
|
||||
break;
|
||||
}
|
||||
return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`;
|
||||
}
|
||||
function resolveDownloadPath(platform, buildId) {
|
||||
const [channel, resolvedBuildId] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
return [archiveNightly(platform, resolvedBuildId)];
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.STABLE:
|
||||
case FirefoxChannel.ESR:
|
||||
return [
|
||||
resolvedBuildId,
|
||||
platformName(platform),
|
||||
'en-US',
|
||||
archive(platform, resolvedBuildId),
|
||||
];
|
||||
}
|
||||
}
|
||||
function relativeExecutablePath(platform, buildId) {
|
||||
const [channel] = parseBuildId(buildId);
|
||||
switch (channel) {
|
||||
case FirefoxChannel.NIGHTLY:
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return node_path_1.default.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('firefox', 'firefox');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('firefox', 'firefox.exe');
|
||||
}
|
||||
case FirefoxChannel.BETA:
|
||||
case FirefoxChannel.DEVEDITION:
|
||||
case FirefoxChannel.ESR:
|
||||
case FirefoxChannel.STABLE:
|
||||
switch (platform) {
|
||||
case types_js_1.BrowserPlatform.MAC_ARM:
|
||||
case types_js_1.BrowserPlatform.MAC:
|
||||
return node_path_1.default.join('Firefox.app', 'Contents', 'MacOS', 'firefox');
|
||||
case types_js_1.BrowserPlatform.LINUX_ARM:
|
||||
case types_js_1.BrowserPlatform.LINUX:
|
||||
return node_path_1.default.join('firefox', 'firefox');
|
||||
case types_js_1.BrowserPlatform.WIN32:
|
||||
case types_js_1.BrowserPlatform.WIN64:
|
||||
return node_path_1.default.join('core', 'firefox.exe');
|
||||
}
|
||||
}
|
||||
}
|
||||
var FirefoxChannel;
|
||||
(function (FirefoxChannel) {
|
||||
FirefoxChannel["STABLE"] = "stable";
|
||||
FirefoxChannel["ESR"] = "esr";
|
||||
FirefoxChannel["DEVEDITION"] = "devedition";
|
||||
FirefoxChannel["BETA"] = "beta";
|
||||
FirefoxChannel["NIGHTLY"] = "nightly";
|
||||
})(FirefoxChannel || (exports.FirefoxChannel = FirefoxChannel = {}));
|
||||
let baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
function changeBaseVersionUrlForTesting(url) {
|
||||
baseVersionUrl = url;
|
||||
}
|
||||
function resetBaseVersionUrlForTesting() {
|
||||
baseVersionUrl = 'https://product-details.mozilla.org/1.0';
|
||||
}
|
||||
async function resolveBuildId(channel = FirefoxChannel.NIGHTLY) {
|
||||
const channelToVersionKey = {
|
||||
[FirefoxChannel.ESR]: 'FIREFOX_ESR',
|
||||
[FirefoxChannel.STABLE]: 'LATEST_FIREFOX_VERSION',
|
||||
[FirefoxChannel.DEVEDITION]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.BETA]: 'FIREFOX_DEVEDITION',
|
||||
[FirefoxChannel.NIGHTLY]: 'FIREFOX_NIGHTLY',
|
||||
};
|
||||
const versions = (await (0, httpUtil_js_1.getJSON)(new URL(`${baseVersionUrl}/firefox_versions.json`)));
|
||||
const version = versions[channelToVersionKey[channel]];
|
||||
if (!version) {
|
||||
throw new Error(`Channel ${channel} is not found.`);
|
||||
}
|
||||
return channel + '_' + version;
|
||||
}
|
||||
async function createProfile(options) {
|
||||
if (!node_fs_1.default.existsSync(options.path)) {
|
||||
await node_fs_1.default.promises.mkdir(options.path, {
|
||||
recursive: true,
|
||||
});
|
||||
}
|
||||
await syncPreferences({
|
||||
preferences: {
|
||||
...defaultProfilePreferences(options.preferences),
|
||||
...options.preferences,
|
||||
},
|
||||
path: options.path,
|
||||
});
|
||||
}
|
||||
function defaultProfilePreferences(extraPrefs) {
|
||||
const server = 'dummy.test';
|
||||
const defaultPrefs = {
|
||||
// Make sure Shield doesn't hit the network.
|
||||
'app.normandy.api_url': '',
|
||||
// Disable Firefox old build background check
|
||||
'app.update.checkInstallTime': false,
|
||||
// Disable automatically upgrading Firefox
|
||||
'app.update.disabledForTesting': true,
|
||||
// Increase the APZ content response timeout to 1 minute
|
||||
'apz.content_response_timeout': 60000,
|
||||
// Prevent various error message on the console
|
||||
// jest-puppeteer asserts that no error message is emitted by the console
|
||||
'browser.contentblocking.features.standard': '-tp,tpPrivate,cookieBehavior0,-cryptoTP,-fp',
|
||||
// Enable the dump function: which sends messages to the system
|
||||
// console
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1543115
|
||||
'browser.dom.window.dump.enabled': true,
|
||||
// Disable topstories
|
||||
'browser.newtabpage.activity-stream.feeds.system.topstories': false,
|
||||
// Always display a blank page
|
||||
'browser.newtabpage.enabled': false,
|
||||
// Background thumbnails in particular cause grief: and disabling
|
||||
// thumbnails in general cannot hurt
|
||||
'browser.pagethumbnails.capturing_disabled': true,
|
||||
// Disable safebrowsing components.
|
||||
'browser.safebrowsing.blockedURIs.enabled': false,
|
||||
'browser.safebrowsing.downloads.enabled': false,
|
||||
'browser.safebrowsing.malware.enabled': false,
|
||||
'browser.safebrowsing.phishing.enabled': false,
|
||||
// Disable updates to search engines.
|
||||
'browser.search.update': false,
|
||||
// Do not restore the last open set of tabs if the browser has crashed
|
||||
'browser.sessionstore.resume_from_crash': false,
|
||||
// Skip check for default browser on startup
|
||||
'browser.shell.checkDefaultBrowser': false,
|
||||
// Disable newtabpage
|
||||
'browser.startup.homepage': 'about:blank',
|
||||
// Do not redirect user when a milstone upgrade of Firefox is detected
|
||||
'browser.startup.homepage_override.mstone': 'ignore',
|
||||
// Start with a blank page about:blank
|
||||
'browser.startup.page': 0,
|
||||
// Do not allow background tabs to be zombified on Android: otherwise for
|
||||
// tests that open additional tabs: the test harness tab itself might get
|
||||
// unloaded
|
||||
'browser.tabs.disableBackgroundZombification': false,
|
||||
// Do not warn when closing all other open tabs
|
||||
'browser.tabs.warnOnCloseOtherTabs': false,
|
||||
// Do not warn when multiple tabs will be opened
|
||||
'browser.tabs.warnOnOpen': false,
|
||||
// Do not automatically offer translations, as tests do not expect this.
|
||||
'browser.translations.automaticallyPopup': false,
|
||||
// Disable the UI tour.
|
||||
'browser.uitour.enabled': false,
|
||||
// Turn off search suggestions in the location bar so as not to trigger
|
||||
// network connections.
|
||||
'browser.urlbar.suggest.searches': false,
|
||||
// Disable first run splash page on Windows 10
|
||||
'browser.usedOnWindows10.introURL': '',
|
||||
// Do not warn on quitting Firefox
|
||||
'browser.warnOnQuit': false,
|
||||
// Defensively disable data reporting systems
|
||||
'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`,
|
||||
'datareporting.healthreport.logging.consoleEnabled': false,
|
||||
'datareporting.healthreport.service.enabled': false,
|
||||
'datareporting.healthreport.service.firstRun': false,
|
||||
'datareporting.healthreport.uploadEnabled': false,
|
||||
// Do not show datareporting policy notifications which can interfere with tests
|
||||
'datareporting.policy.dataSubmissionEnabled': false,
|
||||
'datareporting.policy.dataSubmissionPolicyBypassNotification': true,
|
||||
// DevTools JSONViewer sometimes fails to load dependencies with its require.js.
|
||||
// This doesn't affect Puppeteer but spams console (Bug 1424372)
|
||||
'devtools.jsonview.enabled': false,
|
||||
// Disable popup-blocker
|
||||
'dom.disable_open_during_load': false,
|
||||
// Enable the support for File object creation in the content process
|
||||
// Required for |Page.setFileInputFiles| protocol method.
|
||||
'dom.file.createInChild': true,
|
||||
// Disable the ProcessHangMonitor
|
||||
'dom.ipc.reportProcessHangs': false,
|
||||
// Disable slow script dialogues
|
||||
'dom.max_chrome_script_run_time': 0,
|
||||
'dom.max_script_run_time': 0,
|
||||
// Only load extensions from the application and user profile
|
||||
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
|
||||
'extensions.autoDisableScopes': 0,
|
||||
'extensions.enabledScopes': 5,
|
||||
// Disable metadata caching for installed add-ons by default
|
||||
'extensions.getAddons.cache.enabled': false,
|
||||
// Disable installing any distribution extensions or add-ons.
|
||||
'extensions.installDistroAddons': false,
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.enabled': false,
|
||||
// Turn off extension updates so they do not bother tests
|
||||
'extensions.update.notifyUser': false,
|
||||
// Make sure opening about:addons will not hit the network
|
||||
'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`,
|
||||
// Allow the application to have focus even it runs in the background
|
||||
'focusmanager.testmode': true,
|
||||
// Disable useragent updates
|
||||
'general.useragent.updates.enabled': false,
|
||||
// Always use network provider for geolocation tests so we bypass the
|
||||
// macOS dialog raised by the corelocation provider
|
||||
'geo.provider.testing': true,
|
||||
// Do not scan Wifi
|
||||
'geo.wifi.scan': false,
|
||||
// No hang monitor
|
||||
'hangmonitor.timeout': 0,
|
||||
// Show chrome errors and warnings in the error console
|
||||
'javascript.options.showInConsole': true,
|
||||
// Disable download and usage of OpenH264: and Widevine plugins
|
||||
'media.gmp-manager.updateEnabled': false,
|
||||
// Disable the GFX sanity window
|
||||
'media.sanity-test.disabled': true,
|
||||
// Disable experimental feature that is only available in Nightly
|
||||
'network.cookie.sameSite.laxByDefault': false,
|
||||
// Do not prompt for temporary redirects
|
||||
'network.http.prompt-temp-redirect': false,
|
||||
// Disable speculative connections so they are not reported as leaking
|
||||
// when they are hanging around
|
||||
'network.http.speculative-parallel-limit': 0,
|
||||
// Do not automatically switch between offline and online
|
||||
'network.manage-offline-status': false,
|
||||
// Make sure SNTP requests do not hit the network
|
||||
'network.sntp.pools': server,
|
||||
// Disable Flash.
|
||||
'plugin.state.flash': 0,
|
||||
'privacy.trackingprotection.enabled': false,
|
||||
// Can be removed once Firefox 89 is no longer supported
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1710839
|
||||
'remote.enabled': true,
|
||||
// Until Bug 1999693 is resolved, this preference needs to be set to allow
|
||||
// Webdriver BiDi to automatically dismiss file pickers.
|
||||
'remote.bidi.dismiss_file_pickers.enabled': true,
|
||||
// Disabled screenshots component
|
||||
'screenshots.browser.component.enabled': false,
|
||||
// Don't do network connections for mitm priming
|
||||
'security.certerrors.mitm.priming.enabled': false,
|
||||
// Local documents have access to all other local documents,
|
||||
// including directory listings
|
||||
'security.fileuri.strict_origin_policy': false,
|
||||
// Do not wait for the notification button security delay
|
||||
'security.notification_enable_delay': 0,
|
||||
// Ensure blocklist updates do not hit the network
|
||||
'services.settings.server': `http://${server}/dummy/blocklist/`,
|
||||
// Do not automatically fill sign-in forms with known usernames and
|
||||
// passwords
|
||||
'signon.autofillForms': false,
|
||||
// Disable password capture, so that tests that include forms are not
|
||||
// influenced by the presence of the persistent doorhanger notification
|
||||
'signon.rememberSignons': false,
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url': 'about:blank',
|
||||
// Disable first-run welcome page
|
||||
'startup.homepage_welcome_url.additional': '',
|
||||
// Disable browser animations (tabs, fullscreen, sliding alerts)
|
||||
'toolkit.cosmeticAnimations.enabled': false,
|
||||
// Prevent starting into safe mode after application crashes
|
||||
'toolkit.startup.max_resumed_crashes': -1,
|
||||
};
|
||||
return Object.assign(defaultPrefs, extraPrefs);
|
||||
}
|
||||
async function backupFile(input) {
|
||||
if (!node_fs_1.default.existsSync(input)) {
|
||||
return;
|
||||
}
|
||||
await node_fs_1.default.promises.copyFile(input, input + '.puppeteer');
|
||||
}
|
||||
/**
|
||||
* Populates the user.js file with custom preferences as needed to allow
|
||||
* Firefox's support to properly function. These preferences will be
|
||||
* automatically copied over to prefs.js during startup of Firefox. To be
|
||||
* able to restore the original values of preferences a backup of prefs.js
|
||||
* will be created.
|
||||
*/
|
||||
async function syncPreferences(options) {
|
||||
const prefsPath = node_path_1.default.join(options.path, 'prefs.js');
|
||||
const userPath = node_path_1.default.join(options.path, 'user.js');
|
||||
const lines = Object.entries(options.preferences).map(([key, value]) => {
|
||||
return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`;
|
||||
});
|
||||
// Use allSettled to prevent corruption.
|
||||
const result = await Promise.allSettled([
|
||||
backupFile(userPath).then(async () => {
|
||||
await node_fs_1.default.promises.writeFile(userPath, lines.join('\n'));
|
||||
}),
|
||||
backupFile(prefsPath),
|
||||
]);
|
||||
for (const command of result) {
|
||||
if (command.status === 'rejected') {
|
||||
throw command.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
function compareVersions(a, b) {
|
||||
// TODO: this is a not very reliable check.
|
||||
return parseInt(a.replace('.', ''), 16) - parseInt(b.replace('.', ''), 16);
|
||||
}
|
||||
//# sourceMappingURL=firefox.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
66
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.d.ts
generated
vendored
Normal file
66
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.d.ts
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* Supported browsers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum Browser {
|
||||
CHROME = "chrome",
|
||||
CHROMEHEADLESSSHELL = "chrome-headless-shell",
|
||||
CHROMIUM = "chromium",
|
||||
FIREFOX = "firefox",
|
||||
CHROMEDRIVER = "chromedriver"
|
||||
}
|
||||
/**
|
||||
* Platform names used to identify a OS platform x architecture combination in the way
|
||||
* that is relevant for the browser download.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum BrowserPlatform {
|
||||
LINUX = "linux",
|
||||
LINUX_ARM = "linux_arm",
|
||||
MAC = "mac",
|
||||
MAC_ARM = "mac_arm",
|
||||
WIN32 = "win32",
|
||||
WIN64 = "win64"
|
||||
}
|
||||
/**
|
||||
* Enum describing a release channel for a browser.
|
||||
*
|
||||
* You can use this in combination with {@link resolveBuildId} to resolve
|
||||
* a build ID based on a release channel.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare enum BrowserTag {
|
||||
CANARY = "canary",
|
||||
NIGHTLY = "nightly",
|
||||
BETA = "beta",
|
||||
DEV = "dev",
|
||||
DEVEDITION = "devedition",
|
||||
STABLE = "stable",
|
||||
ESR = "esr",
|
||||
LATEST = "latest"
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ProfileOptions {
|
||||
preferences: Record<string, unknown>;
|
||||
path: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare enum ChromeReleaseChannel {
|
||||
STABLE = "stable",
|
||||
DEV = "dev",
|
||||
CANARY = "canary",
|
||||
BETA = "beta"
|
||||
}
|
||||
//# sourceMappingURL=types.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/browser-data/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,oBAAY,OAAO;IACjB,MAAM,WAAW;IACjB,mBAAmB,0BAA0B;IAC7C,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,YAAY,iBAAiB;CAC9B;AAED;;;;;GAKG;AACH,oBAAY,eAAe;IACzB,KAAK,UAAU;IACf,SAAS,cAAc;IACvB,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,KAAK,UAAU;CAChB;AAED;;;;;;;GAOG;AACH,oBAAY,UAAU;IACpB,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,UAAU,eAAe;IACzB,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,oBAAY,oBAAoB;IAC9B,MAAM,WAAW;IACjB,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd"}
|
||||
66
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js
generated
vendored
Normal file
66
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js
generated
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.ChromeReleaseChannel = exports.BrowserTag = exports.BrowserPlatform = exports.Browser = void 0;
|
||||
/**
|
||||
* Supported browsers.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
var Browser;
|
||||
(function (Browser) {
|
||||
Browser["CHROME"] = "chrome";
|
||||
Browser["CHROMEHEADLESSSHELL"] = "chrome-headless-shell";
|
||||
Browser["CHROMIUM"] = "chromium";
|
||||
Browser["FIREFOX"] = "firefox";
|
||||
Browser["CHROMEDRIVER"] = "chromedriver";
|
||||
})(Browser || (exports.Browser = Browser = {}));
|
||||
/**
|
||||
* Platform names used to identify a OS platform x architecture combination in the way
|
||||
* that is relevant for the browser download.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
var BrowserPlatform;
|
||||
(function (BrowserPlatform) {
|
||||
BrowserPlatform["LINUX"] = "linux";
|
||||
BrowserPlatform["LINUX_ARM"] = "linux_arm";
|
||||
BrowserPlatform["MAC"] = "mac";
|
||||
BrowserPlatform["MAC_ARM"] = "mac_arm";
|
||||
BrowserPlatform["WIN32"] = "win32";
|
||||
BrowserPlatform["WIN64"] = "win64";
|
||||
})(BrowserPlatform || (exports.BrowserPlatform = BrowserPlatform = {}));
|
||||
/**
|
||||
* Enum describing a release channel for a browser.
|
||||
*
|
||||
* You can use this in combination with {@link resolveBuildId} to resolve
|
||||
* a build ID based on a release channel.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
var BrowserTag;
|
||||
(function (BrowserTag) {
|
||||
BrowserTag["CANARY"] = "canary";
|
||||
BrowserTag["NIGHTLY"] = "nightly";
|
||||
BrowserTag["BETA"] = "beta";
|
||||
BrowserTag["DEV"] = "dev";
|
||||
BrowserTag["DEVEDITION"] = "devedition";
|
||||
BrowserTag["STABLE"] = "stable";
|
||||
BrowserTag["ESR"] = "esr";
|
||||
BrowserTag["LATEST"] = "latest";
|
||||
})(BrowserTag || (exports.BrowserTag = BrowserTag = {}));
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
var ChromeReleaseChannel;
|
||||
(function (ChromeReleaseChannel) {
|
||||
ChromeReleaseChannel["STABLE"] = "stable";
|
||||
ChromeReleaseChannel["DEV"] = "dev";
|
||||
ChromeReleaseChannel["CANARY"] = "canary";
|
||||
ChromeReleaseChannel["BETA"] = "beta";
|
||||
})(ChromeReleaseChannel || (exports.ChromeReleaseChannel = ChromeReleaseChannel = {}));
|
||||
//# sourceMappingURL=types.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/browser-data/types.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH;;;;GAIG;AACH,IAAY,OAMX;AAND,WAAY,OAAO;IACjB,4BAAiB,CAAA;IACjB,wDAA6C,CAAA;IAC7C,gCAAqB,CAAA;IACrB,8BAAmB,CAAA;IACnB,wCAA6B,CAAA;AAC/B,CAAC,EANW,OAAO,uBAAP,OAAO,QAMlB;AAED;;;;;GAKG;AACH,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,0CAAuB,CAAA;IACvB,8BAAW,CAAA;IACX,sCAAmB,CAAA;IACnB,kCAAe,CAAA;IACf,kCAAe,CAAA;AACjB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED;;;;;;;GAOG;AACH,IAAY,UASX;AATD,WAAY,UAAU;IACpB,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,uCAAyB,CAAA;IACzB,+BAAiB,CAAA;IACjB,yBAAW,CAAA;IACX,+BAAiB,CAAA;AACnB,CAAC,EATW,UAAU,0BAAV,UAAU,QASrB;AAUD;;GAEG;AACH,IAAY,oBAKX;AALD,WAAY,oBAAoB;IAC9B,yCAAiB,CAAA;IACjB,mCAAW,CAAA;IACX,yCAAiB,CAAA;IACjB,qCAAa,CAAA;AACf,CAAC,EALW,oBAAoB,oCAApB,oBAAoB,QAK/B"}
|
||||
8
node_modules/@puppeteer/browsers/lib/cjs/debug.d.ts
generated
vendored
Normal file
8
node_modules/@puppeteer/browsers/lib/cjs/debug.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import debug from 'debug';
|
||||
export { debug };
|
||||
//# sourceMappingURL=debug.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/debug.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/debug.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,KAAK,EAAC,CAAC"}
|
||||
14
node_modules/@puppeteer/browsers/lib/cjs/debug.js
generated
vendored
Normal file
14
node_modules/@puppeteer/browsers/lib/cjs/debug.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.debug = void 0;
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
exports.debug = debug_1.default;
|
||||
//# sourceMappingURL=debug.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/debug.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/debug.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"debug.js","sourceRoot":"","sources":["../../src/debug.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;AAEH,kDAA0B;AAElB,gBAFD,eAAK,CAEC"}
|
||||
11
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.d.ts
generated
vendored
Normal file
11
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.d.ts
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function detectBrowserPlatform(): BrowserPlatform | undefined;
|
||||
//# sourceMappingURL=detectPlatform.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectPlatform.d.ts","sourceRoot":"","sources":["../../src/detectPlatform.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAC,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,GAAG,SAAS,CAmBnE"}
|
||||
53
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js
generated
vendored
Normal file
53
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.detectBrowserPlatform = detectBrowserPlatform;
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
function detectBrowserPlatform() {
|
||||
const platform = node_os_1.default.platform();
|
||||
const arch = node_os_1.default.arch();
|
||||
switch (platform) {
|
||||
case 'darwin':
|
||||
return arch === 'arm64' ? browser_data_js_1.BrowserPlatform.MAC_ARM : browser_data_js_1.BrowserPlatform.MAC;
|
||||
case 'linux':
|
||||
return arch === 'arm64'
|
||||
? browser_data_js_1.BrowserPlatform.LINUX_ARM
|
||||
: browser_data_js_1.BrowserPlatform.LINUX;
|
||||
case 'win32':
|
||||
return arch === 'x64' ||
|
||||
// Windows 11 for ARM supports x64 emulation
|
||||
(arch === 'arm64' && isWindows11(node_os_1.default.release()))
|
||||
? browser_data_js_1.BrowserPlatform.WIN64
|
||||
: browser_data_js_1.BrowserPlatform.WIN32;
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Windows 11 is identified by the version 10.0.22000 or greater
|
||||
* @internal
|
||||
*/
|
||||
function isWindows11(version) {
|
||||
const parts = version.split('.');
|
||||
if (parts.length > 2) {
|
||||
const major = parseInt(parts[0], 10);
|
||||
const minor = parseInt(parts[1], 10);
|
||||
const patch = parseInt(parts[2], 10);
|
||||
return (major > 10 ||
|
||||
(major === 10 && minor > 0) ||
|
||||
(major === 10 && minor === 0 && patch >= 22000));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//# sourceMappingURL=detectPlatform.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"detectPlatform.js","sourceRoot":"","sources":["../../src/detectPlatform.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;AASH,sDAmBC;AA1BD,sDAAyB;AAEzB,oEAA+D;AAE/D;;GAEG;AACH,SAAgB,qBAAqB;IACnC,MAAM,QAAQ,GAAG,iBAAE,CAAC,QAAQ,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,iBAAE,CAAC,IAAI,EAAE,CAAC;IACvB,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YACX,OAAO,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,iCAAe,CAAC,OAAO,CAAC,CAAC,CAAC,iCAAe,CAAC,GAAG,CAAC;QAC1E,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,OAAO;gBACrB,CAAC,CAAC,iCAAe,CAAC,SAAS;gBAC3B,CAAC,CAAC,iCAAe,CAAC,KAAK,CAAC;QAC5B,KAAK,OAAO;YACV,OAAO,IAAI,KAAK,KAAK;gBACnB,4CAA4C;gBAC5C,CAAC,IAAI,KAAK,OAAO,IAAI,WAAW,CAAC,iBAAE,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC/C,CAAC,CAAC,iCAAe,CAAC,KAAK;gBACvB,CAAC,CAAC,iCAAe,CAAC,KAAK,CAAC;QAC5B;YACE,OAAO,SAAS,CAAC;IACrB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,WAAW,CAAC,OAAe;IAClC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,CAAC;QAC/C,OAAO,CACL,KAAK,GAAG,EAAE;YACV,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC;YAC3B,CAAC,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,IAAI,KAAK,CAAC,CAChD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
||||
17
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.d.ts
generated
vendored
Normal file
17
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function unpackArchive(archivePath: string, folderPath: string): Promise<void>;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare const internalConstantsForTesting: {
|
||||
xz: string;
|
||||
bzip2: string;
|
||||
};
|
||||
//# sourceMappingURL=fileUtil.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fileUtil.d.ts","sourceRoot":"","sources":["../../src/fileUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,wBAAsB,aAAa,CACjC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,IAAI,CAAC,CA6Bf;AAgDD;;GAEG;AACH,eAAO,MAAM,2BAA2B;;;CAGvC,CAAC"}
|
||||
196
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js
generated
vendored
Normal file
196
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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 () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.internalConstantsForTesting = void 0;
|
||||
exports.unpackArchive = unpackArchive;
|
||||
const node_child_process_1 = require("node:child_process");
|
||||
const node_fs_1 = require("node:fs");
|
||||
const promises_1 = require("node:fs/promises");
|
||||
const path = __importStar(require("node:path"));
|
||||
const node_stream_1 = require("node:stream");
|
||||
const debug_1 = __importDefault(require("debug"));
|
||||
const debugFileUtil = (0, debug_1.default)('puppeteer:browsers:fileUtil');
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function unpackArchive(archivePath, folderPath) {
|
||||
if (!path.isAbsolute(folderPath)) {
|
||||
folderPath = path.resolve(process.cwd(), folderPath);
|
||||
}
|
||||
if (archivePath.endsWith('.zip')) {
|
||||
const extractZip = await import('extract-zip');
|
||||
await extractZip.default(archivePath, { dir: folderPath });
|
||||
}
|
||||
else if (archivePath.endsWith('.tar.bz2')) {
|
||||
await extractTar(archivePath, folderPath, 'bzip2');
|
||||
}
|
||||
else if (archivePath.endsWith('.dmg')) {
|
||||
await (0, promises_1.mkdir)(folderPath);
|
||||
await installDMG(archivePath, folderPath);
|
||||
}
|
||||
else if (archivePath.endsWith('.exe')) {
|
||||
// Firefox on Windows.
|
||||
const result = (0, node_child_process_1.spawnSync)(archivePath, [`/ExtractDir=${folderPath}`], {
|
||||
env: {
|
||||
__compat_layer: 'RunAsInvoker',
|
||||
},
|
||||
});
|
||||
if (result.status !== 0) {
|
||||
throw new Error(`Failed to extract ${archivePath} to ${folderPath}: ${result.output}`);
|
||||
}
|
||||
}
|
||||
else if (archivePath.endsWith('.tar.xz')) {
|
||||
await extractTar(archivePath, folderPath, 'xz');
|
||||
}
|
||||
else {
|
||||
throw new Error(`Unsupported archive format: ${archivePath}`);
|
||||
}
|
||||
}
|
||||
function createTransformStream(child) {
|
||||
const stream = new node_stream_1.Stream.Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
if (!child.stdin.write(chunk, encoding)) {
|
||||
child.stdin.once('drain', callback);
|
||||
}
|
||||
else {
|
||||
callback();
|
||||
}
|
||||
},
|
||||
flush(callback) {
|
||||
if (child.stdout.destroyed) {
|
||||
callback();
|
||||
}
|
||||
else {
|
||||
child.stdin.end();
|
||||
child.stdout.on('close', callback);
|
||||
}
|
||||
},
|
||||
});
|
||||
child.stdin.on('error', e => {
|
||||
if ('code' in e && e.code === 'EPIPE') {
|
||||
// finished before reading the file finished (i.e. head)
|
||||
stream.emit('end');
|
||||
}
|
||||
else {
|
||||
stream.destroy(e);
|
||||
}
|
||||
});
|
||||
child.stdout
|
||||
.on('data', data => {
|
||||
return stream.push(data);
|
||||
})
|
||||
.on('error', e => {
|
||||
return stream.destroy(e);
|
||||
});
|
||||
child.once('close', () => {
|
||||
return stream.end();
|
||||
});
|
||||
return stream;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
exports.internalConstantsForTesting = {
|
||||
xz: 'xz',
|
||||
bzip2: 'bzip2',
|
||||
};
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function extractTar(tarPath, folderPath, decompressUtilityName) {
|
||||
const tarFs = await import('tar-fs');
|
||||
return await new Promise((fulfill, reject) => {
|
||||
function handleError(utilityName) {
|
||||
return (error) => {
|
||||
if ('code' in error && error.code === 'ENOENT') {
|
||||
error = new Error(`\`${utilityName}\` utility is required to unpack this archive`, {
|
||||
cause: error,
|
||||
});
|
||||
}
|
||||
reject(error);
|
||||
};
|
||||
}
|
||||
const unpack = (0, node_child_process_1.spawn)(exports.internalConstantsForTesting[decompressUtilityName], ['-d'], {
|
||||
stdio: ['pipe', 'pipe', 'inherit'],
|
||||
})
|
||||
.once('error', handleError(decompressUtilityName))
|
||||
.once('exit', code => {
|
||||
debugFileUtil(`${decompressUtilityName} exited, code=${code}`);
|
||||
});
|
||||
const tar = tarFs.extract(folderPath);
|
||||
tar.once('error', handleError('tar'));
|
||||
tar.once('finish', fulfill);
|
||||
(0, node_fs_1.createReadStream)(tarPath).pipe(createTransformStream(unpack)).pipe(tar);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
async function installDMG(dmgPath, folderPath) {
|
||||
const { stdout } = (0, node_child_process_1.spawnSync)(`hdiutil`, [
|
||||
'attach',
|
||||
'-nobrowse',
|
||||
'-noautoopen',
|
||||
dmgPath,
|
||||
]);
|
||||
const volumes = stdout.toString('utf8').match(/\/Volumes\/(.*)/m);
|
||||
if (!volumes) {
|
||||
throw new Error(`Could not find volume path in ${stdout}`);
|
||||
}
|
||||
const mountPath = volumes[0];
|
||||
try {
|
||||
const fileNames = await (0, promises_1.readdir)(mountPath);
|
||||
const appName = fileNames.find(item => {
|
||||
return typeof item === 'string' && item.endsWith('.app');
|
||||
});
|
||||
if (!appName) {
|
||||
throw new Error(`Cannot find app in ${mountPath}`);
|
||||
}
|
||||
const mountedPath = path.join(mountPath, appName);
|
||||
(0, node_child_process_1.spawnSync)('cp', ['-R', mountedPath, folderPath]);
|
||||
}
|
||||
finally {
|
||||
(0, node_child_process_1.spawnSync)('hdiutil', ['detach', mountPath, '-quiet']);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=fileUtil.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"fileUtil.js","sourceRoot":"","sources":["../../src/fileUtil.ts"],"names":[],"mappings":"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"}
|
||||
16
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.d.ts
generated
vendored
Normal file
16
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as http from 'node:http';
|
||||
import { URL } from 'node:url';
|
||||
export declare function headHttpRequest(url: URL): Promise<boolean>;
|
||||
export declare function httpRequest(url: URL, method: string, response: (x: http.IncomingMessage) => void, keepAlive?: boolean): http.ClientRequest;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function downloadFile(url: URL, destinationPath: string, progressCallback?: (downloadedBytes: number, totalBytes: number) => void): Promise<void>;
|
||||
export declare function getJSON(url: URL): Promise<unknown>;
|
||||
export declare function getText(url: URL): Promise<string>;
|
||||
//# sourceMappingURL=httpUtil.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpUtil.d.ts","sourceRoot":"","sources":["../../src/httpUtil.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAC,GAAG,EAAmB,MAAM,UAAU,CAAC;AAI/C,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAgB1D;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,KAAK,IAAI,EAC3C,SAAS,UAAO,GACf,IAAI,CAAC,aAAa,CAiCpB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,GAAG,EAAE,GAAG,EACR,eAAe,EAAE,MAAM,EACvB,gBAAgB,CAAC,EAAE,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,GACvE,OAAO,CAAC,IAAI,CAAC,CA6Cf;AAED,wBAAsB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED,wBAAgB,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BjD"}
|
||||
172
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js
generated
vendored
Normal file
172
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js
generated
vendored
Normal file
@@ -0,0 +1,172 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
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 () {
|
||||
var ownKeys = function(o) {
|
||||
ownKeys = Object.getOwnPropertyNames || function (o) {
|
||||
var ar = [];
|
||||
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
||||
return ar;
|
||||
};
|
||||
return ownKeys(o);
|
||||
};
|
||||
return function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.headHttpRequest = headHttpRequest;
|
||||
exports.httpRequest = httpRequest;
|
||||
exports.downloadFile = downloadFile;
|
||||
exports.getJSON = getJSON;
|
||||
exports.getText = getText;
|
||||
const node_fs_1 = require("node:fs");
|
||||
const http = __importStar(require("node:http"));
|
||||
const https = __importStar(require("node:https"));
|
||||
const node_url_1 = require("node:url");
|
||||
const proxy_agent_1 = require("proxy-agent");
|
||||
function headHttpRequest(url) {
|
||||
return new Promise(resolve => {
|
||||
const request = httpRequest(url, 'HEAD', response => {
|
||||
// consume response data free node process
|
||||
response.resume();
|
||||
resolve(response.statusCode === 200);
|
||||
}, false);
|
||||
request.on('error', () => {
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
function httpRequest(url, method, response, keepAlive = true) {
|
||||
const options = {
|
||||
protocol: url.protocol,
|
||||
hostname: url.hostname,
|
||||
port: url.port,
|
||||
path: url.pathname + url.search,
|
||||
method,
|
||||
headers: keepAlive ? { Connection: 'keep-alive' } : undefined,
|
||||
auth: (0, node_url_1.urlToHttpOptions)(url).auth,
|
||||
agent: new proxy_agent_1.ProxyAgent(),
|
||||
};
|
||||
const requestCallback = (res) => {
|
||||
if (res.statusCode &&
|
||||
res.statusCode >= 300 &&
|
||||
res.statusCode < 400 &&
|
||||
res.headers.location) {
|
||||
httpRequest(new node_url_1.URL(res.headers.location), method, response);
|
||||
// consume response data to free up memory
|
||||
// And prevents the connection from being kept alive
|
||||
res.resume();
|
||||
}
|
||||
else {
|
||||
response(res);
|
||||
}
|
||||
};
|
||||
const request = options.protocol === 'https:'
|
||||
? https.request(options, requestCallback)
|
||||
: http.request(options, requestCallback);
|
||||
request.end();
|
||||
return request;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function downloadFile(url, destinationPath, progressCallback) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let downloadedBytes = 0;
|
||||
let totalBytes = 0;
|
||||
function onData(chunk) {
|
||||
downloadedBytes += chunk.length;
|
||||
progressCallback(downloadedBytes, totalBytes);
|
||||
}
|
||||
const request = httpRequest(url, 'GET', response => {
|
||||
if (response.statusCode !== 200) {
|
||||
const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`);
|
||||
// consume response data to free up memory
|
||||
response.resume();
|
||||
reject(error);
|
||||
return;
|
||||
}
|
||||
const file = (0, node_fs_1.createWriteStream)(destinationPath);
|
||||
file.on('close', () => {
|
||||
// The 'close' event is emitted when the stream and any of its
|
||||
// underlying resources (a file descriptor, for example) have been
|
||||
// closed. The event indicates that no more events will be emitted, and
|
||||
// no further computation will occur.
|
||||
return resolve();
|
||||
});
|
||||
file.on('error', error => {
|
||||
// The 'error' event may be emitted by a Readable implementation at any
|
||||
// time. Typically, this may occur if the underlying stream is unable to
|
||||
// generate data due to an underlying internal failure, or when a stream
|
||||
// implementation attempts to push an invalid chunk of data.
|
||||
return reject(error);
|
||||
});
|
||||
response.pipe(file);
|
||||
totalBytes = parseInt(response.headers['content-length'], 10);
|
||||
if (progressCallback) {
|
||||
response.on('data', onData);
|
||||
}
|
||||
});
|
||||
request.on('error', error => {
|
||||
return reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
async function getJSON(url) {
|
||||
const text = await getText(url);
|
||||
try {
|
||||
return JSON.parse(text);
|
||||
}
|
||||
catch {
|
||||
throw new Error('Could not parse JSON from ' + url.toString());
|
||||
}
|
||||
}
|
||||
function getText(url) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const request = httpRequest(url, 'GET', response => {
|
||||
let data = '';
|
||||
if (response.statusCode && response.statusCode >= 400) {
|
||||
return reject(new Error(`Got status code ${response.statusCode}`));
|
||||
}
|
||||
response.on('data', chunk => {
|
||||
data += chunk;
|
||||
});
|
||||
response.on('end', () => {
|
||||
try {
|
||||
return resolve(String(data));
|
||||
}
|
||||
catch {
|
||||
return reject(new Error(`Failed to read text response from ${url}`));
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
request.on('error', err => {
|
||||
reject(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=httpUtil.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"httpUtil.js","sourceRoot":"","sources":["../../src/httpUtil.ts"],"names":[],"mappings":"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"}
|
||||
195
node_modules/@puppeteer/browsers/lib/cjs/install.d.ts
generated
vendored
Normal file
195
node_modules/@puppeteer/browsers/lib/cjs/install.d.ts
generated
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
import { InstalledBrowser } from './Cache.js';
|
||||
import type { BrowserProvider } from './provider.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface InstallOptions {
|
||||
/**
|
||||
* Determines the path to download browsers to.
|
||||
*/
|
||||
cacheDir: string;
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to install.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
/**
|
||||
* An alias for the provided `buildId`. It will be used to maintain local
|
||||
* metadata to support aliases in the `launch` command.
|
||||
*
|
||||
* @example 'canary'
|
||||
*/
|
||||
buildIdAlias?: string;
|
||||
/**
|
||||
* Provides information about the progress of the download. If set to
|
||||
* 'default', the default callback implementing a progress bar will be
|
||||
* used.
|
||||
*/
|
||||
downloadProgressCallback?: 'default' | ((downloadedBytes: number, totalBytes: number) => void);
|
||||
/**
|
||||
* Determines the host that will be used for downloading.
|
||||
*
|
||||
* @defaultValue Either
|
||||
*
|
||||
* - https://storage.googleapis.com/chrome-for-testing-public or
|
||||
* - https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central
|
||||
*
|
||||
*/
|
||||
baseUrl?: string;
|
||||
/**
|
||||
* Whether to unpack and install browser archives.
|
||||
*
|
||||
* @defaultValue `true`
|
||||
*/
|
||||
unpack?: boolean;
|
||||
/**
|
||||
* @internal
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
forceFallbackForTesting?: boolean;
|
||||
/**
|
||||
* Whether to attempt to install system-level dependencies required
|
||||
* for the browser.
|
||||
*
|
||||
* Only supported for Chrome on Debian or Ubuntu.
|
||||
* Requires system-level privileges to run `apt-get`.
|
||||
*
|
||||
* @defaultValue `false`
|
||||
*/
|
||||
installDeps?: boolean;
|
||||
/**
|
||||
* Custom provider implementation for alternative download sources.
|
||||
*
|
||||
* If not provided, uses the default provider.
|
||||
* Multiple providers can be chained - they will be tried in order.
|
||||
* The default provider is automatically added as the final fallback.
|
||||
*
|
||||
* ⚠️ **IMPORTANT**: Custom providers are NOT officially supported by
|
||||
* Puppeteer.
|
||||
*
|
||||
* By using custom providers, you accept full responsibility for:
|
||||
*
|
||||
* - **Version compatibility**: Different platforms may receive different
|
||||
* binary versions
|
||||
* - **Archive compatibility**: Binary structure must match Puppeteer's expectations
|
||||
* - **Feature integration**: Browser launch and other Puppeteer features may not work
|
||||
* - **Testing**: You must validate that downloaded binaries work with Puppeteer
|
||||
*
|
||||
* **Puppeteer only tests and guarantees compatibility with default binaries.**
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```typescript
|
||||
* import {ElectronProvider} from './puppeteer-browser-provider-electron.js';
|
||||
*
|
||||
* await install({
|
||||
* browser: Browser.CHROMEDRIVER,
|
||||
* buildId: '142.0.7444.175',
|
||||
* cacheDir: './cache',
|
||||
* providers: [
|
||||
* new ElectronProvider(), // Try Electron releases first
|
||||
* // Falls back to Chrome for Testing automatically
|
||||
* ],
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
providers?: BrowserProvider[];
|
||||
}
|
||||
/**
|
||||
* Downloads and unpacks the browser archive according to the
|
||||
* {@link InstallOptions}.
|
||||
*
|
||||
* @returns a {@link InstalledBrowser} instance.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function install(options: InstallOptions & {
|
||||
unpack?: true;
|
||||
}): Promise<InstalledBrowser>;
|
||||
/**
|
||||
* Downloads the browser archive according to the {@link InstallOptions} without
|
||||
* unpacking.
|
||||
*
|
||||
* @returns the absolute path to the archive.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function install(options: InstallOptions & {
|
||||
unpack: false;
|
||||
}): Promise<string>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface UninstallOptions {
|
||||
/**
|
||||
* Determines the platform for the browser binary.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* The path to the root of the cache directory.
|
||||
*/
|
||||
cacheDir: string;
|
||||
/**
|
||||
* Determines which browser to uninstall.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* The browser build to uninstall
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function uninstall(options: UninstallOptions): Promise<void>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface GetInstalledBrowsersOptions {
|
||||
/**
|
||||
* The path to the root of the cache directory.
|
||||
*/
|
||||
cacheDir: string;
|
||||
}
|
||||
/**
|
||||
* Returns metadata about browsers installed in the cache directory.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getInstalledBrowsers(options: GetInstalledBrowsersOptions): Promise<InstalledBrowser[]>;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function canDownload(options: InstallOptions): Promise<boolean>;
|
||||
/**
|
||||
* Retrieves a URL for downloading the binary archive of a given browser.
|
||||
*
|
||||
* The archive is bound to the specific platform and build ID specified.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function getDownloadUrl(browser: Browser, platform: BrowserPlatform, buildId: string, baseUrl?: string): URL;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function makeProgressCallback(browser: Browser, buildId: string): (downloadedBytes: number, totalBytes: number) => void;
|
||||
//# sourceMappingURL=install.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/install.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/install.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../src/install.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EACL,OAAO,EACP,eAAe,EAEhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAQ,gBAAgB,EAAC,MAAM,YAAY,CAAC;AAMnD,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAoBnD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,wBAAwB,CAAC,EACrB,SAAS,GACT,CAAC,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC,CAAC;IAC5D;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;;;;;OAQG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAmHD;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,cAAc,GAAG;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAC,GACxC,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAC7B;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,cAAc,GAAG;IAAC,MAAM,EAAE,KAAK,CAAA;CAAC,GACxC,OAAO,CAAC,MAAM,CAAC,CAAC;AAuNnB;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAaxE;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAE7B;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CAgC3E;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,GACf,GAAG,CAEL;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,CAAC,eAAe,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAoBvD"}
|
||||
362
node_modules/@puppeteer/browsers/lib/cjs/install.js
generated
vendored
Normal file
362
node_modules/@puppeteer/browsers/lib/cjs/install.js
generated
vendored
Normal file
@@ -0,0 +1,362 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.install = install;
|
||||
exports.uninstall = uninstall;
|
||||
exports.getInstalledBrowsers = getInstalledBrowsers;
|
||||
exports.canDownload = canDownload;
|
||||
exports.getDownloadUrl = getDownloadUrl;
|
||||
exports.makeProgressCallback = makeProgressCallback;
|
||||
const node_assert_1 = __importDefault(require("node:assert"));
|
||||
const node_child_process_1 = require("node:child_process");
|
||||
const node_fs_1 = require("node:fs");
|
||||
const promises_1 = require("node:fs/promises");
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const node_path_1 = __importDefault(require("node:path"));
|
||||
const progress_1 = __importDefault(require("progress"));
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
const Cache_js_1 = require("./Cache.js");
|
||||
const debug_js_1 = require("./debug.js");
|
||||
const DefaultProvider_js_1 = require("./DefaultProvider.js");
|
||||
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||
const fileUtil_js_1 = require("./fileUtil.js");
|
||||
const httpUtil_js_1 = require("./httpUtil.js");
|
||||
const debugInstall = (0, debug_js_1.debug)('puppeteer:browsers:install');
|
||||
const times = new Map();
|
||||
function debugTime(label) {
|
||||
times.set(label, process.hrtime());
|
||||
}
|
||||
function debugTimeEnd(label) {
|
||||
const end = process.hrtime();
|
||||
const start = times.get(label);
|
||||
if (!start) {
|
||||
return;
|
||||
}
|
||||
const duration = end[0] * 1000 + end[1] / 1e6 - (start[0] * 1000 + start[1] / 1e6); // calculate duration in milliseconds
|
||||
debugInstall(`Duration for ${label}: ${duration}ms`);
|
||||
}
|
||||
/**
|
||||
* Install using custom provider plugins.
|
||||
* Tries each provider in order until one succeeds.
|
||||
* Falls back to default provider if all custom providers fail.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
async function installWithProviders(options) {
|
||||
if (!options.platform) {
|
||||
throw new Error('Platform must be defined');
|
||||
}
|
||||
const cache = new Cache_js_1.Cache(options.cacheDir);
|
||||
const browserRoot = cache.browserRoot(options.browser);
|
||||
// Build provider list with proper fallback behavior
|
||||
const providers = [...(options.providers || [])];
|
||||
// If custom baseUrl is provided, add it as a provider
|
||||
if (options.baseUrl) {
|
||||
providers.push(new DefaultProvider_js_1.DefaultProvider(options.baseUrl));
|
||||
}
|
||||
// Always add default provider as final fallback
|
||||
// (unless custom baseUrl is provided and forceFallbackForTesting is false)
|
||||
if (!options.baseUrl || options.forceFallbackForTesting) {
|
||||
providers.push(new DefaultProvider_js_1.DefaultProvider());
|
||||
}
|
||||
const downloadOptions = {
|
||||
browser: options.browser,
|
||||
platform: options.platform,
|
||||
buildId: options.buildId,
|
||||
progressCallback: options.downloadProgressCallback === 'default'
|
||||
? await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId)
|
||||
: options.downloadProgressCallback,
|
||||
};
|
||||
const errors = [];
|
||||
for (const provider of providers) {
|
||||
try {
|
||||
// Check: does this provider support this browser/platform?
|
||||
if (!(await provider.supports(downloadOptions))) {
|
||||
debugInstall(`Provider ${provider.getName()} does not support ${options.browser} on ${options.platform}`);
|
||||
continue;
|
||||
}
|
||||
// Warn if using non-default provider
|
||||
if (!(provider instanceof DefaultProvider_js_1.DefaultProvider)) {
|
||||
debugInstall(`⚠️ Using custom downloader: ${provider.getName()}`);
|
||||
debugInstall(`⚠️ Puppeteer does not guarantee compatibility with non-default providers`);
|
||||
}
|
||||
debugInstall(`Trying provider: ${provider.getName()} for ${options.browser} ${options.buildId}`);
|
||||
// Get download URL from provider
|
||||
const url = await provider.getDownloadUrl(downloadOptions);
|
||||
if (!url) {
|
||||
debugInstall(`Provider ${provider.getName()} returned no URL for ${options.browser} ${options.buildId}`);
|
||||
continue;
|
||||
}
|
||||
debugInstall(`Successfully got URL from ${provider.getName()}: ${url}`);
|
||||
if (!(0, node_fs_1.existsSync)(browserRoot)) {
|
||||
await (0, promises_1.mkdir)(browserRoot, { recursive: true });
|
||||
}
|
||||
// Download and install using the URL from the provider
|
||||
return await installUrl(url, options, provider);
|
||||
}
|
||||
catch (err) {
|
||||
debugInstall(`Provider ${provider.getName()} failed: ${err.message}`);
|
||||
errors.push({
|
||||
providerName: provider.getName(),
|
||||
error: err,
|
||||
});
|
||||
// Continue to next provider
|
||||
}
|
||||
}
|
||||
// All providers failed
|
||||
const errorDetails = errors
|
||||
.map(e => {
|
||||
return ` - ${e.providerName}: ${e.error.message}`;
|
||||
})
|
||||
.join('\n');
|
||||
throw new Error(`All providers failed for ${options.browser} ${options.buildId}:\n${errorDetails}`);
|
||||
}
|
||||
async function install(options) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
options.unpack ??= true;
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
// Always use plugin architecture (uses default provider if none specified)
|
||||
options.providers ??= [];
|
||||
return await installWithProviders(options);
|
||||
}
|
||||
async function installDeps(installedBrowser) {
|
||||
if (process.platform !== 'linux' ||
|
||||
installedBrowser.platform !== browser_data_js_1.BrowserPlatform.LINUX) {
|
||||
return;
|
||||
}
|
||||
// Currently, only Debian-like deps are supported.
|
||||
const depsPath = node_path_1.default.join(node_path_1.default.dirname(installedBrowser.executablePath), 'deb.deps');
|
||||
if (!(0, node_fs_1.existsSync)(depsPath)) {
|
||||
debugInstall(`deb.deps file was not found at ${depsPath}`);
|
||||
return;
|
||||
}
|
||||
const data = (0, node_fs_1.readFileSync)(depsPath, 'utf-8').split('\n').join(',');
|
||||
if (process.getuid?.() !== 0) {
|
||||
throw new Error('Installing system dependencies requires root privileges');
|
||||
}
|
||||
let result = (0, node_child_process_1.spawnSync)('apt-get', ['-v']);
|
||||
if (result.status !== 0) {
|
||||
throw new Error('Failed to install system dependencies: apt-get does not seem to be available');
|
||||
}
|
||||
debugInstall(`Trying to install dependencies: ${data}`);
|
||||
result = (0, node_child_process_1.spawnSync)('apt-get', [
|
||||
'satisfy',
|
||||
'-y',
|
||||
data,
|
||||
'--no-install-recommends',
|
||||
]);
|
||||
if (result.status !== 0) {
|
||||
throw new Error(`Failed to install system dependencies: status=${result.status},error=${result.error},stdout=${result.stdout.toString('utf8')},stderr=${result.stderr.toString('utf8')}`);
|
||||
}
|
||||
debugInstall(`Installed system dependencies ${data}`);
|
||||
}
|
||||
async function installUrl(url, options, provider) {
|
||||
if (!provider) {
|
||||
throw new Error('Provider is required for installation');
|
||||
}
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
let downloadProgressCallback = options.downloadProgressCallback;
|
||||
if (downloadProgressCallback === 'default') {
|
||||
downloadProgressCallback = await makeProgressCallback(options.browser, options.buildIdAlias ?? options.buildId);
|
||||
}
|
||||
const fileName = decodeURIComponent(url.toString()).split('/').pop();
|
||||
(0, node_assert_1.default)(fileName, `A malformed download URL was found: ${url}.`);
|
||||
const cache = new Cache_js_1.Cache(options.cacheDir);
|
||||
const browserRoot = cache.browserRoot(options.browser);
|
||||
const archivePath = node_path_1.default.join(browserRoot, `${options.buildId}-${fileName}`);
|
||||
if (!(0, node_fs_1.existsSync)(browserRoot)) {
|
||||
await (0, promises_1.mkdir)(browserRoot, { recursive: true });
|
||||
}
|
||||
if (!options.unpack) {
|
||||
if ((0, node_fs_1.existsSync)(archivePath)) {
|
||||
return archivePath;
|
||||
}
|
||||
debugInstall(`Downloading binary from ${url}`);
|
||||
debugTime('download');
|
||||
await (0, httpUtil_js_1.downloadFile)(url, archivePath, downloadProgressCallback);
|
||||
debugTimeEnd('download');
|
||||
return archivePath;
|
||||
}
|
||||
const outputPath = cache.installationDir(options.browser, options.platform, options.buildId);
|
||||
// Get executable path from provider once (used for both cached and new installations)
|
||||
const relativeExecutablePath = await provider.getExecutablePath({
|
||||
browser: options.browser,
|
||||
buildId: options.buildId,
|
||||
platform: options.platform,
|
||||
});
|
||||
debugInstall(`Using executable path from provider: ${relativeExecutablePath}`);
|
||||
const installedBrowser = new Cache_js_1.InstalledBrowser(cache, options.browser, options.buildId, options.platform);
|
||||
// Write metadata for the installation (only for non-default providers)
|
||||
if (!(provider instanceof DefaultProvider_js_1.DefaultProvider)) {
|
||||
cache.writeExecutablePath(options.browser, options.platform, options.buildId, relativeExecutablePath);
|
||||
}
|
||||
try {
|
||||
if ((0, node_fs_1.existsSync)(outputPath)) {
|
||||
if (!(0, node_fs_1.existsSync)(installedBrowser.executablePath)) {
|
||||
throw new Error(`The browser folder (${outputPath}) exists but the executable (${installedBrowser.executablePath}) is missing`);
|
||||
}
|
||||
await runSetup(installedBrowser);
|
||||
if (options.installDeps) {
|
||||
await installDeps(installedBrowser);
|
||||
}
|
||||
return installedBrowser;
|
||||
}
|
||||
// Check if archive already exists (e.g., from a custom provider)
|
||||
if (!(0, node_fs_1.existsSync)(archivePath)) {
|
||||
debugInstall(`Downloading binary from ${url}`);
|
||||
try {
|
||||
debugTime('download');
|
||||
await (0, httpUtil_js_1.downloadFile)(url, archivePath, downloadProgressCallback);
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('download');
|
||||
}
|
||||
}
|
||||
else {
|
||||
debugInstall(`Using existing archive at ${archivePath}`);
|
||||
}
|
||||
debugInstall(`Installing ${archivePath} to ${outputPath}`);
|
||||
try {
|
||||
debugTime('extract');
|
||||
await (0, fileUtil_js_1.unpackArchive)(archivePath, outputPath);
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('extract');
|
||||
}
|
||||
if (options.buildIdAlias) {
|
||||
const metadata = installedBrowser.readMetadata();
|
||||
metadata.aliases[options.buildIdAlias] = options.buildId;
|
||||
installedBrowser.writeMetadata(metadata);
|
||||
}
|
||||
await runSetup(installedBrowser);
|
||||
if (options.installDeps) {
|
||||
await installDeps(installedBrowser);
|
||||
}
|
||||
return installedBrowser;
|
||||
}
|
||||
finally {
|
||||
if ((0, node_fs_1.existsSync)(archivePath)) {
|
||||
await (0, promises_1.unlink)(archivePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
async function runSetup(installedBrowser) {
|
||||
// On Windows for Chrome invoke setup.exe to configure sandboxes.
|
||||
if ((installedBrowser.platform === browser_data_js_1.BrowserPlatform.WIN32 ||
|
||||
installedBrowser.platform === browser_data_js_1.BrowserPlatform.WIN64) &&
|
||||
installedBrowser.browser === browser_data_js_1.Browser.CHROME &&
|
||||
installedBrowser.platform === (0, detectPlatform_js_1.detectBrowserPlatform)()) {
|
||||
try {
|
||||
debugTime('permissions');
|
||||
const browserDir = node_path_1.default.dirname(installedBrowser.executablePath);
|
||||
const setupExePath = node_path_1.default.join(browserDir, 'setup.exe');
|
||||
if (!(0, node_fs_1.existsSync)(setupExePath)) {
|
||||
return;
|
||||
}
|
||||
(0, node_child_process_1.spawnSync)(node_path_1.default.join(browserDir, 'setup.exe'), [`--configure-browser-in-directory=` + browserDir], {
|
||||
shell: true,
|
||||
});
|
||||
// TODO: Handle error here. Currently the setup.exe sometimes
|
||||
// errors although it sets the permissions correctly.
|
||||
}
|
||||
finally {
|
||||
debugTimeEnd('permissions');
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
async function uninstall(options) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot detect the browser platform for: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
new Cache_js_1.Cache(options.cacheDir).uninstall(options.browser, options.platform, options.buildId);
|
||||
}
|
||||
/**
|
||||
* Returns metadata about browsers installed in the cache directory.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
async function getInstalledBrowsers(options) {
|
||||
return new Cache_js_1.Cache(options.cacheDir).getInstalledBrowsers();
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
async function canDownload(options) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
// Always use plugin architecture (uses default provider if none specified)
|
||||
const providers = [
|
||||
...(options.providers || []),
|
||||
new DefaultProvider_js_1.DefaultProvider(options.baseUrl),
|
||||
];
|
||||
const downloadOptions = {
|
||||
browser: options.browser,
|
||||
platform: options.platform,
|
||||
buildId: options.buildId,
|
||||
};
|
||||
// Check if any provider can provide a valid, downloadable URL
|
||||
for (const provider of providers) {
|
||||
if (!(await provider.supports(downloadOptions))) {
|
||||
continue;
|
||||
}
|
||||
const url = await provider.getDownloadUrl(downloadOptions);
|
||||
if (url && (await (0, httpUtil_js_1.headHttpRequest)(url))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Retrieves a URL for downloading the binary archive of a given browser.
|
||||
*
|
||||
* The archive is bound to the specific platform and build ID specified.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function getDownloadUrl(browser, platform, buildId, baseUrl) {
|
||||
return new URL(browser_data_js_1.downloadUrls[browser](platform, buildId, baseUrl));
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
function makeProgressCallback(browser, buildId) {
|
||||
let progressBar;
|
||||
let lastDownloadedBytes = 0;
|
||||
return (downloadedBytes, totalBytes) => {
|
||||
if (!progressBar) {
|
||||
progressBar = new progress_1.default(`Downloading ${browser} ${buildId} - ${toMegabytes(totalBytes)} [:bar] :percent :etas `, {
|
||||
complete: '=',
|
||||
incomplete: ' ',
|
||||
width: 20,
|
||||
total: totalBytes,
|
||||
});
|
||||
}
|
||||
const delta = downloadedBytes - lastDownloadedBytes;
|
||||
lastDownloadedBytes = downloadedBytes;
|
||||
progressBar.tick(delta);
|
||||
};
|
||||
}
|
||||
function toMegabytes(bytes) {
|
||||
const mb = bytes / 1000 / 1000;
|
||||
return `${Math.round(mb * 10) / 10} MB`;
|
||||
}
|
||||
//# sourceMappingURL=install.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/install.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/install.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
190
node_modules/@puppeteer/browsers/lib/cjs/launch.d.ts
generated
vendored
Normal file
190
node_modules/@puppeteer/browsers/lib/cjs/launch.d.ts
generated
vendored
Normal file
@@ -0,0 +1,190 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import childProcess from 'node:child_process';
|
||||
import { type Browser, type BrowserPlatform, type ChromeReleaseChannel } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Root path to the storage directory.
|
||||
*
|
||||
* Can be set to `null` if the executable path should be relative
|
||||
* to the extracted download location. E.g. `./chrome-linux64/chrome`.
|
||||
*/
|
||||
cacheDir: string | null;
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare function computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface SystemOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Release channel to look for on the system.
|
||||
*/
|
||||
channel: ChromeReleaseChannel;
|
||||
}
|
||||
/**
|
||||
* Returns a path to a system-wide Chrome installation given a release channel
|
||||
* name by checking known installation locations (using
|
||||
* {@link https://pptr.dev/browsers-api/browsers.computesystemexecutablepath}).
|
||||
* If Chrome instance is not found at the expected path, an error is thrown.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function computeSystemExecutablePath(options: SystemOptions): string;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface LaunchOptions {
|
||||
/**
|
||||
* Absolute path to the browser's executable.
|
||||
*/
|
||||
executablePath: string;
|
||||
/**
|
||||
* Configures stdio streams to open two additional streams for automation over
|
||||
* those streams instead of WebSocket.
|
||||
*
|
||||
* @defaultValue `false`.
|
||||
*/
|
||||
pipe?: boolean;
|
||||
/**
|
||||
* If true, forwards the browser's process stdout and stderr to the Node's
|
||||
* process stdout and stderr.
|
||||
*
|
||||
* @defaultValue `false`.
|
||||
*/
|
||||
dumpio?: boolean;
|
||||
/**
|
||||
* Additional arguments to pass to the executable when launching.
|
||||
*/
|
||||
args?: string[];
|
||||
/**
|
||||
* Environment variables to set for the browser process.
|
||||
*/
|
||||
env?: Record<string, string | undefined>;
|
||||
/**
|
||||
* Handles SIGINT in the Node process and tries to kill the browser process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGINT?: boolean;
|
||||
/**
|
||||
* Handles SIGTERM in the Node process and tries to gracefully close the browser
|
||||
* process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGTERM?: boolean;
|
||||
/**
|
||||
* Handles SIGHUP in the Node process and tries to gracefully close the browser process.
|
||||
*
|
||||
* @defaultValue `true`.
|
||||
*/
|
||||
handleSIGHUP?: boolean;
|
||||
/**
|
||||
* Whether to spawn process in the {@link https://nodejs.org/api/child_process.html#optionsdetached | detached}
|
||||
* mode.
|
||||
*
|
||||
* @defaultValue `true` except on Windows.
|
||||
*/
|
||||
detached?: boolean;
|
||||
/**
|
||||
* A callback to run after the browser process exits or before the process
|
||||
* will be closed via the {@link Process.close} call (including when handling
|
||||
* signals). The callback is only run once.
|
||||
*/
|
||||
onExit?: () => Promise<void>;
|
||||
/**
|
||||
* If provided, the process will be killed when the signal is aborted.
|
||||
*/
|
||||
signal?: AbortSignal;
|
||||
}
|
||||
/**
|
||||
* Launches a browser process according to {@link LaunchOptions}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare function launch(opts: LaunchOptions): Process;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare const CDP_WEBSOCKET_ENDPOINT_REGEX: RegExp;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare const WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX: RegExp;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class Process {
|
||||
#private;
|
||||
constructor(opts: LaunchOptions);
|
||||
get nodeProcess(): childProcess.ChildProcess;
|
||||
close(): Promise<void>;
|
||||
hasClosed(): Promise<void>;
|
||||
kill(): void;
|
||||
/**
|
||||
* Get recent logs (stderr + stdout) emitted by the browser.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getRecentLogs(): string[];
|
||||
waitForLineOutput(regex: RegExp, timeout?: number): Promise<string>;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ErrorLike extends Error {
|
||||
name: string;
|
||||
message: string;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function isErrorLike(obj: unknown): obj is ErrorLike;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export declare function isErrnoException(obj: unknown): obj is NodeJS.ErrnoException;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class TimeoutError extends Error {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(message?: string);
|
||||
}
|
||||
//# sourceMappingURL=launch.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/launch.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/launch.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../src/launch.ts"],"names":[],"mappings":"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"}
|
||||
439
node_modules/@puppeteer/browsers/lib/cjs/launch.js
generated
vendored
Normal file
439
node_modules/@puppeteer/browsers/lib/cjs/launch.js
generated
vendored
Normal file
@@ -0,0 +1,439 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.TimeoutError = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = void 0;
|
||||
exports.computeExecutablePath = computeExecutablePath;
|
||||
exports.computeSystemExecutablePath = computeSystemExecutablePath;
|
||||
exports.launch = launch;
|
||||
exports.isErrorLike = isErrorLike;
|
||||
exports.isErrnoException = isErrnoException;
|
||||
const node_child_process_1 = __importDefault(require("node:child_process"));
|
||||
const node_events_1 = require("node:events");
|
||||
const node_fs_1 = require("node:fs");
|
||||
const node_os_1 = __importDefault(require("node:os"));
|
||||
const node_readline_1 = __importDefault(require("node:readline"));
|
||||
const browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
const Cache_js_1 = require("./Cache.js");
|
||||
const debug_js_1 = require("./debug.js");
|
||||
const detectPlatform_js_1 = require("./detectPlatform.js");
|
||||
const debugLaunch = (0, debug_js_1.debug)('puppeteer:browsers:launcher');
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
function computeExecutablePath(options) {
|
||||
if (options.cacheDir === null) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (options.platform === undefined) {
|
||||
throw new Error(`No platform specified. Couldn't auto-detect browser platform.`);
|
||||
}
|
||||
return browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId);
|
||||
}
|
||||
return new Cache_js_1.Cache(options.cacheDir).computeExecutablePath(options);
|
||||
}
|
||||
/**
|
||||
* Returns a path to a system-wide Chrome installation given a release channel
|
||||
* name by checking known installation locations (using
|
||||
* {@link https://pptr.dev/browsers-api/browsers.computesystemexecutablepath}).
|
||||
* If Chrome instance is not found at the expected path, an error is thrown.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function computeSystemExecutablePath(options) {
|
||||
options.platform ??= (0, detectPlatform_js_1.detectBrowserPlatform)();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${node_os_1.default.platform()} (${node_os_1.default.arch()})`);
|
||||
}
|
||||
const paths = (0, browser_data_js_1.resolveSystemExecutablePaths)(options.browser, options.platform, options.channel);
|
||||
for (const path of paths) {
|
||||
try {
|
||||
(0, node_fs_1.accessSync)(path);
|
||||
return path;
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at:${paths.map(path => {
|
||||
return `\n - ${path}`;
|
||||
})}.`);
|
||||
}
|
||||
/**
|
||||
* Launches a browser process according to {@link LaunchOptions}.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
function launch(opts) {
|
||||
return new Process(opts);
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
exports.CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/;
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/;
|
||||
const processListeners = new Map();
|
||||
const dispatchers = {
|
||||
exit: (...args) => {
|
||||
processListeners.get('exit')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGINT: (...args) => {
|
||||
processListeners.get('SIGINT')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGHUP: (...args) => {
|
||||
processListeners.get('SIGHUP')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
SIGTERM: (...args) => {
|
||||
processListeners.get('SIGTERM')?.forEach(handler => {
|
||||
return handler(...args);
|
||||
});
|
||||
},
|
||||
};
|
||||
function subscribeToProcessEvent(event, handler) {
|
||||
const listeners = processListeners.get(event) || [];
|
||||
if (listeners.length === 0) {
|
||||
process.on(event, dispatchers[event]);
|
||||
}
|
||||
listeners.push(handler);
|
||||
processListeners.set(event, listeners);
|
||||
}
|
||||
function unsubscribeFromProcessEvent(event, handler) {
|
||||
const listeners = processListeners.get(event) || [];
|
||||
const existingListenerIdx = listeners.indexOf(handler);
|
||||
if (existingListenerIdx === -1) {
|
||||
return;
|
||||
}
|
||||
listeners.splice(existingListenerIdx, 1);
|
||||
processListeners.set(event, listeners);
|
||||
if (listeners.length === 0) {
|
||||
process.off(event, dispatchers[event]);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
class Process {
|
||||
#executablePath;
|
||||
#args;
|
||||
#browserProcess;
|
||||
#exited = false;
|
||||
// The browser process can be closed externally or from the driver process. We
|
||||
// need to invoke the hooks only once though but we don't know how many times
|
||||
// we will be invoked.
|
||||
#hooksRan = false;
|
||||
#onExitHook = async () => { };
|
||||
#browserProcessExiting;
|
||||
#logs = [];
|
||||
#maxLogLinesSize = 1000;
|
||||
#lineEmitter = new node_events_1.EventEmitter();
|
||||
#onAbort = () => {
|
||||
this.kill();
|
||||
};
|
||||
#signal;
|
||||
constructor(opts) {
|
||||
this.#executablePath = opts.executablePath;
|
||||
this.#args = opts.args ?? [];
|
||||
this.#signal = opts.signal;
|
||||
if (this.#signal?.aborted) {
|
||||
throw new Error(this.#signal.reason ? this.#signal.reason : 'Launch aborted');
|
||||
}
|
||||
this.#signal?.addEventListener('abort', this.#onAbort, { once: true });
|
||||
opts.pipe ??= false;
|
||||
opts.dumpio ??= false;
|
||||
opts.handleSIGINT ??= true;
|
||||
opts.handleSIGTERM ??= true;
|
||||
opts.handleSIGHUP ??= true;
|
||||
// On non-windows platforms, `detached: true` makes child process a
|
||||
// leader of a new process group, making it possible to kill child
|
||||
// process tree with `.kill(-pid)` command. @see
|
||||
// https://nodejs.org/api/child_process.html#child_process_options_detached
|
||||
opts.detached ??= process.platform !== 'win32';
|
||||
const stdio = this.#configureStdio({
|
||||
pipe: opts.pipe,
|
||||
});
|
||||
const env = opts.env || {};
|
||||
debugLaunch(`Launching ${this.#executablePath} ${this.#args.join(' ')}`, {
|
||||
detached: opts.detached,
|
||||
env: Object.keys(env).reduce((res, key) => {
|
||||
if (key.toLowerCase().startsWith('puppeteer_')) {
|
||||
res[key] = env[key];
|
||||
}
|
||||
return res;
|
||||
}, {}),
|
||||
stdio,
|
||||
});
|
||||
this.#browserProcess = node_child_process_1.default.spawn(this.#executablePath, this.#args, {
|
||||
detached: opts.detached,
|
||||
env,
|
||||
stdio,
|
||||
});
|
||||
this.#recordStream(this.#browserProcess.stderr);
|
||||
this.#recordStream(this.#browserProcess.stdout);
|
||||
debugLaunch(`Launched ${this.#browserProcess.pid}`);
|
||||
if (opts.dumpio) {
|
||||
this.#browserProcess.stderr?.pipe(process.stderr);
|
||||
this.#browserProcess.stdout?.pipe(process.stdout);
|
||||
}
|
||||
subscribeToProcessEvent('exit', this.#onDriverProcessExit);
|
||||
if (opts.handleSIGINT) {
|
||||
subscribeToProcessEvent('SIGINT', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.handleSIGTERM) {
|
||||
subscribeToProcessEvent('SIGTERM', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.handleSIGHUP) {
|
||||
subscribeToProcessEvent('SIGHUP', this.#onDriverProcessSignal);
|
||||
}
|
||||
if (opts.onExit) {
|
||||
this.#onExitHook = opts.onExit;
|
||||
}
|
||||
this.#browserProcessExiting = new Promise((resolve, reject) => {
|
||||
this.#browserProcess.once('exit', async () => {
|
||||
debugLaunch(`Browser process ${this.#browserProcess.pid} onExit`);
|
||||
this.#clearListeners();
|
||||
this.#exited = true;
|
||||
try {
|
||||
await this.#runHooks();
|
||||
}
|
||||
catch (err) {
|
||||
reject(err);
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
async #runHooks() {
|
||||
if (this.#hooksRan) {
|
||||
return;
|
||||
}
|
||||
this.#hooksRan = true;
|
||||
await this.#onExitHook();
|
||||
}
|
||||
get nodeProcess() {
|
||||
return this.#browserProcess;
|
||||
}
|
||||
#configureStdio(opts) {
|
||||
if (opts.pipe) {
|
||||
return ['pipe', 'pipe', 'pipe', 'pipe', 'pipe'];
|
||||
}
|
||||
else {
|
||||
return ['pipe', 'pipe', 'pipe'];
|
||||
}
|
||||
}
|
||||
#clearListeners() {
|
||||
unsubscribeFromProcessEvent('exit', this.#onDriverProcessExit);
|
||||
unsubscribeFromProcessEvent('SIGINT', this.#onDriverProcessSignal);
|
||||
unsubscribeFromProcessEvent('SIGTERM', this.#onDriverProcessSignal);
|
||||
unsubscribeFromProcessEvent('SIGHUP', this.#onDriverProcessSignal);
|
||||
this.#signal?.removeEventListener('abort', this.#onAbort);
|
||||
}
|
||||
#onDriverProcessExit = (_code) => {
|
||||
this.kill();
|
||||
};
|
||||
#onDriverProcessSignal = (signal) => {
|
||||
switch (signal) {
|
||||
case 'SIGINT':
|
||||
this.kill();
|
||||
process.exit(130);
|
||||
case 'SIGTERM':
|
||||
case 'SIGHUP':
|
||||
void this.close();
|
||||
break;
|
||||
}
|
||||
};
|
||||
async close() {
|
||||
await this.#runHooks();
|
||||
if (!this.#exited) {
|
||||
this.kill();
|
||||
}
|
||||
return await this.#browserProcessExiting;
|
||||
}
|
||||
hasClosed() {
|
||||
return this.#browserProcessExiting;
|
||||
}
|
||||
kill() {
|
||||
debugLaunch(`Trying to kill ${this.#browserProcess.pid}`);
|
||||
// If the process failed to launch (for example if the browser executable path
|
||||
// is invalid), then the process does not get a pid assigned. A call to
|
||||
// `proc.kill` would error, as the `pid` to-be-killed can not be found.
|
||||
if (this.#browserProcess &&
|
||||
this.#browserProcess.pid &&
|
||||
pidExists(this.#browserProcess.pid)) {
|
||||
try {
|
||||
debugLaunch(`Browser process ${this.#browserProcess.pid} exists`);
|
||||
if (process.platform === 'win32') {
|
||||
try {
|
||||
node_child_process_1.default.execSync(`taskkill /pid ${this.#browserProcess.pid} /T /F`);
|
||||
}
|
||||
catch (error) {
|
||||
debugLaunch(`Killing ${this.#browserProcess.pid} using taskkill failed`, error);
|
||||
// taskkill can fail to kill the process e.g. due to missing permissions.
|
||||
// Let's kill the process via Node API. This delays killing of all child
|
||||
// processes of `this.proc` until the main Node.js process dies.
|
||||
this.#browserProcess.kill();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// on linux the process group can be killed with the group id prefixed with
|
||||
// a minus sign. The process group id is the group leader's pid.
|
||||
const processGroupId = -this.#browserProcess.pid;
|
||||
try {
|
||||
process.kill(processGroupId, 'SIGKILL');
|
||||
}
|
||||
catch (error) {
|
||||
debugLaunch(`Killing ${this.#browserProcess.pid} using process.kill failed`, error);
|
||||
// Killing the process group can fail due e.g. to missing permissions.
|
||||
// Let's kill the process via Node API. This delays killing of all child
|
||||
// processes of `this.proc` until the main Node.js process dies.
|
||||
this.#browserProcess.kill('SIGKILL');
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
throw new Error(`${PROCESS_ERROR_EXPLANATION}\nError cause: ${isErrorLike(error) ? error.stack : error}`);
|
||||
}
|
||||
}
|
||||
this.#clearListeners();
|
||||
}
|
||||
#recordStream(stream) {
|
||||
const rl = node_readline_1.default.createInterface(stream);
|
||||
const cleanup = () => {
|
||||
rl.off('line', onLine);
|
||||
rl.off('close', onClose);
|
||||
try {
|
||||
rl.close();
|
||||
}
|
||||
catch { }
|
||||
};
|
||||
const onLine = (line) => {
|
||||
if (line.trim() === '') {
|
||||
return;
|
||||
}
|
||||
this.#logs.push(line);
|
||||
const delta = this.#logs.length - this.#maxLogLinesSize;
|
||||
if (delta) {
|
||||
this.#logs.splice(0, delta);
|
||||
}
|
||||
this.#lineEmitter.emit('line', line);
|
||||
};
|
||||
const onClose = () => {
|
||||
cleanup();
|
||||
};
|
||||
rl.on('line', onLine);
|
||||
rl.on('close', onClose);
|
||||
}
|
||||
/**
|
||||
* Get recent logs (stderr + stdout) emitted by the browser.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
getRecentLogs() {
|
||||
return [...this.#logs];
|
||||
}
|
||||
waitForLineOutput(regex, timeout = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const onClose = (errorOrCode) => {
|
||||
cleanup();
|
||||
reject(new Error([
|
||||
`Failed to launch the browser process: ${errorOrCode instanceof Error
|
||||
? ` ${errorOrCode.message}`
|
||||
: ` Code: ${errorOrCode}`}`,
|
||||
'',
|
||||
`stderr:`,
|
||||
this.getRecentLogs().join('\n'),
|
||||
'',
|
||||
'TROUBLESHOOTING: https://pptr.dev/troubleshooting',
|
||||
'',
|
||||
].join('\n')));
|
||||
};
|
||||
this.#browserProcess.on('exit', onClose);
|
||||
this.#browserProcess.on('error', onClose);
|
||||
const timeoutId = timeout > 0 ? setTimeout(onTimeout, timeout) : undefined;
|
||||
this.#lineEmitter.on('line', onLine);
|
||||
const cleanup = () => {
|
||||
clearTimeout(timeoutId);
|
||||
this.#lineEmitter.off('line', onLine);
|
||||
this.#browserProcess.off('exit', onClose);
|
||||
this.#browserProcess.off('error', onClose);
|
||||
};
|
||||
function onTimeout() {
|
||||
cleanup();
|
||||
reject(new TimeoutError(`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`));
|
||||
}
|
||||
for (const line of this.#logs) {
|
||||
onLine(line);
|
||||
}
|
||||
function onLine(line) {
|
||||
const match = line.match(regex);
|
||||
if (!match) {
|
||||
return;
|
||||
}
|
||||
cleanup();
|
||||
// The RegExp matches, so this will obviously exist.
|
||||
resolve(match[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Process = Process;
|
||||
const PROCESS_ERROR_EXPLANATION = `Puppeteer was unable to kill the process which ran the browser binary.
|
||||
This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser.
|
||||
Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed.
|
||||
If you think this is a bug, please report it on the Puppeteer issue tracker.`;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function pidExists(pid) {
|
||||
try {
|
||||
return process.kill(pid, 0);
|
||||
}
|
||||
catch (error) {
|
||||
if (isErrnoException(error)) {
|
||||
if (error.code && error.code === 'ESRCH') {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function isErrorLike(obj) {
|
||||
return (typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj);
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
function isErrnoException(obj) {
|
||||
return (isErrorLike(obj) &&
|
||||
('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj));
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
class TimeoutError extends Error {
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(message) {
|
||||
super(message);
|
||||
this.name = this.constructor.name;
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
}
|
||||
exports.TimeoutError = TimeoutError;
|
||||
//# sourceMappingURL=launch.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/launch.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/launch.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
8
node_modules/@puppeteer/browsers/lib/cjs/main-cli.d.ts
generated
vendored
Normal file
8
node_modules/@puppeteer/browsers/lib/cjs/main-cli.d.ts
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export {};
|
||||
//# sourceMappingURL=main-cli.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/main-cli.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/main-cli.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main-cli.d.ts","sourceRoot":"","sources":["../../src/main-cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
|
||||
11
node_modules/@puppeteer/browsers/lib/cjs/main-cli.js
generated
vendored
Executable file
11
node_modules/@puppeteer/browsers/lib/cjs/main-cli.js
generated
vendored
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env node
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const CLI_js_1 = require("./CLI.js");
|
||||
void new CLI_js_1.CLI().run(process.argv);
|
||||
//# sourceMappingURL=main-cli.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/main-cli.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/main-cli.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main-cli.js","sourceRoot":"","sources":["../../src/main-cli.ts"],"names":[],"mappings":";;AAEA;;;;GAIG;;AAEH,qCAA6B;AAE7B,KAAK,IAAI,YAAG,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
||||
18
node_modules/@puppeteer/browsers/lib/cjs/main.d.ts
generated
vendored
Normal file
18
node_modules/@puppeteer/browsers/lib/cjs/main.d.ts
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
export type { LaunchOptions, ComputeExecutablePathOptions as Options, SystemOptions, } from './launch.js';
|
||||
export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js';
|
||||
export type { InstallOptions, GetInstalledBrowsersOptions, UninstallOptions, } from './install.js';
|
||||
export { install, makeProgressCallback, getInstalledBrowsers, canDownload, uninstall, getDownloadUrl, } from './install.js';
|
||||
export { detectBrowserPlatform } from './detectPlatform.js';
|
||||
export type { ProfileOptions } from './browser-data/browser-data.js';
|
||||
export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, getVersionComparator, resolveDefaultUserDataDir, } from './browser-data/browser-data.js';
|
||||
export { CLI } from './CLI.js';
|
||||
export { Cache, InstalledBrowser, type Metadata, type ComputeExecutablePathOptions, } from './Cache.js';
|
||||
export { BrowserTag } from './browser-data/types.js';
|
||||
export { DefaultProvider } from './DefaultProvider.js';
|
||||
export { type BrowserProvider, buildArchiveFilename, type DownloadOptions, } from './provider.js';
|
||||
//# sourceMappingURL=main.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/main.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/main.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,aAAa,EACb,4BAA4B,IAAI,OAAO,EACvC,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,MAAM,EACN,qBAAqB,EACrB,2BAA2B,EAC3B,YAAY,EACZ,4BAA4B,EAC5B,uCAAuC,EACvC,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,cAAc,EACd,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EACpB,WAAW,EACX,SAAS,EACT,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,qBAAqB,EAAC,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AACnE,OAAO,EACL,cAAc,EACd,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAC,GAAG,EAAC,MAAM,UAAU,CAAC;AAC7B,OAAO,EACL,KAAK,EACL,gBAAgB,EAChB,KAAK,QAAQ,EACb,KAAK,4BAA4B,GAClC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACL,KAAK,eAAe,EACpB,oBAAoB,EACpB,KAAK,eAAe,GACrB,MAAM,eAAe,CAAC"}
|
||||
45
node_modules/@puppeteer/browsers/lib/cjs/main.js
generated
vendored
Normal file
45
node_modules/@puppeteer/browsers/lib/cjs/main.js
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildArchiveFilename = exports.DefaultProvider = exports.BrowserTag = exports.InstalledBrowser = exports.Cache = exports.CLI = exports.resolveDefaultUserDataDir = exports.getVersionComparator = exports.createProfile = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.resolveBuildId = exports.detectBrowserPlatform = exports.getDownloadUrl = exports.uninstall = exports.canDownload = exports.getInstalledBrowsers = exports.makeProgressCallback = exports.install = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.TimeoutError = exports.computeSystemExecutablePath = exports.computeExecutablePath = exports.launch = void 0;
|
||||
var launch_js_1 = require("./launch.js");
|
||||
Object.defineProperty(exports, "launch", { enumerable: true, get: function () { return launch_js_1.launch; } });
|
||||
Object.defineProperty(exports, "computeExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeExecutablePath; } });
|
||||
Object.defineProperty(exports, "computeSystemExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeSystemExecutablePath; } });
|
||||
Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return launch_js_1.TimeoutError; } });
|
||||
Object.defineProperty(exports, "CDP_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.CDP_WEBSOCKET_ENDPOINT_REGEX; } });
|
||||
Object.defineProperty(exports, "WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX; } });
|
||||
Object.defineProperty(exports, "Process", { enumerable: true, get: function () { return launch_js_1.Process; } });
|
||||
var install_js_1 = require("./install.js");
|
||||
Object.defineProperty(exports, "install", { enumerable: true, get: function () { return install_js_1.install; } });
|
||||
Object.defineProperty(exports, "makeProgressCallback", { enumerable: true, get: function () { return install_js_1.makeProgressCallback; } });
|
||||
Object.defineProperty(exports, "getInstalledBrowsers", { enumerable: true, get: function () { return install_js_1.getInstalledBrowsers; } });
|
||||
Object.defineProperty(exports, "canDownload", { enumerable: true, get: function () { return install_js_1.canDownload; } });
|
||||
Object.defineProperty(exports, "uninstall", { enumerable: true, get: function () { return install_js_1.uninstall; } });
|
||||
Object.defineProperty(exports, "getDownloadUrl", { enumerable: true, get: function () { return install_js_1.getDownloadUrl; } });
|
||||
var detectPlatform_js_1 = require("./detectPlatform.js");
|
||||
Object.defineProperty(exports, "detectBrowserPlatform", { enumerable: true, get: function () { return detectPlatform_js_1.detectBrowserPlatform; } });
|
||||
var browser_data_js_1 = require("./browser-data/browser-data.js");
|
||||
Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return browser_data_js_1.resolveBuildId; } });
|
||||
Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return browser_data_js_1.Browser; } });
|
||||
Object.defineProperty(exports, "BrowserPlatform", { enumerable: true, get: function () { return browser_data_js_1.BrowserPlatform; } });
|
||||
Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return browser_data_js_1.ChromeReleaseChannel; } });
|
||||
Object.defineProperty(exports, "createProfile", { enumerable: true, get: function () { return browser_data_js_1.createProfile; } });
|
||||
Object.defineProperty(exports, "getVersionComparator", { enumerable: true, get: function () { return browser_data_js_1.getVersionComparator; } });
|
||||
Object.defineProperty(exports, "resolveDefaultUserDataDir", { enumerable: true, get: function () { return browser_data_js_1.resolveDefaultUserDataDir; } });
|
||||
var CLI_js_1 = require("./CLI.js");
|
||||
Object.defineProperty(exports, "CLI", { enumerable: true, get: function () { return CLI_js_1.CLI; } });
|
||||
var Cache_js_1 = require("./Cache.js");
|
||||
Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_js_1.Cache; } });
|
||||
Object.defineProperty(exports, "InstalledBrowser", { enumerable: true, get: function () { return Cache_js_1.InstalledBrowser; } });
|
||||
var types_js_1 = require("./browser-data/types.js");
|
||||
Object.defineProperty(exports, "BrowserTag", { enumerable: true, get: function () { return types_js_1.BrowserTag; } });
|
||||
var DefaultProvider_js_1 = require("./DefaultProvider.js");
|
||||
Object.defineProperty(exports, "DefaultProvider", { enumerable: true, get: function () { return DefaultProvider_js_1.DefaultProvider; } });
|
||||
var provider_js_1 = require("./provider.js");
|
||||
Object.defineProperty(exports, "buildArchiveFilename", { enumerable: true, get: function () { return provider_js_1.buildArchiveFilename; } });
|
||||
//# sourceMappingURL=main.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/main.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/main.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/main.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAOH,yCAQqB;AAPnB,mGAAA,MAAM,OAAA;AACN,kHAAA,qBAAqB,OAAA;AACrB,wHAAA,2BAA2B,OAAA;AAC3B,yGAAA,YAAY,OAAA;AACZ,yHAAA,4BAA4B,OAAA;AAC5B,oIAAA,uCAAuC,OAAA;AACvC,oGAAA,OAAO,OAAA;AAOT,2CAOsB;AANpB,qGAAA,OAAO,OAAA;AACP,kHAAA,oBAAoB,OAAA;AACpB,kHAAA,oBAAoB,OAAA;AACpB,yGAAA,WAAW,OAAA;AACX,uGAAA,SAAS,OAAA;AACT,4GAAA,cAAc,OAAA;AAEhB,yDAA0D;AAAlD,0HAAA,qBAAqB,OAAA;AAE7B,kEAQwC;AAPtC,iHAAA,cAAc,OAAA;AACd,0GAAA,OAAO,OAAA;AACP,kHAAA,eAAe,OAAA;AACf,uHAAA,oBAAoB,OAAA;AACpB,gHAAA,aAAa,OAAA;AACb,uHAAA,oBAAoB,OAAA;AACpB,4HAAA,yBAAyB,OAAA;AAE3B,mCAA6B;AAArB,6FAAA,GAAG,OAAA;AACX,uCAKoB;AAJlB,iGAAA,KAAK,OAAA;AACL,4GAAA,gBAAgB,OAAA;AAIlB,oDAAmD;AAA3C,sGAAA,UAAU,OAAA;AAClB,2DAAqD;AAA7C,qHAAA,eAAe,OAAA;AACvB,6CAIuB;AAFrB,mHAAA,oBAAoB,OAAA"}
|
||||
153
node_modules/@puppeteer/browsers/lib/cjs/provider.d.ts
generated
vendored
Normal file
153
node_modules/@puppeteer/browsers/lib/cjs/provider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,153 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* Options passed to a provider.
|
||||
* @public
|
||||
*/
|
||||
export interface DownloadOptions {
|
||||
browser: Browser;
|
||||
platform: BrowserPlatform;
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* Interface for custom browser provider implementations.
|
||||
* Allows users to implement alternative download sources for browsers.
|
||||
*
|
||||
* ⚠️ **IMPORTANT**: Custom providers are NOT officially supported by
|
||||
* Puppeteer.
|
||||
*
|
||||
* By implementing this interface, you accept full responsibility for:
|
||||
*
|
||||
* - Ensuring downloaded binaries are compatible with Puppeteer's expectations
|
||||
* - Testing that browser launch and other features work with your binaries
|
||||
* - Maintaining compatibility when Puppeteer or your download source changes
|
||||
* - Version consistency across platforms if mixing sources
|
||||
*
|
||||
* Puppeteer only tests and guarantees Chrome for Testing binaries.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```typescript
|
||||
* class ElectronDownloader implements BrowserProvider {
|
||||
* supports(options: DownloadOptions): boolean {
|
||||
* return options.browser === Browser.CHROMEDRIVER;
|
||||
* }
|
||||
*
|
||||
* getDownloadUrl(options: DownloadOptions): URL {
|
||||
* const platform = mapToPlatform(options.platform);
|
||||
* return new URL(
|
||||
* `v${options.buildId}/chromedriver-v${options.buildId}-${platform}.zip`,
|
||||
* 'https://github.com/electron/electron/releases/download/',
|
||||
* );
|
||||
* }
|
||||
*
|
||||
* getExecutablePath(options): string {
|
||||
* const ext = options.platform.includes('win') ? '.exe' : '';
|
||||
* return `chromedriver/chromedriver${ext}`;
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export interface BrowserProvider {
|
||||
/**
|
||||
* Check if this provider supports the given browser/platform.
|
||||
* Used for filtering before attempting downloads.
|
||||
*
|
||||
* Can be synchronous for quick checks or asynchronous if version
|
||||
* resolution/network requests are needed.
|
||||
*
|
||||
* @param options - Download options to check
|
||||
* @returns True if this provider supports the browser/platform combination
|
||||
*/
|
||||
supports(options: DownloadOptions): Promise<boolean> | boolean;
|
||||
/**
|
||||
* Get the download URL for the requested browser.
|
||||
*
|
||||
* The buildId can be either an exact version (e.g., "131.0.6778.109")
|
||||
* or an alias (e.g., "latest", "stable"). Custom providers should handle
|
||||
* version resolution internally if they support aliases.
|
||||
*
|
||||
* Returns null if the buildId cannot be resolved to a valid version.
|
||||
* The URL is not validated - download will fail later if URL doesn't exist.
|
||||
*
|
||||
* Can be synchronous for simple URL construction or asynchronous if version
|
||||
* resolution/network requests are needed.
|
||||
*
|
||||
* @param options - Download options (buildId may be alias or exact version)
|
||||
* @returns Download URL, or null if version cannot be resolved
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* // Synchronous example
|
||||
* getDownloadUrl(options) {
|
||||
* const platform = mapPlatform(options.platform);
|
||||
* return new URL(`https://releases.example.com/v${options.buildId}/${platform}.zip`);
|
||||
* }
|
||||
*
|
||||
* // Asynchronous example with version mapping
|
||||
* async getDownloadUrl(options) {
|
||||
* const electronVersion = await resolveElectronVersion(options.buildId);
|
||||
* if (!electronVersion) return null;
|
||||
*
|
||||
* const platform = mapPlatform(options.platform);
|
||||
* return new URL(`https://github.com/electron/electron/releases/download/v${electronVersion}/${platform}.zip`);
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getDownloadUrl(options: DownloadOptions): Promise<URL | null> | URL | null;
|
||||
/**
|
||||
* Get the relative path to the executable within the extracted archive.
|
||||
*
|
||||
* @param options - Browser, buildId, and platform
|
||||
* @returns Relative path to the executable
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* // Electron uses simple structure
|
||||
* getExecutablePath() {
|
||||
* return 'chromedriver/chromedriver';
|
||||
* }
|
||||
*
|
||||
* // Custom provider with platform-specific paths
|
||||
* getExecutablePath(options) {
|
||||
* return `binaries/${options.browser}-${options.platform}`;
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): Promise<string> | string;
|
||||
/**
|
||||
* Get the name of this provider.
|
||||
* Used for error messages and logging purposes.
|
||||
*
|
||||
* @returns The provider name (e.g., "DefaultProvider", "CustomProvider")
|
||||
*
|
||||
* @remarks
|
||||
* This method is used instead of `constructor.name` to avoid issues with
|
||||
* minification in production builds.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* ```ts
|
||||
* getName() {
|
||||
* return 'MyCustomProvider';
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
getName(): string;
|
||||
}
|
||||
/**
|
||||
* Utility function to build a standard archive filename.
|
||||
* @public
|
||||
*/
|
||||
export declare function buildArchiveFilename(browser: Browser, platform: BrowserPlatform, buildId: string, extension?: string): string;
|
||||
//# sourceMappingURL=provider.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/provider.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/provider.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAC,OAAO,EAAE,eAAe,EAAC,MAAM,gCAAgC,CAAC;AAE7E;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IAE3E;;;;;;;;;;;;;;;;;;OAkBG;IACH,iBAAiB,CAAC,OAAO,EAAE;QACzB,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,EAAE,eAAe,CAAC;KAC3B,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAE7B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,IAAI,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,SAAS,SAAQ,GAChB,MAAM,CAER"}
|
||||
16
node_modules/@puppeteer/browsers/lib/cjs/provider.js
generated
vendored
Normal file
16
node_modules/@puppeteer/browsers/lib/cjs/provider.js
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.buildArchiveFilename = buildArchiveFilename;
|
||||
/**
|
||||
* Utility function to build a standard archive filename.
|
||||
* @public
|
||||
*/
|
||||
function buildArchiveFilename(browser, platform, buildId, extension = 'zip') {
|
||||
return `${browser}-${platform}-${buildId}.${extension}`;
|
||||
}
|
||||
//# sourceMappingURL=provider.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/cjs/provider.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/cjs/provider.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/provider.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA0JH,oDAOC;AAXD;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,OAAgB,EAChB,QAAyB,EACzB,OAAe,EACf,SAAS,GAAG,KAAK;IAEjB,OAAO,GAAG,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC;AAC1D,CAAC"}
|
||||
29
node_modules/@puppeteer/browsers/lib/esm/CLI.d.ts
generated
vendored
Normal file
29
node_modules/@puppeteer/browsers/lib/esm/CLI.d.ts
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import * as readline from 'node:readline';
|
||||
import { Browser } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class CLI {
|
||||
#private;
|
||||
constructor(opts?: string | {
|
||||
cachePath?: string;
|
||||
scriptName?: string;
|
||||
version?: string;
|
||||
prefixCommand?: {
|
||||
cmd: string;
|
||||
description: string;
|
||||
};
|
||||
allowCachePathOverride?: boolean;
|
||||
pinnedBrowsers?: Partial<Record<Browser, {
|
||||
buildId: string;
|
||||
skipDownload: boolean;
|
||||
}>>;
|
||||
}, rl?: readline.Interface);
|
||||
run(argv: string[]): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=CLI.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/esm/CLI.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/esm/CLI.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CLI.d.ts","sourceRoot":"","sources":["../../src/CLI.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAI1C,OAAO,EACL,OAAO,EAIR,MAAM,gCAAgC,CAAC;AAmCxC;;GAEG;AACH,qBAAa,GAAG;;gBAkBZ,IAAI,CAAC,EACD,MAAM,GACN;QACE,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE;YAAC,GAAG,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAC,CAAC;QACnD,sBAAsB,CAAC,EAAE,OAAO,CAAC;QACjC,cAAc,CAAC,EAAE,OAAO,CACtB,MAAM,CACJ,OAAO,EACP;YACE,OAAO,EAAE,MAAM,CAAC;YAChB,YAAY,EAAE,OAAO,CAAC;SACvB,CACF,CACF,CAAC;KACH,EACL,EAAE,CAAC,EAAE,QAAQ,CAAC,SAAS;IA+EnB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAoYzC"}
|
||||
328
node_modules/@puppeteer/browsers/lib/esm/CLI.js
generated
vendored
Normal file
328
node_modules/@puppeteer/browsers/lib/esm/CLI.js
generated
vendored
Normal file
@@ -0,0 +1,328 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { stdin as input, stdout as output } from 'node:process';
|
||||
import * as readline from 'node:readline';
|
||||
import { Browser, resolveBuildId, BrowserPlatform, } from './browser-data/browser-data.js';
|
||||
import { Cache } from './Cache.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
import { install } from './install.js';
|
||||
import { computeExecutablePath, computeSystemExecutablePath, launch, } from './launch.js';
|
||||
function isValidBrowser(browser) {
|
||||
return Object.values(Browser).includes(browser);
|
||||
}
|
||||
function isValidPlatform(platform) {
|
||||
return Object.values(BrowserPlatform).includes(platform);
|
||||
}
|
||||
// If moved update release-please config
|
||||
// x-release-please-start-version
|
||||
const packageVersion = '2.12.0';
|
||||
// x-release-please-end
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class CLI {
|
||||
#cachePath;
|
||||
#rl;
|
||||
#scriptName;
|
||||
#version;
|
||||
#allowCachePathOverride;
|
||||
#pinnedBrowsers;
|
||||
#prefixCommand;
|
||||
constructor(opts, rl) {
|
||||
if (!opts) {
|
||||
opts = {};
|
||||
}
|
||||
if (typeof opts === 'string') {
|
||||
opts = {
|
||||
cachePath: opts,
|
||||
};
|
||||
}
|
||||
this.#cachePath = opts.cachePath ?? process.cwd();
|
||||
this.#rl = rl;
|
||||
this.#scriptName = opts.scriptName ?? '@puppeteer/browsers';
|
||||
this.#version = opts.version ?? packageVersion;
|
||||
this.#allowCachePathOverride = opts.allowCachePathOverride ?? true;
|
||||
this.#pinnedBrowsers = opts.pinnedBrowsers;
|
||||
this.#prefixCommand = opts.prefixCommand;
|
||||
}
|
||||
#defineBrowserParameter(yargs, required) {
|
||||
return yargs.positional('browser', {
|
||||
description: 'Which browser to install <browser>[@<buildId|latest>]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.',
|
||||
type: 'string',
|
||||
coerce: (opt) => {
|
||||
const browser = {
|
||||
name: this.#parseBrowser(opt),
|
||||
buildId: this.#parseBuildId(opt),
|
||||
};
|
||||
if (!isValidBrowser(browser.name)) {
|
||||
throw new Error(`Unsupported browser '${browser.name}'`);
|
||||
}
|
||||
return browser;
|
||||
},
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
#definePlatformParameter(yargs) {
|
||||
return yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
default: detectBrowserPlatform(),
|
||||
coerce: platform => {
|
||||
if (!isValidPlatform(platform)) {
|
||||
throw new Error(`Unsupported platform '${platform}'`);
|
||||
}
|
||||
return platform;
|
||||
},
|
||||
defaultDescription: 'Auto-detected',
|
||||
});
|
||||
}
|
||||
#definePathParameter(yargs, required = false) {
|
||||
if (!this.#allowCachePathOverride) {
|
||||
return yargs;
|
||||
}
|
||||
return yargs.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path to the root folder for the browser downloads and installation. If a relative path is provided, it will be resolved relative to the current working directory. The installation folder structure is compatible with the cache structure used by Puppeteer.',
|
||||
defaultDescription: 'Current working directory',
|
||||
...(required ? {} : { default: process.cwd() }),
|
||||
demandOption: required,
|
||||
});
|
||||
}
|
||||
async run(argv) {
|
||||
const { default: yargs } = await import('yargs');
|
||||
const { hideBin } = await import('yargs/helpers');
|
||||
const yargsInstance = yargs(hideBin(argv));
|
||||
let target = yargsInstance
|
||||
.scriptName(this.#scriptName)
|
||||
.version(this.#version);
|
||||
if (this.#prefixCommand) {
|
||||
target = target.command(this.#prefixCommand.cmd, this.#prefixCommand.description, yargs => {
|
||||
return this.#build(yargs);
|
||||
});
|
||||
}
|
||||
else {
|
||||
target = this.#build(target);
|
||||
}
|
||||
await target
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.wrap(Math.min(120, yargsInstance.terminalWidth()))
|
||||
.parseAsync();
|
||||
}
|
||||
#build(yargs) {
|
||||
const latestOrPinned = this.#pinnedBrowsers ? 'pinned' : 'latest';
|
||||
// If there are pinned browsers allow the positional arg to be optional
|
||||
const browserArgType = this.#pinnedBrowsers ? '[browser]' : '<browser>';
|
||||
return yargs
|
||||
.command(`install ${browserArgType}`, 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: <browser>@<buildID> <path>).', yargs => {
|
||||
if (this.#pinnedBrowsers) {
|
||||
yargs.example('$0 install', 'Install all pinned browsers');
|
||||
}
|
||||
yargs
|
||||
.example('$0 install chrome', `Install the ${latestOrPinned} available build of the Chrome browser.`)
|
||||
.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.')
|
||||
.example('$0 install chrome@stable', 'Install the latest available build for the Chrome browser from the stable channel.')
|
||||
.example('$0 install chrome@beta', 'Install the latest available build for the Chrome browser from the beta channel.')
|
||||
.example('$0 install chrome@dev', 'Install the latest available build for the Chrome browser from the dev channel.')
|
||||
.example('$0 install chrome@canary', 'Install the latest available build for the Chrome Canary browser.')
|
||||
.example('$0 install chrome@115', 'Install the latest available build for Chrome 115.')
|
||||
.example('$0 install chromedriver@canary', 'Install the latest available build for ChromeDriver Canary.')
|
||||
.example('$0 install chromedriver@115', 'Install the latest available build for ChromeDriver 115.')
|
||||
.example('$0 install chromedriver@115.0.5790', 'Install the latest available patch (115.0.5790.X) build for ChromeDriver.')
|
||||
.example('$0 install chrome-headless-shell', 'Install the latest available chrome-headless-shell build.')
|
||||
.example('$0 install chrome-headless-shell@beta', 'Install the latest available chrome-headless-shell build corresponding to the Beta channel.')
|
||||
.example('$0 install chrome-headless-shell@118', 'Install the latest available chrome-headless-shell 118 build.')
|
||||
.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.')
|
||||
.example('$0 install firefox', 'Install the latest nightly available build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable', 'Install the latest stable build of the Firefox browser.')
|
||||
.example('$0 install firefox@beta', 'Install the latest beta build of the Firefox browser.')
|
||||
.example('$0 install firefox@devedition', 'Install the latest devedition build of the Firefox browser.')
|
||||
.example('$0 install firefox@esr', 'Install the latest ESR build of the Firefox browser.')
|
||||
.example('$0 install firefox@nightly', 'Install the latest nightly build of the Firefox browser.')
|
||||
.example('$0 install firefox@stable_111.0.1', 'Install a specific version of the Firefox browser.')
|
||||
.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.');
|
||||
}
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargs, !Boolean(this.#pinnedBrowsers));
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam, false)
|
||||
.option('base-url', {
|
||||
type: 'string',
|
||||
desc: 'Base URL to download from',
|
||||
})
|
||||
.option('install-deps', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to attempt installing system dependencies (only supported on Linux, requires root privileges).',
|
||||
default: false,
|
||||
});
|
||||
}, async (args) => {
|
||||
if (this.#pinnedBrowsers && !args.browser) {
|
||||
// Use allSettled to avoid scenarios that
|
||||
// a browser may fail early and leave the other
|
||||
// installation in a faulty state
|
||||
const result = await Promise.allSettled(Object.entries(this.#pinnedBrowsers).map(async ([browser, options]) => {
|
||||
if (options.skipDownload) {
|
||||
return;
|
||||
}
|
||||
await this.#install({
|
||||
...args,
|
||||
browser: {
|
||||
name: browser,
|
||||
buildId: options.buildId,
|
||||
},
|
||||
});
|
||||
}));
|
||||
for (const install of result) {
|
||||
if (install.status === 'rejected') {
|
||||
throw install.reason;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
await this.#install(args);
|
||||
}
|
||||
})
|
||||
.command('launch <browser>', 'Launch the specified browser', yargs => {
|
||||
yargs
|
||||
.example('$0 launch chrome@115.0.5790.170', 'Launch Chrome 115.0.5790.170')
|
||||
.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.')
|
||||
.example('$0 launch chrome@115.0.5790.170 --detached', 'Launch the browser but detach the sub-processes.')
|
||||
.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.')
|
||||
.example('$0 launch chrome@115.0.5790.170 -- --version', 'Launch Chrome 115.0.5790.170 and pass custom argument to the binary.');
|
||||
const yargsWithExtraAgs = yargs.parserConfiguration({
|
||||
'populate--': true,
|
||||
// Yargs does not have the correct overload for this.
|
||||
});
|
||||
const yargsWithBrowserParam = this.#defineBrowserParameter(yargsWithExtraAgs, true);
|
||||
const yargsWithPlatformParam = this.#definePlatformParameter(yargsWithBrowserParam);
|
||||
return this.#definePathParameter(yargsWithPlatformParam)
|
||||
.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Detach the child process.',
|
||||
default: false,
|
||||
})
|
||||
.option('system', {
|
||||
type: 'boolean',
|
||||
desc: 'Search for a browser installed on the system instead of the cache folder.',
|
||||
default: false,
|
||||
})
|
||||
.option('dumpio', {
|
||||
type: 'boolean',
|
||||
desc: "Forwards the browser's process stdout and stderr",
|
||||
default: false,
|
||||
});
|
||||
}, async (args) => {
|
||||
const extraArgs = args['--']?.filter(arg => {
|
||||
return typeof arg === 'string';
|
||||
});
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const executablePath = args.system
|
||||
? computeSystemExecutablePath({
|
||||
browser: args.browser.name,
|
||||
// TODO: throw an error if not a ChromeReleaseChannel is provided.
|
||||
channel: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
})
|
||||
: computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
});
|
||||
launch({
|
||||
args: extraArgs,
|
||||
executablePath,
|
||||
dumpio: args.dumpio,
|
||||
detached: args.detached,
|
||||
});
|
||||
})
|
||||
.command('clear', this.#allowCachePathOverride
|
||||
? 'Removes all installed browsers from the specified cache directory'
|
||||
: `Removes all installed browsers from ${this.#cachePath}`, yargs => {
|
||||
return this.#definePathParameter(yargs, true);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const rl = this.#rl ?? readline.createInterface({ input, output });
|
||||
rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => {
|
||||
rl.close();
|
||||
if (!['y', 'yes'].includes(answer.toLowerCase().trim())) {
|
||||
console.log('Cancelled.');
|
||||
return;
|
||||
}
|
||||
const cache = new Cache(cacheDir);
|
||||
cache.clear();
|
||||
console.log(`${cacheDir} cleared.`);
|
||||
});
|
||||
})
|
||||
.command('list', 'List all installed browsers in the cache directory', yargs => {
|
||||
yargs.example('$0 list', 'List all installed browsers in the cache directory');
|
||||
if (this.#allowCachePathOverride) {
|
||||
yargs.example('$0 list --path /tmp/my-browser-cache', 'List browsers installed in the specified cache directory');
|
||||
}
|
||||
return this.#definePathParameter(yargs);
|
||||
}, async (args) => {
|
||||
const cacheDir = args.path ?? this.#cachePath;
|
||||
const cache = new Cache(cacheDir);
|
||||
const browsers = cache.getInstalledBrowsers();
|
||||
for (const browser of browsers) {
|
||||
console.log(`${browser.browser}@${browser.buildId} (${browser.platform}) ${browser.executablePath}`);
|
||||
}
|
||||
})
|
||||
.demandCommand(1)
|
||||
.help();
|
||||
}
|
||||
#parseBrowser(version) {
|
||||
return version.split('@').shift();
|
||||
}
|
||||
#parseBuildId(version) {
|
||||
const parts = version.split('@');
|
||||
return parts.length === 2
|
||||
? parts[1]
|
||||
: this.#pinnedBrowsers
|
||||
? 'pinned'
|
||||
: 'latest';
|
||||
}
|
||||
#resolvePinnedBrowserIfNeeded(buildId, browserName) {
|
||||
if (buildId === 'pinned') {
|
||||
const options = this.#pinnedBrowsers?.[browserName];
|
||||
if (!options || !options.buildId) {
|
||||
throw new Error(`No pinned version found for ${browserName}`);
|
||||
}
|
||||
return options.buildId;
|
||||
}
|
||||
return buildId;
|
||||
}
|
||||
async #install(args) {
|
||||
if (!args.browser) {
|
||||
throw new Error(`No browser arg provided`);
|
||||
}
|
||||
if (!args.platform) {
|
||||
throw new Error(`Could not resolve the current platform`);
|
||||
}
|
||||
args.browser.buildId = this.#resolvePinnedBrowserIfNeeded(args.browser.buildId, args.browser.name);
|
||||
const originalBuildId = args.browser.buildId;
|
||||
args.browser.buildId = await resolveBuildId(args.browser.name, args.platform, args.browser.buildId);
|
||||
await install({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
platform: args.platform,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
downloadProgressCallback: 'default',
|
||||
baseUrl: args.baseUrl,
|
||||
buildIdAlias: originalBuildId !== args.browser.buildId ? originalBuildId : undefined,
|
||||
installDeps: args.installDeps,
|
||||
});
|
||||
console.log(`${args.browser.name}@${args.browser.buildId} ${computeExecutablePath({
|
||||
browser: args.browser.name,
|
||||
buildId: args.browser.buildId,
|
||||
cacheDir: args.path ?? this.#cachePath,
|
||||
platform: args.platform,
|
||||
})}`);
|
||||
}
|
||||
}
|
||||
//# sourceMappingURL=CLI.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/esm/CLI.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/esm/CLI.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
89
node_modules/@puppeteer/browsers/lib/esm/Cache.d.ts
generated
vendored
Normal file
89
node_modules/@puppeteer/browsers/lib/esm/Cache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import { Browser, type BrowserPlatform } from './browser-data/browser-data.js';
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export declare class InstalledBrowser {
|
||||
#private;
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
readonly executablePath: string;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache: Cache, browser: Browser, buildId: string, platform: BrowserPlatform);
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path(): string;
|
||||
readMetadata(): Metadata;
|
||||
writeMetadata(metadata: Metadata): void;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export interface ComputeExecutablePathOptions {
|
||||
/**
|
||||
* Determines which platform the browser will be suited for.
|
||||
*
|
||||
* @defaultValue **Auto-detected.**
|
||||
*/
|
||||
platform?: BrowserPlatform;
|
||||
/**
|
||||
* Determines which browser to launch.
|
||||
*/
|
||||
browser: Browser;
|
||||
/**
|
||||
* Determines which buildId to download. BuildId should uniquely identify
|
||||
* binaries and they are used for caching.
|
||||
*/
|
||||
buildId: string;
|
||||
}
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Metadata {
|
||||
aliases: Record<string, string>;
|
||||
executablePaths?: Record<string, string>;
|
||||
}
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export declare class Cache {
|
||||
#private;
|
||||
constructor(rootDir: string);
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir(): string;
|
||||
browserRoot(browser: Browser): string;
|
||||
metadataFile(browser: Browser): string;
|
||||
readMetadata(browser: Browser): Metadata;
|
||||
writeMetadata(browser: Browser, metadata: Metadata): void;
|
||||
readExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string): string | null;
|
||||
writeExecutablePath(browser: Browser, platform: BrowserPlatform, buildId: string, executablePath: string): void;
|
||||
resolveAlias(browser: Browser, alias: string): string | undefined;
|
||||
installationDir(browser: Browser, platform: BrowserPlatform, buildId: string): string;
|
||||
clear(): void;
|
||||
uninstall(browser: Browser, platform: BrowserPlatform, buildId: string): void;
|
||||
getInstalledBrowsers(): InstalledBrowser[];
|
||||
computeExecutablePath(options: ComputeExecutablePathOptions): string;
|
||||
}
|
||||
//# sourceMappingURL=Cache.d.ts.map
|
||||
1
node_modules/@puppeteer/browsers/lib/esm/Cache.d.ts.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/esm/Cache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Cache.d.ts","sourceRoot":"","sources":["../../src/Cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,EACL,OAAO,EACP,KAAK,eAAe,EAGrB,MAAM,gCAAgC,CAAC;AAKxC;;GAEG;AACH,qBAAa,gBAAgB;;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAIhC;;OAEG;gBAED,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,eAAe;IAa3B;;;OAGG;IACH,IAAI,IAAI,IAAI,MAAM,CAMjB;IAED,YAAY,IAAI,QAAQ;IAIxB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI;CAGxC;AAED;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IAEvB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEhC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;GAaG;AACH,qBAAa,KAAK;;gBAGJ,OAAO,EAAE,MAAM;IAI3B;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIrC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAItC,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,QAAQ;IAaxC,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI;IAMzD,kBAAkB,CAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,IAAI;IAMhB,mBAAmB,CACjB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACrB,IAAI;IAUP,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAUjE,eAAe,CACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,MAAM;IAIT,KAAK,IAAI,IAAI;IASb,SAAS,CACP,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,GACd,IAAI;IAqBP,oBAAoB,IAAI,gBAAgB,EAAE;IA+B1C,qBAAqB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;CAqCrE"}
|
||||
208
node_modules/@puppeteer/browsers/lib/esm/Cache.js
generated
vendored
Normal file
208
node_modules/@puppeteer/browsers/lib/esm/Cache.js
generated
vendored
Normal file
@@ -0,0 +1,208 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2023 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import debug from 'debug';
|
||||
import { Browser, executablePathByBrowser, getVersionComparator, } from './browser-data/browser-data.js';
|
||||
import { detectBrowserPlatform } from './detectPlatform.js';
|
||||
const debugCache = debug('puppeteer:browsers:cache');
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export class InstalledBrowser {
|
||||
browser;
|
||||
buildId;
|
||||
platform;
|
||||
executablePath;
|
||||
#cache;
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
constructor(cache, browser, buildId, platform) {
|
||||
this.#cache = cache;
|
||||
this.browser = browser;
|
||||
this.buildId = buildId;
|
||||
this.platform = platform;
|
||||
this.executablePath = cache.computeExecutablePath({
|
||||
browser,
|
||||
buildId,
|
||||
platform,
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Path to the root of the installation folder. Use
|
||||
* {@link computeExecutablePath} to get the path to the executable binary.
|
||||
*/
|
||||
get path() {
|
||||
return this.#cache.installationDir(this.browser, this.platform, this.buildId);
|
||||
}
|
||||
readMetadata() {
|
||||
return this.#cache.readMetadata(this.browser);
|
||||
}
|
||||
writeMetadata(metadata) {
|
||||
this.#cache.writeMetadata(this.browser, metadata);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The cache used by Puppeteer relies on the following structure:
|
||||
*
|
||||
* - rootDir
|
||||
* -- <browser1> | browserRoot(browser1)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* -- <browser2> | browserRoot(browser2)
|
||||
* ---- <platform>-<buildId> | installationDir()
|
||||
* ------ the browser-platform-buildId
|
||||
* ------ specific structure.
|
||||
* @internal
|
||||
*/
|
||||
export class Cache {
|
||||
#rootDir;
|
||||
constructor(rootDir) {
|
||||
this.#rootDir = rootDir;
|
||||
}
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
get rootDir() {
|
||||
return this.#rootDir;
|
||||
}
|
||||
browserRoot(browser) {
|
||||
return path.join(this.#rootDir, browser);
|
||||
}
|
||||
metadataFile(browser) {
|
||||
return path.join(this.browserRoot(browser), '.metadata');
|
||||
}
|
||||
readMetadata(browser) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
if (!fs.existsSync(metatadaPath)) {
|
||||
return { aliases: {} };
|
||||
}
|
||||
// TODO: add type-safe parsing.
|
||||
const data = JSON.parse(fs.readFileSync(metatadaPath, 'utf8'));
|
||||
if (typeof data !== 'object') {
|
||||
throw new Error('.metadata is not an object');
|
||||
}
|
||||
return data;
|
||||
}
|
||||
writeMetadata(browser, metadata) {
|
||||
const metatadaPath = this.metadataFile(browser);
|
||||
fs.mkdirSync(path.dirname(metatadaPath), { recursive: true });
|
||||
fs.writeFileSync(metatadaPath, JSON.stringify(metadata, null, 2));
|
||||
}
|
||||
readExecutablePath(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
const key = `${platform}-${buildId}`;
|
||||
return metadata.executablePaths?.[key] ?? null;
|
||||
}
|
||||
writeExecutablePath(browser, platform, buildId, executablePath) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (!metadata.executablePaths) {
|
||||
metadata.executablePaths = {};
|
||||
}
|
||||
const key = `${platform}-${buildId}`;
|
||||
metadata.executablePaths[key] = executablePath;
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
resolveAlias(browser, alias) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
if (alias === 'latest') {
|
||||
return Object.values(metadata.aliases || {})
|
||||
.sort(getVersionComparator(browser))
|
||||
.at(-1);
|
||||
}
|
||||
return metadata.aliases[alias];
|
||||
}
|
||||
installationDir(browser, platform, buildId) {
|
||||
return path.join(this.browserRoot(browser), `${platform}-${buildId}`);
|
||||
}
|
||||
clear() {
|
||||
fs.rmSync(this.#rootDir, {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
uninstall(browser, platform, buildId) {
|
||||
const metadata = this.readMetadata(browser);
|
||||
for (const alias of Object.keys(metadata.aliases)) {
|
||||
if (metadata.aliases[alias] === buildId) {
|
||||
delete metadata.aliases[alias];
|
||||
}
|
||||
}
|
||||
// Clean up executable path entry
|
||||
const key = `${platform}-${buildId}`;
|
||||
if (metadata.executablePaths?.[key]) {
|
||||
delete metadata.executablePaths[key];
|
||||
this.writeMetadata(browser, metadata);
|
||||
}
|
||||
fs.rmSync(this.installationDir(browser, platform, buildId), {
|
||||
force: true,
|
||||
recursive: true,
|
||||
maxRetries: 10,
|
||||
retryDelay: 500,
|
||||
});
|
||||
}
|
||||
getInstalledBrowsers() {
|
||||
if (!fs.existsSync(this.#rootDir)) {
|
||||
return [];
|
||||
}
|
||||
const types = fs.readdirSync(this.#rootDir);
|
||||
const browsers = types.filter((t) => {
|
||||
return Object.values(Browser).includes(t);
|
||||
});
|
||||
return browsers.flatMap(browser => {
|
||||
const files = fs.readdirSync(this.browserRoot(browser));
|
||||
return files
|
||||
.map(file => {
|
||||
const result = parseFolderPath(path.join(this.browserRoot(browser), file));
|
||||
if (!result) {
|
||||
return null;
|
||||
}
|
||||
return new InstalledBrowser(this, browser, result.buildId, result.platform);
|
||||
})
|
||||
.filter((item) => {
|
||||
return item !== null;
|
||||
});
|
||||
});
|
||||
}
|
||||
computeExecutablePath(options) {
|
||||
options.platform ??= detectBrowserPlatform();
|
||||
if (!options.platform) {
|
||||
throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`);
|
||||
}
|
||||
try {
|
||||
options.buildId =
|
||||
this.resolveAlias(options.browser, options.buildId) ?? options.buildId;
|
||||
}
|
||||
catch {
|
||||
debugCache('could not read .metadata file for the browser');
|
||||
}
|
||||
const installationDir = this.installationDir(options.browser, options.platform, options.buildId);
|
||||
const storedExecutablePath = this.readExecutablePath(options.browser, options.platform, options.buildId);
|
||||
if (storedExecutablePath) {
|
||||
// The metadata contains a resolved relative path from the installation dir
|
||||
return path.join(installationDir, storedExecutablePath);
|
||||
}
|
||||
return path.join(installationDir, executablePathByBrowser[options.browser](options.platform, options.buildId));
|
||||
}
|
||||
}
|
||||
function parseFolderPath(folderPath) {
|
||||
const name = path.basename(folderPath);
|
||||
const splits = name.split('-');
|
||||
if (splits.length !== 2) {
|
||||
return;
|
||||
}
|
||||
const [platform, buildId] = splits;
|
||||
if (!buildId || !platform) {
|
||||
return;
|
||||
}
|
||||
return { platform, buildId };
|
||||
}
|
||||
//# sourceMappingURL=Cache.js.map
|
||||
1
node_modules/@puppeteer/browsers/lib/esm/Cache.js.map
generated
vendored
Normal file
1
node_modules/@puppeteer/browsers/lib/esm/Cache.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
26
node_modules/@puppeteer/browsers/lib/esm/DefaultProvider.d.ts
generated
vendored
Normal file
26
node_modules/@puppeteer/browsers/lib/esm/DefaultProvider.d.ts
generated
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2026 Google Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import type { Browser, BrowserPlatform } from './browser-data/browser-data.js';
|
||||
import type { BrowserProvider, DownloadOptions } from './provider.js';
|
||||
/**
|
||||
* Default provider implementation that uses default sources.
|
||||
* This is the standard provider used by Puppeteer.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export declare class DefaultProvider implements BrowserProvider {
|
||||
#private;
|
||||
constructor(baseUrl?: string);
|
||||
supports(_options: DownloadOptions): boolean;
|
||||
getDownloadUrl(options: DownloadOptions): URL;
|
||||
getExecutablePath(options: {
|
||||
browser: Browser;
|
||||
buildId: string;
|
||||
platform: BrowserPlatform;
|
||||
}): string;
|
||||
getName(): string;
|
||||
}
|
||||
//# sourceMappingURL=DefaultProvider.d.ts.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user