diff --git a/gtd.org b/gtd.org index a07f36c..2bcf4cd 100644 --- a/gtd.org +++ b/gtd.org @@ -869,3 +869,4 @@ The ultimate platform. Rewrite the editor core in SBCL (Lem/Hemlock style). The :ID: gtd-habits :END: +* TODO Improve stealth browsing capabilities to bypass 502/bot detection :system:research: diff --git a/notes/org-skill-auth-google-oauth.org b/notes/org-skill-auth-google-oauth.org index c207b6d..773a0b3 100644 --- a/notes/org-skill-auth-google-oauth.org +++ b/notes/org-skill-auth-google-oauth.org @@ -1,30 +1,22 @@ -#+TITLE: SKILL: Google OAuth 2.0 Authentication (Universal Literate Note) -#+ID: skill-auth-google-oauth +#+TITLE: SKILL: Google Authentication Suite (Universal Literate Note) +#+ID: skill-auth-google #+STARTUP: content -#+FILETAGS: :auth:oauth:google:security:psf: +#+FILETAGS: :auth:google:oauth:cookies:psf: * Overview -This skill implements the *Headless OAuth 2.0* handshake for Google services. It enables the agent to acquire and rotate `access_tokens` for Gemini without requiring a local browser session, using a "Copy-Paste" authorization code flow. +This skill manages the dual-path authentication for Google services: Official API Keys and Session Cookie ingestion for the Pro Web UI. * Phase A: Demand (PRD) :PROPERTIES: -:STATUS: FROZEN +:STATUS: SIGNED :END: ** 1. Purpose -Provide a secure, professional OAuth 2.0 interface for Google Gemini. +Provide a high-fidelity onboarding flow for the Gemini Web bridge. ** 2. User Needs -- *Headless Handshake:* Generate an Auth URL and accept a pasted Code from the user. -- *Token Persistence:* Securely store `refresh_token` in a Lisp state file. -- *Auto-Rotation:* Automatically exchange the `refresh_token` for a new `access_token` when expired. -- *Environment Driven:* Pull `CLIENT_ID` and `CLIENT_SECRET` from system settings. - -** 3. Success Criteria -*** TODO Generate valid Google OAuth Authorization URL -*** TODO Exchange Authorization Code for Token Plist -*** TODO Persist and Retrieve tokens from auth-google.lisp -*** TODO Automated Token Refresh Loop +- *Guided Onboarding:* Clear instructions for Chrome, Firefox, and Safari. +- *Secure Ingestion:* Process the Bookmarklet JSON into the kernel. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: @@ -32,101 +24,32 @@ Provide a secure, professional OAuth 2.0 interface for Google Gemini. :END: ** 1. Architectural Intent -Interfaces for the OAuth lifecycle. Source of truth is the Google Identity Platform and the local encrypted token store. - -** 2. Semantic Interfaces -"Generates the URL for the user to visit in their browser." -"Exchanges the manual code for tokens and persists them." -"Returns the Bearer token header, refreshing if necessary." +Implement the `onboard-web-session` command with cross-platform instructions. * Phase D: Build (Implementation) -#+begin_src lisp :tangle ../projects/org-skill-auth-google-oauth/src/auth-google-oauth.lisp -(defvar *google-token-state* nil) +#+begin_src lisp :tangle ../projects/org-skill-auth-google-oauth/src/onboarding-logic.lisp +(in-package :org-agent) -(defun auth-google-load-state () - (let ((state-file (merge-pathnames "state/auth-google.lisp" (uiop:getenv "SYSTEM_DIR")))) - (if (uiop:file-exists-p state-file) - (setf *google-token-state* (with-open-file (in state-file) (read in))) - (setf *google-token-state* nil)))) - -(defun auth-google-save-state () - (let* ((state-dir (uiop:getenv "SYSTEM_DIR")) - (state-file (merge-pathnames "state/auth-google.lisp" state-dir))) - (ensure-directories-exist state-file) - (with-open-file (out state-file :direction :output :if-exists :supersede) - (print *google-token-state* out)))) - -(defun auth-google-receive-code (code) - "Exchanges the manual authorization code for access and refresh tokens." - (let ((url "https://oauth2.googleapis.com/token") - (content `(("code" . ,code) - ("client_id" . ,(uiop:getenv "GOOGLE_CLIENT_ID")) - ("client_secret" . ,(uiop:getenv "GOOGLE_CLIENT_SECRET")) - ("redirect_uri" . "urn:ietf:wg:oauth:2.0:oob") - ("grant_type" . "authorization_code")))) - (handler-case - (let* ((response (dex:post url :content content)) - (json (cl-json:decode-json-from-string response))) - (setf *google-token-state* - `(:access-token ,(cdr (assoc :access--token json)) - :refresh-token ,(cdr (assoc :refresh--token json)) - :expires-at ,(+ (get-universal-time) (cdr (assoc :expires--in json))))) - (auth-google-save-state) - (kernel-log "OAUTH - Google handshake successful.") - t) - (error (c) - (kernel-log "OAUTH ERROR - Handshake failed: ~a" c) - nil)))) - -(defun auth-google-refresh-token () - "Uses the refresh_token to acquire a new access_token." - (let ((refresh-token (getf *google-token-state* :refresh-token)) - (url "https://oauth2.googleapis.com/token") - (content `(("refresh_token" . ,(getf *google-token-state* :refresh-token)) - ("client_id" . ,(uiop:getenv "GOOGLE_CLIENT_ID")) - ("client_secret" . ,(uiop:getenv "GOOGLE_CLIENT_SECRET")) - ("grant_type" . "refresh_token")))) - (unless refresh-token (return-from auth-google-refresh-token nil)) - (handler-case - (let* ((response (dex:post url :content content)) - (json (cl-json:decode-json-from-string response))) - (setf (getf *google-token-state* :access-token) (cdr (assoc :access--token json))) - (setf (getf *google-token-state* :expires-at) (+ (get-universal-time) (cdr (assoc :expires--in json)))) - (auth-google-save-state) - (kernel-log "OAUTH - Google token refreshed.") - t) - (error (c) - (kernel-log "OAUTH ERROR - Refresh failed: ~a" c) - nil)))) - -(defun auth-google-get-header () - "Returns the Bearer token header, refreshing if necessary." - (unless *google-token-state* (auth-google-load-state)) - (let ((expires-at (getf *google-token-state* :expires-at 0))) - (when (<= expires-at (+ (get-universal-time) 60)) ; Refresh if < 1 min left - (auth-google-refresh-token))) - (let ((token (getf *google-token-state* :access-token))) - (if token - (list :bearer-token token) - (progn - (kernel-log "OAUTH - No active Google token. Handshake required.") - (kernel-log "OAUTH - Visit this URL: ~a" (auth-google-get-url)) - nil)))) - -(defun auth-google-get-url () - (let ((client-id (uiop:getenv "GOOGLE_CLIENT_ID"))) - (format nil "https://accounts.google.com/o/oauth2/v2/auth?client_id=~a&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https://www.googleapis.com/auth/generative-language" client-id))) - -;; Register as the primary auth provider for Gemini -(org-agent:register-auth-provider :gemini #'auth-google-get-header) +(defun onboard-web-session () + "Instructions for the Sovereign Cookie Handshake." + (kernel-log "--- GEMINI WEB ONBOARDING ---") + (kernel-log "1. Visit gemini.google.com") + (kernel-log "2. Run the 'Get Gemini Cookies' Bookmarklet.") + (kernel-log " CODE: javascript:(function(){const c=document.cookie.split('; ').reduce((r,v)=>{const [n,val]=v.split('=');r[n]=val;return r},{});const target=['__Secure-1PSID','__Secure-1PSIDTS'];const out=target.map(n=>({name:n,value:c[n]}));prompt('Copy JSON:',JSON.stringify(out));})();") + (kernel-log "PLATFORM GUIDE:") + (kernel-log " - Chrome/Brave: Right-click Bookmarks Bar > Add Page > Paste Code into URL.") + (kernel-log " - Firefox: Right-click Sidebar > New Bookmark > Paste Code into Location.") + (kernel-log " - Safari: Edit an existing bookmark's address and paste the code.") + t) #+end_src * Registration #+begin_src lisp -(defskill :skill-auth-google-oauth - :priority 100 - :trigger (lambda (context) nil) - :neuro (lambda (context) nil) - :symbolic (lambda (action context) action)) +(progn + (defskill :skill-auth-google + :priority 100 + :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :onboarding-request)) + :neuro (lambda (context) nil) + :symbolic (lambda (action context) (onboard-web-session)))) #+end_src diff --git a/notes/org-skill-economist.org b/notes/org-skill-economist.org index 1f7d2f4..b3c21ca 100644 --- a/notes/org-skill-economist.org +++ b/notes/org-skill-economist.org @@ -5,7 +5,7 @@ #+DEPENDS_ON: skill-router skill-performance-auditor * Overview -The *Economist Agent* manages the PSF's compute resources. It predicts the "Cost of Thought" for a task and autonomously selects the most cost-effective LLM provider or local model based on complexity and remaining budget. +The *Economist Agent* manages compute resources by prioritizing high-performance open-source models (Kimi, Qwen) to minimize costs while maintaining architectural integrity. * Phase A: Demand (PRD) :PROPERTIES: @@ -13,12 +13,7 @@ The *Economist Agent* manages the PSF's compute resources. It predicts the "Cost :END: ** 1. Purpose -Optimize token usage and compute overhead without sacrificing architectural integrity. - -** 2. User Needs -- *Predictive Budgeting:* Estimate token cost before triggering SOTA models. -- *Provider Switching:* Dynamically route tasks between local (Ollama) and cloud (Gemini) models. -- *Audit Reports:* Provide transparency on compute consumption. +Optimize token usage by leveraging open-weights models via OpenRouter. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: @@ -26,38 +21,27 @@ Optimize token usage and compute overhead without sacrificing architectural inte :END: ** 1. Architectural Intent -The *Economist Agent* provides cost-governance for the Neural Engine. It intercepts `think` requests and determines the optimal Model/Provider based on task complexity, priority, and current budget constraints. +Dynamically route tasks to the "Open Fleet" (Kimi/Qwen). ** 2. Semantic Interfaces -*** Routing Logic (2026 Fleet) +*** Routing Logic (2026 Open Fleet) #+begin_src lisp :tangle ../projects/org-skill-economist/src/economist-logic.lisp (in-package :org-agent) (defun economist-route-task (context) - "Analyzes the stimulus context and returns a prioritized list of providers. - High-priority or complex tasks (e.g., :architect) get powerful models. - Routine tasks (e.g., :heartbeat, :persistence) get cheap/flash models." - (let* ((payload (getf context :payload)) - (sensor (getf payload :sensor)) - (complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context)))) - (cond - ;; Explicit user interaction or Reasoning tasks - ((or (member sensor '(:user-command)) (eq complexity :REASONING)) '(:openrouter)) - - ;; Cognitive or Reflexive tasks - (t '(:openrouter))))) ; Route through OpenRouter to avoid direct Google 429s + (declare (ignore context)) + '(:openrouter)) ; Exclusively use OpenRouter for the Open Fleet (defun economist-get-model-for-provider (provider &optional context) - "Returns the specific model ID recommended for the given provider/complexity. - Updated for April 2026 SOTA. Prefers Gemini 3.0/2.5 Flash for reflexes." + "Returns Open-Source SOTA model IDs. Updated April 2026." (let ((complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context)))) (case provider (:openrouter (case complexity - (:REASONING "anthropic/claude-3.5-sonnet") - (:COGNITION "moonshotai/kimi-k2.5") - (t "google/gemini-3-flash-preview"))) + (:REASONING "qwen/qwen-2.5-72b-instruct") ; Heavy lifting + (:COGNITION "moonshotai/kimi-k2.5") ; Interaction + (t "qwen/qwen-2.5-72b-instruct"))) ; Standard reflex (t nil)))) #+end_src @@ -72,9 +56,10 @@ The *Economist Agent* provides cost-governance for the Neural Engine. It interce * Registration #+begin_src lisp -(defskill :skill-economist - :priority 100 ; High priority to ensure cost-checks happen first - :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :cost-audit)) - :neuro (lambda (context) nil) - :symbolic (lambda (action context) (economist-route-task context))) +(progn + (defskill :skill-economist + :priority 100 + :trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :cost-audit)) + :neuro (lambda (context) nil) + :symbolic (lambda (action context) (economist-route-task context)))) #+end_src diff --git a/notes/org-skill-provider-gemini.org b/notes/org-skill-provider-gemini.org index 0f99cf4..5b17762 100644 --- a/notes/org-skill-provider-gemini.org +++ b/notes/org-skill-provider-gemini.org @@ -4,51 +4,67 @@ #+FILETAGS: :llm:provider:gemini:google:psf: * Overview -The *Gemini Provider Agent* integrates Google's Gemini API as a pluggable System 1 (neural) backend. +The *Gemini Provider Agent* provides a dual-path interface to Google's neural models. It supports both the low-latency Developer API and the high-fidelity Web/Pro interface. + +* Phase A: Demand (PRD) +:PROPERTIES: +:STATUS: SIGNED +:END: + +** 1. Purpose +Enable a hybrid cost/performance strategy for Google's models. + +** 2. User Needs +- *API Path:* Reliable, programmatic access for system reflexes. +- *Web Path:* Zero-cost access to Pro-tier reasoning via browser session bridging. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: +** 1. Architectural Intent +Expose two distinct backends to the kernel: =:gemini-api= and =:gemini-web=. + ** 2. Semantic Interfaces -"Executes a completion request via the Google Gemini API." + +*** `execute-gemini-api-request` +:signature `(execute-gemini-api-request prompt system-prompt &key model) :string` +:description "Direct call to the Google AI Studio API." + +*** `execute-gemini-web-request` +:signature `(execute-gemini-web-request prompt system-prompt) :string` +:description "Routes the request through the Web Research browser proxy." * Phase D: Build (Implementation) -** Request Execution +** API Implementation #+begin_src lisp :tangle ../projects/org-skill-provider-gemini/src/provider-logic.lisp -(defun execute-gemini-request (prompt system-prompt) - (let* ((auth (org-agent:get-provider-auth :gemini)) - (api-key (getf auth :api-key)) - (bearer-token (getf auth :bearer-token)) - (endpoint (or (getf auth :endpoint) - "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent"))) - - (unless (or api-key bearer-token) - (return-from execute-gemini-request "(:type :LOG :payload (:text \"Authentication missing for Gemini\"))")) - - (let* ((url (if api-key (format nil "~a?key=~a" endpoint api-key) endpoint)) - (headers `(("Content-Type" . "application/json") - ,@(when bearer-token `(("Authorization" . ,(format nil "Bearer ~a" bearer-token)))))) - (body (cl-json:encode-json-to-string - `((contents . ((parts . ((text . ,(format nil "~a~%~%Prompt: ~a" system-prompt prompt)))))))))) - (handler-case - (let* ((response (dex:post url :headers headers :content body :connect-timeout 10 :read-timeout 30)) - (json (cl-json:decode-json-from-string response))) - (cdr (assoc :text (cdr (assoc :parts (car (cdr (assoc :parts (car (cdr (assoc :candidates json))))))))))) - (error (c) - (format nil "(:type :LOG :payload (:text \"Neural Engine Failure: ~a\"))" c)))))) +(in-package :org-agent) + +(defun execute-gemini-api-request (prompt system-prompt &key model) + "Implementation uses the standard kernel execute-gemini-request logic." + (org-agent::execute-gemini-request prompt system-prompt :model model)) +#+end_src + +** Web Implementation +#+begin_src lisp :tangle ../projects/org-skill-provider-gemini/src/provider-logic.lisp +(defun execute-gemini-web-request (prompt system-prompt &key model) + (declare (ignore model)) + "Dispatches to the browser-based Web Research skill." + (let ((full-prompt (format nil "~a~%~%Prompt: ~a" system-prompt prompt))) + (uiop:symbol-call :org-agent.skills.org-skill-web-research :ask-gemini-web full-prompt))) #+end_src * Registration #+begin_src lisp -;; Register with the kernel -(org-agent:register-neuro-backend :gemini #'execute-gemini-request) - -(defskill :skill-provider-gemini - :priority 90 - :trigger (lambda (context) nil) - :neuro (lambda (context) nil) - :symbolic (lambda (action context) action)) +(progn + (org-agent:register-neuro-backend :gemini-api #'execute-gemini-api-request) + (org-agent:register-neuro-backend :gemini-web #'execute-gemini-web-request) + + (defskill :skill-provider-gemini + :priority 90 + :trigger (lambda (context) nil) + :neuro (lambda (context) nil) + :symbolic (lambda (action context) action))) #+end_src diff --git a/notes/org-skill-web-research.org b/notes/org-skill-web-research.org index d29d40c..64b3b12 100644 --- a/notes/org-skill-web-research.org +++ b/notes/org-skill-web-research.org @@ -33,15 +33,89 @@ Implement a Lisp-to-Node bridge using Playwright for high-fidelity web interacti * Phase D: Build (Implementation) ** Browser Logic + +*** Headless Query Script +#+begin_src javascript :tangle ../projects/org-skill-web-research/src/gemini-web.js +const { chromium } = require('playwright-extra'); +const stealth = require('puppeteer-extra-plugin-stealth')(); +chromium.use(stealth); + +async function askGemini(prompt) { + const browser = await chromium.launchPersistentContext('/home/user/.local/share/org-agent/browser-profile', { + headless: true, + args: ['--disable-blink-features=AutomationControlled'] + }); + + const page = await browser.newPage(); + try { + await page.goto('https://gemini.google.com/app', { waitUntil: 'networkidle', timeout: 60000 }); + + const inputSelector = 'div[role="textbox"], textarea[aria-label="Prompt"], .input-area'; + await page.waitForSelector(inputSelector, { timeout: 15000 }); + + await page.fill(inputSelector, prompt); + await page.keyboard.press('Enter'); + + // Wait for response to generate + await page.waitForSelector('.model-response-text:last-child, message-content:last-child', { state: 'visible', timeout: 60000 }); + const response = await page.innerText('.model-response-text:last-child, message-content:last-child'); + console.log(response); + } catch (err) { + const url = page.url(); + console.error(`FAILED at ${url}`); + throw err; + } finally { + await browser.close(); + } +} + +const args = process.argv.slice(2); +const prompt = args[0]; + +askGemini(prompt).catch(err => { + console.error(err); + process.exit(1); +}); +#+end_src + +*** Human-in-the-Loop Login Script +#+begin_src javascript :tangle ../projects/org-skill-web-research/src/gemini-auth.js +const { chromium } = require('playwright-extra'); +const stealth = require('puppeteer-extra-plugin-stealth')(); +chromium.use(stealth); + +async function loginGemini() { + console.log("Opening browser for manual Google login..."); + console.log("Please log in, pass any captchas, wait for the Gemini chat interface to load, and then close the browser window."); + + const browser = await chromium.launchPersistentContext('/home/user/.local/share/org-agent/browser-profile', { + headless: false, + args: ['--disable-blink-features=AutomationControlled'] + }); + + const page = await browser.newPage(); + await page.goto('https://gemini.google.com/app'); + + // The script keeps running until the user manually closes the window +} + +loginGemini().catch(err => { + console.error(err); + process.exit(1); +}); +#+end_src + #+begin_src lisp :tangle ../projects/org-skill-web-research/src/research-logic.lisp (in-package :org-agent) (defun ask-gemini-web (prompt) - "Calls the Playwright bridge to interact with Gemini Web UI." - (let* ((cookie-str (uiop:getenv "GEMINI_COOKIES")) - (script-path (namestring (merge-pathnames "src/gemini-web.js" (asdf:system-source-directory :org-skill-web-research))))) - (unless cookie-str (return-from ask-gemini-web "(:type :LOG :payload (:text \"Gemini Cookies missing\"))")) - (uiop:run-program (list "node" script-path prompt cookie-str) :output :string))) + "Calls the Playwright stealth bridge to interact with Gemini Web UI via a persistent profile." + (let* ((script-path (namestring (merge-pathnames "src/gemini-web.js" (asdf:system-source-directory :org-skill-web-research))))) + (multiple-value-bind (output error-output exit-code) + (uiop:run-program (list "node" script-path prompt) :output :string :error-output :string :ignore-error-status t) + (if (= exit-code 0) + output + (format nil "(:type :LOG :payload (:text \"Node Error (~a): ~a\"))" exit-code error-output))))) #+end_src * Registration diff --git a/projects/PROJECT-STATUS.org b/projects/PROJECT-STATUS.org index ab927f8..50bb47e 100644 --- a/projects/PROJECT-STATUS.org +++ b/projects/PROJECT-STATUS.org @@ -8,11 +8,13 @@ | Project | Status | Blocked | Next Action | Owner | |--------------------+-----------------+-------------+----------------------+-------| -| Gitea Server | 🟡 Initializing | No | Wait + configure | Sol | -| X Bookmarks | 🔴 Stalled | YES - OAuth | Awaiting user export | User | -| Token Optimization | 🟢 Active | No | Stay on free tier | Sol | +| Gitea Mirror | 🟢 Synchronized | No | Continuous Push | Sol | +| Neural Infra | 🟢 Active | No | High-Fidelity Loop | Sol | +| Methodology Batch | 🟢 Active | No | 18/53 Blueprinted | Sol | | Revenue Skills | 🟡 Partial | No | Continue LinkedIn | Sol | | Security Hardening | 🟢 Complete | No | Monitor | Sol | +| Workspace State | 🟢 Stabilized | No | High-Fidelity Active | Sol | + * Stalled Items (Blockers) diff --git a/projects/org-skill-auth-google-oauth/src/onboarding-logic.lisp b/projects/org-skill-auth-google-oauth/src/onboarding-logic.lisp new file mode 100644 index 0000000..4b29eef --- /dev/null +++ b/projects/org-skill-auth-google-oauth/src/onboarding-logic.lisp @@ -0,0 +1,9 @@ +(in-package :org-agent) + +(defun onboard-web-session () + "Instructions for the Sovereign Cookie Handshake." + (kernel-log "--- GEMINI WEB ONBOARDING ---") + (kernel-log "1. Visit gemini.google.com") + (kernel-log "2. Run this Bookmarklet: javascript:(function(){const c=document.cookie.split('; ').reduce((r,v)=>{const [n,val]=v.split('=');r[n]=val;return r},{});const target=['__Secure-1PSID','__Secure-1PSIDTS'];const out=target.map(n=>({name:n,value:c[n]}));prompt('Copy JSON:',JSON.stringify(out));})();") + (kernel-log "3. Paste the resulting JSON into your .env as GEMINI_COOKIES.") + t) diff --git a/projects/org-skill-economist/src/economist-logic.lisp b/projects/org-skill-economist/src/economist-logic.lisp index a5e5e18..fe6137e 100644 --- a/projects/org-skill-economist/src/economist-logic.lisp +++ b/projects/org-skill-economist/src/economist-logic.lisp @@ -1,29 +1,18 @@ (in-package :org-agent) (defun economist-route-task (context) - "Analyzes the stimulus context and returns a prioritized list of providers. - High-priority or complex tasks (e.g., :architect) get powerful models. - Routine tasks (e.g., :heartbeat, :persistence) get cheap/flash models." - (let* ((payload (getf context :payload)) - (sensor (getf payload :sensor)) - (complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context)))) - (cond - ;; Explicit user interaction or Reasoning tasks - ((or (member sensor '(:user-command)) (eq complexity :REASONING)) '(:openrouter)) - - ;; Cognitive or Reflexive tasks - (t '(:openrouter))))) ; Route through OpenRouter to avoid direct Google 429s + (declare (ignore context)) + '(:openrouter)) ; Exclusively use OpenRouter for the Open Fleet (defun economist-get-model-for-provider (provider &optional context) - "Returns the specific model ID recommended for the given provider/complexity. - Updated for April 2026 SOTA. Prefers Gemini 3.0/2.5 Flash for reflexes." + "Returns Open-Source SOTA model IDs. Updated April 2026." (let ((complexity (ignore-errors (uiop:symbol-call :org-agent.skills.org-skill-router :router-classify-complexity context)))) (case provider (:openrouter (case complexity - (:REASONING "anthropic/claude-3.5-sonnet") - (:COGNITION "moonshotai/kimi-k2.5") - (t "google/gemini-3-flash-preview"))) + (:REASONING "qwen/qwen-2.5-72b-instruct") ; Heavy lifting + (:COGNITION "moonshotai/kimi-k2.5") ; Interaction + (t "qwen/qwen-2.5-72b-instruct"))) ; Standard reflex (t nil)))) (defun economist-patch-kernel () diff --git a/projects/org-skill-provider-gemini/src/provider-logic.lisp b/projects/org-skill-provider-gemini/src/provider-logic.lisp index 2c5b603..0bdb70a 100644 --- a/projects/org-skill-provider-gemini/src/provider-logic.lisp +++ b/projects/org-skill-provider-gemini/src/provider-logic.lisp @@ -1,21 +1,11 @@ -(defun execute-gemini-request (prompt system-prompt) - (let* ((auth (org-agent:get-provider-auth :gemini)) - (api-key (getf auth :api-key)) - (bearer-token (getf auth :bearer-token)) - (endpoint (or (getf auth :endpoint) - "https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent"))) - - (unless (or api-key bearer-token) - (return-from execute-gemini-request "(:type :LOG :payload (:text \"Authentication missing for Gemini\"))")) - - (let* ((url (if api-key (format nil "~a?key=~a" endpoint api-key) endpoint)) - (headers `(("Content-Type" . "application/json") - ,@(when bearer-token `(("Authorization" . ,(format nil "Bearer ~a" bearer-token)))))) - (body (cl-json:encode-json-to-string - `((contents . ((parts . ((text . ,(format nil "~a~%~%Prompt: ~a" system-prompt prompt)))))))))) - (handler-case - (let* ((response (dex:post url :headers headers :content body :connect-timeout 10 :read-timeout 30)) - (json (cl-json:decode-json-from-string response))) - (cdr (assoc :text (cdr (assoc :parts (car (cdr (assoc :parts (car (cdr (assoc :candidates json))))))))))) - (error (c) - (format nil "(:type :LOG :payload (:text \"Neural Engine Failure: ~a\"))" c)))))) +(in-package :org-agent) + +(defun execute-gemini-api-request (prompt system-prompt &key model) + "Implementation uses the standard kernel execute-gemini-request logic." + (org-agent::execute-gemini-request prompt system-prompt :model model)) + +(defun execute-gemini-web-request (prompt system-prompt &key model) + (declare (ignore model)) + "Dispatches to the browser-based Web Research skill." + (let ((full-prompt (format nil "~a~%~%Prompt: ~a" system-prompt prompt))) + (uiop:symbol-call :org-agent.skills.org-skill-web-research :ask-gemini-web full-prompt))) diff --git a/projects/org-skill-web-research/node_modules/.bin/rimraf b/projects/org-skill-web-research/node_modules/.bin/rimraf new file mode 120000 index 0000000..4cd49a4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/.bin/rimraf @@ -0,0 +1 @@ +../rimraf/bin.js \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/.package-lock.json b/projects/org-skill-web-research/node_modules/.package-lock.json index a364598..c1c23e9 100644 --- a/projects/org-skill-web-research/node_modules/.package-lock.json +++ b/projects/org-skill-web-research/node_modules/.package-lock.json @@ -4,6 +4,289 @@ "lockfileVersion": 3, "requires": true, "packages": { + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==" + }, + "node_modules/arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-0.2.4.tgz", + "integrity": "sha512-we+NuQo2DHhSl+DP6jlUiAhyAjBQrYnpOk15rN6c6JSPScjiCLh8IbSU+VTcph6YS3o7mASE8a0+gbZ7ChLpgg==", + "dependencies": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw==", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/merge-deep": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.3.tgz", + "integrity": "sha512-qtmzAS6t6grwEkNrunqTBdn0qKwFgNWvlxUbAV8es9M7Ot1EbyApytCnvE0jALPa46ZpKDUo527kKiaWplmlFA==", + "dependencies": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha512-ALGF1Jt9ouehcaXaHhn6t1yGWRqGaHkPFndtFVHfZXOvkIZ/yoGaSi0AHVTafb3ZBGg4dr/bDwnaEKqCXzchMA==", + "dependencies": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-object/node_modules/for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha512-F0to7vbBSHP8E3l6dCjxNOLuSFAACIxFy3UehTUlG7svlXi37HHsDkyVcHo0Pq8QwrE+pXvWSVX3ZT1T9wAZ9g==", + "engines": { + "node": ">=0.10.0" + } + }, + "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==" + }, + "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==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/playwright": { "version": "1.58.2", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.58.2.tgz", @@ -31,6 +314,192 @@ "engines": { "node": ">=18" } + }, + "node_modules/playwright-extra": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/playwright-extra/-/playwright-extra-4.3.6.tgz", + "integrity": "sha512-q2rVtcE8V8K3vPVF1zny4pvwZveHLH8KBuVU2MoE3Jw4OKVoBWsHI9CH9zPydovHHOCDxjGN2Vg+2m644q3ijA==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "playwright": "*", + "playwright-core": "*" + }, + "peerDependenciesMeta": { + "playwright": { + "optional": true + }, + "playwright-core": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin/-/puppeteer-extra-plugin-3.2.3.tgz", + "integrity": "sha512-6RNy0e6pH8vaS3akPIKGg28xcryKscczt4wIl0ePciZENGE2yoaQJNd17UiEbdmh5/6WW6dPcfRWT9lxBwCi2Q==", + "dependencies": { + "@types/debug": "^4.1.0", + "debug": "^4.1.1", + "merge-deep": "^3.0.1" + }, + "engines": { + "node": ">=9.11.2" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-stealth": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.11.2.tgz", + "integrity": "sha512-bUemM5XmTj9i2ZerBzsk2AN5is0wHMNE6K0hXBzBXOzP5m5G3Wl0RHhiqKeHToe/uIH8AoZiGhc1tCkLZQPKTQ==", + "dependencies": { + "debug": "^4.1.1", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-preferences": "^2.4.1" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-user-data-dir": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-user-data-dir/-/puppeteer-extra-plugin-user-data-dir-2.4.1.tgz", + "integrity": "sha512-kH1GnCcqEDoBXO7epAse4TBPJh9tEpVEK/vkedKfjOVOhZAvLkHGc9swMs5ChrJbRnf8Hdpug6TJlEuimXNQ+g==", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^10.0.0", + "puppeteer-extra-plugin": "^3.2.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-user-preferences": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-user-preferences/-/puppeteer-extra-plugin-user-preferences-2.4.1.tgz", + "integrity": "sha512-i1oAZxRbc1bk8MZufKCruCEC3CCafO9RKMkkodZltI4OqibLFXF3tj6HZ4LZ9C5vCXZjYcDWazgtY69mnmrQ9A==", + "dependencies": { + "debug": "^4.1.1", + "deepmerge": "^4.2.2", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-data-dir": "^2.4.1" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz", + "integrity": "sha512-J1zdXCky5GmNnuauESROVu31MQSnLoYvlyEn6j2Ztk6Q5EHFIhxkMhYcv6vuDzl2XEzoRr856QwzMgWM/TmZgw==", + "dependencies": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz", + "integrity": "sha512-0u8i1NZ/mg0b+W3MGGw5I7+6Eib2nx72S/QvXa0hYjEkjTknYmEYQJwGu3mLC0BrhtJjtQafTkyRUQ75Kx0LVg==", + "dependencies": { + "is-buffer": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.7.tgz", + "integrity": "sha512-gkX52wvU/R8DVMMt78ATVPFMJqfW8FPz1GZ1sVHBVQHmu/WvhIWE4cE1GBzhJNFicDeYhnwp6Rl35BcAIM3YOQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, + "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==" } } } diff --git a/projects/org-skill-web-research/node_modules/@types/debug/LICENSE b/projects/org-skill-web-research/node_modules/@types/debug/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/debug/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/projects/org-skill-web-research/node_modules/@types/debug/README.md b/projects/org-skill-web-research/node_modules/@types/debug/README.md new file mode 100644 index 0000000..c62700a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/debug/README.md @@ -0,0 +1,69 @@ +# Installation +> `npm install --save @types/debug` + +# Summary +This package contains type definitions for debug (https://github.com/debug-js/debug). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug/index.d.ts) +````ts +declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug }; + +export = debug; +export as namespace debug; + +declare namespace debug { + interface Debug { + (namespace: string): Debugger; + coerce: (val: any) => any; + disable: () => string; + enable: (namespaces: string) => void; + enabled: (namespaces: string) => boolean; + formatArgs: (this: Debugger, args: any[]) => void; + log: (...args: any[]) => any; + selectColor: (namespace: string) => string | number; + humanize: typeof import("ms"); + + names: string[]; + skips: string[]; + + formatters: Formatters; + + inspectOpts?: { + hideDate?: boolean | number | null; + colors?: boolean | number | null; + depth?: boolean | number | null; + showHidden?: boolean | number | null; + }; + } + + type IDebug = Debug; + + interface Formatters { + [formatter: string]: (v: any) => string; + } + + type IDebugger = Debugger; + + interface Debugger { + (formatter: any, ...args: any[]): void; + + color: string; + diff: number; + enabled: boolean; + log: (...args: any[]) => any; + namespace: string; + destroy: () => boolean; + extend: (namespace: string, delimiter?: string) => Debugger; + } +} + +```` + +### Additional Details + * Last updated: Thu, 19 Mar 2026 06:47:22 GMT + * Dependencies: [@types/ms](https://npmjs.com/package/@types/ms) + +# Credits +These definitions were written by [Seon-Wook Park](https://github.com/swook), [Gal Talmor](https://github.com/galtalmor), [John McLaughlin](https://github.com/zamb3zi), [Brasten Sager](https://github.com/brasten), [Nicolas Penin](https://github.com/npenin), [Kristian Brünn](https://github.com/kristianmitk), and [Caleb Gregory](https://github.com/calebgregory). diff --git a/projects/org-skill-web-research/node_modules/@types/debug/index.d.ts b/projects/org-skill-web-research/node_modules/@types/debug/index.d.ts new file mode 100644 index 0000000..38bef7b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/debug/index.d.ts @@ -0,0 +1,50 @@ +declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug }; + +export = debug; +export as namespace debug; + +declare namespace debug { + interface Debug { + (namespace: string): Debugger; + coerce: (val: any) => any; + disable: () => string; + enable: (namespaces: string) => void; + enabled: (namespaces: string) => boolean; + formatArgs: (this: Debugger, args: any[]) => void; + log: (...args: any[]) => any; + selectColor: (namespace: string) => string | number; + humanize: typeof import("ms"); + + names: string[]; + skips: string[]; + + formatters: Formatters; + + inspectOpts?: { + hideDate?: boolean | number | null; + colors?: boolean | number | null; + depth?: boolean | number | null; + showHidden?: boolean | number | null; + }; + } + + type IDebug = Debug; + + interface Formatters { + [formatter: string]: (v: any) => string; + } + + type IDebugger = Debugger; + + interface Debugger { + (formatter: any, ...args: any[]): void; + + color: string; + diff: number; + enabled: boolean; + log: (...args: any[]) => any; + namespace: string; + destroy: () => boolean; + extend: (namespace: string, delimiter?: string) => Debugger; + } +} diff --git a/projects/org-skill-web-research/node_modules/@types/debug/package.json b/projects/org-skill-web-research/node_modules/@types/debug/package.json new file mode 100644 index 0000000..0dacd20 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/debug/package.json @@ -0,0 +1,58 @@ +{ + "name": "@types/debug", + "version": "4.1.13", + "description": "TypeScript definitions for debug", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/debug", + "license": "MIT", + "contributors": [ + { + "name": "Seon-Wook Park", + "githubUsername": "swook", + "url": "https://github.com/swook" + }, + { + "name": "Gal Talmor", + "githubUsername": "galtalmor", + "url": "https://github.com/galtalmor" + }, + { + "name": "John McLaughlin", + "githubUsername": "zamb3zi", + "url": "https://github.com/zamb3zi" + }, + { + "name": "Brasten Sager", + "githubUsername": "brasten", + "url": "https://github.com/brasten" + }, + { + "name": "Nicolas Penin", + "githubUsername": "npenin", + "url": "https://github.com/npenin" + }, + { + "name": "Kristian Brünn", + "githubUsername": "kristianmitk", + "url": "https://github.com/kristianmitk" + }, + { + "name": "Caleb Gregory", + "githubUsername": "calebgregory", + "url": "https://github.com/calebgregory" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/debug" + }, + "scripts": {}, + "dependencies": { + "@types/ms": "*" + }, + "peerDependencies": {}, + "typesPublisherContentHash": "1c506e100366b85350ff1c28c9cf4cc09e9a07275546bb050993c241c9821cd9", + "typeScriptVersion": "5.2" +} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/@types/ms/LICENSE b/projects/org-skill-web-research/node_modules/@types/ms/LICENSE new file mode 100644 index 0000000..9e841e7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/ms/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/projects/org-skill-web-research/node_modules/@types/ms/README.md b/projects/org-skill-web-research/node_modules/@types/ms/README.md new file mode 100644 index 0000000..1152869 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/ms/README.md @@ -0,0 +1,82 @@ +# Installation +> `npm install --save @types/ms` + +# Summary +This package contains type definitions for ms (https://github.com/vercel/ms). + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms. +## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms/index.d.ts) +````ts +/** + * Short/Long format for `value`. + * + * @param {Number} value + * @param {{long: boolean}} options + * @return {String} + */ +declare function ms(value: number, options?: { long: boolean }): string; + +/** + * Parse the given `value` and return milliseconds. + * + * @param {ms.StringValue} value + * @return {Number} + */ +declare function ms(value: ms.StringValue): number; + +declare namespace ms { + // Unit, UnitAnyCase, and StringValue are backported from ms@3 + // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts + + type Unit = + | "Years" + | "Year" + | "Yrs" + | "Yr" + | "Y" + | "Weeks" + | "Week" + | "W" + | "Days" + | "Day" + | "D" + | "Hours" + | "Hour" + | "Hrs" + | "Hr" + | "H" + | "Minutes" + | "Minute" + | "Mins" + | "Min" + | "M" + | "Seconds" + | "Second" + | "Secs" + | "Sec" + | "s" + | "Milliseconds" + | "Millisecond" + | "Msecs" + | "Msec" + | "Ms"; + + type UnitAnyCase = Unit | Uppercase | Lowercase; + + type StringValue = + | `${number}` + | `${number}${UnitAnyCase}` + | `${number} ${UnitAnyCase}`; +} + +export = ms; + +```` + +### Additional Details + * Last updated: Thu, 16 Jan 2025 21:02:45 GMT + * Dependencies: none + +# Credits +These definitions were written by [Zhiyuan Wang](https://github.com/danny8002). diff --git a/projects/org-skill-web-research/node_modules/@types/ms/index.d.ts b/projects/org-skill-web-research/node_modules/@types/ms/index.d.ts new file mode 100644 index 0000000..b1b1f51 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/ms/index.d.ts @@ -0,0 +1,63 @@ +/** + * Short/Long format for `value`. + * + * @param {Number} value + * @param {{long: boolean}} options + * @return {String} + */ +declare function ms(value: number, options?: { long: boolean }): string; + +/** + * Parse the given `value` and return milliseconds. + * + * @param {ms.StringValue} value + * @return {Number} + */ +declare function ms(value: ms.StringValue): number; + +declare namespace ms { + // Unit, UnitAnyCase, and StringValue are backported from ms@3 + // https://github.com/vercel/ms/blob/8b5923d1d86c84a9f6aba8022d416dcf2361aa8d/src/index.ts + + type Unit = + | "Years" + | "Year" + | "Yrs" + | "Yr" + | "Y" + | "Weeks" + | "Week" + | "W" + | "Days" + | "Day" + | "D" + | "Hours" + | "Hour" + | "Hrs" + | "Hr" + | "H" + | "Minutes" + | "Minute" + | "Mins" + | "Min" + | "M" + | "Seconds" + | "Second" + | "Secs" + | "Sec" + | "s" + | "Milliseconds" + | "Millisecond" + | "Msecs" + | "Msec" + | "Ms"; + + type UnitAnyCase = Unit | Uppercase | Lowercase; + + type StringValue = + | `${number}` + | `${number}${UnitAnyCase}` + | `${number} ${UnitAnyCase}`; +} + +export = ms; diff --git a/projects/org-skill-web-research/node_modules/@types/ms/package.json b/projects/org-skill-web-research/node_modules/@types/ms/package.json new file mode 100644 index 0000000..0f547d0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/@types/ms/package.json @@ -0,0 +1,26 @@ +{ + "name": "@types/ms", + "version": "2.1.0", + "description": "TypeScript definitions for ms", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/ms", + "license": "MIT", + "contributors": [ + { + "name": "Zhiyuan Wang", + "githubUsername": "danny8002", + "url": "https://github.com/danny8002" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/ms" + }, + "scripts": {}, + "dependencies": {}, + "peerDependencies": {}, + "typesPublisherContentHash": "2c8651ce1714fdc6bcbc0f262c93a790f1d127fb1c2dc8edbb583decef56fd39", + "typeScriptVersion": "5.0" +} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/arr-union/LICENSE b/projects/org-skill-web-research/node_modules/arr-union/LICENSE new file mode 100644 index 0000000..39245ac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/arr-union/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2016, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/arr-union/README.md b/projects/org-skill-web-research/node_modules/arr-union/README.md new file mode 100644 index 0000000..b3cd4f4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/arr-union/README.md @@ -0,0 +1,99 @@ +# arr-union [![NPM version](https://img.shields.io/npm/v/arr-union.svg)](https://www.npmjs.com/package/arr-union) [![Build Status](https://img.shields.io/travis/jonschlinkert/arr-union.svg)](https://travis-ci.org/jonschlinkert/arr-union) + +> Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm i arr-union --save +``` + +## Benchmarks + +This library is **10-20 times faster** and more performant than [array-union](https://github.com/sindresorhus/array-union). + +See the [benchmarks](./benchmark). + +```sh +#1: five-arrays + array-union x 511,121 ops/sec ±0.80% (96 runs sampled) + arr-union x 5,716,039 ops/sec ±0.86% (93 runs sampled) + +#2: ten-arrays + array-union x 245,196 ops/sec ±0.69% (94 runs sampled) + arr-union x 1,850,786 ops/sec ±0.84% (97 runs sampled) + +#3: two-arrays + array-union x 563,869 ops/sec ±0.97% (94 runs sampled) + arr-union x 9,602,852 ops/sec ±0.87% (92 runs sampled) +``` + +## Usage + +```js +var union = require('arr-union'); + +union(['a'], ['b', 'c'], ['d', 'e', 'f']); +//=> ['a', 'b', 'c', 'd', 'e', 'f'] +``` + +Returns only unique elements: + +```js +union(['a', 'a'], ['b', 'c']); +//=> ['a', 'b', 'c'] +``` + +## Related projects + +* [arr-diff](https://www.npmjs.com/package/arr-diff): Returns an array with only the unique values from the first array, by excluding all… [more](https://www.npmjs.com/package/arr-diff) | [homepage](https://github.com/jonschlinkert/arr-diff) +* [arr-filter](https://www.npmjs.com/package/arr-filter): Faster alternative to javascript's native filter method. | [homepage](https://github.com/jonschlinkert/arr-filter) +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) +* [arr-map](https://www.npmjs.com/package/arr-map): Faster, node.js focused alternative to JavaScript's native array map. | [homepage](https://github.com/jonschlinkert/arr-map) +* [arr-pluck](https://www.npmjs.com/package/arr-pluck): Retrieves the value of a specified property from all elements in the collection. | [homepage](https://github.com/jonschlinkert/arr-pluck) +* [arr-reduce](https://www.npmjs.com/package/arr-reduce): Fast array reduce that also loops over sparse elements. | [homepage](https://github.com/jonschlinkert/arr-reduce) +* [array-unique](https://www.npmjs.com/package/array-unique): Return an array free of duplicate values. Fastest ES5 implementation. | [homepage](https://github.com/jonschlinkert/array-unique) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/arr-union/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm i verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the [MIT license](https://github.com/jonschlinkert/arr-union/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on February 23, 2016._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/arr-union/index.js b/projects/org-skill-web-research/node_modules/arr-union/index.js new file mode 100644 index 0000000..5ae6c4a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/arr-union/index.js @@ -0,0 +1,29 @@ +'use strict'; + +module.exports = function union(init) { + if (!Array.isArray(init)) { + throw new TypeError('arr-union expects the first argument to be an array.'); + } + + var len = arguments.length; + var i = 0; + + while (++i < len) { + var arg = arguments[i]; + if (!arg) continue; + + if (!Array.isArray(arg)) { + arg = [arg]; + } + + for (var j = 0; j < arg.length; j++) { + var ele = arg[j]; + + if (init.indexOf(ele) >= 0) { + continue; + } + init.push(ele); + } + } + return init; +}; diff --git a/projects/org-skill-web-research/node_modules/arr-union/package.json b/projects/org-skill-web-research/node_modules/arr-union/package.json new file mode 100644 index 0000000..5ee87fd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/arr-union/package.json @@ -0,0 +1,76 @@ +{ + "name": "arr-union", + "description": "Combines a list of arrays, returning a single array with unique values, using strict equality for comparisons.", + "version": "3.1.0", + "homepage": "https://github.com/jonschlinkert/arr-union", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/arr-union", + "bugs": { + "url": "https://github.com/jonschlinkert/arr-union/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "ansi-bold": "^0.1.1", + "array-union": "^1.0.1", + "array-unique": "^0.2.1", + "benchmarked": "^0.1.4", + "gulp-format-md": "^0.1.7", + "minimist": "^1.1.1", + "mocha": "*", + "should": "*" + }, + "keywords": [ + "add", + "append", + "array", + "arrays", + "combine", + "concat", + "extend", + "union", + "uniq", + "unique", + "util", + "utility", + "utils" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-diff", + "arr-flatten", + "arr-filter", + "arr-map", + "arr-pluck", + "arr-reduce", + "array-unique" + ] + }, + "reflinks": [ + "verb", + "array-union" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/balanced-match/.github/FUNDING.yml b/projects/org-skill-web-research/node_modules/balanced-match/.github/FUNDING.yml new file mode 100644 index 0000000..cea8b16 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/balanced-match/.github/FUNDING.yml @@ -0,0 +1,2 @@ +tidelift: "npm/balanced-match" +patreon: juliangruber diff --git a/projects/org-skill-web-research/node_modules/balanced-match/LICENSE.md b/projects/org-skill-web-research/node_modules/balanced-match/LICENSE.md new file mode 100644 index 0000000..2cdc8e4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/balanced-match/LICENSE.md @@ -0,0 +1,21 @@ +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/balanced-match/README.md b/projects/org-skill-web-research/node_modules/balanced-match/README.md new file mode 100644 index 0000000..d2a48b6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/balanced-match/README.md @@ -0,0 +1,97 @@ +# balanced-match + +Match balanced string pairs, like `{` and `}` or `` and ``. Supports regular expressions as well! + +[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match) +[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match) + +[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match) + +## Example + +Get the first matching pair of braces: + +```js +var balanced = require('balanced-match'); + +console.log(balanced('{', '}', 'pre{in{nested}}post')); +console.log(balanced('{', '}', 'pre{first}between{second}post')); +console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post')); +``` + +The matches are: + +```bash +$ node example.js +{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' } +{ start: 3, + end: 9, + pre: 'pre', + body: 'first', + post: 'between{second}post' } +{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' } +``` + +## API + +### var m = balanced(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +object with those keys: + +* **start** the index of the first match of `a` +* **end** the index of the matching `b` +* **pre** the preamble, `a` and `b` not included +* **body** the match, `a` and `b` not included +* **post** the postscript, `a` and `b` not included + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`. + +### var r = balanced.range(a, b, str) + +For the first non-nested matching pair of `a` and `b` in `str`, return an +array with indexes: `[ , ]`. + +If there's no match, `undefined` will be returned. + +If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install balanced-match +``` + +## Security contact information + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/balanced-match/index.js b/projects/org-skill-web-research/node_modules/balanced-match/index.js new file mode 100644 index 0000000..c67a646 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/balanced-match/index.js @@ -0,0 +1,62 @@ +'use strict'; +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} diff --git a/projects/org-skill-web-research/node_modules/balanced-match/package.json b/projects/org-skill-web-research/node_modules/balanced-match/package.json new file mode 100644 index 0000000..ce6073e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/balanced-match/package.json @@ -0,0 +1,48 @@ +{ + "name": "balanced-match", + "description": "Match balanced character pairs, like \"{\" and \"}\"", + "version": "1.0.2", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/balanced-match.git" + }, + "homepage": "https://github.com/juliangruber/balanced-match", + "main": "index.js", + "scripts": { + "test": "tape test/test.js", + "bench": "matcha test/bench.js" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [ + "match", + "regexp", + "test", + "balanced", + "parse" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/brace-expansion/LICENSE b/projects/org-skill-web-research/node_modules/brace-expansion/LICENSE new file mode 100644 index 0000000..de32266 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/brace-expansion/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2013 Julian Gruber + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/brace-expansion/README.md b/projects/org-skill-web-research/node_modules/brace-expansion/README.md new file mode 100644 index 0000000..6b4e0e1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/brace-expansion/README.md @@ -0,0 +1,129 @@ +# brace-expansion + +[Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html), +as known from sh/bash, in JavaScript. + +[![build status](https://secure.travis-ci.org/juliangruber/brace-expansion.svg)](http://travis-ci.org/juliangruber/brace-expansion) +[![downloads](https://img.shields.io/npm/dm/brace-expansion.svg)](https://www.npmjs.org/package/brace-expansion) +[![Greenkeeper badge](https://badges.greenkeeper.io/juliangruber/brace-expansion.svg)](https://greenkeeper.io/) + +[![testling badge](https://ci.testling.com/juliangruber/brace-expansion.png)](https://ci.testling.com/juliangruber/brace-expansion) + +## Example + +```js +var expand = require('brace-expansion'); + +expand('file-{a,b,c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('-v{,,}') +// => ['-v', '-v', '-v'] + +expand('file{0..2}.jpg') +// => ['file0.jpg', 'file1.jpg', 'file2.jpg'] + +expand('file-{a..c}.jpg') +// => ['file-a.jpg', 'file-b.jpg', 'file-c.jpg'] + +expand('file{2..0}.jpg') +// => ['file2.jpg', 'file1.jpg', 'file0.jpg'] + +expand('file{0..4..2}.jpg') +// => ['file0.jpg', 'file2.jpg', 'file4.jpg'] + +expand('file-{a..e..2}.jpg') +// => ['file-a.jpg', 'file-c.jpg', 'file-e.jpg'] + +expand('file{00..10..5}.jpg') +// => ['file00.jpg', 'file05.jpg', 'file10.jpg'] + +expand('{{A..C},{a..c}}') +// => ['A', 'B', 'C', 'a', 'b', 'c'] + +expand('ppp{,config,oe{,conf}}') +// => ['ppp', 'pppconfig', 'pppoe', 'pppoeconf'] +``` + +## API + +```js +var expand = require('brace-expansion'); +``` + +### var expanded = expand(str) + +Return an array of all possible and valid expansions of `str`. If none are +found, `[str]` is returned. + +Valid expansions are: + +```js +/^(.*,)+(.+)?$/ +// {a,b,...} +``` + +A comma separated list of options, like `{a,b}` or `{a,{b,c}}` or `{,a,}`. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +A numeric sequence from `x` to `y` inclusive, with optional increment. +If `x` or `y` start with a leading `0`, all the numbers will be padded +to have equal length. Negative numbers and backwards iteration work too. + +```js +/^-?\d+\.\.-?\d+(\.\.-?\d+)?$/ +// {x..y[..incr]} +``` + +An alphabetic sequence from `x` to `y` inclusive, with optional increment. +`x` and `y` must be exactly one character, and if given, `incr` must be a +number. + +For compatibility reasons, the string `${` is not eligible for brace expansion. + +## Installation + +With [npm](https://npmjs.org) do: + +```bash +npm install brace-expansion +``` + +## Contributors + +- [Julian Gruber](https://github.com/juliangruber) +- [Isaac Z. Schlueter](https://github.com/isaacs) + +## Sponsors + +This module is proudly supported by my [Sponsors](https://github.com/juliangruber/sponsors)! + +Do you want to support modules like this to improve their quality, stability and weigh in on new features? Then please consider donating to my [Patreon](https://www.patreon.com/juliangruber). Not sure how much of my modules you're using? Try [feross/thanks](https://github.com/feross/thanks)! + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/brace-expansion/index.js b/projects/org-skill-web-research/node_modules/brace-expansion/index.js new file mode 100644 index 0000000..e847647 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/brace-expansion/index.js @@ -0,0 +1,200 @@ +var concatMap = require('concat-map'); +var balanced = require('balanced-match'); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function identity(e) { + return e; +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m || /\$$/.test(m.pre)) return [str]; + + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,(?!,).*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + var post = m.post.length + ? expand(m.post, false) + : ['']; + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.max(Math.abs(numeric(n[2])), 1) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = concatMap(n, function(el) { return expand(el, false) }); + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + + return expansions; +} diff --git a/projects/org-skill-web-research/node_modules/brace-expansion/package.json b/projects/org-skill-web-research/node_modules/brace-expansion/package.json new file mode 100644 index 0000000..b791a05 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/brace-expansion/package.json @@ -0,0 +1,50 @@ +{ + "name": "brace-expansion", + "description": "Brace expansion as known from sh/bash", + "version": "1.1.13", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/brace-expansion.git" + }, + "homepage": "https://github.com/juliangruber/brace-expansion", + "main": "index.js", + "scripts": { + "test": "tape test/*.js", + "gentest": "bash test/generate.sh", + "bench": "matcha test/perf/bench.js" + }, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "devDependencies": { + "matcha": "^0.7.0", + "tape": "^4.6.0" + }, + "keywords": [], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "testling": { + "files": "test/*.js", + "browsers": [ + "ie/8..latest", + "firefox/20..latest", + "firefox/nightly", + "chrome/25..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + }, + "publishConfig": { + "tag": "1.x" + } +} diff --git a/projects/org-skill-web-research/node_modules/clone-deep/LICENSE b/projects/org-skill-web-research/node_modules/clone-deep/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/clone-deep/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/clone-deep/README.md b/projects/org-skill-web-research/node_modules/clone-deep/README.md new file mode 100644 index 0000000..319df2b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/clone-deep/README.md @@ -0,0 +1,72 @@ +# clone-deep [![NPM version](https://img.shields.io/npm/v/clone-deep.svg)](https://www.npmjs.com/package/clone-deep) [![Build Status](https://img.shields.io/travis/jonschlinkert/clone-deep.svg)](https://travis-ci.org/jonschlinkert/clone-deep) + +> Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. + +The `instanceClone` function is invoked to clone objects that are not "plain" objects (as defined by [](#isPlainObject)`isPlainObject`) if it is provided. If `instanceClone` is not specified, it will not attempt to clone non-plain objects, and will copy the object reference. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i clone-deep --save +``` + +## Usage + +```js +var cloneDeep = require('clone-deep'); + +var obj = {a: 'b'}; +var arr = [obj]; + +var copy = cloneDeep(arr); +obj.c = 'd'; + +console.log(copy); +//=> [{a: 'b'}] + +console.log(arr); +//=> [{a: 'b', c: 'd'}] +``` + +## Other object utils + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the enumerable properties and/or es6 Symbol properies of source objects to the target… [more](https://www.npmjs.com/package/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep) +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow) +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep) +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. | [homepage](https://github.com/jonschlinkert/mixin-deep) +* [mixin-object](https://www.npmjs.com/package/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://www.npmjs.com/package/mixin-object) | [homepage](https://github.com/jonschlinkert/mixin-object) +* [shallow-clone](https://www.npmjs.com/package/shallow-clone): Make a shallow clone of an object, array or primitive. | [homepage](https://github.com/jonschlinkert/shallow-clone) + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/clone-deep/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +Based on [mout's](https://github.com/mout/mout) implementation of deepClone. + +## License + +Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 23, 2015._ + + \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/clone-deep/index.js b/projects/org-skill-web-research/node_modules/clone-deep/index.js new file mode 100644 index 0000000..a42d9b5 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/clone-deep/index.js @@ -0,0 +1,51 @@ +'use strict'; + +/** + * Module dependenices + */ + +var utils = require('./utils'); + +/** + * Recursively clone native types. + */ + +function cloneDeep(val, instanceClone) { + switch (utils.typeOf(val)) { + case 'object': + return cloneObjectDeep(val, instanceClone); + case 'array': + return cloneArrayDeep(val, instanceClone); + default: + return utils.clone(val); + } +} + +function cloneObjectDeep(obj, instanceClone) { + if (utils.isObject(obj)) { + var res = {}; + utils.forOwn(obj, function(obj, key) { + this[key] = cloneDeep(obj, instanceClone); + }, res); + return res; + } else if (instanceClone) { + return instanceClone(obj); + } else { + return obj; + } +} + +function cloneArrayDeep(arr, instanceClone) { + var len = arr.length, res = []; + var i = -1; + while (++i < len) { + res[i] = cloneDeep(arr[i], instanceClone); + } + return res; +} + +/** + * Expose `cloneDeep` + */ + +module.exports = cloneDeep; diff --git a/projects/org-skill-web-research/node_modules/clone-deep/package.json b/projects/org-skill-web-research/node_modules/clone-deep/package.json new file mode 100644 index 0000000..481d58e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/clone-deep/package.json @@ -0,0 +1,67 @@ +{ + "name": "clone-deep", + "description": "Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives.", + "version": "0.2.4", + "homepage": "https://github.com/jonschlinkert/clone-deep", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/clone-deep", + "bugs": { + "url": "https://github.com/jonschlinkert/clone-deep/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "utils.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "keywords": [ + "array", + "clone", + "clone-array", + "clone-array-deep", + "clone-date", + "clone-deep", + "clone-object", + "clone-object-deep", + "clone-reg-exp", + "date", + "deep", + "exp", + "for", + "for-in", + "for-own", + "javascript", + "mixin", + "mixin-object", + "object", + "own", + "reg", + "util", + "utility" + ], + "verb": { + "related": { + "list": [] + }, + "plugins": [ + "gulp-format-md" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/clone-deep/utils.js b/projects/org-skill-web-research/node_modules/clone-deep/utils.js new file mode 100644 index 0000000..d2a7570 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/clone-deep/utils.js @@ -0,0 +1,21 @@ +'use strict'; + +/** + * Lazily required module dependencies + */ + +var utils = require('lazy-cache')(require); +var fn = require; + +require = utils; +require('is-plain-object', 'isObject'); +require('shallow-clone', 'clone'); +require('kind-of', 'typeOf'); +require('for-own'); +require = fn; + +/** + * Expose `utils` + */ + +module.exports = utils; diff --git a/projects/org-skill-web-research/node_modules/concat-map/.travis.yml b/projects/org-skill-web-research/node_modules/concat-map/.travis.yml new file mode 100644 index 0000000..f1d0f13 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - 0.4 + - 0.6 diff --git a/projects/org-skill-web-research/node_modules/concat-map/LICENSE b/projects/org-skill-web-research/node_modules/concat-map/LICENSE new file mode 100644 index 0000000..ee27ba4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/LICENSE @@ -0,0 +1,18 @@ +This software is released under the MIT license: + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/concat-map/README.markdown b/projects/org-skill-web-research/node_modules/concat-map/README.markdown new file mode 100644 index 0000000..408f70a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/README.markdown @@ -0,0 +1,62 @@ +concat-map +========== + +Concatenative mapdashery. + +[![browser support](http://ci.testling.com/substack/node-concat-map.png)](http://ci.testling.com/substack/node-concat-map) + +[![build status](https://secure.travis-ci.org/substack/node-concat-map.png)](http://travis-ci.org/substack/node-concat-map) + +example +======= + +``` js +var concatMap = require('concat-map'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); +``` + +*** + +``` +[ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ] +``` + +methods +======= + +``` js +var concatMap = require('concat-map') +``` + +concatMap(xs, fn) +----------------- + +Return an array of concatenated elements by calling `fn(x, i)` for each element +`x` and each index `i` in the array `xs`. + +When `fn(x, i)` returns an array, its result will be concatenated with the +result array. If `fn(x, i)` returns anything else, that value will be pushed +onto the end of the result array. + +install +======= + +With [npm](http://npmjs.org) do: + +``` +npm install concat-map +``` + +license +======= + +MIT + +notes +===== + +This module was written while sitting high above the ground in a tree. diff --git a/projects/org-skill-web-research/node_modules/concat-map/example/map.js b/projects/org-skill-web-research/node_modules/concat-map/example/map.js new file mode 100644 index 0000000..3365621 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/example/map.js @@ -0,0 +1,6 @@ +var concatMap = require('../'); +var xs = [ 1, 2, 3, 4, 5, 6 ]; +var ys = concatMap(xs, function (x) { + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; +}); +console.dir(ys); diff --git a/projects/org-skill-web-research/node_modules/concat-map/index.js b/projects/org-skill-web-research/node_modules/concat-map/index.js new file mode 100644 index 0000000..b29a781 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/index.js @@ -0,0 +1,13 @@ +module.exports = function (xs, fn) { + var res = []; + for (var i = 0; i < xs.length; i++) { + var x = fn(xs[i], i); + if (isArray(x)) res.push.apply(res, x); + else res.push(x); + } + return res; +}; + +var isArray = Array.isArray || function (xs) { + return Object.prototype.toString.call(xs) === '[object Array]'; +}; diff --git a/projects/org-skill-web-research/node_modules/concat-map/package.json b/projects/org-skill-web-research/node_modules/concat-map/package.json new file mode 100644 index 0000000..d3640e6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/package.json @@ -0,0 +1,43 @@ +{ + "name" : "concat-map", + "description" : "concatenative mapdashery", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/substack/node-concat-map.git" + }, + "main" : "index.js", + "keywords" : [ + "concat", + "concatMap", + "map", + "functional", + "higher-order" + ], + "directories" : { + "example" : "example", + "test" : "test" + }, + "scripts" : { + "test" : "tape test/*.js" + }, + "devDependencies" : { + "tape" : "~2.4.0" + }, + "license" : "MIT", + "author" : { + "name" : "James Halliday", + "email" : "mail@substack.net", + "url" : "http://substack.net" + }, + "testling" : { + "files" : "test/*.js", + "browsers" : { + "ie" : [ 6, 7, 8, 9 ], + "ff" : [ 3.5, 10, 15.0 ], + "chrome" : [ 10, 22 ], + "safari" : [ 5.1 ], + "opera" : [ 12 ] + } + } +} diff --git a/projects/org-skill-web-research/node_modules/concat-map/test/map.js b/projects/org-skill-web-research/node_modules/concat-map/test/map.js new file mode 100644 index 0000000..fdbd702 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/concat-map/test/map.js @@ -0,0 +1,39 @@ +var concatMap = require('../'); +var test = require('tape'); + +test('empty or not', function (t) { + var xs = [ 1, 2, 3, 4, 5, 6 ]; + var ixes = []; + var ys = concatMap(xs, function (x, ix) { + ixes.push(ix); + return x % 2 ? [ x - 0.1, x, x + 0.1 ] : []; + }); + t.same(ys, [ 0.9, 1, 1.1, 2.9, 3, 3.1, 4.9, 5, 5.1 ]); + t.same(ixes, [ 0, 1, 2, 3, 4, 5 ]); + t.end(); +}); + +test('always something', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : [ x ]; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('scalars', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function (x) { + return x === 'b' ? [ 'B', 'B', 'B' ] : x; + }); + t.same(ys, [ 'a', 'B', 'B', 'B', 'c', 'd' ]); + t.end(); +}); + +test('undefs', function (t) { + var xs = [ 'a', 'b', 'c', 'd' ]; + var ys = concatMap(xs, function () {}); + t.same(ys, [ undefined, undefined, undefined, undefined ]); + t.end(); +}); diff --git a/projects/org-skill-web-research/node_modules/debug/LICENSE b/projects/org-skill-web-research/node_modules/debug/LICENSE new file mode 100644 index 0000000..1a9820e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the 'Software'), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/projects/org-skill-web-research/node_modules/debug/README.md b/projects/org-skill-web-research/node_modules/debug/README.md new file mode 100644 index 0000000..9ebdfbf --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/README.md @@ -0,0 +1,481 @@ +# debug +[![OpenCollective](https://opencollective.com/debug/backers/badge.svg)](#backers) +[![OpenCollective](https://opencollective.com/debug/sponsors/badge.svg)](#sponsors) + + + +A tiny JavaScript debugging utility modelled after Node.js core's debugging +technique. Works in Node.js and web browsers. + +## Installation + +```bash +$ npm install debug +``` + +## Usage + +`debug` exposes a function; simply pass this function the name of your module, and it will return a decorated version of `console.error` for you to pass debug statements to. This will allow you to toggle the debug output for different parts of your module as well as the module as a whole. + +Example [_app.js_](./examples/node/app.js): + +```js +var debug = require('debug')('http') + , http = require('http') + , name = 'My App'; + +// fake app + +debug('booting %o', name); + +http.createServer(function(req, res){ + debug(req.method + ' ' + req.url); + res.end('hello\n'); +}).listen(3000, function(){ + debug('listening'); +}); + +// fake worker of some kind + +require('./worker'); +``` + +Example [_worker.js_](./examples/node/worker.js): + +```js +var a = require('debug')('worker:a') + , b = require('debug')('worker:b'); + +function work() { + a('doing lots of uninteresting work'); + setTimeout(work, Math.random() * 1000); +} + +work(); + +function workb() { + b('doing some work'); + setTimeout(workb, Math.random() * 2000); +} + +workb(); +``` + +The `DEBUG` environment variable is then used to enable these based on space or +comma-delimited names. + +Here are some examples: + +screen shot 2017-08-08 at 12 53 04 pm +screen shot 2017-08-08 at 12 53 38 pm +screen shot 2017-08-08 at 12 53 25 pm + +#### Windows command prompt notes + +##### CMD + +On Windows the environment variable is set using the `set` command. + +```cmd +set DEBUG=*,-not_this +``` + +Example: + +```cmd +set DEBUG=* & node app.js +``` + +##### PowerShell (VS Code default) + +PowerShell uses different syntax to set environment variables. + +```cmd +$env:DEBUG = "*,-not_this" +``` + +Example: + +```cmd +$env:DEBUG='app';node app.js +``` + +Then, run the program to be debugged as usual. + +npm script example: +```js + "windowsDebug": "@powershell -Command $env:DEBUG='*';node app.js", +``` + +## Namespace Colors + +Every debug instance has a color generated for it based on its namespace name. +This helps when visually parsing the debug output to identify which debug instance +a debug line belongs to. + +#### Node.js + +In Node.js, colors are enabled when stderr is a TTY. You also _should_ install +the [`supports-color`](https://npmjs.org/supports-color) module alongside debug, +otherwise debug will only use a small handful of basic colors. + + + +#### Web Browser + +Colors are also enabled on "Web Inspectors" that understand the `%c` formatting +option. These are WebKit web inspectors, Firefox ([since version +31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) +and the Firebug plugin for Firefox (any version). + + + + +## Millisecond diff + +When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. + + + +When stdout is not a TTY, `Date#toISOString()` is used, making it more useful for logging the debug information as shown below: + + + + +## Conventions + +If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". If you append a "*" to the end of your name, it will always be enabled regardless of the setting of the DEBUG environment variable. You can then use it for normal output as well as debug output. + +## Wildcards + +The `*` character may be used as a wildcard. Suppose for example your library has +debuggers named "connect:bodyParser", "connect:compress", "connect:session", +instead of listing all three with +`DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do +`DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. + +You can also exclude specific debuggers by prefixing them with a "-" character. +For example, `DEBUG=*,-connect:*` would include all debuggers except those +starting with "connect:". + +## Environment Variables + +When running through Node.js, you can set a few environment variables that will +change the behavior of the debug logging: + +| Name | Purpose | +|-----------|-------------------------------------------------| +| `DEBUG` | Enables/disables specific debugging namespaces. | +| `DEBUG_HIDE_DATE` | Hide date from debug output (non-TTY). | +| `DEBUG_COLORS`| Whether or not to use colors in the debug output. | +| `DEBUG_DEPTH` | Object inspection depth. | +| `DEBUG_SHOW_HIDDEN` | Shows hidden properties on inspected objects. | + + +__Note:__ The environment variables beginning with `DEBUG_` end up being +converted into an Options object that gets used with `%o`/`%O` formatters. +See the Node.js documentation for +[`util.inspect()`](https://nodejs.org/api/util.html#util_util_inspect_object_options) +for the complete list. + +## Formatters + +Debug uses [printf-style](https://wikipedia.org/wiki/Printf_format_string) formatting. +Below are the officially supported formatters: + +| Formatter | Representation | +|-----------|----------------| +| `%O` | Pretty-print an Object on multiple lines. | +| `%o` | Pretty-print an Object all on a single line. | +| `%s` | String. | +| `%d` | Number (both integer and float). | +| `%j` | JSON. Replaced with the string '[Circular]' if the argument contains circular references. | +| `%%` | Single percent sign ('%'). This does not consume an argument. | + + +### Custom formatters + +You can add custom formatters by extending the `debug.formatters` object. +For example, if you wanted to add support for rendering a Buffer as hex with +`%h`, you could do something like: + +```js +const createDebug = require('debug') +createDebug.formatters.h = (v) => { + return v.toString('hex') +} + +// …elsewhere +const debug = createDebug('foo') +debug('this is hex: %h', new Buffer('hello world')) +// foo this is hex: 68656c6c6f20776f726c6421 +0ms +``` + + +## Browser Support + +You can build a browser-ready script using [browserify](https://github.com/substack/node-browserify), +or just use the [browserify-as-a-service](https://wzrd.in/) [build](https://wzrd.in/standalone/debug@latest), +if you don't want to build it yourself. + +Debug's enable state is currently persisted by `localStorage`. +Consider the situation shown below where you have `worker:a` and `worker:b`, +and wish to debug both. You can enable this using `localStorage.debug`: + +```js +localStorage.debug = 'worker:*' +``` + +And then refresh the page. + +```js +a = debug('worker:a'); +b = debug('worker:b'); + +setInterval(function(){ + a('doing some work'); +}, 1000); + +setInterval(function(){ + b('doing some work'); +}, 1200); +``` + +In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by `debug` if the "Verbose" log level is _enabled_. + + + +## Output streams + + By default `debug` will log to stderr, however this can be configured per-namespace by overriding the `log` method: + +Example [_stdout.js_](./examples/node/stdout.js): + +```js +var debug = require('debug'); +var error = debug('app:error'); + +// by default stderr is used +error('goes to stderr!'); + +var log = debug('app:log'); +// set this namespace to log via console.log +log.log = console.log.bind(console); // don't forget to bind to console! +log('goes to stdout'); +error('still goes to stderr!'); + +// set all output to go via console.info +// overrides all per-namespace log settings +debug.log = console.info.bind(console); +error('now goes to stdout via console.info'); +log('still goes to stdout, but via console.info now'); +``` + +## Extend +You can simply extend debugger +```js +const log = require('debug')('auth'); + +//creates new debug instance with extended namespace +const logSign = log.extend('sign'); +const logLogin = log.extend('login'); + +log('hello'); // auth hello +logSign('hello'); //auth:sign hello +logLogin('hello'); //auth:login hello +``` + +## Set dynamically + +You can also enable debug dynamically by calling the `enable()` method : + +```js +let debug = require('debug'); + +console.log(1, debug.enabled('test')); + +debug.enable('test'); +console.log(2, debug.enabled('test')); + +debug.disable(); +console.log(3, debug.enabled('test')); + +``` + +print : +``` +1 false +2 true +3 false +``` + +Usage : +`enable(namespaces)` +`namespaces` can include modes separated by a colon and wildcards. + +Note that calling `enable()` completely overrides previously set DEBUG variable : + +``` +$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))' +=> false +``` + +`disable()` + +Will disable all namespaces. The functions returns the namespaces currently +enabled (and skipped). This can be useful if you want to disable debugging +temporarily without knowing what was enabled to begin with. + +For example: + +```js +let debug = require('debug'); +debug.enable('foo:*,-foo:bar'); +let namespaces = debug.disable(); +debug.enable(namespaces); +``` + +Note: There is no guarantee that the string will be identical to the initial +enable string, but semantically they will be identical. + +## Checking whether a debug target is enabled + +After you've created a debug instance, you can determine whether or not it is +enabled by checking the `enabled` property: + +```javascript +const debug = require('debug')('http'); + +if (debug.enabled) { + // do stuff... +} +``` + +You can also manually toggle this property to force the debug instance to be +enabled or disabled. + +## Usage in child processes + +Due to the way `debug` detects if the output is a TTY or not, colors are not shown in child processes when `stderr` is piped. A solution is to pass the `DEBUG_COLORS=1` environment variable to the child process. +For example: + +```javascript +worker = fork(WORKER_WRAP_PATH, [workerPath], { + stdio: [ + /* stdin: */ 0, + /* stdout: */ 'pipe', + /* stderr: */ 'pipe', + 'ipc', + ], + env: Object.assign({}, process.env, { + DEBUG_COLORS: 1 // without this settings, colors won't be shown + }), +}); + +worker.stderr.pipe(process.stderr, { end: false }); +``` + + +## Authors + + - TJ Holowaychuk + - Nathan Rajlich + - Andrew Rhyne + - Josh Junon + +## Backers + +Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/debug#backer)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## Sponsors + +Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/debug#sponsor)] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +## License + +(The MIT License) + +Copyright (c) 2014-2017 TJ Holowaychuk <tj@vision-media.ca> +Copyright (c) 2018-2021 Josh Junon + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/debug/package.json b/projects/org-skill-web-research/node_modules/debug/package.json new file mode 100644 index 0000000..ee8abb5 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/package.json @@ -0,0 +1,64 @@ +{ + "name": "debug", + "version": "4.4.3", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon (https://github.com/qix-)", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "mocha test.js test.node.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "^2.1.3" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "sinon": "^14.0.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + }, + "xo": { + "rules": { + "import/extensions": "off" + } + } +} diff --git a/projects/org-skill-web-research/node_modules/debug/src/browser.js b/projects/org-skill-web-research/node_modules/debug/src/browser.js new file mode 100644 index 0000000..5993451 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/src/browser.js @@ -0,0 +1,272 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/projects/org-skill-web-research/node_modules/debug/src/common.js b/projects/org-skill-web-research/node_modules/debug/src/common.js new file mode 100644 index 0000000..141cb57 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/src/common.js @@ -0,0 +1,292 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(/\s+/g, ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/projects/org-skill-web-research/node_modules/debug/src/index.js b/projects/org-skill-web-research/node_modules/debug/src/index.js new file mode 100644 index 0000000..bf4c57f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/projects/org-skill-web-research/node_modules/debug/src/node.js b/projects/org-skill-web-research/node_modules/debug/src/node.js new file mode 100644 index 0000000..715560a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/projects/org-skill-web-research/node_modules/deepmerge/.editorconfig b/projects/org-skill-web-research/node_modules/deepmerge/.editorconfig new file mode 100644 index 0000000..6244e1b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/.editorconfig @@ -0,0 +1,7 @@ +root = true + +[*] +indent_style = tab +end_of_line = lf +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/projects/org-skill-web-research/node_modules/deepmerge/.eslintcache b/projects/org-skill-web-research/node_modules/deepmerge/.eslintcache new file mode 100644 index 0000000..c1321eb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/.eslintcache @@ -0,0 +1 @@ +[{"/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js":"1"},{"size":1990,"mtime":1679007485753,"results":"2","hashOfConfig":"3"},{"filePath":"4","messages":"5","suppressedMessages":"6","errorCount":0,"fatalErrorCount":0,"warningCount":0,"fixableErrorCount":0,"fixableWarningCount":0},"ktjd5k","/Users/joshduff/code/deepmerge/test/custom-is-mergeable-object.js",[],[]] \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/deepmerge/changelog.md b/projects/org-skill-web-research/node_modules/deepmerge/changelog.md new file mode 100644 index 0000000..082e0dd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/changelog.md @@ -0,0 +1,167 @@ +# [4.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.1) + +- Fix type definition for arrayMerge options. [#239](https://github.com/TehShrike/deepmerge/pull/239) + +# [4.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.3.0) + +- Avoid thrown errors if the target doesn't have `propertyIsEnumerable`. [#252](https://github.com/TehShrike/deepmerge/pull/252) + +# [4.2.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.2) + +- `isMergeableObject` is now only called if there are two values that could be merged. [a34dd4d2](https://github.com/TehShrike/deepmerge/commit/a34dd4d25bf5e250653540a2022bc832c7b00a19) + +# [4.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.1) + +- Fix: falsey values can now be merged. [#170](https://github.com/TehShrike/deepmerge/issues/170) + +# [4.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.2.0) + +- Properties are now only overwritten if they exist on the target object and are enumerable. [#164](https://github.com/TehShrike/deepmerge/pull/164) + +Technically this could probably be a patch release since "which properties get overwritten" wasn't documented and accidentally overwriting a built-in function or some function up the property chain would almost certainly be undesirable, but it feels like a gray area, so here we are with a feature version bump. + +# [4.1.2](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.2) + +- Rolled back #167 since `Object.assign` breaks ES5 support. [55067352](https://github.com/TehShrike/deepmerge/commit/55067352a92c65a6c44a5165f3387720aae1e192) + +# [4.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.1) + +- The `options` argument is no longer mutated [#167](https://github.com/TehShrike/deepmerge/pull/167) + +# [4.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.1.0) + +- `cloneUnlessOtherwiseSpecified` is now exposed to the `arrayMerge` function [#165](https://github.com/TehShrike/deepmerge/pull/165) + +# [4.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v4.0.0) + +- The `main` entry point in `package.json` is now a CommonJS module instead of a UMD module [#155](https://github.com/TehShrike/deepmerge/pull/155) + +# [3.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.3.0) + +- Enumerable Symbol properties are now copied [#151](https://github.com/TehShrike/deepmerge/pull/151) + +# [3.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.1) + +- bumping dev dependency versions to try to shut up bogus security warnings from Github/npm [#149](https://github.com/TehShrike/deepmerge/pull/149) + +# [3.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.2.0) + +- feature: added the [`customMerge`](https://github.com/TehShrike/deepmerge#custommerge) option [#133](https://github.com/TehShrike/deepmerge/pull/133) + +# [3.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.1.0) + +- typescript typing: make the `all` function generic [#129](https://github.com/TehShrike/deepmerge/pull/129) + +# [3.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v3.0.0) + +- drop ES module build [#123](https://github.com/TehShrike/deepmerge/issues/123) + +# [2.2.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.1) + +- bug: typescript export type was wrong [#121](https://github.com/TehShrike/deepmerge/pull/121) + +# [2.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.2.0) + +- feature: added TypeScript typings [#119](https://github.com/TehShrike/deepmerge/pull/119) + +# [2.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.1) + +- documentation: Rename "methods" to "api", note ESM syntax [#103](https://github.com/TehShrike/deepmerge/pull/103) +- documentation: Fix grammar [#107](https://github.com/TehShrike/deepmerge/pull/107) +- documentation: Restructure headers for clarity + some wording tweaks [108](https://github.com/TehShrike/deepmerge/pull/108) + [109](https://github.com/TehShrike/deepmerge/pull/109) + + +# [2.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.1.0) + +- feature: Support a custom `isMergeableObject` function [#96](https://github.com/TehShrike/deepmerge/pull/96) +- documentation: note a Webpack bug that some users might need to work around [#100](https://github.com/TehShrike/deepmerge/pull/100) + +# [2.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.1) + +- documentation: fix the old array merge algorithm in the readme. [#84](https://github.com/TehShrike/deepmerge/pull/84) + +# [2.0.0](https://github.com/TehShrike/deepmerge/releases/tag/v2.0.0) + +- breaking: the array merge algorithm has changed from a complicated thing to `target.concat(source).map(element => cloneUnlessOtherwiseSpecified(element, optionsArgument))` +- breaking: The `clone` option now defaults to `true` +- feature: `merge.all` now accepts an array of any size, even 0 or 1 elements + +See [pull request 77](https://github.com/TehShrike/deepmerge/pull/77). + +# [1.5.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.2) + +- fix: no longer attempts to merge React elements [#76](https://github.com/TehShrike/deepmerge/issues/76) + +# [1.5.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.1) + +- bower support: officially dropping bower support. If you use bower, please depend on the [unpkg distribution](https://unpkg.com/deepmerge/dist/umd.js). See [#63](https://github.com/TehShrike/deepmerge/issues/63) + +# [1.5.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.5.0) + +- bug fix: merging objects into arrays was allowed, and doesn't make any sense. [#65](https://github.com/TehShrike/deepmerge/issues/65) published as a feature release instead of a patch because it is a decent behavior change. + +# [1.4.4](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.4) + +- bower support: updated `main` in bower.json + +# [1.4.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.3) + +- bower support: inline is-mergeable-object in a new CommonJS build, so that people using both bower and CommonJS can bundle the library [0b34e6](https://github.com/TehShrike/deepmerge/commit/0b34e6e95f989f2fc8091d25f0d291c08f3d2d24) + +# [1.4.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.2) + +- performance: bump is-mergeable-object dependency version for a slight performance improvement [5906c7](https://github.com/TehShrike/deepmerge/commit/5906c765d691d48e83d76efbb0d4b9ca150dc12c) + +# [1.4.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.1) + +- documentation: fix unpkg link [acc45b](https://github.com/TehShrike/deepmerge/commit/acc45be85519c1df906a72ecb24764b622d18d47) + +# [1.4.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.4.0) + +- api: instead of only exporting a UMD module, expose a UMD module with `pkg.main`, a CJS module with `pkg.browser`, and an ES module with `pkg.module` [#62](https://github.com/TehShrike/deepmerge/pull/62) + +# [1.3.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.2) + +- documentation: note the minified/gzipped file sizes [56](https://github.com/TehShrike/deepmerge/pull/56) +- documentation: make data structures more readable in merge example: pull request [57](https://github.com/TehShrike/deepmerge/pull/57) + +# [1.3.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.1) + +- documentation: clarify and test some array merging documentation: pull request [51](https://github.com/TehShrike/deepmerge/pull/51) + +# [1.3.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.3.0) + +- feature: `merge.all`, a merge function that merges any number of objects: pull request [50](https://github.com/TehShrike/deepmerge/pull/50) + +# [1.2.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.2.0) + +- fix: an error that would be thrown when an array would be merged onto a truthy non-array value: pull request [46](https://github.com/TehShrike/deepmerge/pull/46) +- feature: the ability to clone: Issue [28](https://github.com/TehShrike/deepmerge/issues/28), pull requests [44](https://github.com/TehShrike/deepmerge/pull/44) and [48](https://github.com/TehShrike/deepmerge/pull/48) +- maintenance: added tests + travis to `.npmignore`: pull request [47](https://github.com/TehShrike/deepmerge/pull/47) + +# [1.1.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.1) + +- fix an issue where an error was thrown when merging an array onto a non-array: [Pull request 46](https://github.com/TehShrike/deepmerge/pull/46) + +# [1.1.0](https://github.com/TehShrike/deepmerge/releases/tag/v1.1.0) + +- allow consumers to specify their own array merging algorithm: [Pull request 37](https://github.com/TehShrike/deepmerge/pull/37) + +# [1.0.3](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.3) + +- adding bower.json back: [Issue 38](https://github.com/TehShrike/deepmerge/pull/38) +- updating keywords and Github links in package.json [bc3898e](https://github.com/TehShrike/deepmerge/commit/bc3898e587a56f74591328f40f656b0152c1d5eb) + +# [1.0.2](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.2) + +- Updating the readme: dropping bower, testing that the example works: [7102fc](https://github.com/TehShrike/deepmerge/commit/7102fcc4ddec11e2d33205866f9f18df14e5aeb5) + +# [1.0.1](https://github.com/TehShrike/deepmerge/releases/tag/v1.0.1) + +- `null`, dates, and regular expressions are now properly merged in arrays: [Issue 18](https://github.com/TehShrike/deepmerge/pull/18), plus commit: [ef1c6b](https://github.com/TehShrike/deepmerge/commit/ef1c6bac8350ba12a24966f0bc7da02560827586) + +# 1.0.0 + +- Should only be a patch change, because this module is READY. [Issue 15](https://github.com/TehShrike/deepmerge/issues/15) +- Regular expressions are now treated like primitive values when merging: [Issue 30](https://github.com/TehShrike/deepmerge/pull/30) +- Dates are now treated like primitives when merging: [Issue 31](https://github.com/TehShrike/deepmerge/issues/31) diff --git a/projects/org-skill-web-research/node_modules/deepmerge/dist/cjs.js b/projects/org-skill-web-research/node_modules/deepmerge/dist/cjs.js new file mode 100644 index 0000000..7c36cbd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/dist/cjs.js @@ -0,0 +1,133 @@ +'use strict'; + +var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) +}; + +function isNonNullObject(value) { + return !!value && typeof value === 'object' +} + +function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) +} + +// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 +var canUseSymbol = typeof Symbol === 'function' && Symbol.for; +var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + +function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE +} + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } + }); + return destination +} + +function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +}; + +var deepmerge_1 = deepmerge; + +module.exports = deepmerge_1; diff --git a/projects/org-skill-web-research/node_modules/deepmerge/dist/umd.js b/projects/org-skill-web-research/node_modules/deepmerge/dist/umd.js new file mode 100644 index 0000000..4071e7c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/dist/umd.js @@ -0,0 +1,139 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = global || self, global.deepmerge = factory()); +}(this, function () { 'use strict'; + + var isMergeableObject = function isMergeableObject(value) { + return isNonNullObject(value) + && !isSpecial(value) + }; + + function isNonNullObject(value) { + return !!value && typeof value === 'object' + } + + function isSpecial(value) { + var stringValue = Object.prototype.toString.call(value); + + return stringValue === '[object RegExp]' + || stringValue === '[object Date]' + || isReactElement(value) + } + + // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 + var canUseSymbol = typeof Symbol === 'function' && Symbol.for; + var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; + + function isReactElement(value) { + return value.$$typeof === REACT_ELEMENT_TYPE + } + + function emptyTarget(val) { + return Array.isArray(val) ? [] : {} + } + + function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value + } + + function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) + } + + function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key); + return typeof customMerge === 'function' ? customMerge : deepmerge + } + + function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] + } + + function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) + } + + function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } + } + + // Protects from prototype poisoning and unexpected merging up the prototype chain. + function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. + } + + function mergeObject(target, source, options) { + var destination = {}; + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); + }); + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options); + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); + } + }); + return destination + } + + function deepmerge(target, source, options) { + options = options || {}; + options.arrayMerge = options.arrayMerge || defaultArrayMerge; + options.isMergeableObject = options.isMergeableObject || isMergeableObject; + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; + + var sourceIsArray = Array.isArray(source); + var targetIsArray = Array.isArray(target); + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } + } + + deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) + }; + + var deepmerge_1 = deepmerge; + + return deepmerge_1; + +})); diff --git a/projects/org-skill-web-research/node_modules/deepmerge/index.d.ts b/projects/org-skill-web-research/node_modules/deepmerge/index.d.ts new file mode 100644 index 0000000..46784de --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/index.d.ts @@ -0,0 +1,20 @@ +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T; +declare function deepmerge(x: Partial, y: Partial, options?: deepmerge.Options): T1 & T2; + +declare namespace deepmerge { + export interface Options { + arrayMerge?(target: any[], source: any[], options?: ArrayMergeOptions): any[]; + clone?: boolean; + customMerge?: (key: string, options?: Options) => ((x: any, y: any) => any) | undefined; + isMergeableObject?(value: object): boolean; + } + export interface ArrayMergeOptions { + isMergeableObject(value: object): boolean; + cloneUnlessOtherwiseSpecified(value: object, options?: Options): object; + } + + export function all (objects: object[], options?: Options): object; + export function all (objects: Partial[], options?: Options): T; +} + +export = deepmerge; diff --git a/projects/org-skill-web-research/node_modules/deepmerge/index.js b/projects/org-skill-web-research/node_modules/deepmerge/index.js new file mode 100644 index 0000000..77968ae --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/index.js @@ -0,0 +1,106 @@ +var defaultIsMergeableObject = require('is-mergeable-object') + +function emptyTarget(val) { + return Array.isArray(val) ? [] : {} +} + +function cloneUnlessOtherwiseSpecified(value, options) { + return (options.clone !== false && options.isMergeableObject(value)) + ? deepmerge(emptyTarget(value), value, options) + : value +} + +function defaultArrayMerge(target, source, options) { + return target.concat(source).map(function(element) { + return cloneUnlessOtherwiseSpecified(element, options) + }) +} + +function getMergeFunction(key, options) { + if (!options.customMerge) { + return deepmerge + } + var customMerge = options.customMerge(key) + return typeof customMerge === 'function' ? customMerge : deepmerge +} + +function getEnumerableOwnPropertySymbols(target) { + return Object.getOwnPropertySymbols + ? Object.getOwnPropertySymbols(target).filter(function(symbol) { + return Object.propertyIsEnumerable.call(target, symbol) + }) + : [] +} + +function getKeys(target) { + return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)) +} + +function propertyIsOnObject(object, property) { + try { + return property in object + } catch(_) { + return false + } +} + +// Protects from prototype poisoning and unexpected merging up the prototype chain. +function propertyIsUnsafe(target, key) { + return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, + && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, + && Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable. +} + +function mergeObject(target, source, options) { + var destination = {} + if (options.isMergeableObject(target)) { + getKeys(target).forEach(function(key) { + destination[key] = cloneUnlessOtherwiseSpecified(target[key], options) + }) + } + getKeys(source).forEach(function(key) { + if (propertyIsUnsafe(target, key)) { + return + } + + if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) { + destination[key] = getMergeFunction(key, options)(target[key], source[key], options) + } else { + destination[key] = cloneUnlessOtherwiseSpecified(source[key], options) + } + }) + return destination +} + +function deepmerge(target, source, options) { + options = options || {} + options.arrayMerge = options.arrayMerge || defaultArrayMerge + options.isMergeableObject = options.isMergeableObject || defaultIsMergeableObject + // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() + // implementations can use it. The caller may not replace it. + options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified + + var sourceIsArray = Array.isArray(source) + var targetIsArray = Array.isArray(target) + var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray + + if (!sourceAndTargetTypesMatch) { + return cloneUnlessOtherwiseSpecified(source, options) + } else if (sourceIsArray) { + return options.arrayMerge(target, source, options) + } else { + return mergeObject(target, source, options) + } +} + +deepmerge.all = function deepmergeAll(array, options) { + if (!Array.isArray(array)) { + throw new Error('first argument should be an array') + } + + return array.reduce(function(prev, next) { + return deepmerge(prev, next, options) + }, {}) +} + +module.exports = deepmerge diff --git a/projects/org-skill-web-research/node_modules/deepmerge/license.txt b/projects/org-skill-web-research/node_modules/deepmerge/license.txt new file mode 100644 index 0000000..5003078 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/license.txt @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012 James Halliday, Josh Duff, and other contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/deepmerge/package.json b/projects/org-skill-web-research/node_modules/deepmerge/package.json new file mode 100644 index 0000000..2b7b1be --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/package.json @@ -0,0 +1,42 @@ +{ + "name": "deepmerge", + "description": "A library for deep (recursive) merging of Javascript objects", + "keywords": [ + "merge", + "deep", + "extend", + "copy", + "clone", + "recursive" + ], + "version": "4.3.1", + "homepage": "https://github.com/TehShrike/deepmerge", + "repository": { + "type": "git", + "url": "git://github.com/TehShrike/deepmerge.git" + }, + "main": "dist/cjs.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "build": "rollup -c", + "test": "npm run build && tape test/*.js && jsmd readme.md && npm run test:typescript", + "test:typescript": "tsc --noEmit test/typescript.ts && ts-node test/typescript.ts", + "size": "npm run build && uglifyjs --compress --mangle -- ./dist/umd.js | gzip -c | wc -c" + }, + "devDependencies": { + "@types/node": "^8.10.54", + "is-mergeable-object": "1.1.0", + "is-plain-object": "^5.0.0", + "jsmd": "^1.0.2", + "rollup": "^1.23.1", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "tape": "^4.11.0", + "ts-node": "7.0.1", + "typescript": "=2.2.2", + "uglify-js": "^3.6.1" + }, + "license": "MIT" +} diff --git a/projects/org-skill-web-research/node_modules/deepmerge/readme.md b/projects/org-skill-web-research/node_modules/deepmerge/readme.md new file mode 100644 index 0000000..79e4e30 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/readme.md @@ -0,0 +1,264 @@ +# deepmerge + +Merges the enumerable properties of two or more objects deeply. + +> UMD bundle is 723B minified+gzipped + +## Getting Started + +### Example Usage + + +```js +const x = { + foo: { bar: 3 }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }] +} + +const y = { + foo: { baz: 4 }, + quux: 5, + array: [{ + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }] +} + +const output = { + foo: { + bar: 3, + baz: 4 + }, + array: [{ + does: 'work', + too: [ 1, 2, 3 ] + }, { + does: 'work', + too: [ 4, 5, 6 ] + }, { + really: 'yes' + }], + quux: 5 +} + +merge(x, y) // => output +``` + + +### Installation + +With [npm](http://npmjs.org) do: + +```sh +npm install deepmerge +``` + +deepmerge can be used directly in the browser without the use of package managers/bundlers as well: [UMD version from unpkg.com](https://unpkg.com/deepmerge/dist/umd.js). + + +### Include + +deepmerge exposes a CommonJS entry point: + +``` +const merge = require('deepmerge') +``` + +The ESM entry point was dropped due to a [Webpack bug](https://github.com/webpack/webpack/issues/6584). + +# API + + +## `merge(x, y, [options])` + +Merge two objects `x` and `y` deeply, returning a new merged object with the +elements from both `x` and `y`. + +If an element at the same key is present for both `x` and `y`, the value from +`y` will appear in the result. + +Merging creates a new object, so that neither `x` or `y` is modified. + +**Note:** By default, arrays are merged by concatenating them. + +## `merge.all(arrayOfObjects, [options])` + +Merges any number of objects into a single result object. + +```js +const foobar = { foo: { bar: 3 } } +const foobaz = { foo: { baz: 4 } } +const bar = { bar: 'yay!' } + +merge.all([ foobar, foobaz, bar ]) // => { foo: { bar: 3, baz: 4 }, bar: 'yay!' } +``` + + +## Options + +### `arrayMerge` + +There are multiple ways to merge two arrays, below are a few examples but you can also create your own custom function. + +Your `arrayMerge` function will be called with three arguments: a `target` array, the `source` array, and an `options` object with these properties: + +- `isMergeableObject(value)` +- `cloneUnlessOtherwiseSpecified(value, options)` + +#### `arrayMerge` example: overwrite target array + +Overwrites the existing array values completely rather than concatenating them: + +```js +const overwriteMerge = (destinationArray, sourceArray, options) => sourceArray + +merge( + [1, 2, 3], + [3, 2, 1], + { arrayMerge: overwriteMerge } +) // => [3, 2, 1] +``` + +#### `arrayMerge` example: combine arrays + +Combines objects at the same index in the two arrays. + +This was the default array merging algorithm pre-version-2.0.0. + +```js +const combineMerge = (target, source, options) => { + const destination = target.slice() + + source.forEach((item, index) => { + if (typeof destination[index] === 'undefined') { + destination[index] = options.cloneUnlessOtherwiseSpecified(item, options) + } else if (options.isMergeableObject(item)) { + destination[index] = merge(target[index], item, options) + } else if (target.indexOf(item) === -1) { + destination.push(item) + } + }) + return destination +} + +merge( + [{ a: true }], + [{ b: true }, 'ah yup'], + { arrayMerge: combineMerge } +) // => [{ a: true, b: true }, 'ah yup'] +``` + +### `isMergeableObject` + +By default, deepmerge clones every property from almost every kind of object. + +You may not want this, if your objects are of special types, and you want to copy the whole object instead of just copying its properties. + +You can accomplish this by passing in a function for the `isMergeableObject` option. + +If you only want to clone properties of plain objects, and ignore all "special" kinds of instantiated objects, you probably want to drop in [`is-plain-object`](https://github.com/jonschlinkert/is-plain-object). + +```js +const { isPlainObject } = require('is-plain-object') + +function SuperSpecial() { + this.special = 'oh yeah man totally' +} + +const instantiatedSpecialObject = new SuperSpecial() + +const target = { + someProperty: { + cool: 'oh for sure' + } +} + +const source = { + someProperty: instantiatedSpecialObject +} + +const defaultOutput = merge(target, source) + +defaultOutput.someProperty.cool // => 'oh for sure' +defaultOutput.someProperty.special // => 'oh yeah man totally' +defaultOutput.someProperty instanceof SuperSpecial // => false + +const customMergeOutput = merge(target, source, { + isMergeableObject: isPlainObject +}) + +customMergeOutput.someProperty.cool // => undefined +customMergeOutput.someProperty.special // => 'oh yeah man totally' +customMergeOutput.someProperty instanceof SuperSpecial // => true +``` + +### `customMerge` + +Specifies a function which can be used to override the default merge behavior for a property, based on the property name. + +The `customMerge` function will be passed the key for each property, and should return the function which should be used to merge the values for that property. + +It may also return undefined, in which case the default merge behaviour will be used. + +```js +const alex = { + name: { + first: 'Alex', + last: 'Alexson' + }, + pets: ['Cat', 'Parrot'] +} + +const tony = { + name: { + first: 'Tony', + last: 'Tonison' + }, + pets: ['Dog'] +} + +const mergeNames = (nameA, nameB) => `${nameA.first} and ${nameB.first}` + +const options = { + customMerge: (key) => { + if (key === 'name') { + return mergeNames + } + } +} + +const result = merge(alex, tony, options) + +result.name // => 'Alex and Tony' +result.pets // => ['Cat', 'Parrot', 'Dog'] +``` + + +### `clone` + +*Deprecated.* + +Defaults to `true`. + +If `clone` is `false` then child objects will be copied directly instead of being cloned. This was the default behavior before version 2.x. + + +# Testing + +With [npm](http://npmjs.org) do: + +```sh +npm test +``` + + +# License + +MIT diff --git a/projects/org-skill-web-research/node_modules/deepmerge/rollup.config.js b/projects/org-skill-web-research/node_modules/deepmerge/rollup.config.js new file mode 100644 index 0000000..8323ab2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/deepmerge/rollup.config.js @@ -0,0 +1,22 @@ +import resolve from 'rollup-plugin-node-resolve' +import commonjs from 'rollup-plugin-commonjs' +import pkg from './package.json' + +export default { + input: `index.js`, + plugins: [ + commonjs(), + resolve(), + ], + output: [ + { + file: pkg.main, + format: `cjs` + }, + { + name: 'deepmerge', + file: 'dist/umd.js', + format: `umd` + }, + ], +} diff --git a/projects/org-skill-web-research/node_modules/for-in/LICENSE b/projects/org-skill-web-research/node_modules/for-in/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-in/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/for-in/README.md b/projects/org-skill-web-research/node_modules/for-in/README.md new file mode 100644 index 0000000..874e189 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-in/README.md @@ -0,0 +1,85 @@ +# for-in [![NPM version](https://img.shields.io/npm/v/for-in.svg?style=flat)](https://www.npmjs.com/package/for-in) [![NPM monthly downloads](https://img.shields.io/npm/dm/for-in.svg?style=flat)](https://npmjs.org/package/for-in) [![NPM total downloads](https://img.shields.io/npm/dt/for-in.svg?style=flat)](https://npmjs.org/package/for-in) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/for-in.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/for-in) + +> Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save for-in +``` + +## Usage + +```js +var forIn = require('for-in'); + +var obj = {a: 'foo', b: 'bar', c: 'baz'}; +var values = []; +var keys = []; + +forIn(obj, function (value, key, o) { + keys.push(key); + values.push(value); +}); + +console.log(keys); +//=> ['a', 'b', 'c']; + +console.log(values); +//=> ['foo', 'bar', 'baz']; +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.") +* [for-own](https://www.npmjs.com/package/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) | [homepage](https://github.com/jonschlinkert/for-own "Iterate over the own enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 16 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulirish](https://github.com/paulirish) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 28, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/for-in/index.js b/projects/org-skill-web-research/node_modules/for-in/index.js new file mode 100644 index 0000000..0b5f95f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-in/index.js @@ -0,0 +1,16 @@ +/*! + * for-in + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function forIn(obj, fn, thisArg) { + for (var key in obj) { + if (fn.call(thisArg, obj[key], key, obj) === false) { + break; + } + } +}; diff --git a/projects/org-skill-web-research/node_modules/for-in/package.json b/projects/org-skill-web-research/node_modules/for-in/package.json new file mode 100644 index 0000000..48810a1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-in/package.json @@ -0,0 +1,68 @@ +{ + "name": "for-in", + "description": "Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js", + "version": "1.0.2", + "homepage": "https://github.com/jonschlinkert/for-in", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Paul Irish (http://paulirish.com)" + ], + "repository": "jonschlinkert/for-in", + "bugs": { + "url": "https://github.com/jonschlinkert/for-in/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.2.0" + }, + "keywords": [ + "for", + "for-in", + "for-own", + "has", + "has-own", + "hasOwn", + "in", + "key", + "keys", + "object", + "own", + "value" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-flatten", + "collection-map", + "for-own" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/for-own/LICENSE b/projects/org-skill-web-research/node_modules/for-own/LICENSE new file mode 100644 index 0000000..d290fe0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-own/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, 2017, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/for-own/README.md b/projects/org-skill-web-research/node_modules/for-own/README.md new file mode 100644 index 0000000..fd56877 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-own/README.md @@ -0,0 +1,85 @@ +# for-own [![NPM version](https://img.shields.io/npm/v/for-own.svg?style=flat)](https://www.npmjs.com/package/for-own) [![NPM monthly downloads](https://img.shields.io/npm/dm/for-own.svg?style=flat)](https://npmjs.org/package/for-own) [![NPM total downloads](https://img.shields.io/npm/dt/for-own.svg?style=flat)](https://npmjs.org/package/for-own) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/for-own.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/for-own) + +> Iterate over the own enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save for-own +``` + +## Usage + +```js +var forOwn = require('for-own'); + +var obj = {a: 'foo', b: 'bar', c: 'baz'}; +var values = []; +var keys = []; + +forOwn(obj, function (value, key, o) { + keys.push(key); + values.push(value); +}); + +console.log(keys); +//=> ['a', 'b', 'c']; + +console.log(values); +//=> ['foo', 'bar', 'baz']; +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten "Recursively flatten an array or arrays. This is the fastest implementation of array flatten.") +* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map "Returns an array of mapped values from an array or object.") +* [for-in](https://www.npmjs.com/package/for-in): Iterate over the own and inherited enumerable properties of an object, and return an object… [more](https://github.com/jonschlinkert/for-in) | [homepage](https://github.com/jonschlinkert/for-in "Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 10 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [javiercejudo](https://github.com/javiercejudo) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 26, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/for-own/index.js b/projects/org-skill-web-research/node_modules/for-own/index.js new file mode 100644 index 0000000..74e2d75 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-own/index.js @@ -0,0 +1,19 @@ +/*! + * for-own + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var forIn = require('for-in'); +var hasOwn = Object.prototype.hasOwnProperty; + +module.exports = function forOwn(obj, fn, thisArg) { + forIn(obj, function(val, key) { + if (hasOwn.call(obj, key)) { + return fn.call(thisArg, obj[key], key, obj); + } + }); +}; diff --git a/projects/org-skill-web-research/node_modules/for-own/package.json b/projects/org-skill-web-research/node_modules/for-own/package.json new file mode 100644 index 0000000..0f1b502 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/for-own/package.json @@ -0,0 +1,70 @@ +{ + "name": "for-own", + "description": "Iterate over the own enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js.", + "version": "0.1.5", + "homepage": "https://github.com/jonschlinkert/for-own", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Javier Cejudo (https://www.javiercejudo.com)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)" + ], + "repository": "jonschlinkert/for-own", + "bugs": { + "url": "https://github.com/jonschlinkert/for-own/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "for-in": "^1.0.1" + }, + "devDependencies": { + "gulp-format-md": "^0.1.11", + "mocha": "^3.2.0" + }, + "keywords": [ + "for", + "for-in", + "for-own", + "has", + "has-own", + "hasOwn", + "key", + "keys", + "object", + "own", + "value" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-flatten", + "collection-map", + "for-in" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/LICENSE b/projects/org-skill-web-research/node_modules/fs-extra/LICENSE new file mode 100644 index 0000000..93546df --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2011-2017 JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/fs-extra/README.md b/projects/org-skill-web-research/node_modules/fs-extra/README.md new file mode 100644 index 0000000..6ed8b6a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/README.md @@ -0,0 +1,262 @@ +Node.js: fs-extra +================= + +`fs-extra` adds file system methods that aren't included in the native `fs` module and adds promise support to the `fs` methods. It also uses [`graceful-fs`](https://github.com/isaacs/node-graceful-fs) to prevent `EMFILE` errors. It should be a drop in replacement for `fs`. + +[![npm Package](https://img.shields.io/npm/v/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![License](https://img.shields.io/npm/l/fs-extra.svg)](https://github.com/jprichardson/node-fs-extra/blob/master/LICENSE) +[![build status](https://img.shields.io/github/workflow/status/jprichardson/node-fs-extra/Node.js%20CI/master)](https://github.com/jprichardson/node-fs-extra/actions/workflows/ci.yml?query=branch%3Amaster) +[![downloads per month](http://img.shields.io/npm/dm/fs-extra.svg)](https://www.npmjs.org/package/fs-extra) +[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) + +Why? +---- + +I got tired of including `mkdirp`, `rimraf`, and `ncp` in most of my projects. + + + + +Installation +------------ + + npm install fs-extra + + + +Usage +----- + +`fs-extra` is a drop in replacement for native `fs`. All methods in `fs` are attached to `fs-extra`. All `fs` methods return promises if the callback isn't passed. + +You don't ever need to include the original `fs` module again: + +```js +const fs = require('fs') // this is no longer necessary +``` + +you can now do this: + +```js +const fs = require('fs-extra') +``` + +or if you prefer to make it clear that you're using `fs-extra` and not `fs`, you may want +to name your `fs` variable `fse` like so: + +```js +const fse = require('fs-extra') +``` + +you can also keep both, but it's redundant: + +```js +const fs = require('fs') +const fse = require('fs-extra') +``` + +Sync vs Async vs Async/Await +------------- +Most methods are async by default. All async methods will return a promise if the callback isn't passed. + +Sync methods on the other hand will throw if an error occurs. + +Also Async/Await will throw an error if one occurs. + +Example: + +```js +const fs = require('fs-extra') + +// Async with promises: +fs.copy('/tmp/myfile', '/tmp/mynewfile') + .then(() => console.log('success!')) + .catch(err => console.error(err)) + +// Async with callbacks: +fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { + if (err) return console.error(err) + console.log('success!') +}) + +// Sync: +try { + fs.copySync('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') +} catch (err) { + console.error(err) +} + +// Async/Await: +async function copyFiles () { + try { + await fs.copy('/tmp/myfile', '/tmp/mynewfile') + console.log('success!') + } catch (err) { + console.error(err) + } +} + +copyFiles() +``` + + +Methods +------- + +### Async + +- [copy](docs/copy.md) +- [emptyDir](docs/emptyDir.md) +- [ensureFile](docs/ensureFile.md) +- [ensureDir](docs/ensureDir.md) +- [ensureLink](docs/ensureLink.md) +- [ensureSymlink](docs/ensureSymlink.md) +- [mkdirp](docs/ensureDir.md) +- [mkdirs](docs/ensureDir.md) +- [move](docs/move.md) +- [outputFile](docs/outputFile.md) +- [outputJson](docs/outputJson.md) +- [pathExists](docs/pathExists.md) +- [readJson](docs/readJson.md) +- [remove](docs/remove.md) +- [writeJson](docs/writeJson.md) + +### Sync + +- [copySync](docs/copy-sync.md) +- [emptyDirSync](docs/emptyDir-sync.md) +- [ensureFileSync](docs/ensureFile-sync.md) +- [ensureDirSync](docs/ensureDir-sync.md) +- [ensureLinkSync](docs/ensureLink-sync.md) +- [ensureSymlinkSync](docs/ensureSymlink-sync.md) +- [mkdirpSync](docs/ensureDir-sync.md) +- [mkdirsSync](docs/ensureDir-sync.md) +- [moveSync](docs/move-sync.md) +- [outputFileSync](docs/outputFile-sync.md) +- [outputJsonSync](docs/outputJson-sync.md) +- [pathExistsSync](docs/pathExists-sync.md) +- [readJsonSync](docs/readJson-sync.md) +- [removeSync](docs/remove-sync.md) +- [writeJsonSync](docs/writeJson-sync.md) + + +**NOTE:** You can still use the native Node.js methods. They are promisified and copied over to `fs-extra`. See [notes on `fs.read()`, `fs.write()`, & `fs.writev()`](docs/fs-read-write-writev.md) + +### What happened to `walk()` and `walkSync()`? + +They were removed from `fs-extra` in v2.0.0. If you need the functionality, `walk` and `walkSync` are available as separate packages, [`klaw`](https://github.com/jprichardson/node-klaw) and [`klaw-sync`](https://github.com/manidlou/node-klaw-sync). + + +Third Party +----------- + +### CLI + +[fse-cli](https://www.npmjs.com/package/@atao60/fse-cli) allows you to run `fs-extra` from a console or from [npm](https://www.npmjs.com) scripts. + +### TypeScript + +If you like TypeScript, you can use `fs-extra` with it: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/fs-extra + + +### File / Directory Watching + +If you want to watch for changes to files or directories, then you should use [chokidar](https://github.com/paulmillr/chokidar). + +### Obtain Filesystem (Devices, Partitions) Information + +[fs-filesystem](https://github.com/arthurintelligence/node-fs-filesystem) allows you to read the state of the filesystem of the host on which it is run. It returns information about both the devices and the partitions (volumes) of the system. + +### Misc. + +- [fs-extra-debug](https://github.com/jdxcode/fs-extra-debug) - Send your fs-extra calls to [debug](https://npmjs.org/package/debug). +- [mfs](https://github.com/cadorn/mfs) - Monitor your fs-extra calls. + + + +Hacking on fs-extra +------------------- + +Wanna hack on `fs-extra`? Great! Your help is needed! [fs-extra is one of the most depended upon Node.js packages](http://nodei.co/npm/fs-extra.png?downloads=true&downloadRank=true&stars=true). This project +uses [JavaScript Standard Style](https://github.com/feross/standard) - if the name or style choices bother you, +you're gonna have to get over it :) If `standard` is good enough for `npm`, it's good enough for `fs-extra`. + +[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) + +What's needed? +- First, take a look at existing issues. Those are probably going to be where the priority lies. +- More tests for edge cases. Specifically on different platforms. There can never be enough tests. +- Improve test coverage. + +Note: If you make any big changes, **you should definitely file an issue for discussion first.** + +### Running the Test Suite + +fs-extra contains hundreds of tests. + +- `npm run lint`: runs the linter ([standard](http://standardjs.com/)) +- `npm run unit`: runs the unit tests +- `npm test`: runs both the linter and the tests + + +### Windows + +If you run the tests on the Windows and receive a lot of symbolic link `EPERM` permission errors, it's +because on Windows you need elevated privilege to create symbolic links. You can add this to your Windows's +account by following the instructions here: http://superuser.com/questions/104845/permission-to-make-symbolic-links-in-windows-7 +However, I didn't have much luck doing this. + +Since I develop on Mac OS X, I use VMWare Fusion for Windows testing. I create a shared folder that I map to a drive on Windows. +I open the `Node.js command prompt` and run as `Administrator`. I then map the network drive running the following command: + + net use z: "\\vmware-host\Shared Folders" + +I can then navigate to my `fs-extra` directory and run the tests. + + +Naming +------ + +I put a lot of thought into the naming of these functions. Inspired by @coolaj86's request. So he deserves much of the credit for raising the issue. See discussion(s) here: + +* https://github.com/jprichardson/node-fs-extra/issues/2 +* https://github.com/flatiron/utile/issues/11 +* https://github.com/ryanmcgrath/wrench-js/issues/29 +* https://github.com/substack/node-mkdirp/issues/17 + +First, I believe that in as many cases as possible, the [Node.js naming schemes](http://nodejs.org/api/fs.html) should be chosen. However, there are problems with the Node.js own naming schemes. + +For example, `fs.readFile()` and `fs.readdir()`: the **F** is capitalized in *File* and the **d** is not capitalized in *dir*. Perhaps a bit pedantic, but they should still be consistent. Also, Node.js has chosen a lot of POSIX naming schemes, which I believe is great. See: `fs.mkdir()`, `fs.rmdir()`, `fs.chown()`, etc. + +We have a dilemma though. How do you consistently name methods that perform the following POSIX commands: `cp`, `cp -r`, `mkdir -p`, and `rm -rf`? + +My perspective: when in doubt, err on the side of simplicity. A directory is just a hierarchical grouping of directories and files. Consider that for a moment. So when you want to copy it or remove it, in most cases you'll want to copy or remove all of its contents. When you want to create a directory, if the directory that it's suppose to be contained in does not exist, then in most cases you'll want to create that too. + +So, if you want to remove a file or a directory regardless of whether it has contents, just call `fs.remove(path)`. If you want to copy a file or a directory whether it has contents, just call `fs.copy(source, destination)`. If you want to create a directory regardless of whether its parent directories exist, just call `fs.mkdirs(path)` or `fs.mkdirp(path)`. + + +Credit +------ + +`fs-extra` wouldn't be possible without using the modules from the following authors: + +- [Isaac Shlueter](https://github.com/isaacs) +- [Charlie McConnel](https://github.com/avianflu) +- [James Halliday](https://github.com/substack) +- [Andrew Kelley](https://github.com/andrewrk) + + + + +License +------- + +Licensed under MIT + +Copyright (c) 2011-2017 [JP Richardson](https://github.com/jprichardson) + +[1]: http://nodejs.org/docs/latest/api/fs.html + + +[jsonfile]: https://github.com/jprichardson/node-jsonfile diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy-sync.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy-sync.js new file mode 100644 index 0000000..551abe0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy-sync.js @@ -0,0 +1,169 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirsSync = require('../mkdirs').mkdirsSync +const utimesMillisSync = require('../util/utimes').utimesMillisSync +const stat = require('../util/stat') + +function copySync (src, dest, opts) { + if (typeof opts === 'function') { + opts = { filter: opts } + } + + opts = opts || {} + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + process.emitWarning( + 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', + 'Warning', 'fs-extra-WARN0002' + ) + } + + const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts) + stat.checkParentPathsSync(src, srcStat, dest, 'copy') + return handleFilterAndCopy(destStat, src, dest, opts) +} + +function handleFilterAndCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + const destParent = path.dirname(dest) + if (!fs.existsSync(destParent)) mkdirsSync(destParent) + return getStats(destStat, src, dest, opts) +} + +function startCopy (destStat, src, dest, opts) { + if (opts.filter && !opts.filter(src, dest)) return + return getStats(destStat, src, dest, opts) +} + +function getStats (destStat, src, dest, opts) { + const statSync = opts.dereference ? fs.statSync : fs.lstatSync + const srcStat = statSync(src) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) + else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`) + else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`) + throw new Error(`Unknown file: ${src}`) +} + +function onFile (srcStat, destStat, src, dest, opts) { + if (!destStat) return copyFile(srcStat, src, dest, opts) + return mayCopyFile(srcStat, src, dest, opts) +} + +function mayCopyFile (srcStat, src, dest, opts) { + if (opts.overwrite) { + fs.unlinkSync(dest) + return copyFile(srcStat, src, dest, opts) + } else if (opts.errorOnExist) { + throw new Error(`'${dest}' already exists`) + } +} + +function copyFile (srcStat, src, dest, opts) { + fs.copyFileSync(src, dest) + if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest) + return setDestMode(dest, srcStat.mode) +} + +function handleTimestamps (srcMode, src, dest) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode) + return setDestTimestamps(src, dest) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode) { + return setDestMode(dest, srcMode | 0o200) +} + +function setDestMode (dest, srcMode) { + return fs.chmodSync(dest, srcMode) +} + +function setDestTimestamps (src, dest) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + const updatedSrcStat = fs.statSync(src) + return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime) +} + +function onDir (srcStat, destStat, src, dest, opts) { + if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts) + return copyDir(src, dest, opts) +} + +function mkDirAndCopy (srcMode, src, dest, opts) { + fs.mkdirSync(dest) + copyDir(src, dest, opts) + return setDestMode(dest, srcMode) +} + +function copyDir (src, dest, opts) { + fs.readdirSync(src).forEach(item => copyDirItem(item, src, dest, opts)) +} + +function copyDirItem (item, src, dest, opts) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + const { destStat } = stat.checkPathsSync(srcItem, destItem, 'copy', opts) + return startCopy(destStat, srcItem, destItem, opts) +} + +function onLink (destStat, src, dest, opts) { + let resolvedSrc = fs.readlinkSync(src) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlinkSync(resolvedSrc, dest) + } else { + let resolvedDest + try { + resolvedDest = fs.readlinkSync(dest) + } catch (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlinkSync(resolvedSrc, dest) + throw err + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`) + } + + // prevent copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (fs.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`) + } + return copyLink(resolvedSrc, dest) + } +} + +function copyLink (resolvedSrc, dest) { + fs.unlinkSync(dest) + return fs.symlinkSync(resolvedSrc, dest) +} + +module.exports = copySync diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy.js new file mode 100644 index 0000000..09d53df --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/copy.js @@ -0,0 +1,235 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const mkdirs = require('../mkdirs').mkdirs +const pathExists = require('../path-exists').pathExists +const utimesMillis = require('../util/utimes').utimesMillis +const stat = require('../util/stat') + +function copy (src, dest, opts, cb) { + if (typeof opts === 'function' && !cb) { + cb = opts + opts = {} + } else if (typeof opts === 'function') { + opts = { filter: opts } + } + + cb = cb || function () {} + opts = opts || {} + + opts.clobber = 'clobber' in opts ? !!opts.clobber : true // default to true for now + opts.overwrite = 'overwrite' in opts ? !!opts.overwrite : opts.clobber // overwrite falls back to clobber + + // Warn about using preserveTimestamps on 32-bit node + if (opts.preserveTimestamps && process.arch === 'ia32') { + process.emitWarning( + 'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' + + '\tsee https://github.com/jprichardson/node-fs-extra/issues/269', + 'Warning', 'fs-extra-WARN0001' + ) + } + + stat.checkPaths(src, dest, 'copy', opts, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + stat.checkParentPaths(src, srcStat, dest, 'copy', err => { + if (err) return cb(err) + if (opts.filter) return handleFilter(checkParentDir, destStat, src, dest, opts, cb) + return checkParentDir(destStat, src, dest, opts, cb) + }) + }) +} + +function checkParentDir (destStat, src, dest, opts, cb) { + const destParent = path.dirname(dest) + pathExists(destParent, (err, dirExists) => { + if (err) return cb(err) + if (dirExists) return getStats(destStat, src, dest, opts, cb) + mkdirs(destParent, err => { + if (err) return cb(err) + return getStats(destStat, src, dest, opts, cb) + }) + }) +} + +function handleFilter (onInclude, destStat, src, dest, opts, cb) { + Promise.resolve(opts.filter(src, dest)).then(include => { + if (include) return onInclude(destStat, src, dest, opts, cb) + return cb() + }, error => cb(error)) +} + +function startCopy (destStat, src, dest, opts, cb) { + if (opts.filter) return handleFilter(getStats, destStat, src, dest, opts, cb) + return getStats(destStat, src, dest, opts, cb) +} + +function getStats (destStat, src, dest, opts, cb) { + const stat = opts.dereference ? fs.stat : fs.lstat + stat(src, (err, srcStat) => { + if (err) return cb(err) + + if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isFile() || + srcStat.isCharacterDevice() || + srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) + else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`)) + else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)) + return cb(new Error(`Unknown file: ${src}`)) + }) +} + +function onFile (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return copyFile(srcStat, src, dest, opts, cb) + return mayCopyFile(srcStat, src, dest, opts, cb) +} + +function mayCopyFile (srcStat, src, dest, opts, cb) { + if (opts.overwrite) { + fs.unlink(dest, err => { + if (err) return cb(err) + return copyFile(srcStat, src, dest, opts, cb) + }) + } else if (opts.errorOnExist) { + return cb(new Error(`'${dest}' already exists`)) + } else return cb() +} + +function copyFile (srcStat, src, dest, opts, cb) { + fs.copyFile(src, dest, err => { + if (err) return cb(err) + if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb) + return setDestMode(dest, srcStat.mode, cb) + }) +} + +function handleTimestampsAndMode (srcMode, src, dest, cb) { + // Make sure the file is writable before setting the timestamp + // otherwise open fails with EPERM when invoked with 'r+' + // (through utimes call) + if (fileIsNotWritable(srcMode)) { + return makeFileWritable(dest, srcMode, err => { + if (err) return cb(err) + return setDestTimestampsAndMode(srcMode, src, dest, cb) + }) + } + return setDestTimestampsAndMode(srcMode, src, dest, cb) +} + +function fileIsNotWritable (srcMode) { + return (srcMode & 0o200) === 0 +} + +function makeFileWritable (dest, srcMode, cb) { + return setDestMode(dest, srcMode | 0o200, cb) +} + +function setDestTimestampsAndMode (srcMode, src, dest, cb) { + setDestTimestamps(src, dest, err => { + if (err) return cb(err) + return setDestMode(dest, srcMode, cb) + }) +} + +function setDestMode (dest, srcMode, cb) { + return fs.chmod(dest, srcMode, cb) +} + +function setDestTimestamps (src, dest, cb) { + // The initial srcStat.atime cannot be trusted + // because it is modified by the read(2) system call + // (See https://nodejs.org/api/fs.html#fs_stat_time_values) + fs.stat(src, (err, updatedSrcStat) => { + if (err) return cb(err) + return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb) + }) +} + +function onDir (srcStat, destStat, src, dest, opts, cb) { + if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb) + return copyDir(src, dest, opts, cb) +} + +function mkDirAndCopy (srcMode, src, dest, opts, cb) { + fs.mkdir(dest, err => { + if (err) return cb(err) + copyDir(src, dest, opts, err => { + if (err) return cb(err) + return setDestMode(dest, srcMode, cb) + }) + }) +} + +function copyDir (src, dest, opts, cb) { + fs.readdir(src, (err, items) => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) +} + +function copyDirItems (items, src, dest, opts, cb) { + const item = items.pop() + if (!item) return cb() + return copyDirItem(items, item, src, dest, opts, cb) +} + +function copyDirItem (items, item, src, dest, opts, cb) { + const srcItem = path.join(src, item) + const destItem = path.join(dest, item) + stat.checkPaths(srcItem, destItem, 'copy', opts, (err, stats) => { + if (err) return cb(err) + const { destStat } = stats + startCopy(destStat, srcItem, destItem, opts, err => { + if (err) return cb(err) + return copyDirItems(items, src, dest, opts, cb) + }) + }) +} + +function onLink (destStat, src, dest, opts, cb) { + fs.readlink(src, (err, resolvedSrc) => { + if (err) return cb(err) + if (opts.dereference) { + resolvedSrc = path.resolve(process.cwd(), resolvedSrc) + } + + if (!destStat) { + return fs.symlink(resolvedSrc, dest, cb) + } else { + fs.readlink(dest, (err, resolvedDest) => { + if (err) { + // dest exists and is a regular file or directory, + // Windows may throw UNKNOWN error. If dest already exists, + // fs throws error anyway, so no need to guard against it here. + if (err.code === 'EINVAL' || err.code === 'UNKNOWN') return fs.symlink(resolvedSrc, dest, cb) + return cb(err) + } + if (opts.dereference) { + resolvedDest = path.resolve(process.cwd(), resolvedDest) + } + if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) { + return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`)) + } + + // do not copy if src is a subdir of dest since unlinking + // dest in this case would result in removing src contents + // and therefore a broken symlink would be created. + if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) { + return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`)) + } + return copyLink(resolvedSrc, dest, cb) + }) + } + }) +} + +function copyLink (resolvedSrc, dest, cb) { + fs.unlink(dest, err => { + if (err) return cb(err) + return fs.symlink(resolvedSrc, dest, cb) + }) +} + +module.exports = copy diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/index.js new file mode 100644 index 0000000..45c07a2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/copy/index.js @@ -0,0 +1,7 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + copy: u(require('./copy')), + copySync: require('./copy-sync') +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/empty/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/empty/index.js new file mode 100644 index 0000000..b4a2e82 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/empty/index.js @@ -0,0 +1,39 @@ +'use strict' + +const u = require('universalify').fromPromise +const fs = require('../fs') +const path = require('path') +const mkdir = require('../mkdirs') +const remove = require('../remove') + +const emptyDir = u(async function emptyDir (dir) { + let items + try { + items = await fs.readdir(dir) + } catch { + return mkdir.mkdirs(dir) + } + + return Promise.all(items.map(item => remove.remove(path.join(dir, item)))) +}) + +function emptyDirSync (dir) { + let items + try { + items = fs.readdirSync(dir) + } catch { + return mkdir.mkdirsSync(dir) + } + + items.forEach(item => { + item = path.join(dir, item) + remove.removeSync(item) + }) +} + +module.exports = { + emptyDirSync, + emptydirSync: emptyDirSync, + emptyDir, + emptydir: emptyDir +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/file.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/file.js new file mode 100644 index 0000000..15cc473 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/file.js @@ -0,0 +1,69 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') + +function createFile (file, callback) { + function makeFile () { + fs.writeFile(file, '', err => { + if (err) return callback(err) + callback() + }) + } + + fs.stat(file, (err, stats) => { // eslint-disable-line handle-callback-err + if (!err && stats.isFile()) return callback() + const dir = path.dirname(file) + fs.stat(dir, (err, stats) => { + if (err) { + // if the directory doesn't exist, make it + if (err.code === 'ENOENT') { + return mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeFile() + }) + } + return callback(err) + } + + if (stats.isDirectory()) makeFile() + else { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + fs.readdir(dir, err => { + if (err) return callback(err) + }) + } + }) + }) +} + +function createFileSync (file) { + let stats + try { + stats = fs.statSync(file) + } catch {} + if (stats && stats.isFile()) return + + const dir = path.dirname(file) + try { + if (!fs.statSync(dir).isDirectory()) { + // parent is not a directory + // This is just to cause an internal ENOTDIR error to be thrown + fs.readdirSync(dir) + } + } catch (err) { + // If the stat call above failed because the directory doesn't exist, create it + if (err && err.code === 'ENOENT') mkdir.mkdirsSync(dir) + else throw err + } + + fs.writeFileSync(file, '') +} + +module.exports = { + createFile: u(createFile), + createFileSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/index.js new file mode 100644 index 0000000..ecbcdd0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/index.js @@ -0,0 +1,23 @@ +'use strict' + +const { createFile, createFileSync } = require('./file') +const { createLink, createLinkSync } = require('./link') +const { createSymlink, createSymlinkSync } = require('./symlink') + +module.exports = { + // file + createFile, + createFileSync, + ensureFile: createFile, + ensureFileSync: createFileSync, + // link + createLink, + createLinkSync, + ensureLink: createLink, + ensureLinkSync: createLinkSync, + // symlink + createSymlink, + createSymlinkSync, + ensureSymlink: createSymlink, + ensureSymlinkSync: createSymlinkSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/link.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/link.js new file mode 100644 index 0000000..f6d6748 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/link.js @@ -0,0 +1,64 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('graceful-fs') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists +const { areIdentical } = require('../util/stat') + +function createLink (srcpath, dstpath, callback) { + function makeLink (srcpath, dstpath) { + fs.link(srcpath, dstpath, err => { + if (err) return callback(err) + callback(null) + }) + } + + fs.lstat(dstpath, (_, dstStat) => { + fs.lstat(srcpath, (err, srcStat) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureLink') + return callback(err) + } + if (dstStat && areIdentical(srcStat, dstStat)) return callback(null) + + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return makeLink(srcpath, dstpath) + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + makeLink(srcpath, dstpath) + }) + }) + }) + }) +} + +function createLinkSync (srcpath, dstpath) { + let dstStat + try { + dstStat = fs.lstatSync(dstpath) + } catch {} + + try { + const srcStat = fs.lstatSync(srcpath) + if (dstStat && areIdentical(srcStat, dstStat)) return + } catch (err) { + err.message = err.message.replace('lstat', 'ensureLink') + throw err + } + + const dir = path.dirname(dstpath) + const dirExists = fs.existsSync(dir) + if (dirExists) return fs.linkSync(srcpath, dstpath) + mkdir.mkdirsSync(dir) + + return fs.linkSync(srcpath, dstpath) +} + +module.exports = { + createLink: u(createLink), + createLinkSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-paths.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-paths.js new file mode 100644 index 0000000..33cd760 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-paths.js @@ -0,0 +1,99 @@ +'use strict' + +const path = require('path') +const fs = require('graceful-fs') +const pathExists = require('../path-exists').pathExists + +/** + * Function that returns two types of paths, one relative to symlink, and one + * relative to the current working directory. Checks if path is absolute or + * relative. If the path is relative, this function checks if the path is + * relative to symlink or relative to current working directory. This is an + * initiative to find a smarter `srcpath` to supply when building symlinks. + * This allows you to determine which path to use out of one of three possible + * types of source paths. The first is an absolute path. This is detected by + * `path.isAbsolute()`. When an absolute path is provided, it is checked to + * see if it exists. If it does it's used, if not an error is returned + * (callback)/ thrown (sync). The other two options for `srcpath` are a + * relative url. By default Node's `fs.symlink` works by creating a symlink + * using `dstpath` and expects the `srcpath` to be relative to the newly + * created symlink. If you provide a `srcpath` that does not exist on the file + * system it results in a broken symlink. To minimize this, the function + * checks to see if the 'relative to symlink' source file exists, and if it + * does it will use it. If it does not, it checks if there's a file that + * exists that is relative to the current working directory, if does its used. + * This preserves the expectations of the original fs.symlink spec and adds + * the ability to pass in `relative to current working direcotry` paths. + */ + +function symlinkPaths (srcpath, dstpath, callback) { + if (path.isAbsolute(srcpath)) { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + toCwd: srcpath, + toDst: srcpath + }) + }) + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + return pathExists(relativeToDst, (err, exists) => { + if (err) return callback(err) + if (exists) { + return callback(null, { + toCwd: relativeToDst, + toDst: srcpath + }) + } else { + return fs.lstat(srcpath, (err) => { + if (err) { + err.message = err.message.replace('lstat', 'ensureSymlink') + return callback(err) + } + return callback(null, { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + }) + }) + } + }) + } +} + +function symlinkPathsSync (srcpath, dstpath) { + let exists + if (path.isAbsolute(srcpath)) { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('absolute srcpath does not exist') + return { + toCwd: srcpath, + toDst: srcpath + } + } else { + const dstdir = path.dirname(dstpath) + const relativeToDst = path.join(dstdir, srcpath) + exists = fs.existsSync(relativeToDst) + if (exists) { + return { + toCwd: relativeToDst, + toDst: srcpath + } + } else { + exists = fs.existsSync(srcpath) + if (!exists) throw new Error('relative srcpath does not exist') + return { + toCwd: srcpath, + toDst: path.relative(dstdir, srcpath) + } + } + } +} + +module.exports = { + symlinkPaths, + symlinkPathsSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-type.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-type.js new file mode 100644 index 0000000..42dc0ce --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink-type.js @@ -0,0 +1,31 @@ +'use strict' + +const fs = require('graceful-fs') + +function symlinkType (srcpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + if (type) return callback(null, type) + fs.lstat(srcpath, (err, stats) => { + if (err) return callback(null, 'file') + type = (stats && stats.isDirectory()) ? 'dir' : 'file' + callback(null, type) + }) +} + +function symlinkTypeSync (srcpath, type) { + let stats + + if (type) return type + try { + stats = fs.lstatSync(srcpath) + } catch { + return 'file' + } + return (stats && stats.isDirectory()) ? 'dir' : 'file' +} + +module.exports = { + symlinkType, + symlinkTypeSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink.js new file mode 100644 index 0000000..2b93052 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/ensure/symlink.js @@ -0,0 +1,82 @@ +'use strict' + +const u = require('universalify').fromCallback +const path = require('path') +const fs = require('../fs') +const _mkdirs = require('../mkdirs') +const mkdirs = _mkdirs.mkdirs +const mkdirsSync = _mkdirs.mkdirsSync + +const _symlinkPaths = require('./symlink-paths') +const symlinkPaths = _symlinkPaths.symlinkPaths +const symlinkPathsSync = _symlinkPaths.symlinkPathsSync + +const _symlinkType = require('./symlink-type') +const symlinkType = _symlinkType.symlinkType +const symlinkTypeSync = _symlinkType.symlinkTypeSync + +const pathExists = require('../path-exists').pathExists + +const { areIdentical } = require('../util/stat') + +function createSymlink (srcpath, dstpath, type, callback) { + callback = (typeof type === 'function') ? type : callback + type = (typeof type === 'function') ? false : type + + fs.lstat(dstpath, (err, stats) => { + if (!err && stats.isSymbolicLink()) { + Promise.all([ + fs.stat(srcpath), + fs.stat(dstpath) + ]).then(([srcStat, dstStat]) => { + if (areIdentical(srcStat, dstStat)) return callback(null) + _createSymlink(srcpath, dstpath, type, callback) + }) + } else _createSymlink(srcpath, dstpath, type, callback) + }) +} + +function _createSymlink (srcpath, dstpath, type, callback) { + symlinkPaths(srcpath, dstpath, (err, relative) => { + if (err) return callback(err) + srcpath = relative.toDst + symlinkType(relative.toCwd, type, (err, type) => { + if (err) return callback(err) + const dir = path.dirname(dstpath) + pathExists(dir, (err, dirExists) => { + if (err) return callback(err) + if (dirExists) return fs.symlink(srcpath, dstpath, type, callback) + mkdirs(dir, err => { + if (err) return callback(err) + fs.symlink(srcpath, dstpath, type, callback) + }) + }) + }) + }) +} + +function createSymlinkSync (srcpath, dstpath, type) { + let stats + try { + stats = fs.lstatSync(dstpath) + } catch {} + if (stats && stats.isSymbolicLink()) { + const srcStat = fs.statSync(srcpath) + const dstStat = fs.statSync(dstpath) + if (areIdentical(srcStat, dstStat)) return + } + + const relative = symlinkPathsSync(srcpath, dstpath) + srcpath = relative.toDst + type = symlinkTypeSync(relative.toCwd, type) + const dir = path.dirname(dstpath) + const exists = fs.existsSync(dir) + if (exists) return fs.symlinkSync(srcpath, dstpath, type) + mkdirsSync(dir) + return fs.symlinkSync(srcpath, dstpath, type) +} + +module.exports = { + createSymlink: u(createSymlink), + createSymlinkSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/fs/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/fs/index.js new file mode 100644 index 0000000..7b025e2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/fs/index.js @@ -0,0 +1,128 @@ +'use strict' +// This is adapted from https://github.com/normalize/mz +// Copyright (c) 2014-2016 Jonathan Ong me@jongleberry.com and Contributors +const u = require('universalify').fromCallback +const fs = require('graceful-fs') + +const api = [ + 'access', + 'appendFile', + 'chmod', + 'chown', + 'close', + 'copyFile', + 'fchmod', + 'fchown', + 'fdatasync', + 'fstat', + 'fsync', + 'ftruncate', + 'futimes', + 'lchmod', + 'lchown', + 'link', + 'lstat', + 'mkdir', + 'mkdtemp', + 'open', + 'opendir', + 'readdir', + 'readFile', + 'readlink', + 'realpath', + 'rename', + 'rm', + 'rmdir', + 'stat', + 'symlink', + 'truncate', + 'unlink', + 'utimes', + 'writeFile' +].filter(key => { + // Some commands are not available on some systems. Ex: + // fs.opendir was added in Node.js v12.12.0 + // fs.rm was added in Node.js v14.14.0 + // fs.lchown is not available on at least some Linux + return typeof fs[key] === 'function' +}) + +// Export cloned fs: +Object.assign(exports, fs) + +// Universalify async methods: +api.forEach(method => { + exports[method] = u(fs[method]) +}) + +// We differ from mz/fs in that we still ship the old, broken, fs.exists() +// since we are a drop-in replacement for the native module +exports.exists = function (filename, callback) { + if (typeof callback === 'function') { + return fs.exists(filename, callback) + } + return new Promise(resolve => { + return fs.exists(filename, resolve) + }) +} + +// fs.read(), fs.write(), & fs.writev() need special treatment due to multiple callback args + +exports.read = function (fd, buffer, offset, length, position, callback) { + if (typeof callback === 'function') { + return fs.read(fd, buffer, offset, length, position, callback) + } + return new Promise((resolve, reject) => { + fs.read(fd, buffer, offset, length, position, (err, bytesRead, buffer) => { + if (err) return reject(err) + resolve({ bytesRead, buffer }) + }) + }) +} + +// Function signature can be +// fs.write(fd, buffer[, offset[, length[, position]]], callback) +// OR +// fs.write(fd, string[, position[, encoding]], callback) +// We need to handle both cases, so we use ...args +exports.write = function (fd, buffer, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.write(fd, buffer, ...args) + } + + return new Promise((resolve, reject) => { + fs.write(fd, buffer, ...args, (err, bytesWritten, buffer) => { + if (err) return reject(err) + resolve({ bytesWritten, buffer }) + }) + }) +} + +// fs.writev only available in Node v12.9.0+ +if (typeof fs.writev === 'function') { + // Function signature is + // s.writev(fd, buffers[, position], callback) + // We need to handle the optional arg, so we use ...args + exports.writev = function (fd, buffers, ...args) { + if (typeof args[args.length - 1] === 'function') { + return fs.writev(fd, buffers, ...args) + } + + return new Promise((resolve, reject) => { + fs.writev(fd, buffers, ...args, (err, bytesWritten, buffers) => { + if (err) return reject(err) + resolve({ bytesWritten, buffers }) + }) + }) + } +} + +// fs.realpath.native sometimes not available if fs is monkey-patched +if (typeof fs.realpath.native === 'function') { + exports.realpath.native = u(fs.realpath.native) +} else { + process.emitWarning( + 'fs.realpath.native is not a function. Is fs being monkey-patched?', + 'Warning', 'fs-extra-WARN0003' + ) +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/index.js new file mode 100644 index 0000000..da6711a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/index.js @@ -0,0 +1,16 @@ +'use strict' + +module.exports = { + // Export promiseified graceful-fs: + ...require('./fs'), + // Export extra methods: + ...require('./copy'), + ...require('./empty'), + ...require('./ensure'), + ...require('./json'), + ...require('./mkdirs'), + ...require('./move'), + ...require('./output-file'), + ...require('./path-exists'), + ...require('./remove') +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/json/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/index.js new file mode 100644 index 0000000..900126a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/index.js @@ -0,0 +1,16 @@ +'use strict' + +const u = require('universalify').fromPromise +const jsonFile = require('./jsonfile') + +jsonFile.outputJson = u(require('./output-json')) +jsonFile.outputJsonSync = require('./output-json-sync') +// aliases +jsonFile.outputJSON = jsonFile.outputJson +jsonFile.outputJSONSync = jsonFile.outputJsonSync +jsonFile.writeJSON = jsonFile.writeJson +jsonFile.writeJSONSync = jsonFile.writeJsonSync +jsonFile.readJSON = jsonFile.readJson +jsonFile.readJSONSync = jsonFile.readJsonSync + +module.exports = jsonFile diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/json/jsonfile.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/jsonfile.js new file mode 100644 index 0000000..f11d34d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/jsonfile.js @@ -0,0 +1,11 @@ +'use strict' + +const jsonFile = require('jsonfile') + +module.exports = { + // jsonfile exports + readJson: jsonFile.readFile, + readJsonSync: jsonFile.readFileSync, + writeJson: jsonFile.writeFile, + writeJsonSync: jsonFile.writeFileSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json-sync.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json-sync.js new file mode 100644 index 0000000..d4e564f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json-sync.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFileSync } = require('../output-file') + +function outputJsonSync (file, data, options) { + const str = stringify(data, options) + + outputFileSync(file, str, options) +} + +module.exports = outputJsonSync diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json.js new file mode 100644 index 0000000..0afdeb6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/json/output-json.js @@ -0,0 +1,12 @@ +'use strict' + +const { stringify } = require('jsonfile/utils') +const { outputFile } = require('../output-file') + +async function outputJson (file, data, options = {}) { + const str = stringify(data, options) + + await outputFile(file, str, options) +} + +module.exports = outputJson diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/index.js new file mode 100644 index 0000000..9edecee --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/index.js @@ -0,0 +1,14 @@ +'use strict' +const u = require('universalify').fromPromise +const { makeDir: _makeDir, makeDirSync } = require('./make-dir') +const makeDir = u(_makeDir) + +module.exports = { + mkdirs: makeDir, + mkdirsSync: makeDirSync, + // alias + mkdirp: makeDir, + mkdirpSync: makeDirSync, + ensureDir: makeDir, + ensureDirSync: makeDirSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/make-dir.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/make-dir.js new file mode 100644 index 0000000..45ece64 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/make-dir.js @@ -0,0 +1,27 @@ +'use strict' +const fs = require('../fs') +const { checkPath } = require('./utils') + +const getMode = options => { + const defaults = { mode: 0o777 } + if (typeof options === 'number') return options + return ({ ...defaults, ...options }).mode +} + +module.exports.makeDir = async (dir, options) => { + checkPath(dir) + + return fs.mkdir(dir, { + mode: getMode(options), + recursive: true + }) +} + +module.exports.makeDirSync = (dir, options) => { + checkPath(dir) + + return fs.mkdirSync(dir, { + mode: getMode(options), + recursive: true + }) +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/utils.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/utils.js new file mode 100644 index 0000000..a4059ad --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/mkdirs/utils.js @@ -0,0 +1,21 @@ +// Adapted from https://github.com/sindresorhus/make-dir +// Copyright (c) Sindre Sorhus (sindresorhus.com) +// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +'use strict' +const path = require('path') + +// https://github.com/nodejs/node/issues/8987 +// https://github.com/libuv/libuv/pull/1088 +module.exports.checkPath = function checkPath (pth) { + if (process.platform === 'win32') { + const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, '')) + + if (pathHasInvalidWinCharacters) { + const error = new Error(`Path contains invalid characters: ${pth}`) + error.code = 'EINVAL' + throw error + } + } +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/move/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/index.js new file mode 100644 index 0000000..fcee73c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/index.js @@ -0,0 +1,7 @@ +'use strict' + +const u = require('universalify').fromCallback +module.exports = { + move: u(require('./move')), + moveSync: require('./move-sync') +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move-sync.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move-sync.js new file mode 100644 index 0000000..8453366 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move-sync.js @@ -0,0 +1,54 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copySync = require('../copy').copySync +const removeSync = require('../remove').removeSync +const mkdirpSync = require('../mkdirs').mkdirpSync +const stat = require('../util/stat') + +function moveSync (src, dest, opts) { + opts = opts || {} + const overwrite = opts.overwrite || opts.clobber || false + + const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, 'move', opts) + stat.checkParentPathsSync(src, srcStat, dest, 'move') + if (!isParentRoot(dest)) mkdirpSync(path.dirname(dest)) + return doRename(src, dest, overwrite, isChangingCase) +} + +function isParentRoot (dest) { + const parent = path.dirname(dest) + const parsedPath = path.parse(parent) + return parsedPath.root === parent +} + +function doRename (src, dest, overwrite, isChangingCase) { + if (isChangingCase) return rename(src, dest, overwrite) + if (overwrite) { + removeSync(dest) + return rename(src, dest, overwrite) + } + if (fs.existsSync(dest)) throw new Error('dest already exists.') + return rename(src, dest, overwrite) +} + +function rename (src, dest, overwrite) { + try { + fs.renameSync(src, dest) + } catch (err) { + if (err.code !== 'EXDEV') throw err + return moveAcrossDevice(src, dest, overwrite) + } +} + +function moveAcrossDevice (src, dest, overwrite) { + const opts = { + overwrite, + errorOnExist: true + } + copySync(src, dest, opts) + return removeSync(src) +} + +module.exports = moveSync diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move.js new file mode 100644 index 0000000..7dc6ecd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/move/move.js @@ -0,0 +1,75 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const copy = require('../copy').copy +const remove = require('../remove').remove +const mkdirp = require('../mkdirs').mkdirp +const pathExists = require('../path-exists').pathExists +const stat = require('../util/stat') + +function move (src, dest, opts, cb) { + if (typeof opts === 'function') { + cb = opts + opts = {} + } + + opts = opts || {} + + const overwrite = opts.overwrite || opts.clobber || false + + stat.checkPaths(src, dest, 'move', opts, (err, stats) => { + if (err) return cb(err) + const { srcStat, isChangingCase = false } = stats + stat.checkParentPaths(src, srcStat, dest, 'move', err => { + if (err) return cb(err) + if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb) + mkdirp(path.dirname(dest), err => { + if (err) return cb(err) + return doRename(src, dest, overwrite, isChangingCase, cb) + }) + }) + }) +} + +function isParentRoot (dest) { + const parent = path.dirname(dest) + const parsedPath = path.parse(parent) + return parsedPath.root === parent +} + +function doRename (src, dest, overwrite, isChangingCase, cb) { + if (isChangingCase) return rename(src, dest, overwrite, cb) + if (overwrite) { + return remove(dest, err => { + if (err) return cb(err) + return rename(src, dest, overwrite, cb) + }) + } + pathExists(dest, (err, destExists) => { + if (err) return cb(err) + if (destExists) return cb(new Error('dest already exists.')) + return rename(src, dest, overwrite, cb) + }) +} + +function rename (src, dest, overwrite, cb) { + fs.rename(src, dest, err => { + if (!err) return cb() + if (err.code !== 'EXDEV') return cb(err) + return moveAcrossDevice(src, dest, overwrite, cb) + }) +} + +function moveAcrossDevice (src, dest, overwrite, cb) { + const opts = { + overwrite, + errorOnExist: true + } + copy(src, dest, opts, err => { + if (err) return cb(err) + return remove(src, cb) + }) +} + +module.exports = move diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/output-file/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/output-file/index.js new file mode 100644 index 0000000..92297ca --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/output-file/index.js @@ -0,0 +1,40 @@ +'use strict' + +const u = require('universalify').fromCallback +const fs = require('graceful-fs') +const path = require('path') +const mkdir = require('../mkdirs') +const pathExists = require('../path-exists').pathExists + +function outputFile (file, data, encoding, callback) { + if (typeof encoding === 'function') { + callback = encoding + encoding = 'utf8' + } + + const dir = path.dirname(file) + pathExists(dir, (err, itDoes) => { + if (err) return callback(err) + if (itDoes) return fs.writeFile(file, data, encoding, callback) + + mkdir.mkdirs(dir, err => { + if (err) return callback(err) + + fs.writeFile(file, data, encoding, callback) + }) + }) +} + +function outputFileSync (file, ...args) { + const dir = path.dirname(file) + if (fs.existsSync(dir)) { + return fs.writeFileSync(file, ...args) + } + mkdir.mkdirsSync(dir) + fs.writeFileSync(file, ...args) +} + +module.exports = { + outputFile: u(outputFile), + outputFileSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/path-exists/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/path-exists/index.js new file mode 100644 index 0000000..ddd9bc7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/path-exists/index.js @@ -0,0 +1,12 @@ +'use strict' +const u = require('universalify').fromPromise +const fs = require('../fs') + +function pathExists (path) { + return fs.access(path).then(() => true).catch(() => false) +} + +module.exports = { + pathExists: u(pathExists), + pathExistsSync: fs.existsSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/index.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/index.js new file mode 100644 index 0000000..4428e59 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/index.js @@ -0,0 +1,22 @@ +'use strict' + +const fs = require('graceful-fs') +const u = require('universalify').fromCallback +const rimraf = require('./rimraf') + +function remove (path, callback) { + // Node 14.14.0+ + if (fs.rm) return fs.rm(path, { recursive: true, force: true }, callback) + rimraf(path, callback) +} + +function removeSync (path) { + // Node 14.14.0+ + if (fs.rmSync) return fs.rmSync(path, { recursive: true, force: true }) + rimraf.sync(path) +} + +module.exports = { + remove: u(remove), + removeSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/rimraf.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/rimraf.js new file mode 100644 index 0000000..2c77102 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/remove/rimraf.js @@ -0,0 +1,302 @@ +'use strict' + +const fs = require('graceful-fs') +const path = require('path') +const assert = require('assert') + +const isWindows = (process.platform === 'win32') + +function defaults (options) { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 +} + +function rimraf (p, options, cb) { + let busyTries = 0 + + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert.strictEqual(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + rimraf_(p, options, function CB (er) { + if (er) { + if ((er.code === 'EBUSY' || er.code === 'ENOTEMPTY' || er.code === 'EPERM') && + busyTries < options.maxBusyTries) { + busyTries++ + const time = busyTries * 100 + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), time) + } + + // already gone + if (er.code === 'ENOENT') er = null + } + + cb(er) + }) +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +function rimraf_ (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === 'ENOENT') { + return cb(null) + } + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === 'EPERM' && isWindows) { + return fixWinEPERM(p, options, er, cb) + } + + if (st && st.isDirectory()) { + return rmdir(p, options, er, cb) + } + + options.unlink(p, er => { + if (er) { + if (er.code === 'ENOENT') { + return cb(null) + } + if (er.code === 'EPERM') { + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + } + if (er.code === 'EISDIR') { + return rmdir(p, options, er, cb) + } + } + return cb(er) + }) + }) +} + +function fixWinEPERM (p, options, er, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.chmod(p, 0o666, er2 => { + if (er2) { + cb(er2.code === 'ENOENT' ? null : er) + } else { + options.stat(p, (er3, stats) => { + if (er3) { + cb(er3.code === 'ENOENT' ? null : er) + } else if (stats.isDirectory()) { + rmdir(p, options, er, cb) + } else { + options.unlink(p, cb) + } + }) + } + }) +} + +function fixWinEPERMSync (p, options, er) { + let stats + + assert(p) + assert(options) + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === 'ENOENT') { + return + } else { + throw er + } + } + + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === 'ENOENT') { + return + } else { + throw er + } + } + + if (stats.isDirectory()) { + rmdirSync(p, options, er) + } else { + options.unlinkSync(p) + } +} + +function rmdir (p, options, originalEr, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM')) { + rmkids(p, options, cb) + } else if (er && er.code === 'ENOTDIR') { + cb(originalEr) + } else { + cb(er) + } + }) +} + +function rmkids (p, options, cb) { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) return cb(er) + + let n = files.length + let errState + + if (n === 0) return options.rmdir(p, cb) + + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) { + return + } + if (er) return cb(errState = er) + if (--n === 0) { + options.rmdir(p, cb) + } + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +function rimrafSync (p, options) { + let st + + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.strictEqual(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.strictEqual(typeof options, 'object', 'rimraf: options should be object') + + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === 'ENOENT') { + return + } + + // Windows can EPERM on stat. Life is suffering. + if (er.code === 'EPERM' && isWindows) { + fixWinEPERMSync(p, options, er) + } + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) { + rmdirSync(p, options, null) + } else { + options.unlinkSync(p) + } + } catch (er) { + if (er.code === 'ENOENT') { + return + } else if (er.code === 'EPERM') { + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + } else if (er.code !== 'EISDIR') { + throw er + } + rmdirSync(p, options, er) + } +} + +function rmdirSync (p, options, originalEr) { + assert(p) + assert(options) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === 'ENOTDIR') { + throw originalEr + } else if (er.code === 'ENOTEMPTY' || er.code === 'EEXIST' || er.code === 'EPERM') { + rmkidsSync(p, options) + } else if (er.code !== 'ENOENT') { + throw er + } + } +} + +function rmkidsSync (p, options) { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + if (isWindows) { + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const startTime = Date.now() + do { + try { + const ret = options.rmdirSync(p, options) + return ret + } catch {} + } while (Date.now() - startTime < 500) // give up after 500ms + } else { + const ret = options.rmdirSync(p, options) + return ret + } +} + +module.exports = rimraf +rimraf.sync = rimrafSync diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/util/stat.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/util/stat.js new file mode 100644 index 0000000..0ed5aec --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/util/stat.js @@ -0,0 +1,154 @@ +'use strict' + +const fs = require('../fs') +const path = require('path') +const util = require('util') + +function getStats (src, dest, opts) { + const statFunc = opts.dereference + ? (file) => fs.stat(file, { bigint: true }) + : (file) => fs.lstat(file, { bigint: true }) + return Promise.all([ + statFunc(src), + statFunc(dest).catch(err => { + if (err.code === 'ENOENT') return null + throw err + }) + ]).then(([srcStat, destStat]) => ({ srcStat, destStat })) +} + +function getStatsSync (src, dest, opts) { + let destStat + const statFunc = opts.dereference + ? (file) => fs.statSync(file, { bigint: true }) + : (file) => fs.lstatSync(file, { bigint: true }) + const srcStat = statFunc(src) + try { + destStat = statFunc(dest) + } catch (err) { + if (err.code === 'ENOENT') return { srcStat, destStat: null } + throw err + } + return { srcStat, destStat } +} + +function checkPaths (src, dest, funcName, opts, cb) { + util.callbackify(getStats)(src, dest, opts, (err, stats) => { + if (err) return cb(err) + const { srcStat, destStat } = stats + + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src) + const destBaseName = path.basename(dest) + if (funcName === 'move' && + srcBaseName !== destBaseName && + srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return cb(null, { srcStat, destStat, isChangingCase: true }) + } + return cb(new Error('Source and destination must not be the same.')) + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`)) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`)) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return cb(null, { srcStat, destStat }) + }) +} + +function checkPathsSync (src, dest, funcName, opts) { + const { srcStat, destStat } = getStatsSync(src, dest, opts) + + if (destStat) { + if (areIdentical(srcStat, destStat)) { + const srcBaseName = path.basename(src) + const destBaseName = path.basename(dest) + if (funcName === 'move' && + srcBaseName !== destBaseName && + srcBaseName.toLowerCase() === destBaseName.toLowerCase()) { + return { srcStat, destStat, isChangingCase: true } + } + throw new Error('Source and destination must not be the same.') + } + if (srcStat.isDirectory() && !destStat.isDirectory()) { + throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`) + } + if (!srcStat.isDirectory() && destStat.isDirectory()) { + throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`) + } + } + + if (srcStat.isDirectory() && isSrcSubdir(src, dest)) { + throw new Error(errMsg(src, dest, funcName)) + } + return { srcStat, destStat } +} + +// recursively check if dest parent is a subdirectory of src. +// It works for all file types including symlinks since it +// checks the src and dest inodes. It starts from the deepest +// parent and stops once it reaches the src parent or the root path. +function checkParentPaths (src, srcStat, dest, funcName, cb) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return cb() + fs.stat(destParent, { bigint: true }, (err, destStat) => { + if (err) { + if (err.code === 'ENOENT') return cb() + return cb(err) + } + if (areIdentical(srcStat, destStat)) { + return cb(new Error(errMsg(src, dest, funcName))) + } + return checkParentPaths(src, srcStat, destParent, funcName, cb) + }) +} + +function checkParentPathsSync (src, srcStat, dest, funcName) { + const srcParent = path.resolve(path.dirname(src)) + const destParent = path.resolve(path.dirname(dest)) + if (destParent === srcParent || destParent === path.parse(destParent).root) return + let destStat + try { + destStat = fs.statSync(destParent, { bigint: true }) + } catch (err) { + if (err.code === 'ENOENT') return + throw err + } + if (areIdentical(srcStat, destStat)) { + throw new Error(errMsg(src, dest, funcName)) + } + return checkParentPathsSync(src, srcStat, destParent, funcName) +} + +function areIdentical (srcStat, destStat) { + return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev +} + +// return true if dest is a subdir of src, otherwise false. +// It only checks the path strings. +function isSrcSubdir (src, dest) { + const srcArr = path.resolve(src).split(path.sep).filter(i => i) + const destArr = path.resolve(dest).split(path.sep).filter(i => i) + return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true) +} + +function errMsg (src, dest, funcName) { + return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.` +} + +module.exports = { + checkPaths, + checkPathsSync, + checkParentPaths, + checkParentPathsSync, + isSrcSubdir, + areIdentical +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/lib/util/utimes.js b/projects/org-skill-web-research/node_modules/fs-extra/lib/util/utimes.js new file mode 100644 index 0000000..75395de --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/lib/util/utimes.js @@ -0,0 +1,26 @@ +'use strict' + +const fs = require('graceful-fs') + +function utimesMillis (path, atime, mtime, callback) { + // if (!HAS_MILLIS_RES) return fs.utimes(path, atime, mtime, callback) + fs.open(path, 'r+', (err, fd) => { + if (err) return callback(err) + fs.futimes(fd, atime, mtime, futimesErr => { + fs.close(fd, closeErr => { + if (callback) callback(futimesErr || closeErr) + }) + }) + }) +} + +function utimesMillisSync (path, atime, mtime) { + const fd = fs.openSync(path, 'r+') + fs.futimesSync(fd, atime, mtime) + return fs.closeSync(fd) +} + +module.exports = { + utimesMillis, + utimesMillisSync +} diff --git a/projects/org-skill-web-research/node_modules/fs-extra/package.json b/projects/org-skill-web-research/node_modules/fs-extra/package.json new file mode 100644 index 0000000..059000e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs-extra/package.json @@ -0,0 +1,67 @@ +{ + "name": "fs-extra", + "version": "10.1.0", + "description": "fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.", + "engines": { + "node": ">=12" + }, + "homepage": "https://github.com/jprichardson/node-fs-extra", + "repository": { + "type": "git", + "url": "https://github.com/jprichardson/node-fs-extra" + }, + "keywords": [ + "fs", + "file", + "file system", + "copy", + "directory", + "extra", + "mkdirp", + "mkdir", + "mkdirs", + "recursive", + "json", + "read", + "write", + "extra", + "delete", + "remove", + "touch", + "create", + "text", + "output", + "move", + "promise" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "devDependencies": { + "at-least-node": "^1.0.0", + "klaw": "^2.1.1", + "klaw-sync": "^3.0.2", + "minimist": "^1.1.1", + "mocha": "^5.0.5", + "nyc": "^15.0.0", + "proxyquire": "^2.0.1", + "read-dir-files": "^0.1.1", + "standard": "^16.0.3" + }, + "main": "./lib/index.js", + "files": [ + "lib/", + "!lib/**/__tests__/" + ], + "scripts": { + "lint": "standard", + "test-find": "find ./lib/**/__tests__ -name *.test.js | xargs mocha", + "test": "npm run lint && npm run unit", + "unit": "nyc node test.js" + }, + "sideEffects": false +} diff --git a/projects/org-skill-web-research/node_modules/fs.realpath/LICENSE b/projects/org-skill-web-research/node_modules/fs.realpath/LICENSE new file mode 100644 index 0000000..5bd884c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs.realpath/LICENSE @@ -0,0 +1,43 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +---- + +This library bundles a version of the `fs.realpath` and `fs.realpathSync` +methods from Node.js v0.10 under the terms of the Node.js MIT license. + +Node's license follows, also included at the header of `old.js` which contains +the licensed code: + + Copyright Joyent, Inc. and other Node contributors. + + Permission is hereby granted, free of charge, to any person obtaining a + copy of this software and associated documentation files (the "Software"), + to deal in the Software without restriction, including without limitation + the rights to use, copy, modify, merge, publish, distribute, sublicense, + and/or sell copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/fs.realpath/README.md b/projects/org-skill-web-research/node_modules/fs.realpath/README.md new file mode 100644 index 0000000..a42ceac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs.realpath/README.md @@ -0,0 +1,33 @@ +# fs.realpath + +A backwards-compatible fs.realpath for Node v6 and above + +In Node v6, the JavaScript implementation of fs.realpath was replaced +with a faster (but less resilient) native implementation. That raises +new and platform-specific errors and cannot handle long or excessively +symlink-looping paths. + +This module handles those cases by detecting the new errors and +falling back to the JavaScript implementation. On versions of Node +prior to v6, it has no effect. + +## USAGE + +```js +var rp = require('fs.realpath') + +// async version +rp.realpath(someLongAndLoopingPath, function (er, real) { + // the ELOOP was handled, but it was a bit slower +}) + +// sync version +var real = rp.realpathSync(someLongAndLoopingPath) + +// monkeypatch at your own risk! +// This replaces the fs.realpath/fs.realpathSync builtins +rp.monkeypatch() + +// un-do the monkeypatching +rp.unmonkeypatch() +``` diff --git a/projects/org-skill-web-research/node_modules/fs.realpath/index.js b/projects/org-skill-web-research/node_modules/fs.realpath/index.js new file mode 100644 index 0000000..b09c7c7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs.realpath/index.js @@ -0,0 +1,66 @@ +module.exports = realpath +realpath.realpath = realpath +realpath.sync = realpathSync +realpath.realpathSync = realpathSync +realpath.monkeypatch = monkeypatch +realpath.unmonkeypatch = unmonkeypatch + +var fs = require('fs') +var origRealpath = fs.realpath +var origRealpathSync = fs.realpathSync + +var version = process.version +var ok = /^v[0-5]\./.test(version) +var old = require('./old.js') + +function newError (er) { + return er && er.syscall === 'realpath' && ( + er.code === 'ELOOP' || + er.code === 'ENOMEM' || + er.code === 'ENAMETOOLONG' + ) +} + +function realpath (p, cache, cb) { + if (ok) { + return origRealpath(p, cache, cb) + } + + if (typeof cache === 'function') { + cb = cache + cache = null + } + origRealpath(p, cache, function (er, result) { + if (newError(er)) { + old.realpath(p, cache, cb) + } else { + cb(er, result) + } + }) +} + +function realpathSync (p, cache) { + if (ok) { + return origRealpathSync(p, cache) + } + + try { + return origRealpathSync(p, cache) + } catch (er) { + if (newError(er)) { + return old.realpathSync(p, cache) + } else { + throw er + } + } +} + +function monkeypatch () { + fs.realpath = realpath + fs.realpathSync = realpathSync +} + +function unmonkeypatch () { + fs.realpath = origRealpath + fs.realpathSync = origRealpathSync +} diff --git a/projects/org-skill-web-research/node_modules/fs.realpath/old.js b/projects/org-skill-web-research/node_modules/fs.realpath/old.js new file mode 100644 index 0000000..b40305e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs.realpath/old.js @@ -0,0 +1,303 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var pathModule = require('path'); +var isWindows = process.platform === 'win32'; +var fs = require('fs'); + +// JavaScript implementation of realpath, ported from node pre-v6 + +var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG); + +function rethrow() { + // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and + // is fairly slow to generate. + var callback; + if (DEBUG) { + var backtrace = new Error; + callback = debugCallback; + } else + callback = missingCallback; + + return callback; + + function debugCallback(err) { + if (err) { + backtrace.message = err.message; + err = backtrace; + missingCallback(err); + } + } + + function missingCallback(err) { + if (err) { + if (process.throwDeprecation) + throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs + else if (!process.noDeprecation) { + var msg = 'fs: missing callback ' + (err.stack || err.message); + if (process.traceDeprecation) + console.trace(msg); + else + console.error(msg); + } + } + } +} + +function maybeCallback(cb) { + return typeof cb === 'function' ? cb : rethrow(); +} + +var normalize = pathModule.normalize; + +// Regexp that finds the next partion of a (partial) path +// result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] +if (isWindows) { + var nextPartRe = /(.*?)(?:[\/\\]+|$)/g; +} else { + var nextPartRe = /(.*?)(?:[\/]+|$)/g; +} + +// Regex to find the device root, including trailing slash. E.g. 'c:\\'. +if (isWindows) { + var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/; +} else { + var splitRootRe = /^[\/]*/; +} + +exports.realpathSync = function realpathSync(p, cache) { + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return cache[p]; + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstatSync(base); + knownHard[base] = true; + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + // NB: p.length changes. + while (pos < p.length) { + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + continue; + } + + var resolvedLink; + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // some known symbolic link. no need to stat again. + resolvedLink = cache[base]; + } else { + var stat = fs.lstatSync(base); + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + continue; + } + + // read the link if it wasn't read before + // dev/ino always return 0 on windows, so skip the check. + var linkTarget = null; + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + linkTarget = seenLinks[id]; + } + } + if (linkTarget === null) { + fs.statSync(base); + linkTarget = fs.readlinkSync(base); + } + resolvedLink = pathModule.resolve(previous, linkTarget); + // track this, if given a cache. + if (cache) cache[base] = resolvedLink; + if (!isWindows) seenLinks[id] = linkTarget; + } + + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } + + if (cache) cache[original] = p; + + return p; +}; + + +exports.realpath = function realpath(p, cache, cb) { + if (typeof cb !== 'function') { + cb = maybeCallback(cache); + cache = null; + } + + // make p is absolute + p = pathModule.resolve(p); + + if (cache && Object.prototype.hasOwnProperty.call(cache, p)) { + return process.nextTick(cb.bind(null, null, cache[p])); + } + + var original = p, + seenLinks = {}, + knownHard = {}; + + // current character position in p + var pos; + // the partial path so far, including a trailing slash if any + var current; + // the partial path without a trailing slash (except when pointing at a root) + var base; + // the partial path scanned in the previous round, with slash + var previous; + + start(); + + function start() { + // Skip over roots + var m = splitRootRe.exec(p); + pos = m[0].length; + current = m[0]; + base = m[0]; + previous = ''; + + // On windows, check that the root exists. On unix there is no need. + if (isWindows && !knownHard[base]) { + fs.lstat(base, function(err) { + if (err) return cb(err); + knownHard[base] = true; + LOOP(); + }); + } else { + process.nextTick(LOOP); + } + } + + // walk down the path, swapping out linked pathparts for their real + // values + function LOOP() { + // stop if scanned past end of path + if (pos >= p.length) { + if (cache) cache[original] = p; + return cb(null, p); + } + + // find the next part + nextPartRe.lastIndex = pos; + var result = nextPartRe.exec(p); + previous = current; + current += result[0]; + base = previous + result[1]; + pos = nextPartRe.lastIndex; + + // continue if not a symlink + if (knownHard[base] || (cache && cache[base] === base)) { + return process.nextTick(LOOP); + } + + if (cache && Object.prototype.hasOwnProperty.call(cache, base)) { + // known symbolic link. no need to stat again. + return gotResolvedLink(cache[base]); + } + + return fs.lstat(base, gotStat); + } + + function gotStat(err, stat) { + if (err) return cb(err); + + // if not a symlink, skip to the next path part + if (!stat.isSymbolicLink()) { + knownHard[base] = true; + if (cache) cache[base] = base; + return process.nextTick(LOOP); + } + + // stat & read the link if not read before + // call gotTarget as soon as the link target is known + // dev/ino always return 0 on windows, so skip the check. + if (!isWindows) { + var id = stat.dev.toString(32) + ':' + stat.ino.toString(32); + if (seenLinks.hasOwnProperty(id)) { + return gotTarget(null, seenLinks[id], base); + } + } + fs.stat(base, function(err) { + if (err) return cb(err); + + fs.readlink(base, function(err, target) { + if (!isWindows) seenLinks[id] = target; + gotTarget(err, target); + }); + }); + } + + function gotTarget(err, target, base) { + if (err) return cb(err); + + var resolvedLink = pathModule.resolve(previous, target); + if (cache) cache[base] = resolvedLink; + gotResolvedLink(resolvedLink); + } + + function gotResolvedLink(resolvedLink) { + // resolve the link, then start over + p = pathModule.resolve(resolvedLink, p.slice(pos)); + start(); + } +}; diff --git a/projects/org-skill-web-research/node_modules/fs.realpath/package.json b/projects/org-skill-web-research/node_modules/fs.realpath/package.json new file mode 100644 index 0000000..3edc57d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/fs.realpath/package.json @@ -0,0 +1,26 @@ +{ + "name": "fs.realpath", + "version": "1.0.0", + "description": "Use node's fs.realpath, but fall back to the JS implementation if the native one fails", + "main": "index.js", + "dependencies": {}, + "devDependencies": {}, + "scripts": { + "test": "tap test/*.js --cov" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/isaacs/fs.realpath.git" + }, + "keywords": [ + "realpath", + "fs", + "polyfill" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "files": [ + "old.js", + "index.js" + ] +} diff --git a/projects/org-skill-web-research/node_modules/glob/LICENSE b/projects/org-skill-web-research/node_modules/glob/LICENSE new file mode 100644 index 0000000..42ca266 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/LICENSE @@ -0,0 +1,21 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +## Glob Logo + +Glob's logo created by Tanya Brassie , licensed +under a Creative Commons Attribution-ShareAlike 4.0 International License +https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/projects/org-skill-web-research/node_modules/glob/README.md b/projects/org-skill-web-research/node_modules/glob/README.md new file mode 100644 index 0000000..83f0c83 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/README.md @@ -0,0 +1,378 @@ +# Glob + +Match files using the patterns the shell uses, like stars and stuff. + +[![Build Status](https://travis-ci.org/isaacs/node-glob.svg?branch=master)](https://travis-ci.org/isaacs/node-glob/) [![Build Status](https://ci.appveyor.com/api/projects/status/kd7f3yftf7unxlsx?svg=true)](https://ci.appveyor.com/project/isaacs/node-glob) [![Coverage Status](https://coveralls.io/repos/isaacs/node-glob/badge.svg?branch=master&service=github)](https://coveralls.io/github/isaacs/node-glob?branch=master) + +This is a glob implementation in JavaScript. It uses the `minimatch` +library to do its matching. + +![a fun cartoon logo made of glob characters](logo/glob.png) + +## Usage + +Install with npm + +``` +npm i glob +``` + +```javascript +var glob = require("glob") + +// options is optional +glob("**/*.js", options, function (er, files) { + // files is an array of filenames. + // If the `nonull` option is set, and nothing + // was found, then files is ["**/*.js"] + // er is an error object or null. +}) +``` + +## Glob Primer + +"Globs" are the patterns you type when you do stuff like `ls *.js` on +the command line, or put `build/*` in a `.gitignore` file. + +Before parsing the path part patterns, braced sections are expanded +into a set. Braced sections start with `{` and end with `}`, with any +number of comma-delimited sections within. Braced sections may contain +slash characters, so `a{/b/c,bcd}` would expand into `a/b/c` and `abcd`. + +The following characters have special magic meaning when used in a +path portion: + +* `*` Matches 0 or more characters in a single path portion +* `?` Matches 1 character +* `[...]` Matches a range of characters, similar to a RegExp range. + If the first character of the range is `!` or `^` then it matches + any character not in the range. +* `!(pattern|pattern|pattern)` Matches anything that does not match + any of the patterns provided. +* `?(pattern|pattern|pattern)` Matches zero or one occurrence of the + patterns provided. +* `+(pattern|pattern|pattern)` Matches one or more occurrences of the + patterns provided. +* `*(a|b|c)` Matches zero or more occurrences of the patterns provided +* `@(pattern|pat*|pat?erN)` Matches exactly one of the patterns + provided +* `**` If a "globstar" is alone in a path portion, then it matches + zero or more directories and subdirectories searching for matches. + It does not crawl symlinked directories. + +### Dots + +If a file or directory path portion has a `.` as the first character, +then it will not match any glob pattern unless that pattern's +corresponding path part also has a `.` as its first character. + +For example, the pattern `a/.*/c` would match the file at `a/.b/c`. +However the pattern `a/*/c` would not, because `*` does not start with +a dot character. + +You can make glob treat dots as normal characters by setting +`dot:true` in the options. + +### Basename Matching + +If you set `matchBase:true` in the options, and the pattern has no +slashes in it, then it will seek for any file anywhere in the tree +with a matching basename. For example, `*.js` would match +`test/simple/basic.js`. + +### Empty Sets + +If no matching files are found, then an empty array is returned. This +differs from the shell, where the pattern itself is returned. For +example: + + $ echo a*s*d*f + a*s*d*f + +To get the bash-style behavior, set the `nonull:true` in the options. + +### See Also: + +* `man sh` +* `man bash` (Search for "Pattern Matching") +* `man 3 fnmatch` +* `man 5 gitignore` +* [minimatch documentation](https://github.com/isaacs/minimatch) + +## glob.hasMagic(pattern, [options]) + +Returns `true` if there are any special characters in the pattern, and +`false` otherwise. + +Note that the options affect the results. If `noext:true` is set in +the options object, then `+(a|b)` will not be considered a magic +pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}` +then that is considered magical, unless `nobrace:true` is set in the +options. + +## glob(pattern, [options], cb) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* `cb` `{Function}` + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Perform an asynchronous glob search. + +## glob.sync(pattern, [options]) + +* `pattern` `{String}` Pattern to be matched +* `options` `{Object}` +* return: `{Array}` filenames found matching the pattern + +Perform a synchronous glob search. + +## Class: glob.Glob + +Create a Glob object by instantiating the `glob.Glob` class. + +```javascript +var Glob = require("glob").Glob +var mg = new Glob(pattern, options, cb) +``` + +It's an EventEmitter, and starts walking the filesystem to find matches +immediately. + +### new glob.Glob(pattern, [options], [cb]) + +* `pattern` `{String}` pattern to search for +* `options` `{Object}` +* `cb` `{Function}` Called when an error occurs, or matches are found + * `err` `{Error | null}` + * `matches` `{Array}` filenames found matching the pattern + +Note that if the `sync` flag is set in the options, then matches will +be immediately available on the `g.found` member. + +### Properties + +* `minimatch` The minimatch object that the glob uses. +* `options` The options object passed in. +* `aborted` Boolean which is set to true when calling `abort()`. There + is no way at this time to continue a glob search after aborting, but + you can re-use the statCache to avoid having to duplicate syscalls. +* `cache` Convenience object. Each field has the following possible + values: + * `false` - Path does not exist + * `true` - Path exists + * `'FILE'` - Path exists, and is not a directory + * `'DIR'` - Path exists, and is a directory + * `[file, entries, ...]` - Path exists, is a directory, and the + array value is the results of `fs.readdir` +* `statCache` Cache of `fs.stat` results, to prevent statting the same + path multiple times. +* `symlinks` A record of which paths are symbolic links, which is + relevant in resolving `**` patterns. +* `realpathCache` An optional object which is passed to `fs.realpath` + to minimize unnecessary syscalls. It is stored on the instantiated + Glob object, and may be re-used. + +### Events + +* `end` When the matching is finished, this is emitted with all the + matches found. If the `nonull` option is set, and no match was found, + then the `matches` list contains the original pattern. The matches + are sorted, unless the `nosort` flag is set. +* `match` Every time a match is found, this is emitted with the specific + thing that matched. It is not deduplicated or resolved to a realpath. +* `error` Emitted when an unexpected error is encountered, or whenever + any fs error occurs if `options.strict` is set. +* `abort` When `abort()` is called, this event is raised. + +### Methods + +* `pause` Temporarily stop the search +* `resume` Resume the search +* `abort` Stop the search forever + +### Options + +All the options that can be passed to Minimatch can also be passed to +Glob to change pattern matching behavior. Also, some have been added, +or have glob-specific ramifications. + +All options are false by default, unless otherwise noted. + +All options are added to the Glob object, as well. + +If you are running many `glob` operations, you can pass a Glob object +as the `options` argument to a subsequent operation to shortcut some +`stat` and `readdir` calls. At the very least, you may pass in shared +`symlinks`, `statCache`, `realpathCache`, and `cache` options, so that +parallel glob operations will be sped up by sharing information about +the filesystem. + +* `cwd` The current working directory in which to search. Defaults + to `process.cwd()`. +* `root` The place where patterns starting with `/` will be mounted + onto. Defaults to `path.resolve(options.cwd, "/")` (`/` on Unix + systems, and `C:\` or some such on Windows.) +* `dot` Include `.dot` files in normal matches and `globstar` matches. + Note that an explicit dot in a portion of the pattern will always + match dot files. +* `nomount` By default, a pattern starting with a forward-slash will be + "mounted" onto the root setting, so that a valid filesystem path is + returned. Set this flag to disable that behavior. +* `mark` Add a `/` character to directory matches. Note that this + requires additional stat calls. +* `nosort` Don't sort the results. +* `stat` Set to true to stat *all* results. This reduces performance + somewhat, and is completely unnecessary, unless `readdir` is presumed + to be an untrustworthy indicator of file existence. +* `silent` When an unusual error is encountered when attempting to + read a directory, a warning will be printed to stderr. Set the + `silent` option to true to suppress these warnings. +* `strict` When an unusual error is encountered when attempting to + read a directory, the process will just continue on in search of + other matches. Set the `strict` option to raise an error in these + cases. +* `cache` See `cache` property above. Pass in a previously generated + cache object to save some fs calls. +* `statCache` A cache of results of filesystem information, to prevent + unnecessary stat calls. While it should not normally be necessary + to set this, you may pass the statCache from one glob() call to the + options object of another, if you know that the filesystem will not + change between calls. (See "Race Conditions" below.) +* `symlinks` A cache of known symbolic links. You may pass in a + previously generated `symlinks` object to save `lstat` calls when + resolving `**` matches. +* `sync` DEPRECATED: use `glob.sync(pattern, opts)` instead. +* `nounique` In some cases, brace-expanded patterns can result in the + same file showing up multiple times in the result set. By default, + this implementation prevents duplicates in the result set. Set this + flag to disable that behavior. +* `nonull` Set to never return an empty set, instead returning a set + containing the pattern itself. This is the default in glob(3). +* `debug` Set to enable debug logging in minimatch and glob. +* `nobrace` Do not expand `{a,b}` and `{1..3}` brace sets. +* `noglobstar` Do not match `**` against multiple filenames. (Ie, + treat it as a normal `*` instead.) +* `noext` Do not match `+(a|b)` "extglob" patterns. +* `nocase` Perform a case-insensitive match. Note: on + case-insensitive filesystems, non-magic patterns will match by + default, since `stat` and `readdir` will not raise errors. +* `matchBase` Perform a basename-only match if the pattern does not + contain any slash characters. That is, `*.js` would be treated as + equivalent to `**/*.js`, matching all js files in all directories. +* `nodir` Do not match directories, only files. (Note: to match + *only* directories, simply put a `/` at the end of the pattern.) +* `ignore` Add a pattern or an array of glob patterns to exclude matches. + Note: `ignore` patterns are *always* in `dot:true` mode, regardless + of any other settings. +* `follow` Follow symlinked directories when expanding `**` patterns. + Note that this can result in a lot of duplicate references in the + presence of cyclic links. +* `realpath` Set to true to call `fs.realpath` on all of the results. + In the case of a symlink that cannot be resolved, the full absolute + path to the matched entry is returned (though it will usually be a + broken symlink) +* `absolute` Set to true to always receive absolute paths for matched + files. Unlike `realpath`, this also affects the values returned in + the `match` event. +* `fs` File-system object with Node's `fs` API. By default, the built-in + `fs` module will be used. Set to a volume provided by a library like + `memfs` to avoid using the "real" file-system. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between node-glob and other +implementations, and are intentional. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.3, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +Note that symlinked directories are not crawled as part of a `**`, +though their contents may match against subsequent portions of the +pattern. This prevents infinite loops and duplicates and the like. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then glob returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`glob.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. + +### Comments and Negation + +Previously, this module let you mark a pattern as a "comment" if it +started with a `#` character, or a "negated" pattern if it started +with a `!` character. + +These options were deprecated in version 5, and removed in version 6. + +To specify things that should not match, use the `ignore` option. + +## Windows + +**Please only use forward-slashes in glob expressions.** + +Though windows uses either `/` or `\` as its path separator, only `/` +characters are used by this glob implementation. You must use +forward-slashes **only** in glob expressions. Back-slashes will always +be interpreted as escape characters, not path separators. + +Results from absolute patterns such as `/foo/*` are mounted onto the +root setting using `path.join`. On windows, this will by default result +in `/foo/*` matching `C:\foo\bar.txt`. + +## Race Conditions + +Glob searching, by its very nature, is susceptible to race conditions, +since it relies on directory walking and such. + +As a result, it is possible that a file that exists when glob looks for +it may have been deleted or modified by the time it returns the result. + +As part of its internal implementation, this program caches all stat +and readdir calls that it makes, in order to cut down on system +overhead. However, this also makes it even more susceptible to races, +especially if the cache or statCache objects are reused between glob +calls. + +Users are thus advised not to use a glob result as a guarantee of +filesystem state in the face of rapid changes. For the vast majority +of operations, this is never a problem. + +## Glob Logo +Glob's logo was created by [Tanya Brassie](http://tanyabrassie.com/). Logo files can be found [here](https://github.com/isaacs/node-glob/tree/master/logo). + +The logo is licensed under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/). + +## Contributing + +Any change to behavior (including bugfixes) must come with a test. + +Patches that fail tests or reduce performance will be rejected. + +``` +# to run tests +npm test + +# to re-generate test fixtures +npm run test-regen + +# to benchmark against bash/zsh +npm run bench + +# to profile javascript +npm run prof +``` + +![](oh-my-glob.gif) diff --git a/projects/org-skill-web-research/node_modules/glob/common.js b/projects/org-skill-web-research/node_modules/glob/common.js new file mode 100644 index 0000000..424c46e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/common.js @@ -0,0 +1,238 @@ +exports.setopts = setopts +exports.ownProp = ownProp +exports.makeAbs = makeAbs +exports.finish = finish +exports.mark = mark +exports.isIgnored = isIgnored +exports.childrenIgnored = childrenIgnored + +function ownProp (obj, field) { + return Object.prototype.hasOwnProperty.call(obj, field) +} + +var fs = require("fs") +var path = require("path") +var minimatch = require("minimatch") +var isAbsolute = require("path-is-absolute") +var Minimatch = minimatch.Minimatch + +function alphasort (a, b) { + return a.localeCompare(b, 'en') +} + +function setupIgnores (self, options) { + self.ignore = options.ignore || [] + + if (!Array.isArray(self.ignore)) + self.ignore = [self.ignore] + + if (self.ignore.length) { + self.ignore = self.ignore.map(ignoreMap) + } +} + +// ignore patterns are always in dot:true mode. +function ignoreMap (pattern) { + var gmatcher = null + if (pattern.slice(-3) === '/**') { + var gpattern = pattern.replace(/(\/\*\*)+$/, '') + gmatcher = new Minimatch(gpattern, { dot: true }) + } + + return { + matcher: new Minimatch(pattern, { dot: true }), + gmatcher: gmatcher + } +} + +function setopts (self, pattern, options) { + if (!options) + options = {} + + // base-matching: just use globstar for that. + if (options.matchBase && -1 === pattern.indexOf("/")) { + if (options.noglobstar) { + throw new Error("base matching requires globstar") + } + pattern = "**/" + pattern + } + + self.silent = !!options.silent + self.pattern = pattern + self.strict = options.strict !== false + self.realpath = !!options.realpath + self.realpathCache = options.realpathCache || Object.create(null) + self.follow = !!options.follow + self.dot = !!options.dot + self.mark = !!options.mark + self.nodir = !!options.nodir + if (self.nodir) + self.mark = true + self.sync = !!options.sync + self.nounique = !!options.nounique + self.nonull = !!options.nonull + self.nosort = !!options.nosort + self.nocase = !!options.nocase + self.stat = !!options.stat + self.noprocess = !!options.noprocess + self.absolute = !!options.absolute + self.fs = options.fs || fs + + self.maxLength = options.maxLength || Infinity + self.cache = options.cache || Object.create(null) + self.statCache = options.statCache || Object.create(null) + self.symlinks = options.symlinks || Object.create(null) + + setupIgnores(self, options) + + self.changedCwd = false + var cwd = process.cwd() + if (!ownProp(options, "cwd")) + self.cwd = cwd + else { + self.cwd = path.resolve(options.cwd) + self.changedCwd = self.cwd !== cwd + } + + self.root = options.root || path.resolve(self.cwd, "/") + self.root = path.resolve(self.root) + if (process.platform === "win32") + self.root = self.root.replace(/\\/g, "/") + + // TODO: is an absolute `cwd` supposed to be resolved against `root`? + // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test') + self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd) + if (process.platform === "win32") + self.cwdAbs = self.cwdAbs.replace(/\\/g, "/") + self.nomount = !!options.nomount + + // disable comments and negation in Minimatch. + // Note that they are not supported in Glob itself anyway. + options.nonegate = true + options.nocomment = true + // always treat \ in patterns as escapes, not path separators + options.allowWindowsEscape = false + + self.minimatch = new Minimatch(pattern, options) + self.options = self.minimatch.options +} + +function finish (self) { + var nou = self.nounique + var all = nou ? [] : Object.create(null) + + for (var i = 0, l = self.matches.length; i < l; i ++) { + var matches = self.matches[i] + if (!matches || Object.keys(matches).length === 0) { + if (self.nonull) { + // do like the shell, and spit out the literal glob + var literal = self.minimatch.globSet[i] + if (nou) + all.push(literal) + else + all[literal] = true + } + } else { + // had matches + var m = Object.keys(matches) + if (nou) + all.push.apply(all, m) + else + m.forEach(function (m) { + all[m] = true + }) + } + } + + if (!nou) + all = Object.keys(all) + + if (!self.nosort) + all = all.sort(alphasort) + + // at *some* point we statted all of these + if (self.mark) { + for (var i = 0; i < all.length; i++) { + all[i] = self._mark(all[i]) + } + if (self.nodir) { + all = all.filter(function (e) { + var notDir = !(/\/$/.test(e)) + var c = self.cache[e] || self.cache[makeAbs(self, e)] + if (notDir && c) + notDir = c !== 'DIR' && !Array.isArray(c) + return notDir + }) + } + } + + if (self.ignore.length) + all = all.filter(function(m) { + return !isIgnored(self, m) + }) + + self.found = all +} + +function mark (self, p) { + var abs = makeAbs(self, p) + var c = self.cache[abs] + var m = p + if (c) { + var isDir = c === 'DIR' || Array.isArray(c) + var slash = p.slice(-1) === '/' + + if (isDir && !slash) + m += '/' + else if (!isDir && slash) + m = m.slice(0, -1) + + if (m !== p) { + var mabs = makeAbs(self, m) + self.statCache[mabs] = self.statCache[abs] + self.cache[mabs] = self.cache[abs] + } + } + + return m +} + +// lotta situps... +function makeAbs (self, f) { + var abs = f + if (f.charAt(0) === '/') { + abs = path.join(self.root, f) + } else if (isAbsolute(f) || f === '') { + abs = f + } else if (self.changedCwd) { + abs = path.resolve(self.cwd, f) + } else { + abs = path.resolve(f) + } + + if (process.platform === 'win32') + abs = abs.replace(/\\/g, '/') + + return abs +} + + +// Return true, if pattern ends with globstar '**', for the accompanying parent directory. +// Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents +function isIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path)) + }) +} + +function childrenIgnored (self, path) { + if (!self.ignore.length) + return false + + return self.ignore.some(function(item) { + return !!(item.gmatcher && item.gmatcher.match(path)) + }) +} diff --git a/projects/org-skill-web-research/node_modules/glob/glob.js b/projects/org-skill-web-research/node_modules/glob/glob.js new file mode 100644 index 0000000..37a4d7e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/glob.js @@ -0,0 +1,790 @@ +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var inherits = require('inherits') +var EE = require('events').EventEmitter +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var globSync = require('./sync.js') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = require('inflight') +var util = require('util') +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +var once = require('once') + +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} + + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) + } + + return new Glob(pattern, options, cb) +} + +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync + +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin +} + +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true + + var g = new Glob(pattern, options) + var set = g.minimatch.set + + if (!pattern) + return false + + if (set.length > 1) + return true + + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } + + return false +} + +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } + + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) + + setopts(this, pattern, options) + this._didRealPath = false + + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } + + var self = this + this._processing = 0 + + this._emitQueue = [] + this._processQueue = [] + this.paused = false + + if (this.noprocess) + return this + + if (n === 0) + return done() + + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) + } + sync = false + + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } + } +} + +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return + + if (this.realpath && !this._didRealpath) + return this._realpath() + + common.finish(this) + this.emit('end', this.found) +} + +Glob.prototype._realpath = function () { + if (this._didRealpath) + return + + this._didRealpath = true + + var n = this.matches.length + if (n === 0) + return this._finish() + + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } +} + +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + + var found = Object.keys(matchset) + var self = this + var n = found.length + + if (n === 0) + return cb() + + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} + +Glob.prototype._mark = function (p) { + return common.mark(this, p) +} + +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') + } +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } + } + } +} + +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') + + if (this.aborted) + return + + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} + +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) + } + cb() +} + +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return + + if (isIgnored(this, e)) + return + + if (this.paused) { + this._emitQueue.push([index, e]) + return + } + + var abs = isAbsolute(e) ? e : this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) + e = abs + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) + + this.emit('match', e) +} + +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return + + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) + + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) + + if (lstatcb) + self.fs.lstat(abs, lstatcb) + + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() + + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } +} + +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return + + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() + + if (Array.isArray(c)) + return cb(null, c) + } + + var self = this + self.fs.readdir(abs, readdirCb(this, abs, cb)) +} + +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) + } +} + +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return + + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + return cb(null, entries) +} + +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return + + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } + + return cb() +} + +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} + + +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) + + var isSym = this.symlinks[abs] + var len = entries.length + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } + + cb() +} + +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + + //console.error('ps2', prefix, exists) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) + cb() +} + +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return cb() + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) + + if (needDir && c === 'FILE') + return cb() + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } + + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + self.fs.lstat(abs, statcb) + + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return self.fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } +} + +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } + + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat + + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return cb() + + return cb(null, c, stat) +} diff --git a/projects/org-skill-web-research/node_modules/glob/package.json b/projects/org-skill-web-research/node_modules/glob/package.json new file mode 100644 index 0000000..5940b64 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/package.json @@ -0,0 +1,55 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "name": "glob", + "description": "a little globber", + "version": "7.2.3", + "publishConfig": { + "tag": "v7-legacy" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/node-glob.git" + }, + "main": "glob.js", + "files": [ + "glob.js", + "sync.js", + "common.js" + ], + "engines": { + "node": "*" + }, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "devDependencies": { + "memfs": "^3.2.0", + "mkdirp": "0", + "rimraf": "^2.2.8", + "tap": "^15.0.6", + "tick": "0.0.6" + }, + "tap": { + "before": "test/00-setup.js", + "after": "test/zz-cleanup.js", + "jobs": 1 + }, + "scripts": { + "prepublish": "npm run benchclean", + "profclean": "rm -f v8.log profile.txt", + "test": "tap", + "test-regen": "npm run profclean && TEST_REGEN=1 node test/00-setup.js", + "bench": "bash benchmark.sh", + "prof": "bash prof.sh && cat profile.txt", + "benchclean": "node benchclean.js" + }, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/projects/org-skill-web-research/node_modules/glob/sync.js b/projects/org-skill-web-research/node_modules/glob/sync.js new file mode 100644 index 0000000..2c4f480 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/glob/sync.js @@ -0,0 +1,486 @@ +module.exports = globSync +globSync.GlobSync = GlobSync + +var rp = require('fs.realpath') +var minimatch = require('minimatch') +var Minimatch = minimatch.Minimatch +var Glob = require('./glob.js').Glob +var util = require('util') +var path = require('path') +var assert = require('assert') +var isAbsolute = require('path-is-absolute') +var common = require('./common.js') +var setopts = common.setopts +var ownProp = common.ownProp +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored + +function globSync (pattern, options) { + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + return new GlobSync(pattern, options).found +} + +function GlobSync (pattern, options) { + if (!pattern) + throw new Error('must provide pattern') + + if (typeof options === 'function' || arguments.length === 3) + throw new TypeError('callback provided to sync glob\n'+ + 'See: https://github.com/isaacs/node-glob/issues/167') + + if (!(this instanceof GlobSync)) + return new GlobSync(pattern, options) + + setopts(this, pattern, options) + + if (this.noprocess) + return this + + var n = this.minimatch.set.length + this.matches = new Array(n) + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false) + } + this._finish() +} + +GlobSync.prototype._finish = function () { + assert.ok(this instanceof GlobSync) + if (this.realpath) { + var self = this + this.matches.forEach(function (matchset, index) { + var set = self.matches[index] = Object.create(null) + for (var p in matchset) { + try { + p = self._makeAbs(p) + var real = rp.realpathSync(p, self.realpathCache) + set[real] = true + } catch (er) { + if (er.syscall === 'stat') + set[self._makeAbs(p)] = true + else + throw er + } + } + }) + } + common.finish(this) +} + + +GlobSync.prototype._process = function (pattern, index, inGlobStar) { + assert.ok(this instanceof GlobSync) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // See if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || + isAbsolute(pattern.map(function (p) { + return typeof p === 'string' ? p : '[*]' + }).join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + + var abs = this._makeAbs(read) + + //if ignored, skip processing + if (childrenIgnored(this, read)) + return + + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar) +} + + +GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) { + var entries = this._readdir(abs, inGlobStar) + + // if the abs isn't a dir, then nothing can match! + if (!entries) + return + + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' + + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } + + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return + + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. + + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix.slice(-1) !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return + } + + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) + newPattern = [prefix, e] + else + newPattern = [e] + this._process(newPattern.concat(remain), index, inGlobStar) + } +} + + +GlobSync.prototype._emitMatch = function (index, e) { + if (isIgnored(this, e)) + return + + var abs = this._makeAbs(e) + + if (this.mark) + e = this._mark(e) + + if (this.absolute) { + e = abs + } + + if (this.matches[index][e]) + return + + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return + } + + this.matches[index][e] = true + + if (this.stat) + this._stat(e) +} + + +GlobSync.prototype._readdirInGlobStar = function (abs) { + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false) + + var entries + var lstat + var stat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er.code === 'ENOENT') { + // lstat failed, doesn't exist + return null + } + } + + var isSym = lstat && lstat.isSymbolicLink() + this.symlinks[abs] = isSym + + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) + this.cache[abs] = 'FILE' + else + entries = this._readdir(abs, false) + + return entries +} + +GlobSync.prototype._readdir = function (abs, inGlobStar) { + var entries + + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs) + + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return null + + if (Array.isArray(c)) + return c + } + + try { + return this._readdirEntries(abs, this.fs.readdirSync(abs)) + } catch (er) { + this._readdirError(abs, er) + return null + } +} + +GlobSync.prototype._readdirEntries = function (abs, entries) { + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } + + this.cache[abs] = entries + + // mark and cache dir-ness + return entries +} + +GlobSync.prototype._readdirError = function (f, er) { + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + throw error + } + break + + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) + throw er + if (!this.silent) + console.error('glob error', er) + break + } +} + +GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) { + + var entries = this._readdir(abs, inGlobStar) + + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return + + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) + + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false) + + var len = entries.length + var isSym = this.symlinks[abs] + + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return + + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue + + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true) + + var below = gspref.concat(entries[i], remain) + this._process(below, index, true) + } +} + +GlobSync.prototype._processSimple = function (prefix, index) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var exists = this._stat(prefix) + + if (!this.matches[index]) + this.matches[index] = Object.create(null) + + // If it doesn't exist, then just mark the lack of results + if (!exists) + return + + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } + + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') + + // Mark this as a match + this._emitMatch(index, prefix) +} + +// Returns either 'DIR', 'FILE', or false +GlobSync.prototype._stat = function (f) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' + + if (f.length > this.maxLength) + return false + + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] + + if (Array.isArray(c)) + c = 'DIR' + + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return c + + if (needDir && c === 'FILE') + return false + + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } + + var exists + var stat = this.statCache[abs] + if (!stat) { + var lstat + try { + lstat = this.fs.lstatSync(abs) + } catch (er) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return false + } + } + + if (lstat && lstat.isSymbolicLink()) { + try { + stat = this.fs.statSync(abs) + } catch (er) { + stat = lstat + } + } else { + stat = lstat + } + } + + this.statCache[abs] = stat + + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + + this.cache[abs] = this.cache[abs] || c + + if (needDir && c === 'FILE') + return false + + return c +} + +GlobSync.prototype._mark = function (p) { + return common.mark(this, p) +} + +GlobSync.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/LICENSE b/projects/org-skill-web-research/node_modules/graceful-fs/LICENSE new file mode 100644 index 0000000..e906a25 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/README.md b/projects/org-skill-web-research/node_modules/graceful-fs/README.md new file mode 100644 index 0000000..82d6e4d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/README.md @@ -0,0 +1,143 @@ +# graceful-fs + +graceful-fs functions as a drop-in replacement for the fs module, +making various improvements. + +The improvements are meant to normalize behavior across different +platforms and environments, and to make filesystem access more +resilient to errors. + +## Improvements over [fs module](https://nodejs.org/api/fs.html) + +* Queues up `open` and `readdir` calls, and retries them once + something closes if there is an EMFILE error from too many file + descriptors. +* fixes `lchmod` for Node versions prior to 0.6.2. +* implements `fs.lutimes` if possible. Otherwise it becomes a noop. +* ignores `EINVAL` and `EPERM` errors in `chown`, `fchown` or + `lchown` if the user isn't root. +* makes `lchmod` and `lchown` become noops, if not available. +* retries reading a file if `read` results in EAGAIN error. + +On Windows, it retries renaming a file for up to one second if `EACCESS` +or `EPERM` error occurs, likely because antivirus software has locked +the directory. + +## USAGE + +```javascript +// use just like fs +var fs = require('graceful-fs') + +// now go and do stuff with it... +fs.readFile('some-file-or-whatever', (err, data) => { + // Do stuff here. +}) +``` + +## Sync methods + +This module cannot intercept or handle `EMFILE` or `ENFILE` errors from sync +methods. If you use sync methods which open file descriptors then you are +responsible for dealing with any errors. + +This is a known limitation, not a bug. + +## Global Patching + +If you want to patch the global fs module (or any other fs-like +module) you can do this: + +```javascript +// Make sure to read the caveat below. +var realFs = require('fs') +var gracefulFs = require('graceful-fs') +gracefulFs.gracefulify(realFs) +``` + +This should only ever be done at the top-level application layer, in +order to delay on EMFILE errors from any fs-using dependencies. You +should **not** do this in a library, because it can cause unexpected +delays in other parts of the program. + +## Changes + +This module is fairly stable at this point, and used by a lot of +things. That being said, because it implements a subtle behavior +change in a core part of the node API, even modest changes can be +extremely breaking, and the versioning is thus biased towards +bumping the major when in doubt. + +The main change between major versions has been switching between +providing a fully-patched `fs` module vs monkey-patching the node core +builtin, and the approach by which a non-monkey-patched `fs` was +created. + +The goal is to trade `EMFILE` errors for slower fs operations. So, if +you try to open a zillion files, rather than crashing, `open` +operations will be queued up and wait for something else to `close`. + +There are advantages to each approach. Monkey-patching the fs means +that no `EMFILE` errors can possibly occur anywhere in your +application, because everything is using the same core `fs` module, +which is patched. However, it can also obviously cause undesirable +side-effects, especially if the module is loaded multiple times. + +Implementing a separate-but-identical patched `fs` module is more +surgical (and doesn't run the risk of patching multiple times), but +also imposes the challenge of keeping in sync with the core module. + +The current approach loads the `fs` module, and then creates a +lookalike object that has all the same methods, except a few that are +patched. It is safe to use in all versions of Node from 0.8 through +7.0. + +### v4 + +* Do not monkey-patch the fs module. This module may now be used as a + drop-in dep, and users can opt into monkey-patching the fs builtin + if their app requires it. + +### v3 + +* Monkey-patch fs, because the eval approach no longer works on recent + node. +* fixed possible type-error throw if rename fails on windows +* verify that we *never* get EMFILE errors +* Ignore ENOSYS from chmod/chown +* clarify that graceful-fs must be used as a drop-in + +### v2.1.0 + +* Use eval rather than monkey-patching fs. +* readdir: Always sort the results +* win32: requeue a file if error has an OK status + +### v2.0 + +* A return to monkey patching +* wrap process.cwd + +### v1.1 + +* wrap readFile +* Wrap fs.writeFile. +* readdir protection +* Don't clobber the fs builtin +* Handle fs.read EAGAIN errors by trying again +* Expose the curOpen counter +* No-op lchown/lchmod if not implemented +* fs.rename patch only for win32 +* Patch fs.rename to handle AV software on Windows +* Close #4 Chown should not fail on einval or eperm if non-root +* Fix isaacs/fstream#1 Only wrap fs one time +* Fix #3 Start at 1024 max files, then back off on EMFILE +* lutimes that doens't blow up on Linux +* A full on-rewrite using a queue instead of just swallowing the EMFILE error +* Wrap Read/Write streams as well + +### 1.0 + +* Update engines for node 0.6 +* Be lstat-graceful on Windows +* first diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/clone.js b/projects/org-skill-web-research/node_modules/graceful-fs/clone.js new file mode 100644 index 0000000..dff3cc8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/clone.js @@ -0,0 +1,23 @@ +'use strict' + +module.exports = clone + +var getPrototypeOf = Object.getPrototypeOf || function (obj) { + return obj.__proto__ +} + +function clone (obj) { + if (obj === null || typeof obj !== 'object') + return obj + + if (obj instanceof Object) + var copy = { __proto__: getPrototypeOf(obj) } + else + var copy = Object.create(null) + + Object.getOwnPropertyNames(obj).forEach(function (key) { + Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key)) + }) + + return copy +} diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/graceful-fs.js b/projects/org-skill-web-research/node_modules/graceful-fs/graceful-fs.js new file mode 100644 index 0000000..8d5b89e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/graceful-fs.js @@ -0,0 +1,448 @@ +var fs = require('fs') +var polyfills = require('./polyfills.js') +var legacy = require('./legacy-streams.js') +var clone = require('./clone.js') + +var util = require('util') + +/* istanbul ignore next - node 0.x polyfill */ +var gracefulQueue +var previousSymbol + +/* istanbul ignore else - node 0.x polyfill */ +if (typeof Symbol === 'function' && typeof Symbol.for === 'function') { + gracefulQueue = Symbol.for('graceful-fs.queue') + // This is used in testing by future versions + previousSymbol = Symbol.for('graceful-fs.previous') +} else { + gracefulQueue = '___graceful-fs.queue' + previousSymbol = '___graceful-fs.previous' +} + +function noop () {} + +function publishQueue(context, queue) { + Object.defineProperty(context, gracefulQueue, { + get: function() { + return queue + } + }) +} + +var debug = noop +if (util.debuglog) + debug = util.debuglog('gfs4') +else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) + debug = function() { + var m = util.format.apply(util, arguments) + m = 'GFS4: ' + m.split(/\n/).join('\nGFS4: ') + console.error(m) + } + +// Once time initialization +if (!fs[gracefulQueue]) { + // This queue can be shared by multiple loaded instances + var queue = global[gracefulQueue] || [] + publishQueue(fs, queue) + + // Patch fs.close/closeSync to shared queue version, because we need + // to retry() whenever a close happens *anywhere* in the program. + // This is essential when multiple graceful-fs instances are + // in play at the same time. + fs.close = (function (fs$close) { + function close (fd, cb) { + return fs$close.call(fs, fd, function (err) { + // This function uses the graceful-fs shared queue + if (!err) { + resetQueue() + } + + if (typeof cb === 'function') + cb.apply(this, arguments) + }) + } + + Object.defineProperty(close, previousSymbol, { + value: fs$close + }) + return close + })(fs.close) + + fs.closeSync = (function (fs$closeSync) { + function closeSync (fd) { + // This function uses the graceful-fs shared queue + fs$closeSync.apply(fs, arguments) + resetQueue() + } + + Object.defineProperty(closeSync, previousSymbol, { + value: fs$closeSync + }) + return closeSync + })(fs.closeSync) + + if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { + process.on('exit', function() { + debug(fs[gracefulQueue]) + require('assert').equal(fs[gracefulQueue].length, 0) + }) + } +} + +if (!global[gracefulQueue]) { + publishQueue(global, fs[gracefulQueue]); +} + +module.exports = patch(clone(fs)) +if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs.__patched) { + module.exports = patch(fs) + fs.__patched = true; +} + +function patch (fs) { + // Everything that references the open() function needs to be in here + polyfills(fs) + fs.gracefulify = patch + + fs.createReadStream = createReadStream + fs.createWriteStream = createWriteStream + var fs$readFile = fs.readFile + fs.readFile = readFile + function readFile (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$readFile(path, options, cb) + + function go$readFile (path, options, cb, startTime) { + return fs$readFile(path, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$readFile, [path, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$writeFile = fs.writeFile + fs.writeFile = writeFile + function writeFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$writeFile(path, data, options, cb) + + function go$writeFile (path, data, options, cb, startTime) { + return fs$writeFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$writeFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$appendFile = fs.appendFile + if (fs$appendFile) + fs.appendFile = appendFile + function appendFile (path, data, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + return go$appendFile(path, data, options, cb) + + function go$appendFile (path, data, options, cb, startTime) { + return fs$appendFile(path, data, options, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$appendFile, [path, data, options, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$copyFile = fs.copyFile + if (fs$copyFile) + fs.copyFile = copyFile + function copyFile (src, dest, flags, cb) { + if (typeof flags === 'function') { + cb = flags + flags = 0 + } + return go$copyFile(src, dest, flags, cb) + + function go$copyFile (src, dest, flags, cb, startTime) { + return fs$copyFile(src, dest, flags, function (err) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$copyFile, [src, dest, flags, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + var fs$readdir = fs.readdir + fs.readdir = readdir + var noReaddirOptionVersions = /^v[0-5]\./ + function readdir (path, options, cb) { + if (typeof options === 'function') + cb = options, options = null + + var go$readdir = noReaddirOptionVersions.test(process.version) + ? function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, fs$readdirCallback( + path, options, cb, startTime + )) + } + : function go$readdir (path, options, cb, startTime) { + return fs$readdir(path, options, fs$readdirCallback( + path, options, cb, startTime + )) + } + + return go$readdir(path, options, cb) + + function fs$readdirCallback (path, options, cb, startTime) { + return function (err, files) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([ + go$readdir, + [path, options, cb], + err, + startTime || Date.now(), + Date.now() + ]) + else { + if (files && files.sort) + files.sort() + + if (typeof cb === 'function') + cb.call(this, err, files) + } + } + } + } + + if (process.version.substr(0, 4) === 'v0.8') { + var legStreams = legacy(fs) + ReadStream = legStreams.ReadStream + WriteStream = legStreams.WriteStream + } + + var fs$ReadStream = fs.ReadStream + if (fs$ReadStream) { + ReadStream.prototype = Object.create(fs$ReadStream.prototype) + ReadStream.prototype.open = ReadStream$open + } + + var fs$WriteStream = fs.WriteStream + if (fs$WriteStream) { + WriteStream.prototype = Object.create(fs$WriteStream.prototype) + WriteStream.prototype.open = WriteStream$open + } + + Object.defineProperty(fs, 'ReadStream', { + get: function () { + return ReadStream + }, + set: function (val) { + ReadStream = val + }, + enumerable: true, + configurable: true + }) + Object.defineProperty(fs, 'WriteStream', { + get: function () { + return WriteStream + }, + set: function (val) { + WriteStream = val + }, + enumerable: true, + configurable: true + }) + + // legacy names + var FileReadStream = ReadStream + Object.defineProperty(fs, 'FileReadStream', { + get: function () { + return FileReadStream + }, + set: function (val) { + FileReadStream = val + }, + enumerable: true, + configurable: true + }) + var FileWriteStream = WriteStream + Object.defineProperty(fs, 'FileWriteStream', { + get: function () { + return FileWriteStream + }, + set: function (val) { + FileWriteStream = val + }, + enumerable: true, + configurable: true + }) + + function ReadStream (path, options) { + if (this instanceof ReadStream) + return fs$ReadStream.apply(this, arguments), this + else + return ReadStream.apply(Object.create(ReadStream.prototype), arguments) + } + + function ReadStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + if (that.autoClose) + that.destroy() + + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + that.read() + } + }) + } + + function WriteStream (path, options) { + if (this instanceof WriteStream) + return fs$WriteStream.apply(this, arguments), this + else + return WriteStream.apply(Object.create(WriteStream.prototype), arguments) + } + + function WriteStream$open () { + var that = this + open(that.path, that.flags, that.mode, function (err, fd) { + if (err) { + that.destroy() + that.emit('error', err) + } else { + that.fd = fd + that.emit('open', fd) + } + }) + } + + function createReadStream (path, options) { + return new fs.ReadStream(path, options) + } + + function createWriteStream (path, options) { + return new fs.WriteStream(path, options) + } + + var fs$open = fs.open + fs.open = open + function open (path, flags, mode, cb) { + if (typeof mode === 'function') + cb = mode, mode = null + + return go$open(path, flags, mode, cb) + + function go$open (path, flags, mode, cb, startTime) { + return fs$open(path, flags, mode, function (err, fd) { + if (err && (err.code === 'EMFILE' || err.code === 'ENFILE')) + enqueue([go$open, [path, flags, mode, cb], err, startTime || Date.now(), Date.now()]) + else { + if (typeof cb === 'function') + cb.apply(this, arguments) + } + }) + } + } + + return fs +} + +function enqueue (elem) { + debug('ENQUEUE', elem[0].name, elem[1]) + fs[gracefulQueue].push(elem) + retry() +} + +// keep track of the timeout between retry() calls +var retryTimer + +// reset the startTime and lastTime to now +// this resets the start of the 60 second overall timeout as well as the +// delay between attempts so that we'll retry these jobs sooner +function resetQueue () { + var now = Date.now() + for (var i = 0; i < fs[gracefulQueue].length; ++i) { + // entries that are only a length of 2 are from an older version, don't + // bother modifying those since they'll be retried anyway. + if (fs[gracefulQueue][i].length > 2) { + fs[gracefulQueue][i][3] = now // startTime + fs[gracefulQueue][i][4] = now // lastTime + } + } + // call retry to make sure we're actively processing the queue + retry() +} + +function retry () { + // clear the timer and remove it to help prevent unintended concurrency + clearTimeout(retryTimer) + retryTimer = undefined + + if (fs[gracefulQueue].length === 0) + return + + var elem = fs[gracefulQueue].shift() + var fn = elem[0] + var args = elem[1] + // these items may be unset if they were added by an older graceful-fs + var err = elem[2] + var startTime = elem[3] + var lastTime = elem[4] + + // if we don't have a startTime we have no way of knowing if we've waited + // long enough, so go ahead and retry this item now + if (startTime === undefined) { + debug('RETRY', fn.name, args) + fn.apply(null, args) + } else if (Date.now() - startTime >= 60000) { + // it's been more than 60 seconds total, bail now + debug('TIMEOUT', fn.name, args) + var cb = args.pop() + if (typeof cb === 'function') + cb.call(null, err) + } else { + // the amount of time between the last attempt and right now + var sinceAttempt = Date.now() - lastTime + // the amount of time between when we first tried, and when we last tried + // rounded up to at least 1 + var sinceStart = Math.max(lastTime - startTime, 1) + // backoff. wait longer than the total time we've been retrying, but only + // up to a maximum of 100ms + var desiredDelay = Math.min(sinceStart * 1.2, 100) + // it's been long enough since the last retry, do it again + if (sinceAttempt >= desiredDelay) { + debug('RETRY', fn.name, args) + fn.apply(null, args.concat([startTime])) + } else { + // if we can't do this job yet, push it to the end of the queue + // and let the next iteration check again + fs[gracefulQueue].push(elem) + } + } + + // schedule our next run if one isn't already scheduled + if (retryTimer === undefined) { + retryTimer = setTimeout(retry, 0) + } +} diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/legacy-streams.js b/projects/org-skill-web-research/node_modules/graceful-fs/legacy-streams.js new file mode 100644 index 0000000..d617b50 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/legacy-streams.js @@ -0,0 +1,118 @@ +var Stream = require('stream').Stream + +module.exports = legacy + +function legacy (fs) { + return { + ReadStream: ReadStream, + WriteStream: WriteStream + } + + function ReadStream (path, options) { + if (!(this instanceof ReadStream)) return new ReadStream(path, options); + + Stream.call(this); + + var self = this; + + this.path = path; + this.fd = null; + this.readable = true; + this.paused = false; + + this.flags = 'r'; + this.mode = 438; /*=0666*/ + this.bufferSize = 64 * 1024; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.encoding) this.setEncoding(this.encoding); + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.end === undefined) { + this.end = Infinity; + } else if ('number' !== typeof this.end) { + throw TypeError('end must be a Number'); + } + + if (this.start > this.end) { + throw new Error('start must be <= end'); + } + + this.pos = this.start; + } + + if (this.fd !== null) { + process.nextTick(function() { + self._read(); + }); + return; + } + + fs.open(this.path, this.flags, this.mode, function (err, fd) { + if (err) { + self.emit('error', err); + self.readable = false; + return; + } + + self.fd = fd; + self.emit('open', fd); + self._read(); + }) + } + + function WriteStream (path, options) { + if (!(this instanceof WriteStream)) return new WriteStream(path, options); + + Stream.call(this); + + this.path = path; + this.fd = null; + this.writable = true; + + this.flags = 'w'; + this.encoding = 'binary'; + this.mode = 438; /*=0666*/ + this.bytesWritten = 0; + + options = options || {}; + + // Mixin options into this + var keys = Object.keys(options); + for (var index = 0, length = keys.length; index < length; index++) { + var key = keys[index]; + this[key] = options[key]; + } + + if (this.start !== undefined) { + if ('number' !== typeof this.start) { + throw TypeError('start must be a Number'); + } + if (this.start < 0) { + throw new Error('start must be >= zero'); + } + + this.pos = this.start; + } + + this.busy = false; + this._queue = []; + + if (this.fd === null) { + this._open = fs.open; + this._queue.push([this._open, this.path, this.flags, this.mode, undefined]); + this.flush(); + } + } +} diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/package.json b/projects/org-skill-web-research/node_modules/graceful-fs/package.json new file mode 100644 index 0000000..87babf0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/package.json @@ -0,0 +1,53 @@ +{ + "name": "graceful-fs", + "description": "A drop-in replacement for fs, making various improvements.", + "version": "4.2.11", + "repository": { + "type": "git", + "url": "https://github.com/isaacs/node-graceful-fs" + }, + "main": "graceful-fs.js", + "directories": { + "test": "test" + }, + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "nyc --silent node test.js | tap -c -", + "posttest": "nyc report" + }, + "keywords": [ + "fs", + "module", + "reading", + "retry", + "retries", + "queue", + "error", + "errors", + "handling", + "EMFILE", + "EAGAIN", + "EINVAL", + "EPERM", + "EACCESS" + ], + "license": "ISC", + "devDependencies": { + "import-fresh": "^2.0.0", + "mkdirp": "^0.5.0", + "rimraf": "^2.2.8", + "tap": "^16.3.4" + }, + "files": [ + "fs.js", + "graceful-fs.js", + "legacy-streams.js", + "polyfills.js", + "clone.js" + ], + "tap": { + "reporter": "classic" + } +} diff --git a/projects/org-skill-web-research/node_modules/graceful-fs/polyfills.js b/projects/org-skill-web-research/node_modules/graceful-fs/polyfills.js new file mode 100644 index 0000000..453f1a9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/graceful-fs/polyfills.js @@ -0,0 +1,355 @@ +var constants = require('constants') + +var origCwd = process.cwd +var cwd = null + +var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform + +process.cwd = function() { + if (!cwd) + cwd = origCwd.call(process) + return cwd +} +try { + process.cwd() +} catch (er) {} + +// This check is needed until node.js 12 is required +if (typeof process.chdir === 'function') { + var chdir = process.chdir + process.chdir = function (d) { + cwd = null + chdir.call(process, d) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir) +} + +module.exports = patch + +function patch (fs) { + // (re-)implement some things that are known busted or missing. + + // lchmod, broken prior to 0.6.2 + // back-port the fix here. + if (constants.hasOwnProperty('O_SYMLINK') && + process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) { + patchLchmod(fs) + } + + // lutimes implementation, or no-op + if (!fs.lutimes) { + patchLutimes(fs) + } + + // https://github.com/isaacs/node-graceful-fs/issues/4 + // Chown should not fail on einval or eperm if non-root. + // It should not fail on enosys ever, as this just indicates + // that a fs doesn't support the intended operation. + + fs.chown = chownFix(fs.chown) + fs.fchown = chownFix(fs.fchown) + fs.lchown = chownFix(fs.lchown) + + fs.chmod = chmodFix(fs.chmod) + fs.fchmod = chmodFix(fs.fchmod) + fs.lchmod = chmodFix(fs.lchmod) + + fs.chownSync = chownFixSync(fs.chownSync) + fs.fchownSync = chownFixSync(fs.fchownSync) + fs.lchownSync = chownFixSync(fs.lchownSync) + + fs.chmodSync = chmodFixSync(fs.chmodSync) + fs.fchmodSync = chmodFixSync(fs.fchmodSync) + fs.lchmodSync = chmodFixSync(fs.lchmodSync) + + fs.stat = statFix(fs.stat) + fs.fstat = statFix(fs.fstat) + fs.lstat = statFix(fs.lstat) + + fs.statSync = statFixSync(fs.statSync) + fs.fstatSync = statFixSync(fs.fstatSync) + fs.lstatSync = statFixSync(fs.lstatSync) + + // if lchmod/lchown do not exist, then make them no-ops + if (fs.chmod && !fs.lchmod) { + fs.lchmod = function (path, mode, cb) { + if (cb) process.nextTick(cb) + } + fs.lchmodSync = function () {} + } + if (fs.chown && !fs.lchown) { + fs.lchown = function (path, uid, gid, cb) { + if (cb) process.nextTick(cb) + } + fs.lchownSync = function () {} + } + + // on Windows, A/V software can lock the directory, causing this + // to fail with an EACCES or EPERM if the directory contains newly + // created files. Try again on failure, for up to 60 seconds. + + // Set the timeout this long because some Windows Anti-Virus, such as Parity + // bit9, may lock files for up to a minute, causing npm package install + // failures. Also, take care to yield the scheduler. Windows scheduling gives + // CPU to a busy looping process, which can cause the program causing the lock + // contention to be starved of CPU by node, so the contention doesn't resolve. + if (platform === "win32") { + fs.rename = typeof fs.rename !== 'function' ? fs.rename + : (function (fs$rename) { + function rename (from, to, cb) { + var start = Date.now() + var backoff = 0; + fs$rename(from, to, function CB (er) { + if (er + && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") + && Date.now() - start < 60000) { + setTimeout(function() { + fs.stat(to, function (stater, st) { + if (stater && stater.code === "ENOENT") + fs$rename(from, to, CB); + else + cb(er) + }) + }, backoff) + if (backoff < 100) + backoff += 10; + return; + } + if (cb) cb(er) + }) + } + if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename) + return rename + })(fs.rename) + } + + // if read() returns EAGAIN, then just try it again. + fs.read = typeof fs.read !== 'function' ? fs.read + : (function (fs$read) { + function read (fd, buffer, offset, length, position, callback_) { + var callback + if (callback_ && typeof callback_ === 'function') { + var eagCounter = 0 + callback = function (er, _, __) { + if (er && er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + callback_.apply(this, arguments) + } + } + return fs$read.call(fs, fd, buffer, offset, length, position, callback) + } + + // This ensures `util.promisify` works as it does for native `fs.read`. + if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read) + return read + })(fs.read) + + fs.readSync = typeof fs.readSync !== 'function' ? fs.readSync + : (function (fs$readSync) { return function (fd, buffer, offset, length, position) { + var eagCounter = 0 + while (true) { + try { + return fs$readSync.call(fs, fd, buffer, offset, length, position) + } catch (er) { + if (er.code === 'EAGAIN' && eagCounter < 10) { + eagCounter ++ + continue + } + throw er + } + } + }})(fs.readSync) + + function patchLchmod (fs) { + fs.lchmod = function (path, mode, callback) { + fs.open( path + , constants.O_WRONLY | constants.O_SYMLINK + , mode + , function (err, fd) { + if (err) { + if (callback) callback(err) + return + } + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + fs.fchmod(fd, mode, function (err) { + fs.close(fd, function(err2) { + if (callback) callback(err || err2) + }) + }) + }) + } + + fs.lchmodSync = function (path, mode) { + var fd = fs.openSync(path, constants.O_WRONLY | constants.O_SYMLINK, mode) + + // prefer to return the chmod error, if one occurs, + // but still try to close, and report closing errors if they occur. + var threw = true + var ret + try { + ret = fs.fchmodSync(fd, mode) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + } + + function patchLutimes (fs) { + if (constants.hasOwnProperty("O_SYMLINK") && fs.futimes) { + fs.lutimes = function (path, at, mt, cb) { + fs.open(path, constants.O_SYMLINK, function (er, fd) { + if (er) { + if (cb) cb(er) + return + } + fs.futimes(fd, at, mt, function (er) { + fs.close(fd, function (er2) { + if (cb) cb(er || er2) + }) + }) + }) + } + + fs.lutimesSync = function (path, at, mt) { + var fd = fs.openSync(path, constants.O_SYMLINK) + var ret + var threw = true + try { + ret = fs.futimesSync(fd, at, mt) + threw = false + } finally { + if (threw) { + try { + fs.closeSync(fd) + } catch (er) {} + } else { + fs.closeSync(fd) + } + } + return ret + } + + } else if (fs.futimes) { + fs.lutimes = function (_a, _b, _c, cb) { if (cb) process.nextTick(cb) } + fs.lutimesSync = function () {} + } + } + + function chmodFix (orig) { + if (!orig) return orig + return function (target, mode, cb) { + return orig.call(fs, target, mode, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chmodFixSync (orig) { + if (!orig) return orig + return function (target, mode) { + try { + return orig.call(fs, target, mode) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + + function chownFix (orig) { + if (!orig) return orig + return function (target, uid, gid, cb) { + return orig.call(fs, target, uid, gid, function (er) { + if (chownErOk(er)) er = null + if (cb) cb.apply(this, arguments) + }) + } + } + + function chownFixSync (orig) { + if (!orig) return orig + return function (target, uid, gid) { + try { + return orig.call(fs, target, uid, gid) + } catch (er) { + if (!chownErOk(er)) throw er + } + } + } + + function statFix (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } + function callback (er, stats) { + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + if (cb) cb.apply(this, arguments) + } + return options ? orig.call(fs, target, options, callback) + : orig.call(fs, target, callback) + } + } + + function statFixSync (orig) { + if (!orig) return orig + // Older versions of Node erroneously returned signed integers for + // uid + gid. + return function (target, options) { + var stats = options ? orig.call(fs, target, options) + : orig.call(fs, target) + if (stats) { + if (stats.uid < 0) stats.uid += 0x100000000 + if (stats.gid < 0) stats.gid += 0x100000000 + } + return stats; + } + } + + // ENOSYS means that the fs doesn't support the op. Just ignore + // that, because it doesn't matter. + // + // if there's no getuid, or if getuid() is something other + // than 0, and the error is EINVAL or EPERM, then just ignore + // it. + // + // This specific case is a silent failure in cp, install, tar, + // and most other unix tools that manage permissions. + // + // When running as root, or if other types of errors are + // encountered, then it's strict. + function chownErOk (er) { + if (!er) + return true + + if (er.code === "ENOSYS") + return true + + var nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (er.code === "EINVAL" || er.code === "EPERM") + return true + } + + return false + } +} diff --git a/projects/org-skill-web-research/node_modules/inflight/LICENSE b/projects/org-skill-web-research/node_modules/inflight/LICENSE new file mode 100644 index 0000000..05eeeb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inflight/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/inflight/README.md b/projects/org-skill-web-research/node_modules/inflight/README.md new file mode 100644 index 0000000..6dc8929 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inflight/README.md @@ -0,0 +1,37 @@ +# inflight + +Add callbacks to requests in flight to avoid async duplication + +## USAGE + +```javascript +var inflight = require('inflight') + +// some request that does some stuff +function req(key, callback) { + // key is any random string. like a url or filename or whatever. + // + // will return either a falsey value, indicating that the + // request for this key is already in flight, or a new callback + // which when called will call all callbacks passed to inflightk + // with the same key + callback = inflight(key, callback) + + // If we got a falsey value back, then there's already a req going + if (!callback) return + + // this is where you'd fetch the url or whatever + // callback is also once()-ified, so it can safely be assigned + // to multiple events etc. First call wins. + setTimeout(function() { + callback(null, key) + }, 100) +} + +// only assigns a single setTimeout +// when it dings, all cbs get called +req('foo', cb1) +req('foo', cb2) +req('foo', cb3) +req('foo', cb4) +``` diff --git a/projects/org-skill-web-research/node_modules/inflight/inflight.js b/projects/org-skill-web-research/node_modules/inflight/inflight.js new file mode 100644 index 0000000..48202b3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inflight/inflight.js @@ -0,0 +1,54 @@ +var wrappy = require('wrappy') +var reqs = Object.create(null) +var once = require('once') + +module.exports = wrappy(inflight) + +function inflight (key, cb) { + if (reqs[key]) { + reqs[key].push(cb) + return null + } else { + reqs[key] = [cb] + return makeres(key) + } +} + +function makeres (key) { + return once(function RES () { + var cbs = reqs[key] + var len = cbs.length + var args = slice(arguments) + + // XXX It's somewhat ambiguous whether a new callback added in this + // pass should be queued for later execution if something in the + // list of callbacks throws, or if it should just be discarded. + // However, it's such an edge case that it hardly matters, and either + // choice is likely as surprising as the other. + // As it happens, we do go ahead and schedule it for later execution. + try { + for (var i = 0; i < len; i++) { + cbs[i].apply(null, args) + } + } finally { + if (cbs.length > len) { + // added more in the interim. + // de-zalgo, just in case, but don't call again. + cbs.splice(0, len) + process.nextTick(function () { + RES.apply(null, args) + }) + } else { + delete reqs[key] + } + } + }) +} + +function slice (args) { + var length = args.length + var array = [] + + for (var i = 0; i < length; i++) array[i] = args[i] + return array +} diff --git a/projects/org-skill-web-research/node_modules/inflight/package.json b/projects/org-skill-web-research/node_modules/inflight/package.json new file mode 100644 index 0000000..6084d35 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inflight/package.json @@ -0,0 +1,29 @@ +{ + "name": "inflight", + "version": "1.0.6", + "description": "Add callbacks to requests in flight to avoid async duplication", + "main": "inflight.js", + "files": [ + "inflight.js" + ], + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.1.2" + }, + "scripts": { + "test": "tap test.js --100" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/inflight.git" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "bugs": { + "url": "https://github.com/isaacs/inflight/issues" + }, + "homepage": "https://github.com/isaacs/inflight", + "license": "ISC" +} diff --git a/projects/org-skill-web-research/node_modules/inherits/LICENSE b/projects/org-skill-web-research/node_modules/inherits/LICENSE new file mode 100644 index 0000000..dea3013 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inherits/LICENSE @@ -0,0 +1,16 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/projects/org-skill-web-research/node_modules/inherits/README.md b/projects/org-skill-web-research/node_modules/inherits/README.md new file mode 100644 index 0000000..b1c5665 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inherits/README.md @@ -0,0 +1,42 @@ +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/projects/org-skill-web-research/node_modules/inherits/inherits.js b/projects/org-skill-web-research/node_modules/inherits/inherits.js new file mode 100644 index 0000000..f71f2d9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inherits/inherits.js @@ -0,0 +1,9 @@ +try { + var util = require('util'); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = require('./inherits_browser.js'); +} diff --git a/projects/org-skill-web-research/node_modules/inherits/inherits_browser.js b/projects/org-skill-web-research/node_modules/inherits/inherits_browser.js new file mode 100644 index 0000000..86bbb3d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inherits/inherits_browser.js @@ -0,0 +1,27 @@ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} diff --git a/projects/org-skill-web-research/node_modules/inherits/package.json b/projects/org-skill-web-research/node_modules/inherits/package.json new file mode 100644 index 0000000..37b4366 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/inherits/package.json @@ -0,0 +1,29 @@ +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.4", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": "git://github.com/isaacs/inherits", + "license": "ISC", + "scripts": { + "test": "tap" + }, + "devDependencies": { + "tap": "^14.2.4" + }, + "files": [ + "inherits.js", + "inherits_browser.js" + ] +} diff --git a/projects/org-skill-web-research/node_modules/is-buffer/LICENSE b/projects/org-skill-web-research/node_modules/is-buffer/LICENSE new file mode 100644 index 0000000..0c068ce --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/is-buffer/README.md b/projects/org-skill-web-research/node_modules/is-buffer/README.md new file mode 100644 index 0000000..cce0a8c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-buffer/README.md @@ -0,0 +1,53 @@ +# is-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/is-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/is-buffer +[npm-image]: https://img.shields.io/npm/v/is-buffer.svg +[npm-url]: https://npmjs.org/package/is-buffer +[downloads-image]: https://img.shields.io/npm/dm/is-buffer.svg +[downloads-url]: https://npmjs.org/package/is-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Determine if an object is a [`Buffer`](http://nodejs.org/api/buffer.html) (including the [browserify Buffer](https://github.com/feross/buffer)) + +[![saucelabs][saucelabs-image]][saucelabs-url] + +[saucelabs-image]: https://saucelabs.com/browser-matrix/is-buffer.svg +[saucelabs-url]: https://saucelabs.com/u/is-buffer + +## Why not use `Buffer.isBuffer`? + +This module lets you check if an object is a `Buffer` without using `Buffer.isBuffer` (which includes the whole [buffer](https://github.com/feross/buffer) module in [browserify](http://browserify.org/)). + +It's future-proof and works in node too! + +## install + +```bash +npm install is-buffer +``` + +## usage + +```js +var isBuffer = require('is-buffer') + +isBuffer(new Buffer(4)) // true + +isBuffer(undefined) // false +isBuffer(null) // false +isBuffer('') // false +isBuffer(true) // false +isBuffer(false) // false +isBuffer(0) // false +isBuffer(1) // false +isBuffer(1.0) // false +isBuffer('string') // false +isBuffer({}) // false +isBuffer(function foo () {}) // false +``` + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org). diff --git a/projects/org-skill-web-research/node_modules/is-buffer/index.js b/projects/org-skill-web-research/node_modules/is-buffer/index.js new file mode 100644 index 0000000..9cce396 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-buffer/index.js @@ -0,0 +1,21 @@ +/*! + * Determine if an object is a Buffer + * + * @author Feross Aboukhadijeh + * @license MIT + */ + +// The _isBuffer check is for Safari 5-7 support, because it's missing +// Object.prototype.constructor. Remove this eventually +module.exports = function (obj) { + return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer) +} + +function isBuffer (obj) { + return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj) +} + +// For Node v0.10 support. Remove this eventually. +function isSlowBuffer (obj) { + return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) +} diff --git a/projects/org-skill-web-research/node_modules/is-buffer/package.json b/projects/org-skill-web-research/node_modules/is-buffer/package.json new file mode 100644 index 0000000..ea12137 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-buffer/package.json @@ -0,0 +1,51 @@ +{ + "name": "is-buffer", + "description": "Determine if an object is a Buffer", + "version": "1.1.6", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "http://feross.org/" + }, + "bugs": { + "url": "https://github.com/feross/is-buffer/issues" + }, + "dependencies": {}, + "devDependencies": { + "standard": "*", + "tape": "^4.0.0", + "zuul": "^3.0.0" + }, + "keywords": [ + "buffer", + "buffers", + "type", + "core buffer", + "browser buffer", + "browserify", + "typed array", + "uint32array", + "int16array", + "int32array", + "float32array", + "float64array", + "browser", + "arraybuffer", + "dataview" + ], + "license": "MIT", + "main": "index.js", + "repository": { + "type": "git", + "url": "git://github.com/feross/is-buffer.git" + }, + "scripts": { + "test": "standard && npm run test-node && npm run test-browser", + "test-browser": "zuul -- test/*.js", + "test-browser-local": "zuul --local -- test/*.js", + "test-node": "tape test/*.js" + }, + "testling": { + "files": "test/*.js" + } +} diff --git a/projects/org-skill-web-research/node_modules/is-buffer/test/basic.js b/projects/org-skill-web-research/node_modules/is-buffer/test/basic.js new file mode 100644 index 0000000..be4f8e4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-buffer/test/basic.js @@ -0,0 +1,24 @@ +var isBuffer = require('../') +var test = require('tape') + +test('is-buffer', function (t) { + t.equal(isBuffer(Buffer.alloc(4)), true, 'new Buffer(4)') + t.equal(isBuffer(Buffer.allocUnsafeSlow(100)), true, 'SlowBuffer(100)') + + t.equal(isBuffer(undefined), false, 'undefined') + t.equal(isBuffer(null), false, 'null') + t.equal(isBuffer(''), false, 'empty string') + t.equal(isBuffer(true), false, 'true') + t.equal(isBuffer(false), false, 'false') + t.equal(isBuffer(0), false, '0') + t.equal(isBuffer(1), false, '1') + t.equal(isBuffer(1.0), false, '1.0') + t.equal(isBuffer('string'), false, 'string') + t.equal(isBuffer({}), false, '{}') + t.equal(isBuffer([]), false, '[]') + t.equal(isBuffer(function foo () {}), false, 'function foo () {}') + t.equal(isBuffer({ isBuffer: null }), false, '{ isBuffer: null }') + t.equal(isBuffer({ isBuffer: function () { throw new Error() } }), false, '{ isBuffer: function () { throw new Error() } }') + + t.end() +}) diff --git a/projects/org-skill-web-research/node_modules/is-extendable/LICENSE b/projects/org-skill-web-research/node_modules/is-extendable/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-extendable/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/is-extendable/README.md b/projects/org-skill-web-research/node_modules/is-extendable/README.md new file mode 100644 index 0000000..e4cfaeb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-extendable/README.md @@ -0,0 +1,72 @@ +# is-extendable [![NPM version](https://badge.fury.io/js/is-extendable.svg)](http://badge.fury.io/js/is-extendable) + +> Returns true if a value is any of the object types: array, regexp, plain object, function or date. This is useful for determining if a value can be extended, e.g. "can the value have keys?" + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i is-extendable --save +``` + +## Usage + +```js +var isExtendable = require('is-extendable'); +``` + +Returns true if the value is any of the following: + +* `array` +* `regexp` +* `plain object` +* `function` +* `date` +* `error` + +## Notes + +All objects in JavaScript can have keys, but it's a pain to check for this, since we ether need to verify that the value is not `null` or `undefined` and: + +* the value is not a primitive, or +* that the object is an `object`, `function` + +Also note that an `extendable` object is not the same as an [extensible object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible), which is one that (in es6) is not sealed, frozen, or marked as non-extensible using `preventExtensions`. + +## Related projects + +* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [is-equal-shallow](https://github.com/jonschlinkert/is-equal-shallow): Does a shallow comparison of two objects, returning false if the keys or values differ. +* [kind-of](https://github.com/jonschlinkert/kind-of): Get the native type of a value. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/is-extendable/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 04, 2015._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/is-extendable/index.js b/projects/org-skill-web-research/node_modules/is-extendable/index.js new file mode 100644 index 0000000..4ee71a4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-extendable/index.js @@ -0,0 +1,13 @@ +/*! + * is-extendable + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +module.exports = function isExtendable(val) { + return typeof val !== 'undefined' && val !== null + && (typeof val === 'object' || typeof val === 'function'); +}; diff --git a/projects/org-skill-web-research/node_modules/is-extendable/package.json b/projects/org-skill-web-research/node_modules/is-extendable/package.json new file mode 100644 index 0000000..5dd006e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-extendable/package.json @@ -0,0 +1,51 @@ +{ + "name": "is-extendable", + "description": "Returns true if a value is any of the object types: array, regexp, plain object, function or date. This is useful for determining if a value can be extended, e.g. \"can the value have keys?\"", + "version": "0.1.1", + "homepage": "https://github.com/jonschlinkert/is-extendable", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/is-extendable", + "bugs": { + "url": "https://github.com/jonschlinkert/is-extendable/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "mocha": "*" + }, + "keywords": [ + "array", + "assign", + "check", + "date", + "extend", + "extensible", + "function", + "is", + "object", + "regex", + "test" + ], + "verbiage": { + "related": { + "list": [ + "isobject", + "is-plain-object", + "kind-of", + "is-extendable", + "is-equal-shallow", + "extend-shallow", + "assign-deep" + ] + } + } +} diff --git a/projects/org-skill-web-research/node_modules/is-plain-object/LICENSE b/projects/org-skill-web-research/node_modules/is-plain-object/LICENSE new file mode 100644 index 0000000..3f2eca1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-plain-object/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/is-plain-object/README.md b/projects/org-skill-web-research/node_modules/is-plain-object/README.md new file mode 100644 index 0000000..1f9d0c8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-plain-object/README.md @@ -0,0 +1,104 @@ +# is-plain-object [![NPM version](https://img.shields.io/npm/v/is-plain-object.svg?style=flat)](https://www.npmjs.com/package/is-plain-object) [![NPM monthly downloads](https://img.shields.io/npm/dm/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![NPM total downloads](https://img.shields.io/npm/dt/is-plain-object.svg?style=flat)](https://npmjs.org/package/is-plain-object) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/is-plain-object.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/is-plain-object) + +> Returns true if an object was created by the `Object` constructor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save is-plain-object +``` + +Use [isobject](https://github.com/jonschlinkert/isobject) if you only want to check if the value is an object and not an array or null. + +## Usage + +```js +var isPlainObject = require('is-plain-object'); +``` + +**true** when created by the `Object` constructor. + +```js +isPlainObject(Object.create({})); +//=> true +isPlainObject(Object.create(Object.prototype)); +//=> true +isPlainObject({foo: 'bar'}); +//=> true +isPlainObject({}); +//=> true +``` + +**false** when not created by the `Object` constructor. + +```js +isPlainObject(1); +//=> false +isPlainObject(['foo', 'bar']); +//=> false +isPlainObject([]); +//=> false +isPlainObject(new Foo); +//=> false +isPlainObject(null); +//=> false +isPlainObject(Object.create(null)); +//=> false +``` + +## About + +### Related projects + +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [isobject](https://www.npmjs.com/package/isobject): Returns true if the value is an object and not an array or null. | [homepage](https://github.com/jonschlinkert/isobject "Returns true if the value is an object and not an array or null.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 17 | [jonschlinkert](https://github.com/jonschlinkert) | +| 6 | [stevenvachon](https://github.com/stevenvachon) | +| 3 | [onokumus](https://github.com/onokumus) | +| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 11, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/is-plain-object/index.d.ts b/projects/org-skill-web-research/node_modules/is-plain-object/index.d.ts new file mode 100644 index 0000000..74a44e9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-plain-object/index.d.ts @@ -0,0 +1,5 @@ +export = isPlainObject; + +declare function isPlainObject(o: any): boolean; + +declare namespace isPlainObject {} diff --git a/projects/org-skill-web-research/node_modules/is-plain-object/index.js b/projects/org-skill-web-research/node_modules/is-plain-object/index.js new file mode 100644 index 0000000..c328484 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-plain-object/index.js @@ -0,0 +1,37 @@ +/*! + * is-plain-object + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +var isObject = require('isobject'); + +function isObjectObject(o) { + return isObject(o) === true + && Object.prototype.toString.call(o) === '[object Object]'; +} + +module.exports = function isPlainObject(o) { + var ctor,prot; + + if (isObjectObject(o) === false) return false; + + // If has modified constructor + ctor = o.constructor; + if (typeof ctor !== 'function') return false; + + // If has modified prototype + prot = ctor.prototype; + if (isObjectObject(prot) === false) return false; + + // If constructor does not have an Object-specific method + if (prot.hasOwnProperty('isPrototypeOf') === false) { + return false; + } + + // Most likely a plain Object + return true; +}; diff --git a/projects/org-skill-web-research/node_modules/is-plain-object/package.json b/projects/org-skill-web-research/node_modules/is-plain-object/package.json new file mode 100644 index 0000000..dd60498 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/is-plain-object/package.json @@ -0,0 +1,79 @@ +{ + "name": "is-plain-object", + "description": "Returns true if an object was created by the `Object` constructor.", + "version": "2.0.4", + "homepage": "https://github.com/jonschlinkert/is-plain-object", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Osman Nuri Okumuş (http://onokumus.com)", + "Steven Vachon (https://svachon.com)", + "(https://github.com/wtgtybhertgeghgtwtg)" + ], + "repository": "jonschlinkert/is-plain-object", + "bugs": { + "url": "https://github.com/jonschlinkert/is-plain-object/issues" + }, + "license": "MIT", + "files": [ + "index.d.ts", + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "browserify": "browserify index.js --standalone isPlainObject | uglifyjs --compress --mangle -o browser/is-plain-object.js", + "test_browser": "mocha-phantomjs test/browser.html", + "test_node": "mocha", + "test": "npm run test_node && npm run browserify && npm run test_browser" + }, + "dependencies": { + "isobject": "^3.0.1" + }, + "devDependencies": { + "browserify": "^14.4.0", + "chai": "^4.0.2", + "gulp-format-md": "^1.0.0", + "mocha": "^3.4.2", + "mocha-phantomjs": "^4.1.0", + "phantomjs": "^2.1.7", + "uglify-js": "^3.0.24" + }, + "keywords": [ + "check", + "is", + "is-object", + "isobject", + "javascript", + "kind", + "kind-of", + "object", + "plain", + "type", + "typeof", + "value" + ], + "types": "index.d.ts", + "verb": { + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "is-number", + "isobject", + "kind-of" + ] + }, + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/isobject/LICENSE b/projects/org-skill-web-research/node_modules/isobject/LICENSE new file mode 100644 index 0000000..943e71d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/isobject/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/isobject/README.md b/projects/org-skill-web-research/node_modules/isobject/README.md new file mode 100644 index 0000000..d01feaa --- /dev/null +++ b/projects/org-skill-web-research/node_modules/isobject/README.md @@ -0,0 +1,122 @@ +# isobject [![NPM version](https://img.shields.io/npm/v/isobject.svg?style=flat)](https://www.npmjs.com/package/isobject) [![NPM monthly downloads](https://img.shields.io/npm/dm/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![NPM total downloads](https://img.shields.io/npm/dt/isobject.svg?style=flat)](https://npmjs.org/package/isobject) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/isobject.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/isobject) + +> Returns true if the value is an object and not an array or null. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save isobject +``` + +Install with [yarn](https://yarnpkg.com): + +```sh +$ yarn add isobject +``` + +Use [is-plain-object](https://github.com/jonschlinkert/is-plain-object) if you want only objects that are created by the `Object` constructor. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install isobject +``` +Install with [bower](https://bower.io/) + +```sh +$ bower install isobject +``` + +## Usage + +```js +var isObject = require('isobject'); +``` + +**True** + +All of the following return `true`: + +```js +isObject({}); +isObject(Object.create({})); +isObject(Object.create(Object.prototype)); +isObject(Object.create(null)); +isObject({}); +isObject(new Foo); +isObject(/foo/); +``` + +**False** + +All of the following return `false`: + +```js +isObject(); +isObject(function () {}); +isObject(1); +isObject([]); +isObject(undefined); +isObject(null); +``` + +## About + +### Related projects + +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [is-plain-object](https://www.npmjs.com/package/is-plain-object): Returns true if an object was created by the `Object` constructor. | [homepage](https://github.com/jonschlinkert/is-plain-object "Returns true if an object was created by the `Object` constructor.") +* [kind-of](https://www.npmjs.com/package/kind-of): Get the native type of a value. | [homepage](https://github.com/jonschlinkert/kind-of "Get the native type of a value.") +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 29 | [jonschlinkert](https://github.com/jonschlinkert) | +| 4 | [doowb](https://github.com/doowb) | +| 1 | [magnudae](https://github.com/magnudae) | +| 1 | [LeSuisse](https://github.com/LeSuisse) | +| 1 | [tmcw](https://github.com/tmcw) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on June 30, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/isobject/index.d.ts b/projects/org-skill-web-research/node_modules/isobject/index.d.ts new file mode 100644 index 0000000..55f81c2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/isobject/index.d.ts @@ -0,0 +1,5 @@ +export = isObject; + +declare function isObject(val: any): boolean; + +declare namespace isObject {} diff --git a/projects/org-skill-web-research/node_modules/isobject/index.js b/projects/org-skill-web-research/node_modules/isobject/index.js new file mode 100644 index 0000000..2d59958 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/isobject/index.js @@ -0,0 +1,12 @@ +/*! + * isobject + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function isObject(val) { + return val != null && typeof val === 'object' && Array.isArray(val) === false; +}; diff --git a/projects/org-skill-web-research/node_modules/isobject/package.json b/projects/org-skill-web-research/node_modules/isobject/package.json new file mode 100644 index 0000000..62aa8c1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/isobject/package.json @@ -0,0 +1,74 @@ +{ + "name": "isobject", + "description": "Returns true if the value is an object and not an array or null.", + "version": "3.0.1", + "homepage": "https://github.com/jonschlinkert/isobject", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "(https://github.com/LeSuisse)", + "Brian Woodward (https://twitter.com/doowb)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Magnús Dæhlen (https://github.com/magnudae)", + "Tom MacWright (https://macwright.org)" + ], + "repository": "jonschlinkert/isobject", + "bugs": { + "url": "https://github.com/jonschlinkert/isobject/issues" + }, + "license": "MIT", + "files": [ + "index.d.ts", + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": {}, + "devDependencies": { + "gulp-format-md": "^0.1.9", + "mocha": "^2.4.5" + }, + "keywords": [ + "check", + "is", + "is-object", + "isobject", + "kind", + "kind-of", + "kindof", + "native", + "object", + "type", + "typeof", + "value" + ], + "types": "index.d.ts", + "verb": { + "related": { + "list": [ + "extend-shallow", + "is-plain-object", + "kind-of", + "merge-deep" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/jsonfile/LICENSE b/projects/org-skill-web-research/node_modules/jsonfile/LICENSE new file mode 100644 index 0000000..cb7e807 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/jsonfile/LICENSE @@ -0,0 +1,15 @@ +(The MIT License) + +Copyright (c) 2012-2015, JP Richardson + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files +(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, + merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/jsonfile/README.md b/projects/org-skill-web-research/node_modules/jsonfile/README.md new file mode 100644 index 0000000..215dc09 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/jsonfile/README.md @@ -0,0 +1,230 @@ +Node.js - jsonfile +================ + +Easily read/write JSON files in Node.js. _Note: this module cannot be used in the browser._ + +[![npm Package](https://img.shields.io/npm/v/jsonfile.svg?style=flat-square)](https://www.npmjs.org/package/jsonfile) +[![linux build status](https://img.shields.io/github/actions/workflow/status/jprichardson/node-jsonfile/ci.yml?branch=master)](https://github.com/jprichardson/node-jsonfile/actions?query=branch%3Amaster) +[![windows Build status](https://img.shields.io/appveyor/ci/jprichardson/node-jsonfile/master.svg?label=windows%20build)](https://ci.appveyor.com/project/jprichardson/node-jsonfile/branch/master) + +Standard JavaScript + +Why? +---- + +Writing `JSON.stringify()` and then `fs.writeFile()` and `JSON.parse()` with `fs.readFile()` enclosed in `try/catch` blocks became annoying. + + + +Installation +------------ + + npm install --save jsonfile + + + +API +--- + +* [`readFile(filename, [options], callback)`](#readfilefilename-options-callback) +* [`readFileSync(filename, [options])`](#readfilesyncfilename-options) +* [`writeFile(filename, obj, [options], callback)`](#writefilefilename-obj-options-callback) +* [`writeFileSync(filename, obj, [options])`](#writefilesyncfilename-obj-options) + +---- + +### readFile(filename, [options], callback) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFile`](https://nodejs.org/api/fs.html#fs_fs_readfile_path_options_callback) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). + - `throws` (`boolean`, default: `true`). If `JSON.parse` throws an error, pass this error to the callback. + If `false`, returns `null` for the object. + + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file, function (err, obj) { + if (err) console.error(err) + console.dir(obj) +}) +``` + +You can also use this method with promises. The `readFile` method will return a promise if you do not pass a callback function. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' +jsonfile.readFile(file) + .then(obj => console.dir(obj)) + .catch(error => console.error(error)) +``` + +---- + +### readFileSync(filename, [options]) + +`options` (`object`, default `undefined`): Pass in any [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options) options or set `reviver` for a [JSON reviver](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse). +- `throws` (`boolean`, default: `true`). If an error is encountered reading or parsing the file, throw the error. If `false`, returns `null` for the object. + +```js +const jsonfile = require('jsonfile') +const file = '/tmp/data.json' + +console.dir(jsonfile.readFileSync(file)) +``` + +---- + +### writeFile(filename, obj, [options], callback) + +`options`: Pass in any [`fs.writeFile`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, function (err) { + if (err) console.error(err) +}) +``` +Or use with promises as follows: + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj) + .then(res => { + console.log('Write complete') + }) + .catch(error => console.error(error)) +``` + + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2 }, function (err) { + if (err) console.error(err) +}) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, EOL: '\r\n' }, function (err) { + if (err) console.error(err) +}) +``` + + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { spaces: 2, finalEOL: false }, function (err) { + if (err) console.log(err) +}) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFile` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFile(file, obj, { flag: 'a' }, function (err) { + if (err) console.error(err) +}) +``` + +---- + +### writeFileSync(filename, obj, [options]) + +`options`: Pass in any [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) options or set `replacer` for a [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). Can also pass in `spaces`, or override `EOL` string or set `finalEOL` flag as `false` to not save the file with `EOL` at the end. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj) +``` + +**formatting with spaces:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2 }) +``` + +**overriding EOL:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, EOL: '\r\n' }) +``` + +**disabling the EOL at the end of file:** + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/data.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { spaces: 2, finalEOL: false }) +``` + +**appending to an existing JSON file:** + +You can use `fs.writeFileSync` option `{ flag: 'a' }` to achieve this. + +```js +const jsonfile = require('jsonfile') + +const file = '/tmp/mayAlreadyExistedData.json' +const obj = { name: 'JP' } + +jsonfile.writeFileSync(file, obj, { flag: 'a' }) +``` + +License +------- + +(MIT License) + +Copyright 2012-2016, JP Richardson diff --git a/projects/org-skill-web-research/node_modules/jsonfile/index.js b/projects/org-skill-web-research/node_modules/jsonfile/index.js new file mode 100644 index 0000000..acd0af2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/jsonfile/index.js @@ -0,0 +1,88 @@ +let _fs +try { + _fs = require('graceful-fs') +} catch (_) { + _fs = require('fs') +} +const universalify = require('universalify') +const { stringify, stripBom } = require('./utils') + +async function _readFile (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + let data = await universalify.fromCallback(fs.readFile)(file, options) + + data = stripBom(data) + + let obj + try { + obj = JSON.parse(data, options ? options.reviver : null) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } + + return obj +} + +const readFile = universalify.fromPromise(_readFile) + +function readFileSync (file, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + const fs = options.fs || _fs + + const shouldThrow = 'throws' in options ? options.throws : true + + try { + let content = fs.readFileSync(file, options) + content = stripBom(content) + return JSON.parse(content, options.reviver) + } catch (err) { + if (shouldThrow) { + err.message = `${file}: ${err.message}` + throw err + } else { + return null + } + } +} + +async function _writeFile (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + + await universalify.fromCallback(fs.writeFile)(file, str, options) +} + +const writeFile = universalify.fromPromise(_writeFile) + +function writeFileSync (file, obj, options = {}) { + const fs = options.fs || _fs + + const str = stringify(obj, options) + // not sure if fs.writeFileSync returns anything, but just in case + return fs.writeFileSync(file, str, options) +} + +// NOTE: do not change this export format; required for ESM compat +// see https://github.com/jprichardson/node-jsonfile/pull/162 for details +module.exports = { + readFile, + readFileSync, + writeFile, + writeFileSync +} diff --git a/projects/org-skill-web-research/node_modules/jsonfile/package.json b/projects/org-skill-web-research/node_modules/jsonfile/package.json new file mode 100644 index 0000000..0ff96cc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/jsonfile/package.json @@ -0,0 +1,40 @@ +{ + "name": "jsonfile", + "version": "6.2.0", + "description": "Easily read/write JSON files.", + "repository": { + "type": "git", + "url": "git@github.com:jprichardson/node-jsonfile.git" + }, + "keywords": [ + "read", + "write", + "file", + "json", + "fs", + "fs-extra" + ], + "author": "JP Richardson ", + "license": "MIT", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + }, + "devDependencies": { + "mocha": "^8.2.0", + "rimraf": "^2.4.0", + "standard": "^16.0.1" + }, + "main": "index.js", + "files": [ + "index.js", + "utils.js" + ], + "scripts": { + "lint": "standard", + "test": "npm run lint && npm run unit", + "unit": "mocha" + } +} diff --git a/projects/org-skill-web-research/node_modules/jsonfile/utils.js b/projects/org-skill-web-research/node_modules/jsonfile/utils.js new file mode 100644 index 0000000..b5ff48e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/jsonfile/utils.js @@ -0,0 +1,14 @@ +function stringify (obj, { EOL = '\n', finalEOL = true, replacer = null, spaces } = {}) { + const EOF = finalEOL ? EOL : '' + const str = JSON.stringify(obj, replacer, spaces) + + return str.replace(/\n/g, EOL) + EOF +} + +function stripBom (content) { + // we do this because JSON.parse would convert it to a utf8 string if encoding wasn't specified + if (Buffer.isBuffer(content)) content = content.toString('utf8') + return content.replace(/^\uFEFF/, '') +} + +module.exports = { stringify, stripBom } diff --git a/projects/org-skill-web-research/node_modules/kind-of/LICENSE b/projects/org-skill-web-research/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/kind-of/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/kind-of/README.md b/projects/org-skill-web-research/node_modules/kind-of/README.md new file mode 100644 index 0000000..6a9df36 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/kind-of/README.md @@ -0,0 +1,261 @@ +# kind-of [![NPM version](https://img.shields.io/npm/v/kind-of.svg?style=flat)](https://www.npmjs.com/package/kind-of) [![NPM monthly downloads](https://img.shields.io/npm/dm/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![NPM total downloads](https://img.shields.io/npm/dt/kind-of.svg?style=flat)](https://npmjs.org/package/kind-of) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/kind-of.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save kind-of +``` + +## Install + +Install with [bower](https://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/foo/); +//=> 'regexp' + +kindOf(new RegExp('foo')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' + +kindOf(new Int8Array()); +//=> 'int8array' + +kindOf(new Uint8Array()); +//=> 'uint8array' + +kindOf(new Uint8ClampedArray()); +//=> 'uint8clampedarray' + +kindOf(new Int16Array()); +//=> 'int16array' + +kindOf(new Uint16Array()); +//=> 'uint16array' + +kindOf(new Int32Array()); +//=> 'int32array' + +kindOf(new Uint32Array()); +//=> 'uint32array' + +kindOf(new Float32Array()); +//=> 'float32array' + +kindOf(new Float64Array()); +//=> 'float64array' +``` + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) + +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## About + +### Related projects + +* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet") +* [is-number](https://www.npmjs.com/package/is-number): Returns true if the value is a number. comprehensive tests. | [homepage](https://github.com/jonschlinkert/is-number "Returns true if the value is a number. comprehensive tests.") +* [is-primitive](https://www.npmjs.com/package/is-primitive): Returns `true` if the value is a primitive. | [homepage](https://github.com/jonschlinkert/is-primitive "Returns `true` if the value is a primitive. ") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 59 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [miguelmota](https://github.com/miguelmota) | +| 1 | [dtothefp](https://github.com/dtothefp) | +| 1 | [ksheedlo](https://github.com/ksheedlo) | +| 1 | [pdehaan](https://github.com/pdehaan) | +| 1 | [laggingreflex](https://github.com/laggingreflex) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 16, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/kind-of/index.js b/projects/org-skill-web-research/node_modules/kind-of/index.js new file mode 100644 index 0000000..b52c291 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/kind-of/index.js @@ -0,0 +1,116 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; + } + + // buffer + if (isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; + } + if (type === '[object Int32Array]') { + return 'int32array'; + } + if (type === '[object Uint32Array]') { + return 'uint32array'; + } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; +}; diff --git a/projects/org-skill-web-research/node_modules/kind-of/package.json b/projects/org-skill-web-research/node_modules/kind-of/package.json new file mode 100644 index 0000000..5de879e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/kind-of/package.json @@ -0,0 +1,90 @@ +{ + "name": "kind-of", + "description": "Get the native type of a value.", + "version": "3.2.2", + "homepage": "https://github.com/jonschlinkert/kind-of", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "David Fox-Powell (https://dtothefp.github.io/me)", + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Ken Sheedlo (kensheedlo.com)", + "laggingreflex (https://github.com/laggingreflex)", + "Miguel Mota (https://miguelmota.com)", + "Peter deHaan (http://about.me/peterdehaan)" + ], + "repository": "jonschlinkert/kind-of", + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "prepublish": "browserify -o browser.js -e index.js -s index --bare" + }, + "dependencies": { + "is-buffer": "^1.1.5" + }, + "devDependencies": { + "ansi-bold": "^0.1.1", + "benchmarked": "^1.0.0", + "browserify": "^14.3.0", + "glob": "^7.1.1", + "gulp-format-md": "^0.1.12", + "mocha": "^3.3.0", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "of", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "verb": { + "related": { + "list": [ + "is-glob", + "is-number", + "is-primitive" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/lazy-cache/LICENSE b/projects/org-skill-web-research/node_modules/lazy-cache/LICENSE new file mode 100644 index 0000000..1e49edf --- /dev/null +++ b/projects/org-skill-web-research/node_modules/lazy-cache/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/lazy-cache/README.md b/projects/org-skill-web-research/node_modules/lazy-cache/README.md new file mode 100644 index 0000000..33b5a4d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/lazy-cache/README.md @@ -0,0 +1,147 @@ +# lazy-cache [![NPM version](https://img.shields.io/npm/v/lazy-cache.svg?style=flat)](https://www.npmjs.com/package/lazy-cache) [![NPM downloads](https://img.shields.io/npm/dm/lazy-cache.svg?style=flat)](https://npmjs.org/package/lazy-cache) [![Build Status](https://img.shields.io/travis/jonschlinkert/lazy-cache.svg?style=flat)](https://travis-ci.org/jonschlinkert/lazy-cache) + +> Cache requires to be lazy-loaded when needed. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install lazy-cache --save +``` + +If you use webpack and are experiencing issues, try using [unlazy-loader](https://github.com/doowb/unlazy-loader), a webpack loader that fixes the bug that prevents webpack from working with native javascript getters. + +## Usage + +```js +var utils = require('lazy-cache')(require); +``` + +**Use as a property on `lazy`** + +The module is also added as a property to the `lazy` function +so it can be called without having to call a function first. + +```js +var utils = require('lazy-cache')(require); + +// `npm install glob` +utils('glob'); + +// glob sync +console.log(utils.glob.sync('*.js')); + +// glob async +utils.glob('*.js', function (err, files) { + console.log(files); +}); +``` + +**Use as a function** + +```js +var utils = require('lazy-cache')(require); +var glob = utils('glob'); + +// `glob` is a now a function that may be called when needed +glob().sync('foo/*.js'); +``` + +## Aliases + +An alias may be passed as the second argument if you don't want to use the automatically camel-cased variable name. + +**Example** + +```js +var utils = require('lazy-cache')(require); + +// alias `ansi-yellow` as `yellow` +utils('ansi-yellow', 'yellow'); +console.log(utils.yellow('foo')); +``` + +## Browserify usage + +**Example** + +```js +var utils = require('lazy-cache')(require); +// temporarily re-assign `require` to trick browserify +var fn = require; +require = utils; +// list module dependencies (here, `require` is actually `lazy-cache`) +require('glob'); +require = fn; // restore the native `require` function + +/** + * Now you can use glob with the `utils.glob` variable + */ + +// sync +console.log(utils.glob.sync('*.js')); + +// async +utils.glob('*.js', function (err, files) { + console.log(files.join('\n')); +}); +``` + +## Kill switch + +In certain rare edge cases it may be necessary to unlazy all lazy-cached dependencies (5 reported cases after ~30 million downloads). + +To force lazy-cache to immediately invoke all dependencies, do: + +```js +process.env.UNLAZY = true; +``` + +## Related projects + +You might also be interested in these projects: + +[lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps) + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new). + +## Building docs + +Generate readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install verb && npm run docs +``` + +Or, if [verb](https://github.com/verbose/verb) is installed globally: + +```sh +$ verb +``` + +## Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/lazy-cache/blob/master/LICENSE). + +*** + +_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 22, 2016._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/lazy-cache/index.js b/projects/org-skill-web-research/node_modules/lazy-cache/index.js new file mode 100644 index 0000000..da7897d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/lazy-cache/index.js @@ -0,0 +1,67 @@ +'use strict'; + +/** + * Cache results of the first function call to ensure only calling once. + * + * ```js + * var utils = require('lazy-cache')(require); + * // cache the call to `require('ansi-yellow')` + * utils('ansi-yellow', 'yellow'); + * // use `ansi-yellow` + * console.log(utils.yellow('this is yellow')); + * ``` + * + * @param {Function} `fn` Function that will be called only once. + * @return {Function} Function that can be called to get the cached function + * @api public + */ + +function lazyCache(fn) { + var cache = {}; + var proxy = function(mod, name) { + name = name || camelcase(mod); + + // check both boolean and string in case `process.env` cases to string + if (process.env.UNLAZY === 'true' || process.env.UNLAZY === true || process.env.TRAVIS) { + cache[name] = fn(mod); + } + + Object.defineProperty(proxy, name, { + enumerable: true, + configurable: true, + get: getter + }); + + function getter() { + if (cache.hasOwnProperty(name)) { + return cache[name]; + } + return (cache[name] = fn(mod)); + } + return getter; + }; + return proxy; +} + +/** + * Used to camelcase the name to be stored on the `lazy` object. + * + * @param {String} `str` String containing `_`, `.`, `-` or whitespace that will be camelcased. + * @return {String} camelcased string. + */ + +function camelcase(str) { + if (str.length === 1) { + return str.toLowerCase(); + } + str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase(); + return str.replace(/[\W_]+(\w|$)/g, function(_, ch) { + return ch.toUpperCase(); + }); +} + +/** + * Expose `lazyCache` + */ + +module.exports = lazyCache; diff --git a/projects/org-skill-web-research/node_modules/lazy-cache/package.json b/projects/org-skill-web-research/node_modules/lazy-cache/package.json new file mode 100644 index 0000000..e635e98 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/lazy-cache/package.json @@ -0,0 +1,58 @@ +{ + "name": "lazy-cache", + "description": "Cache requires to be lazy-loaded when needed.", + "version": "1.0.4", + "homepage": "https://github.com/jonschlinkert/lazy-cache", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/lazy-cache", + "bugs": { + "url": "https://github.com/jonschlinkert/lazy-cache/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "ansi-yellow": "^0.1.1", + "glob": "^7.0.3", + "gulp-format-md": "^0.1.8", + "mocha": "^2.4.5" + }, + "keywords": [ + "cache", + "caching", + "dependencies", + "dependency", + "lazy", + "require", + "requires" + ], + "verb": { + "related": { + "list": [ + "lint-deps" + ] + }, + "plugins": [ + "gulp-format-md" + ], + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/merge-deep/LICENSE b/projects/org-skill-web-research/node_modules/merge-deep/LICENSE new file mode 100644 index 0000000..9af4a67 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/merge-deep/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-present, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/merge-deep/README.md b/projects/org-skill-web-research/node_modules/merge-deep/README.md new file mode 100644 index 0000000..22ea846 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/merge-deep/README.md @@ -0,0 +1,92 @@ +# merge-deep [![NPM version](https://img.shields.io/npm/v/merge-deep.svg?style=flat)](https://www.npmjs.com/package/merge-deep) [![NPM monthly downloads](https://img.shields.io/npm/dm/merge-deep.svg?style=flat)](https://npmjs.org/package/merge-deep) [![NPM total downloads](https://img.shields.io/npm/dt/merge-deep.svg?style=flat)](https://npmjs.org/package/merge-deep) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/merge-deep.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/merge-deep) + +> Recursively merge values in a javascript object. + +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save merge-deep +``` + +Based on [mout's](https://github.com/mout/mout) implementation of merge + +## Usage + +```js +var merge = require('merge-deep'); + +merge({a: {b: {c: 'c', d: 'd'}}}, {a: {b: {e: 'e', f: 'f'}}}); +//=> { a: { b: { c: 'c', d: 'd', e: 'e', f: 'f' } } } +``` + +## About + +
+Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +
+ +
+Running Tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +
+ +
+Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +
+ +### Related projects + +You might also be interested in these projects: + +* [assign-deep](https://www.npmjs.com/package/assign-deep): Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects… [more](https://github.com/jonschlinkert/assign-deep) | [homepage](https://github.com/jonschlinkert/assign-deep "Deeply assign the values of all enumerable-own-properties and symbols from one or more source objects to a target object. Returns the target object.") +* [defaults-deep](https://www.npmjs.com/package/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. | [homepage](https://github.com/jonschlinkert/defaults-deep "Like `extend` but recursively copies only the missing properties/values to the target object.") +* [extend-shallow](https://www.npmjs.com/package/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. | [homepage](https://github.com/jonschlinkert/extend-shallow "Extend an object with the properties of additional objects. node.js/javascript util.") +* [merge-deep](https://www.npmjs.com/package/merge-deep): Recursively merge values in a javascript object. | [homepage](https://github.com/jonschlinkert/merge-deep "Recursively merge values in a javascript object.") +* [mixin-deep](https://www.npmjs.com/package/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone… [more](https://github.com/jonschlinkert/mixin-deep) | [homepage](https://github.com/jonschlinkert/mixin-deep "Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. No dependencies.") +* [omit-deep](https://www.npmjs.com/package/omit-deep): Recursively omit the specified key or keys from an object. | [homepage](https://github.com/jonschlinkert/omit-deep "Recursively omit the specified key or keys from an object.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 32 | [jonschlinkert](https://github.com/jonschlinkert) | +| 8 | [doowb](https://github.com/doowb) | + +### Author + +**Jon Schlinkert** + +* [GitHub Profile](https://github.com/jonschlinkert) +* [Twitter Profile](https://twitter.com/jonschlinkert) +* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) + +### License + +Copyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on January 11, 2021._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/merge-deep/index.js b/projects/org-skill-web-research/node_modules/merge-deep/index.js new file mode 100644 index 0000000..08db87a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/merge-deep/index.js @@ -0,0 +1,63 @@ +/*! + * merge-deep + * + * Copyright (c) 2014-2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var union = require('arr-union'); +var clone = require('clone-deep'); +var typeOf = require('kind-of'); + +module.exports = function mergeDeep(orig, objects) { + if (!isObject(orig) && !Array.isArray(orig)) { + orig = {}; + } + + var target = clone(orig); + var len = arguments.length; + var idx = 0; + + while (++idx < len) { + var val = arguments[idx]; + + if (isObject(val) || Array.isArray(val)) { + merge(target, val); + } + } + return target; +}; + +function merge(target, obj) { + for (var key in obj) { + if (!isValidKey(key) || !hasOwn(obj, key)) { + continue; + } + + var oldVal = obj[key]; + var newVal = target[key]; + + if (isObject(newVal) && isObject(oldVal)) { + target[key] = merge(newVal, oldVal); + } else if (Array.isArray(newVal)) { + target[key] = union([], newVal, oldVal); + } else { + target[key] = clone(oldVal); + } + } + return target; +} + +function hasOwn(obj, key) { + return Object.prototype.hasOwnProperty.call(obj, key); +} + +function isObject(val) { + return typeOf(val) === 'object' || typeOf(val) === 'function'; +} + +function isValidKey(key) { + return key !== '__proto__' && key !== 'constructor' && key !== 'prototype'; +} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/merge-deep/package.json b/projects/org-skill-web-research/node_modules/merge-deep/package.json new file mode 100644 index 0000000..ad300ff --- /dev/null +++ b/projects/org-skill-web-research/node_modules/merge-deep/package.json @@ -0,0 +1,79 @@ +{ + "name": "merge-deep", + "description": "Recursively merge values in a javascript object.", + "version": "3.0.3", + "homepage": "https://github.com/jonschlinkert/merge-deep", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/merge-deep", + "bugs": { + "url": "https://github.com/jonschlinkert/merge-deep/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "devDependencies": { + "gulp-format-md": "^0.1.7", + "mocha": "^2.4.5" + }, + "keywords": [ + "clone", + "clone-deep", + "copy", + "deep", + "deep-clone", + "deep-merge", + "extend", + "key", + "keys", + "merge", + "merge-deep", + "object", + "objects", + "prop", + "properties", + "property", + "props", + "value", + "values" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "assign-deep", + "defaults-deep", + "extend-shallow", + "merge-deep", + "mixin-deep", + "omit-deep" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/minimatch/LICENSE b/projects/org-skill-web-research/node_modules/minimatch/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/minimatch/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/minimatch/README.md b/projects/org-skill-web-research/node_modules/minimatch/README.md new file mode 100644 index 0000000..60d8850 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/minimatch/README.md @@ -0,0 +1,267 @@ +# minimatch + +A minimal matching utility. + +[![Build Status](https://travis-ci.org/isaacs/minimatch.svg?branch=master)](http://travis-ci.org/isaacs/minimatch) + + +This is the matching library used internally by npm. + +It works by converting glob expressions into JavaScript `RegExp` +objects. + +## Important Security Consideration! + +> [!WARNING] +> This library uses JavaScript regular expressions. Please read +> the following warning carefully, and be thoughtful about what +> you provide to this library in production systems. + +_Any_ library in JavaScript that deals with matching string +patterns using regular expressions will be subject to +[ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) +if the pattern is generated using untrusted input. + +Efforts have been made to mitigate risk as much as is feasible in +such a library, providing maximum recursion depths and so forth, +but these measures can only ultimately protect against accidents, +not malice. A dedicated attacker can _always_ find patterns that +cannot be defended against by a bash-compatible glob pattern +matching system that uses JavaScript regular expressions. + +To be extremely clear: + +> [!WARNING] +> **If you create a system where you take user input, and use +> that input as the source of a Regular Expression pattern, in +> this or any extant glob matcher in JavaScript, you will be +> pwned.** + +A future version of this library _may_ use a different matching +algorithm which does not exhibit backtracking problems. If and +when that happens, it will likely be a sweeping change, and those +improvements will **not** be backported to legacy versions. + +In the near term, it is not reasonable to continue to play +whack-a-mole with security advisories, and so any future ReDoS +reports will be considered "working as intended", and resolved +entirely by this warning. + +## Usage + +```javascript +var minimatch = require("minimatch") + +minimatch("bar.foo", "*.foo") // true! +minimatch("bar.foo", "*.bar") // false! +minimatch("bar.foo", "*.+(bar|foo)", { debug: true }) // true, and noisy! +``` + +## Features + +Supports these glob features: + +* Brace Expansion +* Extended glob matching +* "Globstar" `**` matching + +See: + +* `man sh` +* `man bash` +* `man 3 fnmatch` +* `man 5 gitignore` + +## Minimatch Class + +Create a minimatch object by instantiating the `minimatch.Minimatch` class. + +```javascript +var Minimatch = require("minimatch").Minimatch +var mm = new Minimatch(pattern, options) +``` + +### Properties + +* `pattern` The original pattern the minimatch object represents. +* `options` The options supplied to the constructor. +* `set` A 2-dimensional array of regexp or string expressions. + Each row in the + array corresponds to a brace-expanded pattern. Each item in the row + corresponds to a single path-part. For example, the pattern + `{a,b/c}/d` would expand to a set of patterns like: + + [ [ a, d ] + , [ b, c, d ] ] + + If a portion of the pattern doesn't have any "magic" in it + (that is, it's something like `"foo"` rather than `fo*o?`), then it + will be left as a string rather than converted to a regular + expression. + +* `regexp` Created by the `makeRe` method. A single regular expression + expressing the entire pattern. This is useful in cases where you wish + to use the pattern somewhat like `fnmatch(3)` with `FNM_PATH` enabled. +* `negate` True if the pattern is negated. +* `comment` True if the pattern is a comment. +* `empty` True if the pattern is `""`. + +### Methods + +* `makeRe` Generate the `regexp` member if necessary, and return it. + Will return `false` if the pattern is invalid. +* `match(fname)` Return true if the filename matches the pattern, or + false otherwise. +* `matchOne(fileArray, patternArray, partial)` Take a `/`-split + filename, and match it against a single row in the `regExpSet`. This + method is mainly for internal use, but is exposed so that it can be + used by a glob-walker that needs to avoid excessive filesystem calls. + +All other methods are internal, and will be called as necessary. + +### minimatch(path, pattern, options) + +Main export. Tests a path against the pattern using the options. + +```javascript +var isJS = minimatch(file, "*.js", { matchBase: true }) +``` + +### minimatch.filter(pattern, options) + +Returns a function that tests its +supplied argument, suitable for use with `Array.filter`. Example: + +```javascript +var javascripts = fileList.filter(minimatch.filter("*.js", {matchBase: true})) +``` + +### minimatch.match(list, pattern, options) + +Match against the list of +files, in the style of fnmatch or glob. If nothing is matched, and +options.nonull is set, then return a list containing the pattern itself. + +```javascript +var javascripts = minimatch.match(fileList, "*.js", {matchBase: true})) +``` + +### minimatch.makeRe(pattern, options) + +Make a regular expression object from the pattern. + +## Options + +All options are `false` by default. + +### debug + +Dump a ton of stuff to stderr. + +### nobrace + +Do not expand `{a,b}` and `{1..3}` brace sets. + +### noglobstar + +Disable `**` matching against multiple folder names. + +### dot + +Allow patterns to match filenames starting with a period, even if +the pattern does not explicitly have a period in that spot. + +Note that by default, `a/**/b` will **not** match `a/.d/b`, unless `dot` +is set. + +### noext + +Disable "extglob" style patterns like `+(a|b)`. + +### nocase + +Perform a case-insensitive match. + +### nonull + +When a match is not found by `minimatch.match`, return a list containing +the pattern itself if this option is set. When not set, an empty list +is returned if there are no matches. + +### matchBase + +If set, then patterns without slashes will be matched +against the basename of the path if it contains slashes. For example, +`a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. + +### nocomment + +Suppress the behavior of treating `#` at the start of a pattern as a +comment. + +### nonegate + +Suppress the behavior of treating a leading `!` character as negation. + +### flipNegate + +Returns from negate expressions the same as if they were not negated. +(Ie, true on a hit, false on a miss.) + +### partial + +Compare a partial path to a pattern. As long as the parts of the path that +are present are not contradicted by the pattern, it will be treated as a +match. This is useful in applications where you're walking through a +folder structure, and don't yet have the full path, but want to ensure that +you do not walk down paths that can never be a match. + +For example, + +```js +minimatch('/a/b', '/a/*/c/d', { partial: true }) // true, might be /a/b/c/d +minimatch('/a/b', '/**/d', { partial: true }) // true, might be /a/b/.../d +minimatch('/x/y/z', '/a/**/z', { partial: true }) // false, because x !== a +``` + +### allowWindowsEscape + +Windows path separator `\` is by default converted to `/`, which +prohibits the usage of `\` as a escape character. This flag skips that +behavior and allows using the escape character. + +## Comparisons to other fnmatch/glob implementations + +While strict compliance with the existing standards is a worthwhile +goal, some discrepancies exist between minimatch and other +implementations, and are intentional. + +If the pattern starts with a `!` character, then it is negated. Set the +`nonegate` flag to suppress this behavior, and treat leading `!` +characters normally. This is perhaps relevant if you wish to start the +pattern with a negative extglob pattern like `!(a|B)`. Multiple `!` +characters at the start of a pattern will negate the pattern multiple +times. + +If a pattern starts with `#`, then it is treated as a comment, and +will not match anything. Use `\#` to match a literal `#` at the +start of a line, or set the `nocomment` flag to suppress this behavior. + +The double-star character `**` is supported by default, unless the +`noglobstar` flag is set. This is supported in the manner of bsdglob +and bash 4.1, where `**` only has special significance if it is the only +thing in a path part. That is, `a/**/b` will match `a/x/y/b`, but +`a/**b` will not. + +If an escaped pattern has no matches, and the `nonull` flag is set, +then minimatch.match returns the pattern as-provided, rather than +interpreting the character escapes. For example, +`minimatch.match([], "\\*a\\?")` will return `"\\*a\\?"` rather than +`"*a?"`. This is akin to setting the `nullglob` option in bash, except +that it does not resolve escaped pattern characters. + +If brace expansion is not disabled, then it is performed before any +other interpretation of the glob pattern. Thus, a pattern like +`+(a|{b),c)}`, which would not be valid in bash or zsh, is expanded +**first** into the set of `+(a|b)` and `+(a|c)`, and those patterns are +checked for validity. Since those two are valid, matching proceeds. diff --git a/projects/org-skill-web-research/node_modules/minimatch/minimatch.js b/projects/org-skill-web-research/node_modules/minimatch/minimatch.js new file mode 100644 index 0000000..2e4a058 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/minimatch/minimatch.js @@ -0,0 +1,1005 @@ +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = (function () { try { return require('path') } catch (e) {}}()) || { + sep: '/' +} +minimatch.sep = path.sep + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = require('brace-expansion') + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } +} + +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) +} + +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) + } +} + +function ext (a, b) { + b = b || {} + var t = {} + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || typeof def !== 'object' || !Object.keys(def).length) { + return minimatch + } + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig(p, pattern, ext(def, options)) + } + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + m.Minimatch.defaults = function defaults (options) { + return orig.defaults(ext(def, options)).Minimatch + } + + m.filter = function filter (pattern, options) { + return orig.filter(pattern, ext(def, options)) + } + + m.defaults = function defaults (options) { + return orig.defaults(ext(def, options)) + } + + m.makeRe = function makeRe (pattern, options) { + return orig.makeRe(pattern, ext(def, options)) + } + + m.braceExpand = function braceExpand (pattern, options) { + return orig.braceExpand(pattern, ext(def, options)) + } + + m.match = function (list, pattern, options) { + return orig.match(list, pattern, ext(def, options)) + } + + return m +} + +Minimatch.defaults = function (def) { + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + assertValidPattern(pattern) + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false + } + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) + } + + assertValidPattern(pattern) + + if (!options) options = {} + + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (!options.allowWindowsEscape && path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.maxGlobstarRecursion = options.maxGlobstarRecursion !== undefined + ? options.maxGlobstarRecursion : 200 + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + this.partial = !!options.partial + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) } + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + assertValidPattern(pattern) + + // Thanks to Yeting Li for + // improving this regexp to avoid a ReDOS vulnerability. + if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) +} + +var MAX_PATTERN_LENGTH = 1024 * 64 +var assertValidPattern = function (pattern) { + if (typeof pattern !== 'string') { + throw new TypeError('invalid pattern') + } + + if (pattern.length > MAX_PATTERN_LENGTH) { + throw new TypeError('pattern is too long') + } +} + +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + assertValidPattern(pattern) + + var options = this.options + + // shortcuts + if (pattern === '**') { + if (!options.noglobstar) + return GLOBSTAR + else + pattern = '*' + } + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + /* istanbul ignore next */ + case '/': { + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + } + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // coalesce consecutive non-globstar * characters + if (c === '*' && stateChar === '*') continue + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue + + case '(': + if (inClass) { + re += '(' + continue + } + + if (!stateChar) { + re += '\\(' + continue + } + + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue + + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } + + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue + + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } + + clearStateChar() + re += '|' + continue + + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() + + if (inClass) { + re += '\\' + c + continue + } + + inClass = true + classStart = i + reClassStart = re.length + re += c + continue + + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } + + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + + // finish up the class. + hasMagic = true + inClass = false + re += c + continue + + default: + // swallow any state char that wasn't consumed + clearStateChar() + + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } + + re += c + + } // switch + } // for + + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } + + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } + + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) + + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type + + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } + + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } + + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '[': case '.': case '(': addPatternStart = true + } + + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] + + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) + + nlLast += nlAfter + + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter + + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } + + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } + + if (addPatternStart) { + re = patternStart + re + } + + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } + + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } + + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) /* istanbul ignore next - should be impossible */ { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } + + regExp._glob = pattern + regExp._src = re + + return regExp +} + +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} + +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp + + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set + + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options + + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' + + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') + + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' + + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' + + try { + this.regexp = new RegExp(re, flags) + } catch (ex) /* istanbul ignore next - should be impossible */ { + this.regexp = false + } + return this.regexp +} + +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = function match (f, partial) { + if (typeof partial === 'undefined') partial = this.partial + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true + + var options = this.options + + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } + + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) + + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. + + var set = this.set + this.debug(this.pattern, 'set', set) + + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } + + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } + + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} + +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + if (pattern.indexOf(GLOBSTAR) !== -1) { + return this._matchGlobstar(file, pattern, partial, 0, 0) + } + return this._matchOne(file, pattern, partial, 0, 0) +} + +Minimatch.prototype._matchGlobstar = function (file, pattern, partial, fileIndex, patternIndex) { + var i + + // find first globstar from patternIndex + var firstgs = -1 + for (i = patternIndex; i < pattern.length; i++) { + if (pattern[i] === GLOBSTAR) { firstgs = i; break } + } + + // find last globstar + var lastgs = -1 + for (i = pattern.length - 1; i >= 0; i--) { + if (pattern[i] === GLOBSTAR) { lastgs = i; break } + } + + var head = pattern.slice(patternIndex, firstgs) + var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs) + var tail = partial ? [] : pattern.slice(lastgs + 1) + + // check the head + if (head.length) { + var fileHead = file.slice(fileIndex, fileIndex + head.length) + if (!this._matchOne(fileHead, head, partial, 0, 0)) { + return false + } + fileIndex += head.length + } + + // check the tail + var fileTailMatch = 0 + if (tail.length) { + if (tail.length + fileIndex > file.length) return false + + var tailStart = file.length - tail.length + if (this._matchOne(file, tail, partial, tailStart, 0)) { + fileTailMatch = tail.length + } else { + // affordance for stuff like a/**/* matching a/b/ + if (file[file.length - 1] !== '' || + fileIndex + tail.length === file.length) { + return false + } + tailStart-- + if (!this._matchOne(file, tail, partial, tailStart, 0)) { + return false + } + fileTailMatch = tail.length + 1 + } + } + + // if body is empty (single ** between head and tail) + if (!body.length) { + var sawSome = !!fileTailMatch + for (i = fileIndex; i < file.length - fileTailMatch; i++) { + var f = String(file[i]) + sawSome = true + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return partial || sawSome + } + + // split body into segments at each GLOBSTAR + var bodySegments = [[[], 0]] + var currentBody = bodySegments[0] + var nonGsParts = 0 + var nonGsPartsSums = [0] + for (var bi = 0; bi < body.length; bi++) { + var b = body[bi] + if (b === GLOBSTAR) { + nonGsPartsSums.push(nonGsParts) + currentBody = [[], 0] + bodySegments.push(currentBody) + } else { + currentBody[0].push(b) + nonGsParts++ + } + } + + var idx = bodySegments.length - 1 + var fileLength = file.length - fileTailMatch + for (var si = 0; si < bodySegments.length; si++) { + bodySegments[si][1] = fileLength - + (nonGsPartsSums[idx--] + bodySegments[si][0].length) + } + + return !!this._matchGlobStarBodySections( + file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch + ) +} + +// return false for "nope, not matching" +// return null for "not matching, cannot keep trying" +Minimatch.prototype._matchGlobStarBodySections = function ( + file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail +) { + var bs = bodySegments[bodyIndex] + if (!bs) { + // just make sure there are no bad dots + for (var i = fileIndex; i < file.length; i++) { + sawTail = true + var f = file[i] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + } + return sawTail + } + + var body = bs[0] + var after = bs[1] + while (fileIndex <= after) { + var m = this._matchOne( + file.slice(0, fileIndex + body.length), + body, + partial, + fileIndex, + 0 + ) + // if limit exceeded, no match. intentional false negative, + // acceptable break in correctness for security. + if (m && globStarDepth < this.maxGlobstarRecursion) { + var sub = this._matchGlobStarBodySections( + file, bodySegments, + fileIndex + body.length, bodyIndex + 1, + partial, globStarDepth + 1, sawTail + ) + if (sub !== false) { + return sub + } + } + var f = file[fileIndex] + if (f === '.' || f === '..' || + (!this.options.dot && f.charAt(0) === '.')) { + return false + } + fileIndex++ + } + return partial || null +} + +Minimatch.prototype._matchOne = function (file, pattern, partial, fileIndex, patternIndex) { + var fi, pi, fl, pl + for ( + fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++ + ) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] + + this.debug(pattern, p, f) + + // should be impossible. + // some invalid regexp stuff in the set. + /* istanbul ignore if */ + if (p === false || p === GLOBSTAR) return false + + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + hit = f === p + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } + + if (!hit) return false + } + + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else /* istanbul ignore else */ if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + return (fi === fl - 1) && (file[fi] === '') + } + + // should be unreachable. + /* istanbul ignore next */ + throw new Error('wtf?') +} + +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} + +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} diff --git a/projects/org-skill-web-research/node_modules/minimatch/package.json b/projects/org-skill-web-research/node_modules/minimatch/package.json new file mode 100644 index 0000000..563d218 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/minimatch/package.json @@ -0,0 +1,33 @@ +{ + "author": "Isaac Z. Schlueter (http://blog.izs.me)", + "name": "minimatch", + "description": "a glob matcher in javascript", + "version": "3.1.5", + "publishConfig": { + "tag": "legacy-v3" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/minimatch.git" + }, + "main": "minimatch.js", + "scripts": { + "test": "tap", + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --all; git push origin --tags" + }, + "engines": { + "node": "*" + }, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "devDependencies": { + "tap": "^15.1.6" + }, + "license": "ISC", + "files": [ + "minimatch.js" + ] +} diff --git a/projects/org-skill-web-research/node_modules/mixin-object/LICENSE b/projects/org-skill-web-research/node_modules/mixin-object/LICENSE new file mode 100644 index 0000000..fa30c4c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/mixin-object/README.md b/projects/org-skill-web-research/node_modules/mixin-object/README.md new file mode 100644 index 0000000..6553853 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/README.md @@ -0,0 +1,75 @@ +# mixin-object [![NPM version](https://badge.fury.io/js/mixin-object.svg)](http://badge.fury.io/js/mixin-object) + +> Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone. + +If you only want to combine own-properties, use [extend-shallow](https://github.com/jonschlinkert/extend-shallow). + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i mixin-object --save +``` + +Install with [bower](http://bower.io/) + +```sh +$ bower install mixin-object --save +``` + +## Usage + +```js +var mixin = require('mixin-object'); + +var obj = {c: 'c'}; +var foo = mixin({a: 'a'}, {b: 'b'}); +console.log(foo); +//=> {c: 'c', a: 'a', b: 'b'} +console.log(obj); +//=> {c: 'c'} + +mixin({}, {a: 'a'}, {b: 'b'}); +//=> {a: 'a', b: 'b'} +``` + +## Related + +* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. +* [defaults-deep](https://github.com/jonschlinkert/defaults-deep): Like `extend` but recursively copies only the missing properties/values to the target object. +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [for-own](https://github.com/jonschlinkert/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) +* [for-in](https://github.com/jonschlinkert/for-in): Iterate over the own and inherited enumerable properties of an objecte, and return an object… [more](https://github.com/jonschlinkert/for-in) +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [mixin-deep](https://github.com/jonschlinkert/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. +* [merge-deep](https://github.com/jonschlinkert/merge-deep): Recursively merge values in a javascript object. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/mixin-object/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on July 05, 2015._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/mixin-object/index.js b/projects/org-skill-web-research/node_modules/mixin-object/index.js new file mode 100644 index 0000000..fca0107 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/index.js @@ -0,0 +1,36 @@ +'use strict'; + +var isObject = require('is-extendable'); +var forIn = require('for-in'); + +function mixin(target, objects) { + if (!isObject(target)) { + throw new TypeError('mixin-object expects the first argument to be an object.'); + } + var len = arguments.length, i = 0; + while (++i < len) { + var obj = arguments[i]; + if (isObject(obj)) { + forIn(obj, copy, target); + } + } + return target; +} + +/** + * copy properties from the source object to the + * target object. + * + * @param {*} `value` + * @param {String} `key` + */ + +function copy(value, key) { + this[key] = value; +} + +/** + * Expose `mixin` + */ + +module.exports = mixin; \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/LICENSE b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/LICENSE new file mode 100644 index 0000000..d734237 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-2017, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/README.md b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/README.md new file mode 100644 index 0000000..1173630 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/README.md @@ -0,0 +1,85 @@ +# for-in [![NPM version](https://img.shields.io/npm/v/for-in.svg?style=flat)](https://www.npmjs.com/package/for-in) [![NPM monthly downloads](https://img.shields.io/npm/dm/for-in.svg?style=flat)](https://npmjs.org/package/for-in) [![NPM total downloads](https://img.shields.io/npm/dt/for-in.svg?style=flat)](https://npmjs.org/package/for-in) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/for-in.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/for-in) + +> Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save for-in +``` + +## Usage + +```js +var forIn = require('for-in'); + +var obj = {a: 'foo', b: 'bar', c: 'baz'}; +var values = []; +var keys = []; + +forIn(obj, function (value, key, o) { + keys.push(key); + values.push(value); +}); + +console.log(keys); +//=> ['a', 'b', 'c']; + +console.log(values); +//=> ['foo', 'bar', 'baz']; +``` + +## About + +### Related projects + +* [arr-flatten](https://www.npmjs.com/package/arr-flatten): Recursively flatten an array or arrays. This is the fastest implementation of array flatten. | [homepage](https://github.com/jonschlinkert/arr-flatten) +* [collection-map](https://www.npmjs.com/package/collection-map): Returns an array of mapped values from an array or object. | [homepage](https://github.com/jonschlinkert/collection-map) +* [for-own](https://www.npmjs.com/package/for-own): Iterate over the own enumerable properties of an object, and return an object with properties… [more](https://github.com/jonschlinkert/for-own) | [homepage](https://github.com/jonschlinkert/for-own) + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 11 | [jonschlinkert](https://github.com/jonschlinkert) | +| 2 | [paulirish](https://github.com/paulirish) | + +### Building docs + +_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +### Running tests + +Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command: + +```sh +$ npm install && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](https://twitter.com/jonschlinkert) + +### License + +Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT License](LICENSE). + +*** + +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.2, on February 26, 2017._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/index.js b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/index.js new file mode 100644 index 0000000..0b5f95f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/index.js @@ -0,0 +1,16 @@ +/*! + * for-in + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ + +'use strict'; + +module.exports = function forIn(obj, fn, thisArg) { + for (var key in obj) { + if (fn.call(thisArg, obj[key], key, obj) === false) { + break; + } + } +}; diff --git a/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/package.json b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/package.json new file mode 100644 index 0000000..6d0d373 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/node_modules/for-in/package.json @@ -0,0 +1,64 @@ +{ + "name": "for-in", + "description": "Iterate over the own and inherited enumerable properties of an object, and return an object with properties that evaluate to true from the callback. Exit early by returning `false`. JavaScript/Node.js", + "version": "0.1.8", + "homepage": "https://github.com/jonschlinkert/for-in", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "contributors": [ + "Jon Schlinkert (http://twitter.com/jonschlinkert)", + "Paul Irish (http://paulirish.com)" + ], + "repository": "jonschlinkert/for-in", + "bugs": { + "url": "https://github.com/jonschlinkert/for-in/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "keywords": [ + "for", + "for-in", + "for-own", + "has", + "has-own", + "hasOwn", + "in", + "key", + "keys", + "object", + "own", + "value" + ], + "verb": { + "run": true, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "related": { + "list": [ + "arr-flatten", + "for-own", + "collection-map" + ] + }, + "reflinks": [ + "verb" + ], + "lint": { + "reflinks": true + } + } +} diff --git a/projects/org-skill-web-research/node_modules/mixin-object/package.json b/projects/org-skill-web-research/node_modules/mixin-object/package.json new file mode 100644 index 0000000..8edf2b0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/mixin-object/package.json @@ -0,0 +1,61 @@ +{ + "name": "mixin-object", + "description": "Mixin the own and inherited properties of other objects onto the first object. Pass an empty object as the first arg to shallow clone.", + "version": "2.0.1", + "homepage": "https://github.com/jonschlinkert/mixin-object", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/mixin-object", + "bugs": { + "url": "https://github.com/jonschlinkert/mixin-object/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "devDependencies": { + "mocha": "^2.2.5", + "should": "^7.0.1" + }, + "keywords": [ + "assign", + "copy", + "extend", + "key", + "merge", + "mixin", + "object", + "objects", + "prop", + "properties", + "property", + "shallow", + "util", + "value" + ], + "verbiage": { + "related": { + "list": [ + "defaults-deep", + "extend-shallow", + "assign-deep", + "mixin-deep", + "merge-deep", + "isobject", + "is-plain-object", + "for-own", + "for-in" + ] + } + } +} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/ms/index.js b/projects/org-skill-web-research/node_modules/ms/index.js new file mode 100644 index 0000000..ea734fb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function (val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/projects/org-skill-web-research/node_modules/ms/license.md b/projects/org-skill-web-research/node_modules/ms/license.md new file mode 100644 index 0000000..fa5d39b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/ms/license.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2020 Vercel, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/ms/package.json b/projects/org-skill-web-research/node_modules/ms/package.json new file mode 100644 index 0000000..4997189 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/ms/package.json @@ -0,0 +1,38 @@ +{ + "name": "ms", + "version": "2.1.3", + "description": "Tiny millisecond conversion utility", + "repository": "vercel/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.18.2", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1", + "prettier": "2.0.5" + } +} diff --git a/projects/org-skill-web-research/node_modules/ms/readme.md b/projects/org-skill-web-research/node_modules/ms/readme.md new file mode 100644 index 0000000..0fc1abb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/ms/readme.md @@ -0,0 +1,59 @@ +# ms + +![CI](https://github.com/vercel/ms/workflows/CI/badge.svg) + +Use this package to easily convert various time formats to milliseconds. + +## Examples + +```js +ms('2 days') // 172800000 +ms('1d') // 86400000 +ms('10h') // 36000000 +ms('2.5 hrs') // 9000000 +ms('2h') // 7200000 +ms('1m') // 60000 +ms('5s') // 5000 +ms('1y') // 31557600000 +ms('100') // 100 +ms('-3 days') // -259200000 +ms('-1h') // -3600000 +ms('-200') // -200 +``` + +### Convert from Milliseconds + +```js +ms(60000) // "1m" +ms(2 * 60000) // "2m" +ms(-3 * 60000) // "-3m" +ms(ms('10 hours')) // "10h" +``` + +### Time Format Written-Out + +```js +ms(60000, { long: true }) // "1 minute" +ms(2 * 60000, { long: true }) // "2 minutes" +ms(-3 * 60000, { long: true }) // "-3 minutes" +ms(ms('10 hours'), { long: true }) // "10 hours" +``` + +## Features + +- Works both in [Node.js](https://nodejs.org) and in the browser +- If a number is supplied to `ms`, a string with a unit is returned +- If a string that contains the number is supplied, it returns it as a number (e.g.: it returns `100` for `'100'`) +- If you pass a string with a number and a valid unit, the number of equivalent milliseconds is returned + +## Related Packages + +- [ms.macro](https://github.com/knpwrs/ms.macro) - Run `ms` as a macro at build-time. + +## Caught a Bug? + +1. [Fork](https://help.github.com/articles/fork-a-repo/) this repository to your own GitHub account and then [clone](https://help.github.com/articles/cloning-a-repository/) it to your local device +2. Link the package to the global module directory: `npm link` +3. Within the module you want to test your local development instance of ms, just link it to the dependencies: `npm link ms`. Instead of the default one from npm, Node.js will now use your clone of ms! + +As always, you can run the tests using: `npm test` diff --git a/projects/org-skill-web-research/node_modules/once/LICENSE b/projects/org-skill-web-research/node_modules/once/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/once/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/once/README.md b/projects/org-skill-web-research/node_modules/once/README.md new file mode 100644 index 0000000..1f1ffca --- /dev/null +++ b/projects/org-skill-web-research/node_modules/once/README.md @@ -0,0 +1,79 @@ +# once + +Only call a function once. + +## usage + +```javascript +var once = require('once') + +function load (file, cb) { + cb = once(cb) + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Or add to the Function.prototype in a responsible way: + +```javascript +// only has to be done once +require('once').proto() + +function load (file, cb) { + cb = cb.once() + loader.load('file') + loader.once('load', cb) + loader.once('error', cb) +} +``` + +Ironically, the prototype feature makes this module twice as +complicated as necessary. + +To check whether you function has been called, use `fn.called`. Once the +function is called for the first time the return value of the original +function is saved in `fn.value` and subsequent calls will continue to +return this value. + +```javascript +var once = require('once') + +function load (cb) { + cb = once(cb) + var stream = createStream() + stream.once('data', cb) + stream.once('end', function () { + if (!cb.called) cb(new Error('not found')) + }) +} +``` + +## `once.strict(func)` + +Throw an error if the function is called twice. + +Some functions are expected to be called only once. Using `once` for them would +potentially hide logical errors. + +In the example below, the `greet` function has to call the callback only once: + +```javascript +function greet (name, cb) { + // return is missing from the if statement + // when no name is passed, the callback is called twice + if (!name) cb('Hello anonymous') + cb('Hello ' + name) +} + +function log (msg) { + console.log(msg) +} + +// this will print 'Hello anonymous' but the logical error will be missed +greet(null, once(msg)) + +// once.strict will print 'Hello anonymous' and throw an error when the callback will be called the second time +greet(null, once.strict(msg)) +``` diff --git a/projects/org-skill-web-research/node_modules/once/once.js b/projects/org-skill-web-research/node_modules/once/once.js new file mode 100644 index 0000000..2354067 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/once/once.js @@ -0,0 +1,42 @@ +var wrappy = require('wrappy') +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} diff --git a/projects/org-skill-web-research/node_modules/once/package.json b/projects/org-skill-web-research/node_modules/once/package.json new file mode 100644 index 0000000..16815b2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/once/package.json @@ -0,0 +1,33 @@ +{ + "name": "once", + "version": "1.4.0", + "description": "Run a function exactly one time", + "main": "once.js", + "directories": { + "test": "test" + }, + "dependencies": { + "wrappy": "1" + }, + "devDependencies": { + "tap": "^7.0.1" + }, + "scripts": { + "test": "tap test/*.js" + }, + "files": [ + "once.js" + ], + "repository": { + "type": "git", + "url": "git://github.com/isaacs/once" + }, + "keywords": [ + "once", + "function", + "one", + "single" + ], + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC" +} diff --git a/projects/org-skill-web-research/node_modules/path-is-absolute/index.js b/projects/org-skill-web-research/node_modules/path-is-absolute/index.js new file mode 100644 index 0000000..22aa6c3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/path-is-absolute/index.js @@ -0,0 +1,20 @@ +'use strict'; + +function posix(path) { + return path.charAt(0) === '/'; +} + +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); + + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} + +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; diff --git a/projects/org-skill-web-research/node_modules/path-is-absolute/license b/projects/org-skill-web-research/node_modules/path-is-absolute/license new file mode 100644 index 0000000..654d0bf --- /dev/null +++ b/projects/org-skill-web-research/node_modules/path-is-absolute/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/path-is-absolute/package.json b/projects/org-skill-web-research/node_modules/path-is-absolute/package.json new file mode 100644 index 0000000..91196d5 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/path-is-absolute/package.json @@ -0,0 +1,43 @@ +{ + "name": "path-is-absolute", + "version": "1.0.1", + "description": "Node.js 0.12 path.isAbsolute() ponyfill", + "license": "MIT", + "repository": "sindresorhus/path-is-absolute", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "xo && node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "path", + "paths", + "file", + "dir", + "absolute", + "isabsolute", + "is-absolute", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim", + "is", + "detect", + "check" + ], + "devDependencies": { + "xo": "^0.16.0" + } +} diff --git a/projects/org-skill-web-research/node_modules/path-is-absolute/readme.md b/projects/org-skill-web-research/node_modules/path-is-absolute/readme.md new file mode 100644 index 0000000..8dbdf5f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/path-is-absolute/readme.md @@ -0,0 +1,59 @@ +# path-is-absolute [![Build Status](https://travis-ci.org/sindresorhus/path-is-absolute.svg?branch=master)](https://travis-ci.org/sindresorhus/path-is-absolute) + +> Node.js 0.12 [`path.isAbsolute()`](http://nodejs.org/api/path.html#path_path_isabsolute_path) [ponyfill](https://ponyfill.com) + + +## Install + +``` +$ npm install --save path-is-absolute +``` + + +## Usage + +```js +const pathIsAbsolute = require('path-is-absolute'); + +// Running on Linux +pathIsAbsolute('/home/foo'); +//=> true +pathIsAbsolute('C:/Users/foo'); +//=> false + +// Running on Windows +pathIsAbsolute('C:/Users/foo'); +//=> true +pathIsAbsolute('/home/foo'); +//=> false + +// Running on any OS +pathIsAbsolute.posix('/home/foo'); +//=> true +pathIsAbsolute.posix('C:/Users/foo'); +//=> false +pathIsAbsolute.win32('C:/Users/foo'); +//=> true +pathIsAbsolute.win32('/home/foo'); +//=> false +``` + + +## API + +See the [`path.isAbsolute()` docs](http://nodejs.org/api/path.html#path_path_isabsolute_path). + +### pathIsAbsolute(path) + +### pathIsAbsolute.posix(path) + +POSIX specific version. + +### pathIsAbsolute.win32(path) + +Windows specific version. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/LICENSE b/projects/org-skill-web-research/node_modules/playwright-extra/LICENSE new file mode 100644 index 0000000..a53ecb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 berstend + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.d.ts new file mode 100644 index 0000000..7472239 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.d.ts @@ -0,0 +1,53 @@ +import type * as pw from 'playwright-core'; +import type { CompatiblePlugin } from './types'; +import { PluginList } from './plugins'; +declare type PlaywrightBrowserLauncher = pw.BrowserType; +/** + * The Playwright browser launcher APIs we're augmenting + * @private + */ +interface AugmentedLauncherAPIs extends Pick { +} +/** + * Modular plugin framework to teach `playwright` new tricks. + */ +export declare class PlaywrightExtraClass implements AugmentedLauncherAPIs { + private _launcher?; + /** Plugin manager */ + readonly plugins: PluginList; + constructor(_launcher?: Partial | undefined); + /** + * The **main interface** to register plugins. + * + * Can be called multiple times to enable multiple plugins. + * + * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer. + * + * @example + * chromium.use(plugin1).use(plugin2) + * firefox.use(plugin1).use(plugin2) + * + * @see [PuppeteerExtraPlugin] + * + * @return The same `PlaywrightExtra` instance (for optional chaining) + */ + use(plugin: CompatiblePlugin): this; + launch(...args: Parameters): ReturnType; + launchPersistentContext(...args: Parameters): ReturnType; + connect(wsEndpointOrOptions: string | (pw.ConnectOptions & { + wsEndpoint?: string; + }), wsOptions?: pw.ConnectOptions): ReturnType; + connectOverCDP(wsEndpointOrOptions: string | (pw.ConnectOverCDPOptions & { + endpointURL?: string; + }), wsOptions?: pw.ConnectOverCDPOptions): ReturnType; + protected _bindBrowserContextEvents(context: pw.BrowserContext, contextOptions?: pw.BrowserContextOptions): Promise; + protected _bindBrowserEvents(browser: pw.Browser): Promise; +} +/** + * PlaywrightExtra class with additional launcher methods. + * + * Augments the class with an instance proxy to pass on methods that are not augmented to the original target. + * + */ +export declare const PlaywrightExtra: typeof PlaywrightExtraClass; +export {}; diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js new file mode 100644 index 0000000..73fabb9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js @@ -0,0 +1,230 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PlaywrightExtra = exports.PlaywrightExtraClass = void 0; +const debug_1 = __importDefault(require("debug")); +const debug = (0, debug_1.default)('playwright-extra'); +const plugins_1 = require("./plugins"); +const loader_1 = require("./helper/loader"); +/** + * Modular plugin framework to teach `playwright` new tricks. + */ +class PlaywrightExtraClass { + constructor(_launcher) { + this._launcher = _launcher; + this.plugins = new plugins_1.PluginList(); + } + /** + * The **main interface** to register plugins. + * + * Can be called multiple times to enable multiple plugins. + * + * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer. + * + * @example + * chromium.use(plugin1).use(plugin2) + * firefox.use(plugin1).use(plugin2) + * + * @see [PuppeteerExtraPlugin] + * + * @return The same `PlaywrightExtra` instance (for optional chaining) + */ + use(plugin) { + const isValid = plugin && 'name' in plugin; + if (!isValid) { + throw new Error('A plugin must be provided to .use()'); + } + if (this.plugins.add(plugin)) { + debug('Plugin registered', plugin.name); + } + return this; + } + /** + * In order to support a default export which will require vanilla playwright automatically, + * as well as `addExtra` to patch a provided launcher, we need to so some gymnastics here. + * + * Otherwise this would throw immediately, even when only using the `addExtra` export with an arbitrary compatible launcher. + * + * The solution is to make the vanilla launcher optional and only throw once we try to effectively use and can't find it. + * + * @internal + */ + get launcher() { + if (!this._launcher) { + throw loader_1.playwrightLoader.requireError; + } + return this._launcher; + } + async launch(...args) { + if (!this.launcher.launch) { + throw new Error('Launcher does not support "launch"'); + } + let [options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug('launch', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + debug('launch with options', options); + if ('userDataDir' in options) { + debug("A plugin defined userDataDir during .launch, which isn't supported by playwright - ignoring"); + delete options.userDataDir; + } + const browser = await this.launcher['launch'](options); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterLaunch', browser); + return browser; + } + async launchPersistentContext(...args) { + if (!this.launcher.launchPersistentContext) { + throw new Error('Launcher does not support "launchPersistentContext"'); + } + let [userDataDir, options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug('launchPersistentContext', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + const context = await this.launcher['launchPersistentContext'](userDataDir, options); + await this.plugins.dispatchBlocking('afterLaunch', context); + this._bindBrowserContextEvents(context); + return context; + } + async connect(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connect) { + throw new Error('Launcher does not support "connect"'); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connect + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ wsEndpoint: wsEndpointOrOptions }, wsOptions); + } + debug('connect', options); + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const wsEndpoint = options.wsEndpoint; + if (wsEndpointAsString) { + delete options.wsEndpoint; + args.push(wsEndpoint, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connect'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async connectOverCDP(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connectOverCDP) { + throw new Error(`Launcher does not implement 'connectOverCDP'`); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connectOverCDP + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ endpointURL: wsEndpointOrOptions }, wsOptions); + } + debug('connectOverCDP'), options; + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const endpointURL = options.endpointURL; + if (wsEndpointAsString) { + delete options.endpointURL; + args.push(endpointURL, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connectOverCDP'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async _bindBrowserContextEvents(context, contextOptions) { + debug('_bindBrowserContextEvents'); + this.plugins.dispatch('onContextCreated', context, contextOptions); + // Make sure things like `addInitScript` show an effect on the very first page as well + context.newPage = ((originalMethod, ctx) => { + return async () => { + const page = await originalMethod.call(ctx); + await page.goto('about:blank'); + return page; + }; + })(context.newPage, context); + context.on('close', () => { + // When using `launchPersistentContext` context closing is the same as browser closing + if (!context.browser()) { + this.plugins.dispatch('onDisconnected'); + } + }); + context.on('page', page => { + this.plugins.dispatch('onPageCreated', page); + page.on('close', () => { + this.plugins.dispatch('onPageClose', page); + }); + }); + } + async _bindBrowserEvents(browser) { + debug('_bindPlaywrightBrowserEvents'); + browser.on('disconnected', () => { + this.plugins.dispatch('onDisconnected', browser); + }); + // Note: `browser.newPage` will implicitly call `browser.newContext` as well + browser.newContext = ((originalMethod, ctx) => { + return async (options = {}) => { + const contextOptions = (await this.plugins.dispatchBlocking('beforeContext', options, browser)) || options; + const context = await originalMethod.call(ctx, contextOptions); + this._bindBrowserContextEvents(context, contextOptions); + return context; + }; + })(browser.newContext, browser); + } +} +exports.PlaywrightExtraClass = PlaywrightExtraClass; +/** + * PlaywrightExtra class with additional launcher methods. + * + * Augments the class with an instance proxy to pass on methods that are not augmented to the original target. + * + */ +exports.PlaywrightExtra = new Proxy(PlaywrightExtraClass, { + construct(classTarget, args) { + debug(`create instance of ${classTarget.name}`); + const result = Reflect.construct(classTarget, args); + return new Proxy(result, { + get(target, prop) { + if (prop in target) { + return Reflect.get(target, prop); + } + debug('proxying property to original launcher: ', prop); + return Reflect.get(target.launcher, prop); + } + }); + } +}); +//# sourceMappingURL=extra.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js.map new file mode 100644 index 0000000..289a8db --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extra.js","sourceRoot":"","sources":["../src/extra.ts"],"names":[],"mappings":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AAW,CAAC,IAAI,EAAE,CAAC,CAAA;QAC/C,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,CAAyB,CAAA;QAC3E,OAAO,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,GAAG,CAAC,MAAM,EAAE,IAAI;gBACd,IAAI,IAAI,IAAI,MAAM,EAAE;oBAClB,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;iBACjC;gBACD,KAAK,CAAC,0CAA0C,EAAE,IAAI,CAAC,CAAA;gBACvD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YAC3C,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.d.ts new file mode 100644 index 0000000..0b3d53e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.d.ts @@ -0,0 +1,26 @@ +import type * as pw from 'playwright-core'; +/** Node.js module loader helper */ +export declare class Loader { + moduleName: string; + packageNames: string[]; + constructor(moduleName: string, packageNames: string[]); + /** + * Lazy load a top level export from another module by wrapping it in a JS proxy. + * + * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls + * to it to the module version the user has installed, rather than shipping with a hardcoded version. + * + * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported. + * + * We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value. + */ + lazyloadExportOrDie(exportName: T): TargetModule[T]; + /** Load the module if possible */ + loadModule(): TargetModule | undefined; + /** Load the module if possible or throw */ + loadModuleOrDie(): TargetModule; + get requireError(): Error; +} +export declare function requirePackages(packageNames: string[]): TargetModule | undefined; +/** Playwright specific module loader */ +export declare const playwrightLoader: Loader; diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js new file mode 100644 index 0000000..0a27c75 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.playwrightLoader = exports.requirePackages = exports.Loader = void 0; +/** Node.js module loader helper */ +class Loader { + constructor(moduleName, packageNames) { + this.moduleName = moduleName; + this.packageNames = packageNames; + } + /** + * Lazy load a top level export from another module by wrapping it in a JS proxy. + * + * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls + * to it to the module version the user has installed, rather than shipping with a hardcoded version. + * + * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported. + * + * We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value. + */ + lazyloadExportOrDie(exportName) { + const that = this; + const trapHandler = Object.fromEntries(Object.getOwnPropertyNames(Reflect).map((name) => [ + name, + function (target, ...args) { + const moduleExport = that.loadModuleOrDie()[exportName]; + const customTarget = moduleExport; + const result = Reflect[name](customTarget || target, ...args); + return result; + } + ])); + return new Proxy({}, trapHandler); + } + /** Load the module if possible */ + loadModule() { + return requirePackages(this.packageNames); + } + /** Load the module if possible or throw */ + loadModuleOrDie() { + const module = requirePackages(this.packageNames); + if (module) { + return module; + } + throw this.requireError; + } + get requireError() { + const moduleNamePretty = this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1); + return new Error(` + ${moduleNamePretty} is missing. :-) + + I've tried loading ${this.packageNames + .map(p => `"${p}"`) + .join(', ')} - no luck. + + Make sure you install one of those packages or use the named 'addExtra' export, + to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}. + + To get the latest stable version of ${moduleNamePretty} run: + 'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}' + `); + } +} +exports.Loader = Loader; +function requirePackages(packageNames) { + for (const name of packageNames) { + try { + return require(name); + } + catch (_) { + continue; // noop + } + } + return; +} +exports.requirePackages = requirePackages; +/** Playwright specific module loader */ +exports.playwrightLoader = new Loader('playwright', [ + 'playwright-core', + 'playwright' +]); +//# sourceMappingURL=loader.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js.map new file mode 100644 index 0000000..d14eff6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/helper/loader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/helper/loader.ts"],"names":[],"mappings":";;;AAEA,mCAAmC;AACnC,MAAa,MAAM;IACjB,YAAmB,UAAkB,EAAS,YAAsB;QAAjD,eAAU,GAAV,UAAU,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAU;IAAG,CAAC;IAExE;;;;;;;;;OASG;IACI,mBAAmB,CAA+B,UAAa;QACpE,MAAM,IAAI,GAAG,IAAI,CAAA;QACjB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC;YACrD,IAAI;YACJ,UAAU,MAAW,EAAE,GAAG,IAAW;gBACnC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAA;gBACvD,MAAM,YAAY,GAAG,YAAmB,CAAA;gBACxC,MAAM,MAAM,GAAK,OAAe,CAAC,IAAI,CAAS,CAC5C,YAAY,IAAI,MAAM,EACtB,GAAG,IAAI,CACR,CAAA;gBACD,OAAO,MAAM,CAAA;YACf,CAAC;SACF,CAAC,CACH,CAAA;QACD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,WAAW,CAAoB,CAAA;IACtD,CAAC;IAED,kCAAkC;IAC3B,UAAU;QACf,OAAO,eAAe,CAAe,IAAI,CAAC,YAAY,CAAC,CAAA;IACzD,CAAC;IAED,2CAA2C;IACpC,eAAe;QACpB,MAAM,MAAM,GAAG,eAAe,CAAe,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/D,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAA;SACd;QACD,MAAM,IAAI,CAAC,YAAY,CAAA;IACzB,CAAC;IAED,IAAW,YAAY;QACrB,MAAM,gBAAgB,GACpB,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;QACpE,OAAO,IAAI,KAAK,CAAC;IACjB,gBAAgB;;uBAEG,IAAI,CAAC,YAAY;aACnC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;aAClB,IAAI,CAAC,IAAI,CAAC;;;mEAGoD,gBAAgB;;wCAE3C,gBAAgB;cAC1C,IAAI,CAAC,UAAU,eAAe,IAAI,CAAC,UAAU;GACxD,CAAC,CAAA;IACF,CAAC;CACF;AA/DD,wBA+DC;AAED,SAAgB,eAAe,CAAqB,YAAsB;IACxE,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE;QAC/B,IAAI;YACF,OAAO,OAAO,CAAC,IAAI,CAAiB,CAAA;SACrC;QAAC,OAAO,CAAC,EAAE;YACV,SAAQ,CAAC,OAAO;SACjB;KACF;IACD,OAAM;AACR,CAAC;AATD,0CASC;AAED,wCAAwC;AAC3B,QAAA,gBAAgB,GAAG,IAAI,MAAM,CAAY,YAAY,EAAE;IAClE,iBAAiB;IACjB,YAAY;CACb,CAAC,CAAA"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js new file mode 100644 index 0000000..fcbe500 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js @@ -0,0 +1,934 @@ +/*! + * playwright-extra v4.3.5 by berstend + * https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra#readme + * @license MIT + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var Debug = _interopDefault(require('debug')); + +/** Node.js module loader helper */ +class Loader { + constructor(moduleName, packageNames) { + this.moduleName = moduleName; + this.packageNames = packageNames; + } + /** + * Lazy load a top level export from another module by wrapping it in a JS proxy. + * + * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls + * to it to the module version the user has installed, rather than shipping with a hardcoded version. + * + * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported. + * + * We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value. + */ + lazyloadExportOrDie(exportName) { + const that = this; + const trapHandler = Object.fromEntries(Object.getOwnPropertyNames(Reflect).map((name) => [ + name, + function (target, ...args) { + const moduleExport = that.loadModuleOrDie()[exportName]; + const customTarget = moduleExport; + const result = Reflect[name](customTarget || target, ...args); + return result; + } + ])); + return new Proxy({}, trapHandler); + } + /** Load the module if possible */ + loadModule() { + return requirePackages(this.packageNames); + } + /** Load the module if possible or throw */ + loadModuleOrDie() { + const module = requirePackages(this.packageNames); + if (module) { + return module; + } + throw this.requireError; + } + get requireError() { + const moduleNamePretty = this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1); + return new Error(` + ${moduleNamePretty} is missing. :-) + + I've tried loading ${this.packageNames + .map(p => `"${p}"`) + .join(', ')} - no luck. + + Make sure you install one of those packages or use the named 'addExtra' export, + to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}. + + To get the latest stable version of ${moduleNamePretty} run: + 'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}' + `); + } +} +function requirePackages(packageNames) { + for (const name of packageNames) { + try { + return require(name); + } + catch (_) { + continue; // noop + } + } + return; +} +/** Playwright specific module loader */ +const playwrightLoader = new Loader('playwright', [ + 'playwright-core', + 'playwright' +]); + +const debug = Debug('playwright-extra:puppeteer-compat'); +const isPlaywrightPage = (obj) => { + return 'unroute' in obj; +}; +const isPlaywrightFrame = (obj) => { + return ['parentFrame', 'frameLocator'].every(x => x in obj); +}; +const isPlaywrightBrowser = (obj) => { + return 'newContext' in obj; +}; +const isPuppeteerCompat = (obj) => { + return !!obj && typeof obj === 'object' && !!obj.isCompatShim; +}; +const cache = { + objectToShim: new Map(), + cdpSession: { + page: new Map(), + browser: new Map() + } +}; +/** Augment a Playwright object with compatibility with certain Puppeteer methods */ +function addPuppeteerCompat(object) { + if (!object || typeof object !== 'object') { + return object; + } + if (cache.objectToShim.has(object)) { + return cache.objectToShim.get(object); + } + if (isPuppeteerCompat(object)) { + return object; + } + debug('addPuppeteerCompat', cache.objectToShim.size); + if (isPlaywrightPage(object) || isPlaywrightFrame(object)) { + const shim = createPageShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + if (isPlaywrightBrowser(object)) { + const shim = createBrowserShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + debug('Received unknown object:', Reflect.ownKeys(object)); + return object; +} +// Only chromium browsers support CDP +const dummyCDPClient = { + send: async (...args) => { + debug('dummy CDP client called', 'send', args); + }, + on: (...args) => { + debug('dummy CDP client called', 'on', args); + } +}; +async function getPageCDPSession(page) { + let session = cache.cdpSession.page.get(page); + if (session) { + debug('getPageCDPSession: use existing'); + return session; + } + debug('getPageCDPSession: use new'); + const context = isPlaywrightFrame(page) + ? page.page().context() + : page.context(); + try { + session = await context.newCDPSession(page); + cache.cdpSession.page.set(page, session); + return session; + } + catch (err) { + debug('getPageCDPSession: error while creating session:', err.message); + debug('getPageCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +async function getBrowserCDPSession(browser) { + let session = cache.cdpSession.browser.get(browser); + if (session) { + debug('getBrowserCDPSession: use existing'); + return session; + } + debug('getBrowserCDPSession: use new'); + try { + session = await browser.newBrowserCDPSession(); + cache.cdpSession.browser.set(browser, session); + return session; + } + catch (err) { + debug('getBrowserCDPSession: error while creating session:', err.message); + debug('getBrowserCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +function createPageShim(page) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(page, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('page - get', objId, prop); + if (prop === '_client') { + return () => ({ + send: async (method, params) => { + const session = await getPageCDPSession(page); + return await session.send(method, params); + }, + on: (event, listener) => { + getPageCDPSession(page).then(session => { + session.on(event, listener); + }); + } + }); + } + if (prop === 'setBypassCSP') { + return async (enabled) => { + const session = await getPageCDPSession(page); + return await session.send('Page.setBypassCSP', { + enabled + }); + }; + } + if (prop === 'setUserAgent') { + return async (userAgent, userAgentMetadata) => { + const session = await getPageCDPSession(page); + return await session.send('Emulation.setUserAgentOverride', { + userAgent, + userAgentMetadata + }); + }; + } + if (prop === 'browser') { + if (isPlaywrightPage(page)) { + return () => { + let browser = page.context().browser(); + if (!browser) { + debug('page.browser() - not available, most likely due to launchPersistentContext'); + // Use a page shim as quick drop-in (so browser.userAgent() still works) + browser = page; + } + return addPuppeteerCompat(browser); + }; + } + } + if (prop === 'evaluateOnNewDocument') { + if (isPlaywrightPage(page)) { + return async function (pageFunction, ...args) { + return await page.addInitScript(pageFunction, args[0]); + }; + } + } + // Only relevant when page is being used a pseudo stand-in for the browser object (launchPersistentContext) + if (prop === 'userAgent') { + return async (enabled) => { + const session = await getPageCDPSession(page); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} +function createBrowserShim(browser) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(browser, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('browser - get', objId, prop); + if (prop === 'pages') { + return () => browser + .contexts() + .flatMap(c => c.pages().map(page => addPuppeteerCompat(page))); + } + if (prop === 'userAgent') { + return async () => { + const session = await getBrowserCDPSession(browser); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} + +const debug$1 = Debug('playwright-extra:plugins'); +class PluginList { + constructor() { + this._plugins = []; + this._dependencyDefaults = new Map(); + this._dependencyResolution = new Map(); + } + /** + * Get a list of all registered plugins. + */ + get list() { + return this._plugins; + } + /** + * Get the names of all registered plugins. + */ + get names() { + return this._plugins.map(p => p.name); + } + /** + * Add a new plugin to the list (after checking if it's well-formed). + * + * @param plugin + * @internal + */ + add(plugin) { + var _a; + if (!this.isValidPluginInstance(plugin)) { + return false; + } + if (!!plugin.onPluginRegistered) { + plugin.onPluginRegistered({ framework: 'playwright' }); + } + // PuppeteerExtraPlugin: Populate `_childClassMembers` list containing methods defined by the plugin + if (!!plugin._registerChildClassMembers) { + plugin._registerChildClassMembers(Object.getPrototypeOf(plugin)); + } + if ((_a = plugin.requirements) === null || _a === void 0 ? void 0 : _a.has('dataFromPlugins')) { + plugin.getDataFromPlugins = this.getData.bind(this); + } + this._plugins.push(plugin); + return true; + } + /** Check if the shape of a plugin is correct or warn */ + isValidPluginInstance(plugin) { + if (!plugin || + typeof plugin !== 'object' || + !plugin._isPuppeteerExtraPlugin) { + console.error(`Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`, plugin); + return false; + } + if (!plugin.name) { + console.error(`Warning: Plugin with no name registering, ignoring.`, plugin); + return false; + } + return true; + } + /** Error callback in case calling a plugin method throws an error. Can be overwritten. */ + onPluginError(plugin, method, err) { + console.warn(`An error occured while executing "${method}" in plugin "${plugin.name}":`, err); + } + /** + * Define default values for plugins implicitly required through the `dependencies` plugin stanza. + * + * @param dependencyPath - The string by which the dependency is listed (not the plugin name) + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' }) + */ + setDependencyDefaults(dependencyPath, opts) { + this._dependencyDefaults.set(dependencyPath, opts); + return this; + } + /** + * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza. + * + * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with. + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin) + */ + setDependencyResolution(dependencyPath, pluginModule) { + this._dependencyResolution.set(dependencyPath, pluginModule); + return this; + } + /** + * Prepare plugins to be used (resolve dependencies, ordering) + * @internal + */ + prepare() { + this.resolveDependencies(); + this.order(); + } + /** Return all plugins using the supplied method */ + filterByMethod(methodName) { + return this._plugins.filter(plugin => { + // PuppeteerExtraPlugin: The base class will already define all methods, hence we need to do a different check + if (!!plugin._childClassMembers && + Array.isArray(plugin._childClassMembers)) { + return plugin._childClassMembers.includes(methodName); + } + return methodName in plugin; + }); + } + /** Conditionally add puppeteer compatibility to values provided to the plugins */ + _addPuppeteerCompatIfNeeded(plugin, method, args) { + const canUseShim = plugin._isPuppeteerExtraPlugin && !plugin.noPuppeteerShim; + const methodWhitelist = [ + 'onBrowser', + 'onPageCreated', + 'onPageClose', + 'afterConnect', + 'afterLaunch' + ]; + const shouldUseShim = methodWhitelist.includes(method); + if (!canUseShim || !shouldUseShim) { + return args; + } + debug$1('add puppeteer compatibility', plugin.name, method); + return [...args.map(arg => addPuppeteerCompat(arg))]; + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Will not await results to dispatch events as fast as possible to all plugins. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + dispatch(method, ...args) { + var _a, _b; + const plugins = this.filterByMethod(method); + debug$1('dispatch', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + const fnType = (_b = (_a = plugin[method]) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name; + debug$1('dispatch to plugin', { + plugin: plugin.name, + method, + fnType + }); + if (fnType === 'AsyncFunction') { + ; + plugin[method](...args).catch((err) => this.onPluginError(plugin, method, err)); + } + else { + ; + plugin[method](...args); + } + } + catch (err) { + this.onPluginError(plugin, method, err); + } + } + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Can also be used to get a definite return value after passing it to plugins: + * Calls plugins sequentially and passes on a value (waterfall style). + * + * The plugins can either modify the value or return an updated one. + * Will return the latest, updated value which ran through all plugins. + * + * By convention only the first argument will be used as the updated value. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + async dispatchBlocking(method, ...args) { + const plugins = this.filterByMethod(method); + debug$1('dispatchBlocking', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + let retValue = null; + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + retValue = await plugin[method](...args); + // In case we got a return value use that as new first argument for followup function calls + if (retValue !== undefined) { + args[0] = retValue; + } + } + catch (err) { + this.onPluginError(plugin, method, err); + return retValue; + } + } + return retValue; + } + /** + * Order plugins that have expressed a special placement requirement. + * + * This is useful/necessary for e.g. plugins that depend on the data from other plugins. + * + * @private + */ + order() { + debug$1('order:before', this.names); + const runLast = this._plugins + .filter(p => { var _a; return (_a = p.requirements) === null || _a === void 0 ? void 0 : _a.has('runLast'); }) + .map(p => p.name); + for (const name of runLast) { + const index = this._plugins.findIndex(p => p.name === name); + this._plugins.push(this._plugins.splice(index, 1)[0]); + } + debug$1('order:after', this.names); + } + /** + * Collects the exposed `data` property of all registered plugins. + * Will be reduced/flattened to a single array. + * + * Can be accessed by plugins that listed the `dataFromPlugins` requirement. + * + * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`). + * + * @see [PuppeteerExtraPlugin]/data + * @param name - Filter data by optional name + * + * @private + */ + getData(name) { + const data = this._plugins + .filter((p) => !!p.data) + .map((p) => (Array.isArray(p.data) ? p.data : [p.data])) + .reduce((acc, arr) => [...acc, ...arr], []); + return name ? data.filter((d) => d.name === name) : data; + } + /** + * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports) + */ + resolvePluginsStanza() { + debug$1('resolvePluginsStanza'); + const pluginNames = new Set(this.names); + this._plugins + .filter(p => !!p.plugins && p.plugins.length) + .filter(p => !pluginNames.has(p.name)) // TBD: Do we want to filter out existing? + .forEach(parent => { + (parent.plugins || []).forEach(p => { + debug$1(parent.name, 'adding missing plugin', p.name); + this.add(p); + }); + }); + } + /** + * Handle `dependencies` stanza (which requires dynamic imports) + * + * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts + * + * @note + * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()` + * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()` + */ + resolveDependenciesStanza() { + debug$1('resolveDependenciesStanza'); + /** Attempt to dynamically require a plugin module */ + const requireDependencyOrDie = (parentName, dependencyPath) => { + // If the user provided the plugin module already we use that + if (this._dependencyResolution.has(dependencyPath)) { + return this._dependencyResolution.get(dependencyPath); + } + const possiblePrefixes = ['puppeteer-extra-plugin-']; // could be extended later + const isAlreadyPrefixed = possiblePrefixes.some(prefix => dependencyPath.startsWith(prefix)); + const packagePaths = []; + // If the dependency is not already prefixed we attempt to require all possible combinations to find one that works + if (!isAlreadyPrefixed) { + packagePaths.push(...possiblePrefixes.map(prefix => prefix + dependencyPath)); + } + // We always attempt to require the path verbatim (as a last resort) + packagePaths.push(dependencyPath); + const pluginModule = requirePackages(packagePaths); + if (pluginModule) { + return pluginModule; + } + const explanation = ` +The plugin '${parentName}' listed '${dependencyPath}' as dependency, +which could not be found. Please install it: + +${packagePaths + .map(packagePath => `yarn add ${packagePath.split('/')[0]}`) + .join(`\n or:\n`)} + +Note: You don't need to require the plugin yourself, +unless you want to modify it's default settings. + +If your bundler has issues with dynamic imports take a look at '.plugins.setDependencyResolution()'. + `; + console.warn(explanation); + throw new Error('Plugin dependency not found'); + }; + const existingPluginNames = new Set(this.names); + const recursivelyLoadMissingDependencies = ({ name: parentName, dependencies }) => { + if (!dependencies) { + return; + } + const processDependency = (dependencyPath, opts) => { + const pluginModule = requireDependencyOrDie(parentName, dependencyPath); + opts = opts || this._dependencyDefaults.get(dependencyPath) || {}; + const plugin = pluginModule(opts); + if (existingPluginNames.has(plugin.name)) { + debug$1(parentName, '=> dependency already exists:', plugin.name); + return; + } + existingPluginNames.add(plugin.name); + debug$1(parentName, '=> adding new dependency:', plugin.name, opts); + this.add(plugin); + return recursivelyLoadMissingDependencies(plugin); + }; + if (dependencies instanceof Set || Array.isArray(dependencies)) { + return [...dependencies].forEach(dependencyPath => processDependency(dependencyPath)); + } + if (dependencies instanceof Map) { + // Note: `k,v => v,k` (Map + forEach will reverse the order) + return dependencies.forEach((v, k) => processDependency(k, v)); + } + }; + this.list.forEach(recursivelyLoadMissingDependencies); + } + /** + * Lightweight plugin dependency management to require plugins and code mods on demand. + * @private + */ + resolveDependencies() { + debug$1('resolveDependencies'); + this.resolvePluginsStanza(); + this.resolveDependenciesStanza(); + } +} + +const debug$2 = Debug('playwright-extra'); +/** + * Modular plugin framework to teach `playwright` new tricks. + */ +class PlaywrightExtraClass { + constructor(_launcher) { + this._launcher = _launcher; + this.plugins = new PluginList(); + } + /** + * The **main interface** to register plugins. + * + * Can be called multiple times to enable multiple plugins. + * + * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer. + * + * @example + * chromium.use(plugin1).use(plugin2) + * firefox.use(plugin1).use(plugin2) + * + * @see [PuppeteerExtraPlugin] + * + * @return The same `PlaywrightExtra` instance (for optional chaining) + */ + use(plugin) { + const isValid = plugin && 'name' in plugin; + if (!isValid) { + throw new Error('A plugin must be provided to .use()'); + } + if (this.plugins.add(plugin)) { + debug$2('Plugin registered', plugin.name); + } + return this; + } + /** + * In order to support a default export which will require vanilla playwright automatically, + * as well as `addExtra` to patch a provided launcher, we need to so some gymnastics here. + * + * Otherwise this would throw immediately, even when only using the `addExtra` export with an arbitrary compatible launcher. + * + * The solution is to make the vanilla launcher optional and only throw once we try to effectively use and can't find it. + * + * @internal + */ + get launcher() { + if (!this._launcher) { + throw playwrightLoader.requireError; + } + return this._launcher; + } + async launch(...args) { + if (!this.launcher.launch) { + throw new Error('Launcher does not support "launch"'); + } + let [options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug$2('launch', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + debug$2('launch with options', options); + if ('userDataDir' in options) { + debug$2("A plugin defined userDataDir during .launch, which isn't supported by playwright - ignoring"); + delete options.userDataDir; + } + const browser = await this.launcher['launch'](options); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterLaunch', browser); + return browser; + } + async launchPersistentContext(...args) { + if (!this.launcher.launchPersistentContext) { + throw new Error('Launcher does not support "launchPersistentContext"'); + } + let [userDataDir, options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug$2('launchPersistentContext', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + const context = await this.launcher['launchPersistentContext'](userDataDir, options); + await this.plugins.dispatchBlocking('afterLaunch', context); + this._bindBrowserContextEvents(context); + return context; + } + async connect(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connect) { + throw new Error('Launcher does not support "connect"'); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connect + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ wsEndpoint: wsEndpointOrOptions }, wsOptions); + } + debug$2('connect', options); + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const wsEndpoint = options.wsEndpoint; + if (wsEndpointAsString) { + delete options.wsEndpoint; + args.push(wsEndpoint, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connect'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async connectOverCDP(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connectOverCDP) { + throw new Error(`Launcher does not implement 'connectOverCDP'`); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connectOverCDP + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ endpointURL: wsEndpointOrOptions }, wsOptions); + } + debug$2('connectOverCDP'), options; + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const endpointURL = options.endpointURL; + if (wsEndpointAsString) { + delete options.endpointURL; + args.push(endpointURL, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connectOverCDP'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async _bindBrowserContextEvents(context, contextOptions) { + debug$2('_bindBrowserContextEvents'); + this.plugins.dispatch('onContextCreated', context, contextOptions); + // Make sure things like `addInitScript` show an effect on the very first page as well + context.newPage = ((originalMethod, ctx) => { + return async () => { + const page = await originalMethod.call(ctx); + await page.goto('about:blank'); + return page; + }; + })(context.newPage, context); + context.on('close', () => { + // When using `launchPersistentContext` context closing is the same as browser closing + if (!context.browser()) { + this.plugins.dispatch('onDisconnected'); + } + }); + context.on('page', page => { + this.plugins.dispatch('onPageCreated', page); + page.on('close', () => { + this.plugins.dispatch('onPageClose', page); + }); + }); + } + async _bindBrowserEvents(browser) { + debug$2('_bindPlaywrightBrowserEvents'); + browser.on('disconnected', () => { + this.plugins.dispatch('onDisconnected', browser); + }); + // Note: `browser.newPage` will implicitly call `browser.newContext` as well + browser.newContext = ((originalMethod, ctx) => { + return async (options = {}) => { + const contextOptions = (await this.plugins.dispatchBlocking('beforeContext', options, browser)) || options; + const context = await originalMethod.call(ctx, contextOptions); + this._bindBrowserContextEvents(context, contextOptions); + return context; + }; + })(browser.newContext, browser); + } +} +/** + * PlaywrightExtra class with additional launcher methods. + * + * Augments the class with an instance proxy to pass on methods that are not augmented to the original target. + * + */ +const PlaywrightExtra = new Proxy(PlaywrightExtraClass, { + construct(classTarget, args) { + debug$2(`create instance of ${classTarget.name}`); + const result = Reflect.construct(classTarget, args); + return new Proxy(result, { + get(target, prop) { + if (prop in target) { + return Reflect.get(target, prop); + } + debug$2('proxying property to original launcher: ', prop); + return Reflect.get(target.launcher, prop); + } + }); + } +}); + +/** + * Augment the provided Playwright browser launcher with plugin functionality. + * + * Using `addExtra` will always create a fresh PlaywrightExtra instance. + * + * @example + * import playwright from 'playwright' + * import { addExtra } from 'playwright-extra' + * + * const chromium = addExtra(playwright.chromium) + * chromium.use(plugin) + * + * @param launcher - Playwright (or compatible) browser launcher + */ +const addExtra = (launcher) => new PlaywrightExtra(launcher); +/** + * This object can be used to launch or connect to Chromium with plugin functionality. + * + * This default export will behave exactly the same as the regular playwright + * (just with extra plugin functionality) and can be used as a drop-in replacement. + * + * Behind the scenes it will try to require either the `playwright-core` + * or `playwright` module from the installed dependencies. + * + * @note + * Due to Node.js import caching this will result in a single + * PlaywrightExtra instance, even when used in different files. If you need multiple + * instances with different plugins please use `addExtra`. + * + * @example + * // javascript import + * const { chromium } = require('playwright-extra') + * + * // typescript/es6 module import + * import { chromium } from 'playwright-extra' + * + * // Add plugins + * chromium.use(...) + */ +const chromium = addExtra((playwrightLoader.loadModule() || {}).chromium); +/** + * This object can be used to launch or connect to Firefox with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +const firefox = addExtra((playwrightLoader.loadModule() || {}).firefox); +/** + * This object can be used to launch or connect to Webkit with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +const webkit = addExtra((playwrightLoader.loadModule() || {}).webkit); +// Other playwright module exports we simply re-export with lazy loading +const _android = playwrightLoader.lazyloadExportOrDie('_android'); +const _electron = playwrightLoader.lazyloadExportOrDie('_electron'); +const request = playwrightLoader.lazyloadExportOrDie('request'); +const selectors = playwrightLoader.lazyloadExportOrDie('selectors'); +const devices = playwrightLoader.lazyloadExportOrDie('devices'); +const errors = playwrightLoader.lazyloadExportOrDie('errors'); +/** Playwright with plugin functionality */ +const moduleExports = { + // custom exports + PlaywrightExtra, + PlaywrightExtraClass, + PluginList, + addExtra, + chromium, + firefox, + webkit, + // vanilla exports + _android, + _electron, + request, + selectors, + devices, + errors +}; + +exports.PlaywrightExtra = PlaywrightExtra; +exports.PlaywrightExtraClass = PlaywrightExtraClass; +exports.PluginList = PluginList; +exports._android = _android; +exports._electron = _electron; +exports.addExtra = addExtra; +exports.chromium = chromium; +exports.default = moduleExports; +exports.devices = devices; +exports.errors = errors; +exports.firefox = firefox; +exports.request = request; +exports.selectors = selectors; +exports.webkit = webkit; + + + module.exports = exports.default || {} + Object.entries(exports).forEach(([key, value]) => { module.exports[key] = value }) +//# sourceMappingURL=index.cjs.js.map diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js.map new file mode 100644 index 0000000..005b966 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs.js","sources":["../src/helper/loader.ts","../src/puppeteer-compatiblity-shim/index.ts","../src/plugins.ts","../src/extra.ts","../src/index.ts"],"sourcesContent":["import type * as pw from 'playwright-core'\n\n/** Node.js module loader helper */\nexport class Loader {\n constructor(public moduleName: string, public packageNames: string[]) {}\n\n /**\n * Lazy load a top level export from another module by wrapping it in a JS proxy.\n *\n * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls\n * to it to the module version the user has installed, rather than shipping with a hardcoded version.\n *\n * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported.\n *\n * We use a \"super\" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value.\n */\n public lazyloadExportOrDie(exportName: T) {\n const that = this\n const trapHandler = Object.fromEntries(\n Object.getOwnPropertyNames(Reflect).map((name: any) => [\n name,\n function (target: any, ...args: any[]) {\n const moduleExport = that.loadModuleOrDie()[exportName]\n const customTarget = moduleExport as any\n const result = ((Reflect as any)[name] as any)(\n customTarget || target,\n ...args\n )\n return result\n }\n ])\n )\n return new Proxy({}, trapHandler) as TargetModule[T]\n }\n\n /** Load the module if possible */\n public loadModule() {\n return requirePackages(this.packageNames)\n }\n\n /** Load the module if possible or throw */\n public loadModuleOrDie(): TargetModule {\n const module = requirePackages(this.packageNames)\n if (module) {\n return module\n }\n throw this.requireError\n }\n\n public get requireError() {\n const moduleNamePretty =\n this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1)\n return new Error(`\n ${moduleNamePretty} is missing. :-)\n\n I've tried loading ${this.packageNames\n .map(p => `\"${p}\"`)\n .join(', ')} - no luck.\n\n Make sure you install one of those packages or use the named 'addExtra' export,\n to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}.\n\n To get the latest stable version of ${moduleNamePretty} run:\n 'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}'\n `)\n }\n}\n\nexport function requirePackages(packageNames: string[]) {\n for (const name of packageNames) {\n try {\n return require(name) as TargetModule\n } catch (_) {\n continue // noop\n }\n }\n return\n}\n\n/** Playwright specific module loader */\nexport const playwrightLoader = new Loader('playwright', [\n 'playwright-core',\n 'playwright'\n])\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra:puppeteer-compat')\n\nimport type * as pw from 'playwright-core'\n\nexport type PlaywrightObject = pw.Page | pw.Frame | pw.Browser\n\nexport interface PuppeteerBrowserShim {\n isCompatShim?: boolean\n isPlaywright?: boolean\n pages?: pw.BrowserContext['pages']\n userAgent: () => Promise<'string'>\n}\n\nexport interface PuppeteerPageShim {\n isCompatShim?: boolean\n isPlaywright?: boolean\n browser?: () => pw.Browser\n evaluateOnNewDocument?: pw.Page['addInitScript']\n _client: () => pw.CDPSession\n}\n\nexport const isPlaywrightPage = (obj: unknown): obj is pw.Page => {\n return 'unroute' in (obj as pw.Page)\n}\nexport const isPlaywrightFrame = (obj: unknown): obj is pw.Frame => {\n return ['parentFrame', 'frameLocator'].every(x => x in (obj as pw.Frame))\n}\nexport const isPlaywrightBrowser = (obj: unknown): obj is pw.Browser => {\n return 'newContext' in (obj as pw.Browser)\n}\nexport const isPuppeteerCompat = (obj?: unknown): obj is PlaywrightObject => {\n return !!obj && typeof obj === 'object' && !!(obj as any).isCompatShim\n}\n\nconst cache = {\n objectToShim: new Map(),\n cdpSession: {\n page: new Map(),\n browser: new Map()\n }\n}\n\n/** Augment a Playwright object with compatibility with certain Puppeteer methods */\nexport function addPuppeteerCompat<\n Input extends pw.Page | pw.Frame | pw.Browser | null\n>(object: Input): Input {\n if (!object || typeof object !== 'object') {\n return object\n }\n if (cache.objectToShim.has(object)) {\n return cache.objectToShim.get(object) as Input\n }\n if (isPuppeteerCompat(object)) {\n return object\n }\n debug('addPuppeteerCompat', cache.objectToShim.size)\n if (isPlaywrightPage(object) || isPlaywrightFrame(object)) {\n const shim = createPageShim(object)\n cache.objectToShim.set(object, shim)\n return shim as Input\n }\n if (isPlaywrightBrowser(object)) {\n const shim = createBrowserShim(object)\n cache.objectToShim.set(object, shim)\n return shim as Input\n }\n debug('Received unknown object:', Reflect.ownKeys(object))\n return object\n}\n\n// Only chromium browsers support CDP\nconst dummyCDPClient = {\n send: async (...args: any[]) => {\n debug('dummy CDP client called', 'send', args)\n },\n on: (...args: any[]) => {\n debug('dummy CDP client called', 'on', args)\n }\n} as pw.CDPSession\n\nexport async function getPageCDPSession(page: pw.Page | pw.Frame) {\n let session = cache.cdpSession.page.get(page)\n if (session) {\n debug('getPageCDPSession: use existing')\n return session\n }\n debug('getPageCDPSession: use new')\n const context = isPlaywrightFrame(page)\n ? page.page().context()\n : page.context()\n try {\n session = await context.newCDPSession(page)\n cache.cdpSession.page.set(page, session)\n return session\n } catch (err: any) {\n debug('getPageCDPSession: error while creating session:', err.message)\n debug(\n 'getPageCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'\n )\n }\n return dummyCDPClient\n}\n\nexport async function getBrowserCDPSession(browser: pw.Browser) {\n let session = cache.cdpSession.browser.get(browser)\n if (session) {\n debug('getBrowserCDPSession: use existing')\n return session\n }\n debug('getBrowserCDPSession: use new')\n try {\n session = await browser.newBrowserCDPSession()\n cache.cdpSession.browser.set(browser, session)\n return session\n } catch (err: any) {\n debug('getBrowserCDPSession: error while creating session:', err.message)\n debug(\n 'getBrowserCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'\n )\n }\n return dummyCDPClient\n}\n\nexport function createPageShim(page: pw.Page | pw.Frame) {\n const objId = Math.random().toString(36).substring(2, 7)\n const shim = new Proxy(page, {\n get(target, prop) {\n if (prop === 'isCompatShim' || prop === 'isPlaywright') {\n return true\n }\n debug('page - get', objId, prop)\n if (prop === '_client') {\n return () => ({\n send: async (method: string, params: any) => {\n const session = await getPageCDPSession(page)\n return await session.send(method as any, params)\n },\n on: (event: string, listener: any) => {\n getPageCDPSession(page).then(session => {\n session.on(event as any, listener)\n })\n }\n })\n }\n if (prop === 'setBypassCSP') {\n return async (enabled: boolean) => {\n const session = await getPageCDPSession(page)\n return await session.send('Page.setBypassCSP', {\n enabled\n })\n }\n }\n if (prop === 'setUserAgent') {\n return async (userAgent: string, userAgentMetadata?: any) => {\n const session = await getPageCDPSession(page)\n return await session.send('Emulation.setUserAgentOverride', {\n userAgent,\n userAgentMetadata\n })\n }\n }\n if (prop === 'browser') {\n if (isPlaywrightPage(page)) {\n return () => {\n let browser = page.context().browser()\n if (!browser) {\n debug(\n 'page.browser() - not available, most likely due to launchPersistentContext'\n )\n // Use a page shim as quick drop-in (so browser.userAgent() still works)\n browser = page as any\n }\n return addPuppeteerCompat(browser)\n }\n }\n }\n if (prop === 'evaluateOnNewDocument') {\n if (isPlaywrightPage(page)) {\n return async function (pageFunction: any | string, ...args: any[]) {\n return await page.addInitScript(pageFunction, args[0])\n }\n }\n }\n // Only relevant when page is being used a pseudo stand-in for the browser object (launchPersistentContext)\n if (prop === 'userAgent') {\n return async (enabled: boolean) => {\n const session = await getPageCDPSession(page)\n const data = await session.send('Browser.getVersion')\n return data.userAgent\n }\n }\n return Reflect.get(target, prop)\n }\n })\n return shim\n}\n\nexport function createBrowserShim(browser: pw.Browser) {\n const objId = Math.random().toString(36).substring(2, 7)\n const shim = new Proxy(browser, {\n get(target, prop) {\n if (prop === 'isCompatShim' || prop === 'isPlaywright') {\n return true\n }\n debug('browser - get', objId, prop)\n if (prop === 'pages') {\n return () =>\n browser\n .contexts()\n .flatMap(c => c.pages().map(page => addPuppeteerCompat(page)))\n }\n if (prop === 'userAgent') {\n return async () => {\n const session = await getBrowserCDPSession(browser)\n const data = await session.send('Browser.getVersion')\n return data.userAgent\n }\n }\n return Reflect.get(target, prop)\n }\n })\n return shim\n}\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra:plugins')\n\nimport {\n Plugin,\n PluginMethodName,\n PluginMethodFn,\n PluginModule,\n CompatiblePluginModule\n} from './types'\n\nimport { requirePackages } from './helper/loader'\nimport { addPuppeteerCompat } from './puppeteer-compatiblity-shim'\n\nexport class PluginList {\n private readonly _plugins: Plugin[] = []\n private readonly _dependencyDefaults: Map = new Map()\n private readonly _dependencyResolution: Map =\n new Map()\n\n constructor() {}\n\n /**\n * Get a list of all registered plugins.\n */\n public get list() {\n return this._plugins\n }\n\n /**\n * Get the names of all registered plugins.\n */\n public get names() {\n return this._plugins.map(p => p.name)\n }\n\n /**\n * Add a new plugin to the list (after checking if it's well-formed).\n *\n * @param plugin\n * @internal\n */\n public add(plugin: Plugin) {\n if (!this.isValidPluginInstance(plugin)) {\n return false\n }\n if (!!plugin.onPluginRegistered) {\n plugin.onPluginRegistered({ framework: 'playwright' })\n }\n // PuppeteerExtraPlugin: Populate `_childClassMembers` list containing methods defined by the plugin\n if (!!plugin._registerChildClassMembers) {\n plugin._registerChildClassMembers(Object.getPrototypeOf(plugin))\n }\n if (plugin.requirements?.has('dataFromPlugins')) {\n plugin.getDataFromPlugins = this.getData.bind(this)\n }\n this._plugins.push(plugin)\n return true\n }\n\n /** Check if the shape of a plugin is correct or warn */\n protected isValidPluginInstance(plugin: Plugin) {\n if (\n !plugin ||\n typeof plugin !== 'object' ||\n !plugin._isPuppeteerExtraPlugin\n ) {\n console.error(\n `Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`,\n plugin\n )\n return false\n }\n if (!plugin.name) {\n console.error(\n `Warning: Plugin with no name registering, ignoring.`,\n plugin\n )\n return false\n }\n return true\n }\n\n /** Error callback in case calling a plugin method throws an error. Can be overwritten. */\n public onPluginError(plugin: Plugin, method: PluginMethodName, err: Error) {\n console.warn(\n `An error occured while executing \"${method}\" in plugin \"${plugin.name}\":`,\n err\n )\n }\n\n /**\n * Define default values for plugins implicitly required through the `dependencies` plugin stanza.\n *\n * @param dependencyPath - The string by which the dependency is listed (not the plugin name)\n *\n * @example\n * chromium.use(stealth)\n * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' })\n */\n public setDependencyDefaults(dependencyPath: string, opts: any) {\n this._dependencyDefaults.set(dependencyPath, opts)\n return this\n }\n\n /**\n * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza.\n *\n * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with.\n *\n * @example\n * chromium.use(stealth)\n * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin)\n */\n public setDependencyResolution(\n dependencyPath: string,\n pluginModule: CompatiblePluginModule\n ) {\n this._dependencyResolution.set(dependencyPath, pluginModule)\n return this\n }\n\n /**\n * Prepare plugins to be used (resolve dependencies, ordering)\n * @internal\n */\n public prepare() {\n this.resolveDependencies()\n this.order()\n }\n\n /** Return all plugins using the supplied method */\n protected filterByMethod(methodName: PluginMethodName) {\n return this._plugins.filter(plugin => {\n // PuppeteerExtraPlugin: The base class will already define all methods, hence we need to do a different check\n if (\n !!plugin._childClassMembers &&\n Array.isArray(plugin._childClassMembers)\n ) {\n return plugin._childClassMembers.includes(methodName)\n }\n return methodName in plugin\n })\n }\n\n /** Conditionally add puppeteer compatibility to values provided to the plugins */\n protected _addPuppeteerCompatIfNeeded(\n plugin: Plugin,\n method: TMethod,\n args: Parameters>\n ) {\n const canUseShim = plugin._isPuppeteerExtraPlugin && !plugin.noPuppeteerShim\n const methodWhitelist: PluginMethodName[] = [\n 'onBrowser',\n 'onPageCreated',\n 'onPageClose',\n 'afterConnect',\n 'afterLaunch'\n ]\n const shouldUseShim = methodWhitelist.includes(method)\n if (!canUseShim || !shouldUseShim) {\n return args\n }\n debug('add puppeteer compatibility', plugin.name, method)\n return [...args.map(arg => addPuppeteerCompat(arg as any))] as Parameters<\n PluginMethodFn\n >\n }\n\n /**\n * Dispatch plugin lifecycle events in a typesafe way.\n * Only Plugins that expose the supplied property will be called.\n *\n * Will not await results to dispatch events as fast as possible to all plugins.\n *\n * @param method - The lifecycle method name\n * @param args - Optional: Any arguments to be supplied to the plugin methods\n * @internal\n */\n public dispatch(\n method: TMethod,\n ...args: Parameters>\n ): void {\n const plugins = this.filterByMethod(method)\n debug('dispatch', method, {\n all: this._plugins.length,\n filteredByMethod: plugins.length\n })\n for (const plugin of plugins) {\n try {\n args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args)\n const fnType = plugin[method]?.constructor?.name\n debug('dispatch to plugin', {\n plugin: plugin.name,\n method,\n fnType\n })\n if (fnType === 'AsyncFunction') {\n ;(plugin[method] as any)(...args).catch((err: any) =>\n this.onPluginError(plugin, method, err)\n )\n } else {\n ;(plugin[method] as any)(...args)\n }\n } catch (err) {\n this.onPluginError(plugin, method, err as any)\n }\n }\n }\n\n /**\n * Dispatch plugin lifecycle events in a typesafe way.\n * Only Plugins that expose the supplied property will be called.\n *\n * Can also be used to get a definite return value after passing it to plugins:\n * Calls plugins sequentially and passes on a value (waterfall style).\n *\n * The plugins can either modify the value or return an updated one.\n * Will return the latest, updated value which ran through all plugins.\n *\n * By convention only the first argument will be used as the updated value.\n *\n * @param method - The lifecycle method name\n * @param args - Optional: Any arguments to be supplied to the plugin methods\n * @internal\n */\n public async dispatchBlocking(\n method: TMethod,\n ...args: Parameters>\n ): Promise>> {\n const plugins = this.filterByMethod(method)\n debug('dispatchBlocking', method, {\n all: this._plugins.length,\n filteredByMethod: plugins.length\n })\n\n let retValue: any = null\n for (const plugin of plugins) {\n try {\n args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args)\n retValue = await (plugin[method] as any)(...args)\n // In case we got a return value use that as new first argument for followup function calls\n if (retValue !== undefined) {\n args[0] = retValue\n }\n } catch (err) {\n this.onPluginError(plugin, method, err as any)\n return retValue\n }\n }\n return retValue\n }\n\n /**\n * Order plugins that have expressed a special placement requirement.\n *\n * This is useful/necessary for e.g. plugins that depend on the data from other plugins.\n *\n * @private\n */\n protected order() {\n debug('order:before', this.names)\n const runLast = this._plugins\n .filter(p => p.requirements?.has('runLast'))\n .map(p => p.name)\n for (const name of runLast) {\n const index = this._plugins.findIndex(p => p.name === name)\n this._plugins.push(this._plugins.splice(index, 1)[0])\n }\n debug('order:after', this.names)\n }\n\n /**\n * Collects the exposed `data` property of all registered plugins.\n * Will be reduced/flattened to a single array.\n *\n * Can be accessed by plugins that listed the `dataFromPlugins` requirement.\n *\n * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`).\n *\n * @see [PuppeteerExtraPlugin]/data\n * @param name - Filter data by optional name\n *\n * @private\n */\n protected getData(name?: string) {\n const data = this._plugins\n .filter((p: any) => !!p.data)\n .map((p: any) => (Array.isArray(p.data) ? p.data : [p.data]))\n .reduce((acc, arr) => [...acc, ...arr], [])\n return name ? data.filter((d: any) => d.name === name) : data\n }\n\n /**\n * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports)\n */\n protected resolvePluginsStanza() {\n debug('resolvePluginsStanza')\n const pluginNames = new Set(this.names)\n this._plugins\n .filter(p => !!p.plugins && p.plugins.length)\n .filter(p => !pluginNames.has(p.name)) // TBD: Do we want to filter out existing?\n .forEach(parent => {\n ;(parent.plugins || []).forEach(p => {\n debug(parent.name, 'adding missing plugin', p.name)\n this.add(p as Plugin)\n })\n })\n }\n\n /**\n * Handle `dependencies` stanza (which requires dynamic imports)\n *\n * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts\n *\n * @note\n * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()`\n * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()`\n */\n protected resolveDependenciesStanza() {\n debug('resolveDependenciesStanza')\n\n /** Attempt to dynamically require a plugin module */\n const requireDependencyOrDie = (\n parentName: string,\n dependencyPath: string\n ) => {\n // If the user provided the plugin module already we use that\n if (this._dependencyResolution.has(dependencyPath)) {\n return this._dependencyResolution.get(dependencyPath) as PluginModule\n }\n\n const possiblePrefixes = ['puppeteer-extra-plugin-'] // could be extended later\n const isAlreadyPrefixed = possiblePrefixes.some(prefix =>\n dependencyPath.startsWith(prefix)\n )\n const packagePaths: string[] = []\n // If the dependency is not already prefixed we attempt to require all possible combinations to find one that works\n if (!isAlreadyPrefixed) {\n packagePaths.push(\n ...possiblePrefixes.map(prefix => prefix + dependencyPath)\n )\n }\n // We always attempt to require the path verbatim (as a last resort)\n packagePaths.push(dependencyPath)\n const pluginModule = requirePackages(packagePaths)\n if (pluginModule) {\n return pluginModule\n }\n\n const explanation = `\nThe plugin '${parentName}' listed '${dependencyPath}' as dependency,\nwhich could not be found. Please install it:\n\n${packagePaths\n .map(packagePath => `yarn add ${packagePath.split('/')[0]}`)\n .join(`\\n or:\\n`)}\n\nNote: You don't need to require the plugin yourself,\nunless you want to modify it's default settings.\n\nIf your bundler has issues with dynamic imports take a look at '.plugins.setDependencyResolution()'.\n `\n console.warn(explanation)\n throw new Error('Plugin dependency not found')\n }\n\n const existingPluginNames = new Set(this.names)\n const recursivelyLoadMissingDependencies = ({\n name: parentName,\n dependencies\n }: Plugin): any => {\n if (!dependencies) {\n return\n }\n const processDependency = (dependencyPath: string, opts?: any) => {\n const pluginModule = requireDependencyOrDie(parentName, dependencyPath)\n opts = opts || this._dependencyDefaults.get(dependencyPath) || {}\n const plugin = pluginModule(opts)\n if (existingPluginNames.has(plugin.name)) {\n debug(parentName, '=> dependency already exists:', plugin.name)\n return\n }\n existingPluginNames.add(plugin.name)\n debug(parentName, '=> adding new dependency:', plugin.name, opts)\n this.add(plugin)\n return recursivelyLoadMissingDependencies(plugin)\n }\n\n if (dependencies instanceof Set || Array.isArray(dependencies)) {\n return [...dependencies].forEach(dependencyPath =>\n processDependency(dependencyPath)\n )\n }\n if (dependencies instanceof Map) {\n // Note: `k,v => v,k` (Map + forEach will reverse the order)\n return dependencies.forEach((v, k) => processDependency(k, v))\n }\n }\n this.list.forEach(recursivelyLoadMissingDependencies)\n }\n\n /**\n * Lightweight plugin dependency management to require plugins and code mods on demand.\n * @private\n */\n protected resolveDependencies() {\n debug('resolveDependencies')\n this.resolvePluginsStanza()\n this.resolveDependenciesStanza()\n }\n}\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra')\n\nimport type * as pw from 'playwright-core'\nimport type { CompatiblePlugin, Plugin } from './types'\n\nimport { PluginList } from './plugins'\nimport { playwrightLoader } from './helper/loader'\n\ntype PlaywrightBrowserLauncher = pw.BrowserType\n\n/**\n * The Playwright browser launcher APIs we're augmenting\n * @private\n */\ninterface AugmentedLauncherAPIs\n extends Pick<\n PlaywrightBrowserLauncher,\n 'launch' | 'launchPersistentContext' | 'connect' | 'connectOverCDP'\n > {}\n\n/**\n * Modular plugin framework to teach `playwright` new tricks.\n */\nexport class PlaywrightExtraClass implements AugmentedLauncherAPIs {\n /** Plugin manager */\n public readonly plugins: PluginList\n\n constructor(private _launcher?: Partial) {\n this.plugins = new PluginList()\n }\n\n /**\n * The **main interface** to register plugins.\n *\n * Can be called multiple times to enable multiple plugins.\n *\n * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer.\n *\n * @example\n * chromium.use(plugin1).use(plugin2)\n * firefox.use(plugin1).use(plugin2)\n *\n * @see [PuppeteerExtraPlugin]\n *\n * @return The same `PlaywrightExtra` instance (for optional chaining)\n */\n public use(plugin: CompatiblePlugin): this {\n const isValid = plugin && 'name' in plugin\n if (!isValid) {\n throw new Error('A plugin must be provided to .use()')\n }\n if (this.plugins.add(plugin as Plugin)) {\n debug('Plugin registered', plugin.name)\n }\n return this\n }\n\n /**\n * In order to support a default export which will require vanilla playwright automatically,\n * as well as `addExtra` to patch a provided launcher, we need to so some gymnastics here.\n *\n * Otherwise this would throw immediately, even when only using the `addExtra` export with an arbitrary compatible launcher.\n *\n * The solution is to make the vanilla launcher optional and only throw once we try to effectively use and can't find it.\n *\n * @internal\n */\n public get launcher(): Partial {\n if (!this._launcher) {\n throw playwrightLoader.requireError\n }\n return this._launcher\n }\n\n public async launch(\n ...args: Parameters\n ): ReturnType {\n if (!this.launcher.launch) {\n throw new Error('Launcher does not support \"launch\"')\n }\n\n let [options] = args\n options = { args: [], ...(options || {}) } // Initialize args array\n debug('launch', options)\n this.plugins.prepare()\n\n // Give plugins the chance to modify the options before continuing\n options =\n (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options\n\n debug('launch with options', options)\n if ('userDataDir' in options) {\n debug(\n \"A plugin defined userDataDir during .launch, which isn't supported by playwright - ignoring\"\n )\n delete (options as any).userDataDir\n }\n const browser = await this.launcher['launch'](options)\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterLaunch', browser)\n return browser\n }\n\n public async launchPersistentContext(\n ...args: Parameters\n ): ReturnType {\n if (!this.launcher.launchPersistentContext) {\n throw new Error('Launcher does not support \"launchPersistentContext\"')\n }\n\n let [userDataDir, options] = args\n options = { args: [], ...(options || {}) } // Initialize args array\n debug('launchPersistentContext', options)\n this.plugins.prepare()\n\n // Give plugins the chance to modify the options before continuing\n options =\n (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options\n\n const context = await this.launcher['launchPersistentContext'](\n userDataDir,\n options\n )\n await this.plugins.dispatchBlocking('afterLaunch', context)\n this._bindBrowserContextEvents(context)\n return context\n }\n\n async connect(\n wsEndpointOrOptions: string | (pw.ConnectOptions & { wsEndpoint?: string }),\n wsOptions: pw.ConnectOptions = {}\n ): ReturnType {\n if (!this.launcher.connect) {\n throw new Error('Launcher does not support \"connect\"')\n }\n this.plugins.prepare()\n\n // Playwright currently supports two function signatures for .connect\n let options: pw.ConnectOptions & { wsEndpoint?: string } = {}\n let wsEndpointAsString = false\n if (typeof wsEndpointOrOptions === 'object') {\n options = { ...wsEndpointOrOptions, ...wsOptions }\n } else {\n wsEndpointAsString = true\n options = { wsEndpoint: wsEndpointOrOptions, ...wsOptions }\n }\n debug('connect', options)\n\n // Give plugins the chance to modify the options before launch/connect\n options =\n (await this.plugins.dispatchBlocking('beforeConnect', options)) || options\n\n // Follow call signature of end user\n const args: any[] = []\n const wsEndpoint = options.wsEndpoint\n if (wsEndpointAsString) {\n delete options.wsEndpoint\n args.push(wsEndpoint, options)\n } else {\n args.push(options)\n }\n\n const browser = (await (this.launcher['connect'] as any)(\n ...args\n )) as pw.Browser\n\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterConnect', browser)\n return browser\n }\n\n async connectOverCDP(\n wsEndpointOrOptions:\n | string\n | (pw.ConnectOverCDPOptions & { endpointURL?: string }),\n wsOptions: pw.ConnectOverCDPOptions = {}\n ): ReturnType {\n if (!this.launcher.connectOverCDP) {\n throw new Error(`Launcher does not implement 'connectOverCDP'`)\n }\n this.plugins.prepare()\n\n // Playwright currently supports two function signatures for .connectOverCDP\n let options: pw.ConnectOverCDPOptions & { endpointURL?: string } = {}\n let wsEndpointAsString = false\n if (typeof wsEndpointOrOptions === 'object') {\n options = { ...wsEndpointOrOptions, ...wsOptions }\n } else {\n wsEndpointAsString = true\n options = { endpointURL: wsEndpointOrOptions, ...wsOptions }\n }\n debug('connectOverCDP'), options\n\n // Give plugins the chance to modify the options before launch/connect\n options =\n (await this.plugins.dispatchBlocking('beforeConnect', options)) || options\n\n // Follow call signature of end user\n const args: any[] = []\n const endpointURL = options.endpointURL\n if (wsEndpointAsString) {\n delete options.endpointURL\n args.push(endpointURL, options)\n } else {\n args.push(options)\n }\n\n const browser = (await (this.launcher['connectOverCDP'] as any)(\n ...args\n )) as pw.Browser\n\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterConnect', browser)\n return browser\n }\n\n protected async _bindBrowserContextEvents(\n context: pw.BrowserContext,\n contextOptions?: pw.BrowserContextOptions\n ) {\n debug('_bindBrowserContextEvents')\n this.plugins.dispatch('onContextCreated', context, contextOptions)\n\n // Make sure things like `addInitScript` show an effect on the very first page as well\n context.newPage = ((originalMethod, ctx) => {\n return async () => {\n const page = await originalMethod.call(ctx)\n await page.goto('about:blank')\n return page\n }\n })(context.newPage, context)\n\n context.on('close', () => {\n // When using `launchPersistentContext` context closing is the same as browser closing\n if (!context.browser()) {\n this.plugins.dispatch('onDisconnected')\n }\n })\n context.on('page', page => {\n this.plugins.dispatch('onPageCreated', page)\n page.on('close', () => {\n this.plugins.dispatch('onPageClose', page)\n })\n })\n }\n\n protected async _bindBrowserEvents(browser: pw.Browser) {\n debug('_bindPlaywrightBrowserEvents')\n\n browser.on('disconnected', () => {\n this.plugins.dispatch('onDisconnected', browser)\n })\n\n // Note: `browser.newPage` will implicitly call `browser.newContext` as well\n browser.newContext = ((originalMethod, ctx) => {\n return async (options: pw.BrowserContextOptions = {}) => {\n const contextOptions: pw.BrowserContextOptions =\n (await this.plugins.dispatchBlocking(\n 'beforeContext',\n options,\n browser\n )) || options\n const context = await originalMethod.call(ctx, contextOptions)\n this._bindBrowserContextEvents(context, contextOptions)\n return context\n }\n })(browser.newContext, browser)\n }\n}\n\n/**\n * PlaywrightExtra class with additional launcher methods.\n *\n * Augments the class with an instance proxy to pass on methods that are not augmented to the original target.\n *\n */\nexport const PlaywrightExtra = new Proxy(PlaywrightExtraClass, {\n construct(classTarget, args) {\n debug(`create instance of ${classTarget.name}`)\n const result = Reflect.construct(classTarget, args) as PlaywrightExtraClass\n return new Proxy(result, {\n get(target, prop) {\n if (prop in target) {\n return Reflect.get(target, prop)\n }\n debug('proxying property to original launcher: ', prop)\n return Reflect.get(target.launcher, prop)\n }\n })\n }\n})\n","import type * as pw from 'playwright-core'\n\nimport { PlaywrightExtra, PlaywrightExtraClass } from './extra'\nimport { PluginList } from './plugins'\nimport { playwrightLoader as loader } from './helper/loader'\n\nexport { PlaywrightExtra, PlaywrightExtraClass } from './extra'\nexport { PluginList } from './plugins'\n\n/** A playwright browser launcher */\nexport type PlaywrightBrowserLauncher = pw.BrowserType<{}>\n/** A playwright browser launcher with plugin functionality */\nexport type AugmentedBrowserLauncher = PlaywrightExtraClass &\n PlaywrightBrowserLauncher\n\n/**\n * The minimum shape we expect from a playwright compatible launcher object.\n * We intentionally keep this not strict so other custom or compatible launchers can be used.\n */\nexport interface PlaywrightCompatibleLauncher {\n connect(...args: any[]): Promise\n launch(...args: any[]): Promise\n}\n\n/** Our custom module exports */\ninterface ExtraModuleExports {\n PlaywrightExtra: typeof PlaywrightExtra\n PlaywrightExtraClass: typeof PlaywrightExtraClass\n PluginList: typeof PluginList\n addExtra: typeof addExtra\n chromium: AugmentedBrowserLauncher\n firefox: AugmentedBrowserLauncher\n webkit: AugmentedBrowserLauncher\n}\n\n/** Vanilla playwright module exports */\ntype PlaywrightModuleExports = typeof pw\n\n/**\n * Augment the provided Playwright browser launcher with plugin functionality.\n *\n * Using `addExtra` will always create a fresh PlaywrightExtra instance.\n *\n * @example\n * import playwright from 'playwright'\n * import { addExtra } from 'playwright-extra'\n *\n * const chromium = addExtra(playwright.chromium)\n * chromium.use(plugin)\n *\n * @param launcher - Playwright (or compatible) browser launcher\n */\nexport const addExtra = (\n launcher?: Launcher\n) => new PlaywrightExtra(launcher) as PlaywrightExtraClass & Launcher\n\n/**\n * This object can be used to launch or connect to Chromium with plugin functionality.\n *\n * This default export will behave exactly the same as the regular playwright\n * (just with extra plugin functionality) and can be used as a drop-in replacement.\n *\n * Behind the scenes it will try to require either the `playwright-core`\n * or `playwright` module from the installed dependencies.\n *\n * @note\n * Due to Node.js import caching this will result in a single\n * PlaywrightExtra instance, even when used in different files. If you need multiple\n * instances with different plugins please use `addExtra`.\n *\n * @example\n * // javascript import\n * const { chromium } = require('playwright-extra')\n *\n * // typescript/es6 module import\n * import { chromium } from 'playwright-extra'\n *\n * // Add plugins\n * chromium.use(...)\n */\nexport const chromium = addExtra((loader.loadModule() || {}).chromium)\n/**\n * This object can be used to launch or connect to Firefox with plugin functionality\n * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra`\n */\nexport const firefox = addExtra((loader.loadModule() || {}).firefox)\n/**\n * This object can be used to launch or connect to Webkit with plugin functionality\n * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra`\n */\nexport const webkit = addExtra((loader.loadModule() || {}).webkit)\n\n// Other playwright module exports we simply re-export with lazy loading\nexport const _android = loader.lazyloadExportOrDie('_android')\nexport const _electron = loader.lazyloadExportOrDie('_electron')\nexport const request = loader.lazyloadExportOrDie('request')\nexport const selectors = loader.lazyloadExportOrDie('selectors')\nexport const devices = loader.lazyloadExportOrDie('devices')\nexport const errors = loader.lazyloadExportOrDie('errors')\n\n/** Playwright with plugin functionality */\nconst moduleExports: ExtraModuleExports & PlaywrightModuleExports = {\n // custom exports\n PlaywrightExtra,\n PlaywrightExtraClass,\n PluginList,\n addExtra,\n chromium,\n firefox,\n webkit,\n\n // vanilla exports\n _android,\n _electron,\n request,\n selectors,\n devices,\n errors\n}\n\nexport default moduleExports\n"],"names":["debug","loader"],"mappings":";;;;;;;;;;;;;AAEA;MACa,MAAM;IACjB,YAAmB,UAAkB,EAAS,YAAsB;QAAjD,eAAU,GAAV,UAAU,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAU;KAAI;;;;;;;;;;;IAYjE,mBAAmB,CAA+B,UAAa;QACpE,MAAM,IAAI,GAAG,IAAI,CAAA;QACjB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,KAAK;YACrD,IAAI;YACJ,UAAU,MAAW,EAAE,GAAG,IAAW;gBACnC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAA;gBACvD,MAAM,YAAY,GAAG,YAAmB,CAAA;gBACxC,MAAM,MAAM,GAAK,OAAe,CAAC,IAAI,CAAS,CAC5C,YAAY,IAAI,MAAM,EACtB,GAAG,IAAI,CACR,CAAA;gBACD,OAAO,MAAM,CAAA;aACd;SACF,CAAC,CACH,CAAA;QACD,OAAO,IAAI,KAAK,CAAC,EAAE,EAAE,WAAW,CAAoB,CAAA;KACrD;;IAGM,UAAU;QACf,OAAO,eAAe,CAAe,IAAI,CAAC,YAAY,CAAC,CAAA;KACxD;;IAGM,eAAe;QACpB,MAAM,MAAM,GAAG,eAAe,CAAe,IAAI,CAAC,YAAY,CAAC,CAAA;QAC/D,IAAI,MAAM,EAAE;YACV,OAAO,MAAM,CAAA;SACd;QACD,MAAM,IAAI,CAAC,YAAY,CAAA;KACxB;IAED,IAAW,YAAY;QACrB,MAAM,gBAAgB,GACpB,IAAI,CAAC,U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A,gBAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC5D,MAAa,MAAM,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAE1D;AACA,MAAM,aAAa,GAAiD;;IAElE,eAAe;IACf,oBAAoB;IACpB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;;IAGN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,OAAO;IACP,MAAM;CACP,CAAA;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.d.ts new file mode 100644 index 0000000..e002c8b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.d.ts @@ -0,0 +1,1024 @@ +import type * as pw from 'playwright-core'; +import { PlaywrightExtra, PlaywrightExtraClass } from './extra'; +import { PluginList } from './plugins'; +export { PlaywrightExtra, PlaywrightExtraClass } from './extra'; +export { PluginList } from './plugins'; +/** A playwright browser launcher */ +export declare type PlaywrightBrowserLauncher = pw.BrowserType<{}>; +/** A playwright browser launcher with plugin functionality */ +export declare type AugmentedBrowserLauncher = PlaywrightExtraClass & PlaywrightBrowserLauncher; +/** + * The minimum shape we expect from a playwright compatible launcher object. + * We intentionally keep this not strict so other custom or compatible launchers can be used. + */ +export interface PlaywrightCompatibleLauncher { + connect(...args: any[]): Promise; + launch(...args: any[]): Promise; +} +/** Our custom module exports */ +interface ExtraModuleExports { + PlaywrightExtra: typeof PlaywrightExtra; + PlaywrightExtraClass: typeof PlaywrightExtraClass; + PluginList: typeof PluginList; + addExtra: typeof addExtra; + chromium: AugmentedBrowserLauncher; + firefox: AugmentedBrowserLauncher; + webkit: AugmentedBrowserLauncher; +} +/** Vanilla playwright module exports */ +declare type PlaywrightModuleExports = typeof pw; +/** + * Augment the provided Playwright browser launcher with plugin functionality. + * + * Using `addExtra` will always create a fresh PlaywrightExtra instance. + * + * @example + * import playwright from 'playwright' + * import { addExtra } from 'playwright-extra' + * + * const chromium = addExtra(playwright.chromium) + * chromium.use(plugin) + * + * @param launcher - Playwright (or compatible) browser launcher + */ +export declare const addExtra: (launcher?: Launcher | undefined) => PlaywrightExtraClass & Launcher; +/** + * This object can be used to launch or connect to Chromium with plugin functionality. + * + * This default export will behave exactly the same as the regular playwright + * (just with extra plugin functionality) and can be used as a drop-in replacement. + * + * Behind the scenes it will try to require either the `playwright-core` + * or `playwright` module from the installed dependencies. + * + * @note + * Due to Node.js import caching this will result in a single + * PlaywrightExtra instance, even when used in different files. If you need multiple + * instances with different plugins please use `addExtra`. + * + * @example + * // javascript import + * const { chromium } = require('playwright-extra') + * + * // typescript/es6 module import + * import { chromium } from 'playwright-extra' + * + * // Add plugins + * chromium.use(...) + */ +export declare const chromium: PlaywrightExtraClass & pw.BrowserType<{}>; +/** + * This object can be used to launch or connect to Firefox with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +export declare const firefox: PlaywrightExtraClass & pw.BrowserType<{}>; +/** + * This object can be used to launch or connect to Webkit with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +export declare const webkit: PlaywrightExtraClass & pw.BrowserType<{}>; +export declare const _android: pw.Android; +export declare const _electron: pw.Electron; +export declare const request: pw.APIRequest; +export declare const selectors: pw.Selectors; +export declare const devices: { + [key: string]: { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Blackberry PlayBook": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Blackberry PlayBook landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "BlackBerry Z30": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "BlackBerry Z30 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Note 3": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Note 3 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Note II": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Note II landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S III": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S III landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S5": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S5 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S8": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S8 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S9+": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy S9+ landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Tab S4": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Galaxy Tab S4 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad (gen 6)": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad (gen 6) landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad (gen 7)": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad (gen 7) landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad Mini": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad Mini landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad Pro 11": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPad Pro 11 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 6": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 6 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 6 Plus": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 6 Plus landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 7": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 7 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 7 Plus": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 7 Plus landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 8": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 8 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 8 Plus": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 8 Plus landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone SE": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone SE landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone X": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone X landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone XR": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone XR landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11 Pro": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11 Pro landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11 Pro Max": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 11 Pro Max landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Pro": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Pro landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Pro Max": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Pro Max landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Mini": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 12 Mini landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Pro": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Pro landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Pro Max": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Pro Max landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Mini": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "iPhone 13 Mini landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "JioPhone 2": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "JioPhone 2 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Kindle Fire HDX": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Kindle Fire HDX landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "LG Optimus L70": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "LG Optimus L70 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Microsoft Lumia 550": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Microsoft Lumia 550 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Microsoft Lumia 950": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Microsoft Lumia 950 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 10": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 10 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 4": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 4 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 5": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 5 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 5X": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 5X landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 6": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 6 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 6P": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 6P landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 7": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nexus 7 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nokia Lumia 520": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nokia Lumia 520 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nokia N9": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Nokia N9 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 2": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 2 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 2 XL": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 2 XL landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 3": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 3 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 4": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 4 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 4a (5G)": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 4a (5G) landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 5": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Pixel 5 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Moto G4": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Moto G4 landscape": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Chrome HiDPI": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Edge HiDPI": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Firefox HiDPI": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Safari": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Chrome": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Edge": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; + "Desktop Firefox": { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; + }; +} & { + viewport: pw.ViewportSize; + userAgent: string; + deviceScaleFactor: number; + isMobile: boolean; + hasTouch: boolean; + defaultBrowserType: "chromium" | "firefox" | "webkit"; +}[]; +export declare const errors: typeof pw.errors; +/** Playwright with plugin functionality */ +declare const moduleExports: ExtraModuleExports & PlaywrightModuleExports; +export default moduleExports; diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js new file mode 100644 index 0000000..a884b2c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js @@ -0,0 +1,912 @@ +/*! + * playwright-extra v4.3.5 by berstend + * https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra#readme + * @license MIT + */ +import Debug from 'debug'; + +/** Node.js module loader helper */ +class Loader { + constructor(moduleName, packageNames) { + this.moduleName = moduleName; + this.packageNames = packageNames; + } + /** + * Lazy load a top level export from another module by wrapping it in a JS proxy. + * + * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls + * to it to the module version the user has installed, rather than shipping with a hardcoded version. + * + * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported. + * + * We use a "super" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value. + */ + lazyloadExportOrDie(exportName) { + const that = this; + const trapHandler = Object.fromEntries(Object.getOwnPropertyNames(Reflect).map((name) => [ + name, + function (target, ...args) { + const moduleExport = that.loadModuleOrDie()[exportName]; + const customTarget = moduleExport; + const result = Reflect[name](customTarget || target, ...args); + return result; + } + ])); + return new Proxy({}, trapHandler); + } + /** Load the module if possible */ + loadModule() { + return requirePackages(this.packageNames); + } + /** Load the module if possible or throw */ + loadModuleOrDie() { + const module = requirePackages(this.packageNames); + if (module) { + return module; + } + throw this.requireError; + } + get requireError() { + const moduleNamePretty = this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1); + return new Error(` + ${moduleNamePretty} is missing. :-) + + I've tried loading ${this.packageNames + .map(p => `"${p}"`) + .join(', ')} - no luck. + + Make sure you install one of those packages or use the named 'addExtra' export, + to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}. + + To get the latest stable version of ${moduleNamePretty} run: + 'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}' + `); + } +} +function requirePackages(packageNames) { + for (const name of packageNames) { + try { + return require(name); + } + catch (_) { + continue; // noop + } + } + return; +} +/** Playwright specific module loader */ +const playwrightLoader = new Loader('playwright', [ + 'playwright-core', + 'playwright' +]); + +const debug = Debug('playwright-extra:puppeteer-compat'); +const isPlaywrightPage = (obj) => { + return 'unroute' in obj; +}; +const isPlaywrightFrame = (obj) => { + return ['parentFrame', 'frameLocator'].every(x => x in obj); +}; +const isPlaywrightBrowser = (obj) => { + return 'newContext' in obj; +}; +const isPuppeteerCompat = (obj) => { + return !!obj && typeof obj === 'object' && !!obj.isCompatShim; +}; +const cache = { + objectToShim: new Map(), + cdpSession: { + page: new Map(), + browser: new Map() + } +}; +/** Augment a Playwright object with compatibility with certain Puppeteer methods */ +function addPuppeteerCompat(object) { + if (!object || typeof object !== 'object') { + return object; + } + if (cache.objectToShim.has(object)) { + return cache.objectToShim.get(object); + } + if (isPuppeteerCompat(object)) { + return object; + } + debug('addPuppeteerCompat', cache.objectToShim.size); + if (isPlaywrightPage(object) || isPlaywrightFrame(object)) { + const shim = createPageShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + if (isPlaywrightBrowser(object)) { + const shim = createBrowserShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + debug('Received unknown object:', Reflect.ownKeys(object)); + return object; +} +// Only chromium browsers support CDP +const dummyCDPClient = { + send: async (...args) => { + debug('dummy CDP client called', 'send', args); + }, + on: (...args) => { + debug('dummy CDP client called', 'on', args); + } +}; +async function getPageCDPSession(page) { + let session = cache.cdpSession.page.get(page); + if (session) { + debug('getPageCDPSession: use existing'); + return session; + } + debug('getPageCDPSession: use new'); + const context = isPlaywrightFrame(page) + ? page.page().context() + : page.context(); + try { + session = await context.newCDPSession(page); + cache.cdpSession.page.set(page, session); + return session; + } + catch (err) { + debug('getPageCDPSession: error while creating session:', err.message); + debug('getPageCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +async function getBrowserCDPSession(browser) { + let session = cache.cdpSession.browser.get(browser); + if (session) { + debug('getBrowserCDPSession: use existing'); + return session; + } + debug('getBrowserCDPSession: use new'); + try { + session = await browser.newBrowserCDPSession(); + cache.cdpSession.browser.set(browser, session); + return session; + } + catch (err) { + debug('getBrowserCDPSession: error while creating session:', err.message); + debug('getBrowserCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +function createPageShim(page) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(page, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('page - get', objId, prop); + if (prop === '_client') { + return () => ({ + send: async (method, params) => { + const session = await getPageCDPSession(page); + return await session.send(method, params); + }, + on: (event, listener) => { + getPageCDPSession(page).then(session => { + session.on(event, listener); + }); + } + }); + } + if (prop === 'setBypassCSP') { + return async (enabled) => { + const session = await getPageCDPSession(page); + return await session.send('Page.setBypassCSP', { + enabled + }); + }; + } + if (prop === 'setUserAgent') { + return async (userAgent, userAgentMetadata) => { + const session = await getPageCDPSession(page); + return await session.send('Emulation.setUserAgentOverride', { + userAgent, + userAgentMetadata + }); + }; + } + if (prop === 'browser') { + if (isPlaywrightPage(page)) { + return () => { + let browser = page.context().browser(); + if (!browser) { + debug('page.browser() - not available, most likely due to launchPersistentContext'); + // Use a page shim as quick drop-in (so browser.userAgent() still works) + browser = page; + } + return addPuppeteerCompat(browser); + }; + } + } + if (prop === 'evaluateOnNewDocument') { + if (isPlaywrightPage(page)) { + return async function (pageFunction, ...args) { + return await page.addInitScript(pageFunction, args[0]); + }; + } + } + // Only relevant when page is being used a pseudo stand-in for the browser object (launchPersistentContext) + if (prop === 'userAgent') { + return async (enabled) => { + const session = await getPageCDPSession(page); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} +function createBrowserShim(browser) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(browser, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('browser - get', objId, prop); + if (prop === 'pages') { + return () => browser + .contexts() + .flatMap(c => c.pages().map(page => addPuppeteerCompat(page))); + } + if (prop === 'userAgent') { + return async () => { + const session = await getBrowserCDPSession(browser); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} + +const debug$1 = Debug('playwright-extra:plugins'); +class PluginList { + constructor() { + this._plugins = []; + this._dependencyDefaults = new Map(); + this._dependencyResolution = new Map(); + } + /** + * Get a list of all registered plugins. + */ + get list() { + return this._plugins; + } + /** + * Get the names of all registered plugins. + */ + get names() { + return this._plugins.map(p => p.name); + } + /** + * Add a new plugin to the list (after checking if it's well-formed). + * + * @param plugin + * @internal + */ + add(plugin) { + var _a; + if (!this.isValidPluginInstance(plugin)) { + return false; + } + if (!!plugin.onPluginRegistered) { + plugin.onPluginRegistered({ framework: 'playwright' }); + } + // PuppeteerExtraPlugin: Populate `_childClassMembers` list containing methods defined by the plugin + if (!!plugin._registerChildClassMembers) { + plugin._registerChildClassMembers(Object.getPrototypeOf(plugin)); + } + if ((_a = plugin.requirements) === null || _a === void 0 ? void 0 : _a.has('dataFromPlugins')) { + plugin.getDataFromPlugins = this.getData.bind(this); + } + this._plugins.push(plugin); + return true; + } + /** Check if the shape of a plugin is correct or warn */ + isValidPluginInstance(plugin) { + if (!plugin || + typeof plugin !== 'object' || + !plugin._isPuppeteerExtraPlugin) { + console.error(`Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`, plugin); + return false; + } + if (!plugin.name) { + console.error(`Warning: Plugin with no name registering, ignoring.`, plugin); + return false; + } + return true; + } + /** Error callback in case calling a plugin method throws an error. Can be overwritten. */ + onPluginError(plugin, method, err) { + console.warn(`An error occured while executing "${method}" in plugin "${plugin.name}":`, err); + } + /** + * Define default values for plugins implicitly required through the `dependencies` plugin stanza. + * + * @param dependencyPath - The string by which the dependency is listed (not the plugin name) + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' }) + */ + setDependencyDefaults(dependencyPath, opts) { + this._dependencyDefaults.set(dependencyPath, opts); + return this; + } + /** + * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza. + * + * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with. + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin) + */ + setDependencyResolution(dependencyPath, pluginModule) { + this._dependencyResolution.set(dependencyPath, pluginModule); + return this; + } + /** + * Prepare plugins to be used (resolve dependencies, ordering) + * @internal + */ + prepare() { + this.resolveDependencies(); + this.order(); + } + /** Return all plugins using the supplied method */ + filterByMethod(methodName) { + return this._plugins.filter(plugin => { + // PuppeteerExtraPlugin: The base class will already define all methods, hence we need to do a different check + if (!!plugin._childClassMembers && + Array.isArray(plugin._childClassMembers)) { + return plugin._childClassMembers.includes(methodName); + } + return methodName in plugin; + }); + } + /** Conditionally add puppeteer compatibility to values provided to the plugins */ + _addPuppeteerCompatIfNeeded(plugin, method, args) { + const canUseShim = plugin._isPuppeteerExtraPlugin && !plugin.noPuppeteerShim; + const methodWhitelist = [ + 'onBrowser', + 'onPageCreated', + 'onPageClose', + 'afterConnect', + 'afterLaunch' + ]; + const shouldUseShim = methodWhitelist.includes(method); + if (!canUseShim || !shouldUseShim) { + return args; + } + debug$1('add puppeteer compatibility', plugin.name, method); + return [...args.map(arg => addPuppeteerCompat(arg))]; + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Will not await results to dispatch events as fast as possible to all plugins. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + dispatch(method, ...args) { + var _a, _b; + const plugins = this.filterByMethod(method); + debug$1('dispatch', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + const fnType = (_b = (_a = plugin[method]) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name; + debug$1('dispatch to plugin', { + plugin: plugin.name, + method, + fnType + }); + if (fnType === 'AsyncFunction') { + ; + plugin[method](...args).catch((err) => this.onPluginError(plugin, method, err)); + } + else { + ; + plugin[method](...args); + } + } + catch (err) { + this.onPluginError(plugin, method, err); + } + } + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Can also be used to get a definite return value after passing it to plugins: + * Calls plugins sequentially and passes on a value (waterfall style). + * + * The plugins can either modify the value or return an updated one. + * Will return the latest, updated value which ran through all plugins. + * + * By convention only the first argument will be used as the updated value. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + async dispatchBlocking(method, ...args) { + const plugins = this.filterByMethod(method); + debug$1('dispatchBlocking', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + let retValue = null; + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + retValue = await plugin[method](...args); + // In case we got a return value use that as new first argument for followup function calls + if (retValue !== undefined) { + args[0] = retValue; + } + } + catch (err) { + this.onPluginError(plugin, method, err); + return retValue; + } + } + return retValue; + } + /** + * Order plugins that have expressed a special placement requirement. + * + * This is useful/necessary for e.g. plugins that depend on the data from other plugins. + * + * @private + */ + order() { + debug$1('order:before', this.names); + const runLast = this._plugins + .filter(p => { var _a; return (_a = p.requirements) === null || _a === void 0 ? void 0 : _a.has('runLast'); }) + .map(p => p.name); + for (const name of runLast) { + const index = this._plugins.findIndex(p => p.name === name); + this._plugins.push(this._plugins.splice(index, 1)[0]); + } + debug$1('order:after', this.names); + } + /** + * Collects the exposed `data` property of all registered plugins. + * Will be reduced/flattened to a single array. + * + * Can be accessed by plugins that listed the `dataFromPlugins` requirement. + * + * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`). + * + * @see [PuppeteerExtraPlugin]/data + * @param name - Filter data by optional name + * + * @private + */ + getData(name) { + const data = this._plugins + .filter((p) => !!p.data) + .map((p) => (Array.isArray(p.data) ? p.data : [p.data])) + .reduce((acc, arr) => [...acc, ...arr], []); + return name ? data.filter((d) => d.name === name) : data; + } + /** + * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports) + */ + resolvePluginsStanza() { + debug$1('resolvePluginsStanza'); + const pluginNames = new Set(this.names); + this._plugins + .filter(p => !!p.plugins && p.plugins.length) + .filter(p => !pluginNames.has(p.name)) // TBD: Do we want to filter out existing? + .forEach(parent => { + (parent.plugins || []).forEach(p => { + debug$1(parent.name, 'adding missing plugin', p.name); + this.add(p); + }); + }); + } + /** + * Handle `dependencies` stanza (which requires dynamic imports) + * + * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts + * + * @note + * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()` + * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()` + */ + resolveDependenciesStanza() { + debug$1('resolveDependenciesStanza'); + /** Attempt to dynamically require a plugin module */ + const requireDependencyOrDie = (parentName, dependencyPath) => { + // If the user provided the plugin module already we use that + if (this._dependencyResolution.has(dependencyPath)) { + return this._dependencyResolution.get(dependencyPath); + } + const possiblePrefixes = ['puppeteer-extra-plugin-']; // could be extended later + const isAlreadyPrefixed = possiblePrefixes.some(prefix => dependencyPath.startsWith(prefix)); + const packagePaths = []; + // If the dependency is not already prefixed we attempt to require all possible combinations to find one that works + if (!isAlreadyPrefixed) { + packagePaths.push(...possiblePrefixes.map(prefix => prefix + dependencyPath)); + } + // We always attempt to require the path verbatim (as a last resort) + packagePaths.push(dependencyPath); + const pluginModule = requirePackages(packagePaths); + if (pluginModule) { + return pluginModule; + } + const explanation = ` +The plugin '${parentName}' listed '${dependencyPath}' as dependency, +which could not be found. Please install it: + +${packagePaths + .map(packagePath => `yarn add ${packagePath.split('/')[0]}`) + .join(`\n or:\n`)} + +Note: You don't need to require the plugin yourself, +unless you want to modify it's default settings. + +If your bundler has issues with dynamic imports take a look at '.plugins.setDependencyResolution()'. + `; + console.warn(explanation); + throw new Error('Plugin dependency not found'); + }; + const existingPluginNames = new Set(this.names); + const recursivelyLoadMissingDependencies = ({ name: parentName, dependencies }) => { + if (!dependencies) { + return; + } + const processDependency = (dependencyPath, opts) => { + const pluginModule = requireDependencyOrDie(parentName, dependencyPath); + opts = opts || this._dependencyDefaults.get(dependencyPath) || {}; + const plugin = pluginModule(opts); + if (existingPluginNames.has(plugin.name)) { + debug$1(parentName, '=> dependency already exists:', plugin.name); + return; + } + existingPluginNames.add(plugin.name); + debug$1(parentName, '=> adding new dependency:', plugin.name, opts); + this.add(plugin); + return recursivelyLoadMissingDependencies(plugin); + }; + if (dependencies instanceof Set || Array.isArray(dependencies)) { + return [...dependencies].forEach(dependencyPath => processDependency(dependencyPath)); + } + if (dependencies instanceof Map) { + // Note: `k,v => v,k` (Map + forEach will reverse the order) + return dependencies.forEach((v, k) => processDependency(k, v)); + } + }; + this.list.forEach(recursivelyLoadMissingDependencies); + } + /** + * Lightweight plugin dependency management to require plugins and code mods on demand. + * @private + */ + resolveDependencies() { + debug$1('resolveDependencies'); + this.resolvePluginsStanza(); + this.resolveDependenciesStanza(); + } +} + +const debug$2 = Debug('playwright-extra'); +/** + * Modular plugin framework to teach `playwright` new tricks. + */ +class PlaywrightExtraClass { + constructor(_launcher) { + this._launcher = _launcher; + this.plugins = new PluginList(); + } + /** + * The **main interface** to register plugins. + * + * Can be called multiple times to enable multiple plugins. + * + * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer. + * + * @example + * chromium.use(plugin1).use(plugin2) + * firefox.use(plugin1).use(plugin2) + * + * @see [PuppeteerExtraPlugin] + * + * @return The same `PlaywrightExtra` instance (for optional chaining) + */ + use(plugin) { + const isValid = plugin && 'name' in plugin; + if (!isValid) { + throw new Error('A plugin must be provided to .use()'); + } + if (this.plugins.add(plugin)) { + debug$2('Plugin registered', plugin.name); + } + return this; + } + /** + * In order to support a default export which will require vanilla playwright automatically, + * as well as `addExtra` to patch a provided launcher, we need to so some gymnastics here. + * + * Otherwise this would throw immediately, even when only using the `addExtra` export with an arbitrary compatible launcher. + * + * The solution is to make the vanilla launcher optional and only throw once we try to effectively use and can't find it. + * + * @internal + */ + get launcher() { + if (!this._launcher) { + throw playwrightLoader.requireError; + } + return this._launcher; + } + async launch(...args) { + if (!this.launcher.launch) { + throw new Error('Launcher does not support "launch"'); + } + let [options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug$2('launch', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + debug$2('launch with options', options); + if ('userDataDir' in options) { + debug$2("A plugin defined userDataDir during .launch, which isn't supported by playwright - ignoring"); + delete options.userDataDir; + } + const browser = await this.launcher['launch'](options); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterLaunch', browser); + return browser; + } + async launchPersistentContext(...args) { + if (!this.launcher.launchPersistentContext) { + throw new Error('Launcher does not support "launchPersistentContext"'); + } + let [userDataDir, options] = args; + options = Object.assign({ args: [] }, (options || {})); // Initialize args array + debug$2('launchPersistentContext', options); + this.plugins.prepare(); + // Give plugins the chance to modify the options before continuing + options = + (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options; + const context = await this.launcher['launchPersistentContext'](userDataDir, options); + await this.plugins.dispatchBlocking('afterLaunch', context); + this._bindBrowserContextEvents(context); + return context; + } + async connect(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connect) { + throw new Error('Launcher does not support "connect"'); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connect + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ wsEndpoint: wsEndpointOrOptions }, wsOptions); + } + debug$2('connect', options); + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const wsEndpoint = options.wsEndpoint; + if (wsEndpointAsString) { + delete options.wsEndpoint; + args.push(wsEndpoint, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connect'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async connectOverCDP(wsEndpointOrOptions, wsOptions = {}) { + if (!this.launcher.connectOverCDP) { + throw new Error(`Launcher does not implement 'connectOverCDP'`); + } + this.plugins.prepare(); + // Playwright currently supports two function signatures for .connectOverCDP + let options = {}; + let wsEndpointAsString = false; + if (typeof wsEndpointOrOptions === 'object') { + options = Object.assign(Object.assign({}, wsEndpointOrOptions), wsOptions); + } + else { + wsEndpointAsString = true; + options = Object.assign({ endpointURL: wsEndpointOrOptions }, wsOptions); + } + debug$2('connectOverCDP'), options; + // Give plugins the chance to modify the options before launch/connect + options = + (await this.plugins.dispatchBlocking('beforeConnect', options)) || options; + // Follow call signature of end user + const args = []; + const endpointURL = options.endpointURL; + if (wsEndpointAsString) { + delete options.endpointURL; + args.push(endpointURL, options); + } + else { + args.push(options); + } + const browser = (await this.launcher['connectOverCDP'](...args)); + await this.plugins.dispatchBlocking('onBrowser', browser); + await this._bindBrowserEvents(browser); + await this.plugins.dispatchBlocking('afterConnect', browser); + return browser; + } + async _bindBrowserContextEvents(context, contextOptions) { + debug$2('_bindBrowserContextEvents'); + this.plugins.dispatch('onContextCreated', context, contextOptions); + // Make sure things like `addInitScript` show an effect on the very first page as well + context.newPage = ((originalMethod, ctx) => { + return async () => { + const page = await originalMethod.call(ctx); + await page.goto('about:blank'); + return page; + }; + })(context.newPage, context); + context.on('close', () => { + // When using `launchPersistentContext` context closing is the same as browser closing + if (!context.browser()) { + this.plugins.dispatch('onDisconnected'); + } + }); + context.on('page', page => { + this.plugins.dispatch('onPageCreated', page); + page.on('close', () => { + this.plugins.dispatch('onPageClose', page); + }); + }); + } + async _bindBrowserEvents(browser) { + debug$2('_bindPlaywrightBrowserEvents'); + browser.on('disconnected', () => { + this.plugins.dispatch('onDisconnected', browser); + }); + // Note: `browser.newPage` will implicitly call `browser.newContext` as well + browser.newContext = ((originalMethod, ctx) => { + return async (options = {}) => { + const contextOptions = (await this.plugins.dispatchBlocking('beforeContext', options, browser)) || options; + const context = await originalMethod.call(ctx, contextOptions); + this._bindBrowserContextEvents(context, contextOptions); + return context; + }; + })(browser.newContext, browser); + } +} +/** + * PlaywrightExtra class with additional launcher methods. + * + * Augments the class with an instance proxy to pass on methods that are not augmented to the original target. + * + */ +const PlaywrightExtra = new Proxy(PlaywrightExtraClass, { + construct(classTarget, args) { + debug$2(`create instance of ${classTarget.name}`); + const result = Reflect.construct(classTarget, args); + return new Proxy(result, { + get(target, prop) { + if (prop in target) { + return Reflect.get(target, prop); + } + debug$2('proxying property to original launcher: ', prop); + return Reflect.get(target.launcher, prop); + } + }); + } +}); + +/** + * Augment the provided Playwright browser launcher with plugin functionality. + * + * Using `addExtra` will always create a fresh PlaywrightExtra instance. + * + * @example + * import playwright from 'playwright' + * import { addExtra } from 'playwright-extra' + * + * const chromium = addExtra(playwright.chromium) + * chromium.use(plugin) + * + * @param launcher - Playwright (or compatible) browser launcher + */ +const addExtra = (launcher) => new PlaywrightExtra(launcher); +/** + * This object can be used to launch or connect to Chromium with plugin functionality. + * + * This default export will behave exactly the same as the regular playwright + * (just with extra plugin functionality) and can be used as a drop-in replacement. + * + * Behind the scenes it will try to require either the `playwright-core` + * or `playwright` module from the installed dependencies. + * + * @note + * Due to Node.js import caching this will result in a single + * PlaywrightExtra instance, even when used in different files. If you need multiple + * instances with different plugins please use `addExtra`. + * + * @example + * // javascript import + * const { chromium } = require('playwright-extra') + * + * // typescript/es6 module import + * import { chromium } from 'playwright-extra' + * + * // Add plugins + * chromium.use(...) + */ +const chromium = addExtra((playwrightLoader.loadModule() || {}).chromium); +/** + * This object can be used to launch or connect to Firefox with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +const firefox = addExtra((playwrightLoader.loadModule() || {}).firefox); +/** + * This object can be used to launch or connect to Webkit with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +const webkit = addExtra((playwrightLoader.loadModule() || {}).webkit); +// Other playwright module exports we simply re-export with lazy loading +const _android = playwrightLoader.lazyloadExportOrDie('_android'); +const _electron = playwrightLoader.lazyloadExportOrDie('_electron'); +const request = playwrightLoader.lazyloadExportOrDie('request'); +const selectors = playwrightLoader.lazyloadExportOrDie('selectors'); +const devices = playwrightLoader.lazyloadExportOrDie('devices'); +const errors = playwrightLoader.lazyloadExportOrDie('errors'); +/** Playwright with plugin functionality */ +const moduleExports = { + // custom exports + PlaywrightExtra, + PlaywrightExtraClass, + PluginList, + addExtra, + chromium, + firefox, + webkit, + // vanilla exports + _android, + _electron, + request, + selectors, + devices, + errors +}; + +export default moduleExports; +export { PlaywrightExtra, PlaywrightExtraClass, PluginList, _android, _electron, addExtra, chromium, devices, errors, firefox, request, selectors, webkit }; +//# sourceMappingURL=index.esm.js.map diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js.map new file mode 100644 index 0000000..bd556a1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../src/helper/loader.ts","../src/puppeteer-compatiblity-shim/index.ts","../src/plugins.ts","../src/extra.ts","../src/index.ts"],"sourcesContent":["import type * as pw from 'playwright-core'\n\n/** Node.js module loader helper */\nexport class Loader {\n constructor(public moduleName: string, public packageNames: string[]) {}\n\n /**\n * Lazy load a top level export from another module by wrapping it in a JS proxy.\n *\n * This allows us to re-export e.g. `devices` from `playwright` while redirecting direct calls\n * to it to the module version the user has installed, rather than shipping with a hardcoded version.\n *\n * If we don't do this and the user doesn't have the target module installed we'd throw immediately when our code is imported.\n *\n * We use a \"super\" Proxy defining all traps, so calls like `Object.keys(playwright.devices).length` will return the correct value.\n */\n public lazyloadExportOrDie(exportName: T) {\n const that = this\n const trapHandler = Object.fromEntries(\n Object.getOwnPropertyNames(Reflect).map((name: any) => [\n name,\n function (target: any, ...args: any[]) {\n const moduleExport = that.loadModuleOrDie()[exportName]\n const customTarget = moduleExport as any\n const result = ((Reflect as any)[name] as any)(\n customTarget || target,\n ...args\n )\n return result\n }\n ])\n )\n return new Proxy({}, trapHandler) as TargetModule[T]\n }\n\n /** Load the module if possible */\n public loadModule() {\n return requirePackages(this.packageNames)\n }\n\n /** Load the module if possible or throw */\n public loadModuleOrDie(): TargetModule {\n const module = requirePackages(this.packageNames)\n if (module) {\n return module\n }\n throw this.requireError\n }\n\n public get requireError() {\n const moduleNamePretty =\n this.moduleName.charAt(0).toUpperCase() + this.moduleName.slice(1)\n return new Error(`\n ${moduleNamePretty} is missing. :-)\n\n I've tried loading ${this.packageNames\n .map(p => `\"${p}\"`)\n .join(', ')} - no luck.\n\n Make sure you install one of those packages or use the named 'addExtra' export,\n to patch a specific (and maybe non-standard) implementation of ${moduleNamePretty}.\n\n To get the latest stable version of ${moduleNamePretty} run:\n 'yarn add ${this.moduleName}' or 'npm i ${this.moduleName}'\n `)\n }\n}\n\nexport function requirePackages(packageNames: string[]) {\n for (const name of packageNames) {\n try {\n return require(name) as TargetModule\n } catch (_) {\n continue // noop\n }\n }\n return\n}\n\n/** Playwright specific module loader */\nexport const playwrightLoader = new Loader('playwright', [\n 'playwright-core',\n 'playwright'\n])\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra:puppeteer-compat')\n\nimport type * as pw from 'playwright-core'\n\nexport type PlaywrightObject = pw.Page | pw.Frame | pw.Browser\n\nexport interface PuppeteerBrowserShim {\n isCompatShim?: boolean\n isPlaywright?: boolean\n pages?: pw.BrowserContext['pages']\n userAgent: () => Promise<'string'>\n}\n\nexport interface PuppeteerPageShim {\n isCompatShim?: boolean\n isPlaywright?: boolean\n browser?: () => pw.Browser\n evaluateOnNewDocument?: pw.Page['addInitScript']\n _client: () => pw.CDPSession\n}\n\nexport const isPlaywrightPage = (obj: unknown): obj is pw.Page => {\n return 'unroute' in (obj as pw.Page)\n}\nexport const isPlaywrightFrame = (obj: unknown): obj is pw.Frame => {\n return ['parentFrame', 'frameLocator'].every(x => x in (obj as pw.Frame))\n}\nexport const isPlaywrightBrowser = (obj: unknown): obj is pw.Browser => {\n return 'newContext' in (obj as pw.Browser)\n}\nexport const isPuppeteerCompat = (obj?: unknown): obj is PlaywrightObject => {\n return !!obj && typeof obj === 'object' && !!(obj as any).isCompatShim\n}\n\nconst cache = {\n objectToShim: new Map(),\n cdpSession: {\n page: new Map(),\n browser: new Map()\n }\n}\n\n/** Augment a Playwright object with compatibility with certain Puppeteer methods */\nexport function addPuppeteerCompat<\n Input extends pw.Page | pw.Frame | pw.Browser | null\n>(object: Input): Input {\n if (!object || typeof object !== 'object') {\n return object\n }\n if (cache.objectToShim.has(object)) {\n return cache.objectToShim.get(object) as Input\n }\n if (isPuppeteerCompat(object)) {\n return object\n }\n debug('addPuppeteerCompat', cache.objectToShim.size)\n if (isPlaywrightPage(object) || isPlaywrightFrame(object)) {\n const shim = createPageShim(object)\n cache.objectToShim.set(object, shim)\n return shim as Input\n }\n if (isPlaywrightBrowser(object)) {\n const shim = createBrowserShim(object)\n cache.objectToShim.set(object, shim)\n return shim as Input\n }\n debug('Received unknown object:', Reflect.ownKeys(object))\n return object\n}\n\n// Only chromium browsers support CDP\nconst dummyCDPClient = {\n send: async (...args: any[]) => {\n debug('dummy CDP client called', 'send', args)\n },\n on: (...args: any[]) => {\n debug('dummy CDP client called', 'on', args)\n }\n} as pw.CDPSession\n\nexport async function getPageCDPSession(page: pw.Page | pw.Frame) {\n let session = cache.cdpSession.page.get(page)\n if (session) {\n debug('getPageCDPSession: use existing')\n return session\n }\n debug('getPageCDPSession: use new')\n const context = isPlaywrightFrame(page)\n ? page.page().context()\n : page.context()\n try {\n session = await context.newCDPSession(page)\n cache.cdpSession.page.set(page, session)\n return session\n } catch (err: any) {\n debug('getPageCDPSession: error while creating session:', err.message)\n debug(\n 'getPageCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'\n )\n }\n return dummyCDPClient\n}\n\nexport async function getBrowserCDPSession(browser: pw.Browser) {\n let session = cache.cdpSession.browser.get(browser)\n if (session) {\n debug('getBrowserCDPSession: use existing')\n return session\n }\n debug('getBrowserCDPSession: use new')\n try {\n session = await browser.newBrowserCDPSession()\n cache.cdpSession.browser.set(browser, session)\n return session\n } catch (err: any) {\n debug('getBrowserCDPSession: error while creating session:', err.message)\n debug(\n 'getBrowserCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'\n )\n }\n return dummyCDPClient\n}\n\nexport function createPageShim(page: pw.Page | pw.Frame) {\n const objId = Math.random().toString(36).substring(2, 7)\n const shim = new Proxy(page, {\n get(target, prop) {\n if (prop === 'isCompatShim' || prop === 'isPlaywright') {\n return true\n }\n debug('page - get', objId, prop)\n if (prop === '_client') {\n return () => ({\n send: async (method: string, params: any) => {\n const session = await getPageCDPSession(page)\n return await session.send(method as any, params)\n },\n on: (event: string, listener: any) => {\n getPageCDPSession(page).then(session => {\n session.on(event as any, listener)\n })\n }\n })\n }\n if (prop === 'setBypassCSP') {\n return async (enabled: boolean) => {\n const session = await getPageCDPSession(page)\n return await session.send('Page.setBypassCSP', {\n enabled\n })\n }\n }\n if (prop === 'setUserAgent') {\n return async (userAgent: string, userAgentMetadata?: any) => {\n const session = await getPageCDPSession(page)\n return await session.send('Emulation.setUserAgentOverride', {\n userAgent,\n userAgentMetadata\n })\n }\n }\n if (prop === 'browser') {\n if (isPlaywrightPage(page)) {\n return () => {\n let browser = page.context().browser()\n if (!browser) {\n debug(\n 'page.browser() - not available, most likely due to launchPersistentContext'\n )\n // Use a page shim as quick drop-in (so browser.userAgent() still works)\n browser = page as any\n }\n return addPuppeteerCompat(browser)\n }\n }\n }\n if (prop === 'evaluateOnNewDocument') {\n if (isPlaywrightPage(page)) {\n return async function (pageFunction: any | string, ...args: any[]) {\n return await page.addInitScript(pageFunction, args[0])\n }\n }\n }\n // Only relevant when page is being used a pseudo stand-in for the browser object (launchPersistentContext)\n if (prop === 'userAgent') {\n return async (enabled: boolean) => {\n const session = await getPageCDPSession(page)\n const data = await session.send('Browser.getVersion')\n return data.userAgent\n }\n }\n return Reflect.get(target, prop)\n }\n })\n return shim\n}\n\nexport function createBrowserShim(browser: pw.Browser) {\n const objId = Math.random().toString(36).substring(2, 7)\n const shim = new Proxy(browser, {\n get(target, prop) {\n if (prop === 'isCompatShim' || prop === 'isPlaywright') {\n return true\n }\n debug('browser - get', objId, prop)\n if (prop === 'pages') {\n return () =>\n browser\n .contexts()\n .flatMap(c => c.pages().map(page => addPuppeteerCompat(page)))\n }\n if (prop === 'userAgent') {\n return async () => {\n const session = await getBrowserCDPSession(browser)\n const data = await session.send('Browser.getVersion')\n return data.userAgent\n }\n }\n return Reflect.get(target, prop)\n }\n })\n return shim\n}\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra:plugins')\n\nimport {\n Plugin,\n PluginMethodName,\n PluginMethodFn,\n PluginModule,\n CompatiblePluginModule\n} from './types'\n\nimport { requirePackages } from './helper/loader'\nimport { addPuppeteerCompat } from './puppeteer-compatiblity-shim'\n\nexport class PluginList {\n private readonly _plugins: Plugin[] = []\n private readonly _dependencyDefaults: Map = new Map()\n private readonly _dependencyResolution: Map =\n new Map()\n\n constructor() {}\n\n /**\n * Get a list of all registered plugins.\n */\n public get list() {\n return this._plugins\n }\n\n /**\n * Get the names of all registered plugins.\n */\n public get names() {\n return this._plugins.map(p => p.name)\n }\n\n /**\n * Add a new plugin to the list (after checking if it's well-formed).\n *\n * @param plugin\n * @internal\n */\n public add(plugin: Plugin) {\n if (!this.isValidPluginInstance(plugin)) {\n return false\n }\n if (!!plugin.onPluginRegistered) {\n plugin.onPluginRegistered({ framework: 'playwright' })\n }\n // PuppeteerExtraPlugin: Populate `_childClassMembers` list containing methods defined by the plugin\n if (!!plugin._registerChildClassMembers) {\n plugin._registerChildClassMembers(Object.getPrototypeOf(plugin))\n }\n if (plugin.requirements?.has('dataFromPlugins')) {\n plugin.getDataFromPlugins = this.getData.bind(this)\n }\n this._plugins.push(plugin)\n return true\n }\n\n /** Check if the shape of a plugin is correct or warn */\n protected isValidPluginInstance(plugin: Plugin) {\n if (\n !plugin ||\n typeof plugin !== 'object' ||\n !plugin._isPuppeteerExtraPlugin\n ) {\n console.error(\n `Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`,\n plugin\n )\n return false\n }\n if (!plugin.name) {\n console.error(\n `Warning: Plugin with no name registering, ignoring.`,\n plugin\n )\n return false\n }\n return true\n }\n\n /** Error callback in case calling a plugin method throws an error. Can be overwritten. */\n public onPluginError(plugin: Plugin, method: PluginMethodName, err: Error) {\n console.warn(\n `An error occured while executing \"${method}\" in plugin \"${plugin.name}\":`,\n err\n )\n }\n\n /**\n * Define default values for plugins implicitly required through the `dependencies` plugin stanza.\n *\n * @param dependencyPath - The string by which the dependency is listed (not the plugin name)\n *\n * @example\n * chromium.use(stealth)\n * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' })\n */\n public setDependencyDefaults(dependencyPath: string, opts: any) {\n this._dependencyDefaults.set(dependencyPath, opts)\n return this\n }\n\n /**\n * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza.\n *\n * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with.\n *\n * @example\n * chromium.use(stealth)\n * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin)\n */\n public setDependencyResolution(\n dependencyPath: string,\n pluginModule: CompatiblePluginModule\n ) {\n this._dependencyResolution.set(dependencyPath, pluginModule)\n return this\n }\n\n /**\n * Prepare plugins to be used (resolve dependencies, ordering)\n * @internal\n */\n public prepare() {\n this.resolveDependencies()\n this.order()\n }\n\n /** Return all plugins using the supplied method */\n protected filterByMethod(methodName: PluginMethodName) {\n return this._plugins.filter(plugin => {\n // PuppeteerExtraPlugin: The base class will already define all methods, hence we need to do a different check\n if (\n !!plugin._childClassMembers &&\n Array.isArray(plugin._childClassMembers)\n ) {\n return plugin._childClassMembers.includes(methodName)\n }\n return methodName in plugin\n })\n }\n\n /** Conditionally add puppeteer compatibility to values provided to the plugins */\n protected _addPuppeteerCompatIfNeeded(\n plugin: Plugin,\n method: TMethod,\n args: Parameters>\n ) {\n const canUseShim = plugin._isPuppeteerExtraPlugin && !plugin.noPuppeteerShim\n const methodWhitelist: PluginMethodName[] = [\n 'onBrowser',\n 'onPageCreated',\n 'onPageClose',\n 'afterConnect',\n 'afterLaunch'\n ]\n const shouldUseShim = methodWhitelist.includes(method)\n if (!canUseShim || !shouldUseShim) {\n return args\n }\n debug('add puppeteer compatibility', plugin.name, method)\n return [...args.map(arg => addPuppeteerCompat(arg as any))] as Parameters<\n PluginMethodFn\n >\n }\n\n /**\n * Dispatch plugin lifecycle events in a typesafe way.\n * Only Plugins that expose the supplied property will be called.\n *\n * Will not await results to dispatch events as fast as possible to all plugins.\n *\n * @param method - The lifecycle method name\n * @param args - Optional: Any arguments to be supplied to the plugin methods\n * @internal\n */\n public dispatch(\n method: TMethod,\n ...args: Parameters>\n ): void {\n const plugins = this.filterByMethod(method)\n debug('dispatch', method, {\n all: this._plugins.length,\n filteredByMethod: plugins.length\n })\n for (const plugin of plugins) {\n try {\n args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args)\n const fnType = plugin[method]?.constructor?.name\n debug('dispatch to plugin', {\n plugin: plugin.name,\n method,\n fnType\n })\n if (fnType === 'AsyncFunction') {\n ;(plugin[method] as any)(...args).catch((err: any) =>\n this.onPluginError(plugin, method, err)\n )\n } else {\n ;(plugin[method] as any)(...args)\n }\n } catch (err) {\n this.onPluginError(plugin, method, err as any)\n }\n }\n }\n\n /**\n * Dispatch plugin lifecycle events in a typesafe way.\n * Only Plugins that expose the supplied property will be called.\n *\n * Can also be used to get a definite return value after passing it to plugins:\n * Calls plugins sequentially and passes on a value (waterfall style).\n *\n * The plugins can either modify the value or return an updated one.\n * Will return the latest, updated value which ran through all plugins.\n *\n * By convention only the first argument will be used as the updated value.\n *\n * @param method - The lifecycle method name\n * @param args - Optional: Any arguments to be supplied to the plugin methods\n * @internal\n */\n public async dispatchBlocking(\n method: TMethod,\n ...args: Parameters>\n ): Promise>> {\n const plugins = this.filterByMethod(method)\n debug('dispatchBlocking', method, {\n all: this._plugins.length,\n filteredByMethod: plugins.length\n })\n\n let retValue: any = null\n for (const plugin of plugins) {\n try {\n args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args)\n retValue = await (plugin[method] as any)(...args)\n // In case we got a return value use that as new first argument for followup function calls\n if (retValue !== undefined) {\n args[0] = retValue\n }\n } catch (err) {\n this.onPluginError(plugin, method, err as any)\n return retValue\n }\n }\n return retValue\n }\n\n /**\n * Order plugins that have expressed a special placement requirement.\n *\n * This is useful/necessary for e.g. plugins that depend on the data from other plugins.\n *\n * @private\n */\n protected order() {\n debug('order:before', this.names)\n const runLast = this._plugins\n .filter(p => p.requirements?.has('runLast'))\n .map(p => p.name)\n for (const name of runLast) {\n const index = this._plugins.findIndex(p => p.name === name)\n this._plugins.push(this._plugins.splice(index, 1)[0])\n }\n debug('order:after', this.names)\n }\n\n /**\n * Collects the exposed `data` property of all registered plugins.\n * Will be reduced/flattened to a single array.\n *\n * Can be accessed by plugins that listed the `dataFromPlugins` requirement.\n *\n * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`).\n *\n * @see [PuppeteerExtraPlugin]/data\n * @param name - Filter data by optional name\n *\n * @private\n */\n protected getData(name?: string) {\n const data = this._plugins\n .filter((p: any) => !!p.data)\n .map((p: any) => (Array.isArray(p.data) ? p.data : [p.data]))\n .reduce((acc, arr) => [...acc, ...arr], [])\n return name ? data.filter((d: any) => d.name === name) : data\n }\n\n /**\n * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports)\n */\n protected resolvePluginsStanza() {\n debug('resolvePluginsStanza')\n const pluginNames = new Set(this.names)\n this._plugins\n .filter(p => !!p.plugins && p.plugins.length)\n .filter(p => !pluginNames.has(p.name)) // TBD: Do we want to filter out existing?\n .forEach(parent => {\n ;(parent.plugins || []).forEach(p => {\n debug(parent.name, 'adding missing plugin', p.name)\n this.add(p as Plugin)\n })\n })\n }\n\n /**\n * Handle `dependencies` stanza (which requires dynamic imports)\n *\n * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts\n *\n * @note\n * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()`\n * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()`\n */\n protected resolveDependenciesStanza() {\n debug('resolveDependenciesStanza')\n\n /** Attempt to dynamically require a plugin module */\n const requireDependencyOrDie = (\n parentName: string,\n dependencyPath: string\n ) => {\n // If the user provided the plugin module already we use that\n if (this._dependencyResolution.has(dependencyPath)) {\n return this._dependencyResolution.get(dependencyPath) as PluginModule\n }\n\n const possiblePrefixes = ['puppeteer-extra-plugin-'] // could be extended later\n const isAlreadyPrefixed = possiblePrefixes.some(prefix =>\n dependencyPath.startsWith(prefix)\n )\n const packagePaths: string[] = []\n // If the dependency is not already prefixed we attempt to require all possible combinations to find one that works\n if (!isAlreadyPrefixed) {\n packagePaths.push(\n ...possiblePrefixes.map(prefix => prefix + dependencyPath)\n )\n }\n // We always attempt to require the path verbatim (as a last resort)\n packagePaths.push(dependencyPath)\n const pluginModule = requirePackages(packagePaths)\n if (pluginModule) {\n return pluginModule\n }\n\n const explanation = `\nThe plugin '${parentName}' listed '${dependencyPath}' as dependency,\nwhich could not be found. Please install it:\n\n${packagePaths\n .map(packagePath => `yarn add ${packagePath.split('/')[0]}`)\n .join(`\\n or:\\n`)}\n\nNote: You don't need to require the plugin yourself,\nunless you want to modify it's default settings.\n\nIf your bundler has issues with dynamic imports take a look at '.plugins.setDependencyResolution()'.\n `\n console.warn(explanation)\n throw new Error('Plugin dependency not found')\n }\n\n const existingPluginNames = new Set(this.names)\n const recursivelyLoadMissingDependencies = ({\n name: parentName,\n dependencies\n }: Plugin): any => {\n if (!dependencies) {\n return\n }\n const processDependency = (dependencyPath: string, opts?: any) => {\n const pluginModule = requireDependencyOrDie(parentName, dependencyPath)\n opts = opts || this._dependencyDefaults.get(dependencyPath) || {}\n const plugin = pluginModule(opts)\n if (existingPluginNames.has(plugin.name)) {\n debug(parentName, '=> dependency already exists:', plugin.name)\n return\n }\n existingPluginNames.add(plugin.name)\n debug(parentName, '=> adding new dependency:', plugin.name, opts)\n this.add(plugin)\n return recursivelyLoadMissingDependencies(plugin)\n }\n\n if (dependencies instanceof Set || Array.isArray(dependencies)) {\n return [...dependencies].forEach(dependencyPath =>\n processDependency(dependencyPath)\n )\n }\n if (dependencies instanceof Map) {\n // Note: `k,v => v,k` (Map + forEach will reverse the order)\n return dependencies.forEach((v, k) => processDependency(k, v))\n }\n }\n this.list.forEach(recursivelyLoadMissingDependencies)\n }\n\n /**\n * Lightweight plugin dependency management to require plugins and code mods on demand.\n * @private\n */\n protected resolveDependencies() {\n debug('resolveDependencies')\n this.resolvePluginsStanza()\n this.resolveDependenciesStanza()\n }\n}\n","import Debug from 'debug'\nconst debug = Debug('playwright-extra')\n\nimport type * as pw from 'playwright-core'\nimport type { CompatiblePlugin, Plugin } from './types'\n\nimport { PluginList } from './plugins'\nimport { playwrightLoader } from './helper/loader'\n\ntype PlaywrightBrowserLauncher = pw.BrowserType\n\n/**\n * The Playwright browser launcher APIs we're augmenting\n * @private\n */\ninterface AugmentedLauncherAPIs\n extends Pick<\n PlaywrightBrowserLauncher,\n 'launch' | 'launchPersistentContext' | 'connect' | 'connectOverCDP'\n > {}\n\n/**\n * Modular plugin framework to teach `playwright` new tricks.\n */\nexport class PlaywrightExtraClass implements AugmentedLauncherAPIs {\n /** Plugin manager */\n public readonly plugins: PluginList\n\n constructor(private _launcher?: Partial) {\n this.plugins = new PluginList()\n }\n\n /**\n * The **main interface** to register plugins.\n *\n * Can be called multiple times to enable multiple plugins.\n *\n * Plugins derived from `PuppeteerExtraPlugin` will be used with a compatiblity layer.\n *\n * @example\n * chromium.use(plugin1).use(plugin2)\n * firefox.use(plugin1).use(plugin2)\n *\n * @see [PuppeteerExtraPlugin]\n *\n * @return The same `PlaywrightExtra` instance (for optional chaining)\n */\n public use(plugin: CompatiblePlugin): this {\n const isValid = plugin && 'name' in plugin\n if (!isValid) {\n throw new Error('A plugin must be provided to .use()')\n }\n if (this.plugins.add(plugin as Plugin)) {\n debug('Plugin registered', plugin.name)\n }\n return this\n }\n\n /**\n * In order to support a default export which will require vanilla playwright automatically,\n * as well as `addExtra` to patch a provided launcher, we need to so some gymnastics here.\n *\n * Otherwise this would throw immediately, even when only using the `addExtra` export with an arbitrary compatible launcher.\n *\n * The solution is to make the vanilla launcher optional and only throw once we try to effectively use and can't find it.\n *\n * @internal\n */\n public get launcher(): Partial {\n if (!this._launcher) {\n throw playwrightLoader.requireError\n }\n return this._launcher\n }\n\n public async launch(\n ...args: Parameters\n ): ReturnType {\n if (!this.launcher.launch) {\n throw new Error('Launcher does not support \"launch\"')\n }\n\n let [options] = args\n options = { args: [], ...(options || {}) } // Initialize args array\n debug('launch', options)\n this.plugins.prepare()\n\n // Give plugins the chance to modify the options before continuing\n options =\n (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options\n\n debug('launch with options', options)\n if ('userDataDir' in options) {\n debug(\n \"A plugin defined userDataDir during .launch, which isn't supported by playwright - ignoring\"\n )\n delete (options as any).userDataDir\n }\n const browser = await this.launcher['launch'](options)\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterLaunch', browser)\n return browser\n }\n\n public async launchPersistentContext(\n ...args: Parameters\n ): ReturnType {\n if (!this.launcher.launchPersistentContext) {\n throw new Error('Launcher does not support \"launchPersistentContext\"')\n }\n\n let [userDataDir, options] = args\n options = { args: [], ...(options || {}) } // Initialize args array\n debug('launchPersistentContext', options)\n this.plugins.prepare()\n\n // Give plugins the chance to modify the options before continuing\n options =\n (await this.plugins.dispatchBlocking('beforeLaunch', options)) || options\n\n const context = await this.launcher['launchPersistentContext'](\n userDataDir,\n options\n )\n await this.plugins.dispatchBlocking('afterLaunch', context)\n this._bindBrowserContextEvents(context)\n return context\n }\n\n async connect(\n wsEndpointOrOptions: string | (pw.ConnectOptions & { wsEndpoint?: string }),\n wsOptions: pw.ConnectOptions = {}\n ): ReturnType {\n if (!this.launcher.connect) {\n throw new Error('Launcher does not support \"connect\"')\n }\n this.plugins.prepare()\n\n // Playwright currently supports two function signatures for .connect\n let options: pw.ConnectOptions & { wsEndpoint?: string } = {}\n let wsEndpointAsString = false\n if (typeof wsEndpointOrOptions === 'object') {\n options = { ...wsEndpointOrOptions, ...wsOptions }\n } else {\n wsEndpointAsString = true\n options = { wsEndpoint: wsEndpointOrOptions, ...wsOptions }\n }\n debug('connect', options)\n\n // Give plugins the chance to modify the options before launch/connect\n options =\n (await this.plugins.dispatchBlocking('beforeConnect', options)) || options\n\n // Follow call signature of end user\n const args: any[] = []\n const wsEndpoint = options.wsEndpoint\n if (wsEndpointAsString) {\n delete options.wsEndpoint\n args.push(wsEndpoint, options)\n } else {\n args.push(options)\n }\n\n const browser = (await (this.launcher['connect'] as any)(\n ...args\n )) as pw.Browser\n\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterConnect', browser)\n return browser\n }\n\n async connectOverCDP(\n wsEndpointOrOptions:\n | string\n | (pw.ConnectOverCDPOptions & { endpointURL?: string }),\n wsOptions: pw.ConnectOverCDPOptions = {}\n ): ReturnType {\n if (!this.launcher.connectOverCDP) {\n throw new Error(`Launcher does not implement 'connectOverCDP'`)\n }\n this.plugins.prepare()\n\n // Playwright currently supports two function signatures for .connectOverCDP\n let options: pw.ConnectOverCDPOptions & { endpointURL?: string } = {}\n let wsEndpointAsString = false\n if (typeof wsEndpointOrOptions === 'object') {\n options = { ...wsEndpointOrOptions, ...wsOptions }\n } else {\n wsEndpointAsString = true\n options = { endpointURL: wsEndpointOrOptions, ...wsOptions }\n }\n debug('connectOverCDP'), options\n\n // Give plugins the chance to modify the options before launch/connect\n options =\n (await this.plugins.dispatchBlocking('beforeConnect', options)) || options\n\n // Follow call signature of end user\n const args: any[] = []\n const endpointURL = options.endpointURL\n if (wsEndpointAsString) {\n delete options.endpointURL\n args.push(endpointURL, options)\n } else {\n args.push(options)\n }\n\n const browser = (await (this.launcher['connectOverCDP'] as any)(\n ...args\n )) as pw.Browser\n\n await this.plugins.dispatchBlocking('onBrowser', browser)\n await this._bindBrowserEvents(browser)\n await this.plugins.dispatchBlocking('afterConnect', browser)\n return browser\n }\n\n protected async _bindBrowserContextEvents(\n context: pw.BrowserContext,\n contextOptions?: pw.BrowserContextOptions\n ) {\n debug('_bindBrowserContextEvents')\n this.plugins.dispatch('onContextCreated', context, contextOptions)\n\n // Make sure things like `addInitScript` show an effect on the very first page as well\n context.newPage = ((originalMethod, ctx) => {\n return async () => {\n const page = await originalMethod.call(ctx)\n await page.goto('about:blank')\n return page\n }\n })(context.newPage, context)\n\n context.on('close', () => {\n // When using `launchPersistentContext` context closing is the same as browser closing\n if (!context.browser()) {\n this.plugins.dispatch('onDisconnected')\n }\n })\n context.on('page', page => {\n this.plugins.dispatch('onPageCreated', page)\n page.on('close', () => {\n this.plugins.dispatch('onPageClose', page)\n })\n })\n }\n\n protected async _bindBrowserEvents(browser: pw.Browser) {\n debug('_bindPlaywrightBrowserEvents')\n\n browser.on('disconnected', () => {\n this.plugins.dispatch('onDisconnected', browser)\n })\n\n // Note: `browser.newPage` will implicitly call `browser.newContext` as well\n browser.newContext = ((originalMethod, ctx) => {\n return async (options: pw.BrowserContextOptions = {}) => {\n const contextOptions: pw.BrowserContextOptions =\n (await this.plugins.dispatchBlocking(\n 'beforeContext',\n options,\n browser\n )) || options\n const context = await originalMethod.call(ctx, contextOptions)\n this._bindBrowserContextEvents(context, contextOptions)\n return context\n }\n })(browser.newContext, browser)\n }\n}\n\n/**\n * PlaywrightExtra class with additional launcher methods.\n *\n * Augments the class with an instance proxy to pass on methods that are not augmented to the original target.\n *\n */\nexport const PlaywrightExtra = new Proxy(PlaywrightExtraClass, {\n construct(classTarget, args) {\n debug(`create instance of ${classTarget.name}`)\n const result = Reflect.construct(classTarget, args) as PlaywrightExtraClass\n return new Proxy(result, {\n get(target, prop) {\n if (prop in target) {\n return Reflect.get(target, prop)\n }\n debug('proxying property to original launcher: ', prop)\n return Reflect.get(target.launcher, prop)\n }\n })\n }\n})\n","import type * as pw from 'playwright-core'\n\nimport { PlaywrightExtra, PlaywrightExtraClass } from './extra'\nimport { PluginList } from './plugins'\nimport { playwrightLoader as loader } from './helper/loader'\n\nexport { PlaywrightExtra, PlaywrightExtraClass } from './extra'\nexport { PluginList } from './plugins'\n\n/** A playwright browser launcher */\nexport type PlaywrightBrowserLauncher = pw.BrowserType<{}>\n/** A playwright browser launcher with plugin functionality */\nexport type AugmentedBrowserLauncher = PlaywrightExtraClass &\n PlaywrightBrowserLauncher\n\n/**\n * The minimum shape we expect from a playwright compatible launcher object.\n * We intentionally keep this not strict so other custom or compatible launchers can be used.\n */\nexport interface PlaywrightCompatibleLauncher {\n connect(...args: any[]): Promise\n launch(...args: any[]): Promise\n}\n\n/** Our custom module exports */\ninterface ExtraModuleExports {\n PlaywrightExtra: typeof PlaywrightExtra\n PlaywrightExtraClass: typeof PlaywrightExtraClass\n PluginList: typeof PluginList\n addExtra: typeof addExtra\n chromium: AugmentedBrowserLauncher\n firefox: AugmentedBrowserLauncher\n webkit: AugmentedBrowserLauncher\n}\n\n/** Vanilla playwright module exports */\ntype PlaywrightModuleExports = typeof pw\n\n/**\n * Augment the provided Playwright browser launcher with plugin functionality.\n *\n * Using `addExtra` will always create a fresh PlaywrightExtra instance.\n *\n * @example\n * import playwright from 'playwright'\n * import { addExtra } from 'playwright-extra'\n *\n * const chromium = addExtra(playwright.chromium)\n * chromium.use(plugin)\n *\n * @param launcher - Playwright (or compatible) browser launcher\n */\nexport const addExtra = (\n launcher?: Launcher\n) => new PlaywrightExtra(launcher) as PlaywrightExtraClass & Launcher\n\n/**\n * This object can be used to launch or connect to Chromium with plugin functionality.\n *\n * This default export will behave exactly the same as the regular playwright\n * (just with extra plugin functionality) and can be used as a drop-in replacement.\n *\n * Behind the scenes it will try to require either the `playwright-core`\n * or `playwright` module from the installed dependencies.\n *\n * @note\n * Due to Node.js import caching this will result in a single\n * PlaywrightExtra instance, even when used in different files. If you need multiple\n * instances with different plugins please use `addExtra`.\n *\n * @example\n * // javascript import\n * const { chromium } = require('playwright-extra')\n *\n * // typescript/es6 module import\n * import { chromium } from 'playwright-extra'\n *\n * // Add plugins\n * chromium.use(...)\n */\nexport const chromium = addExtra((loader.loadModule() || {}).chromium)\n/**\n * This object can be used to launch or connect to Firefox with plugin functionality\n * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra`\n */\nexport const firefox = addExtra((loader.loadModule() || {}).firefox)\n/**\n * This object can be used to launch or connect to Webkit with plugin functionality\n * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra`\n */\nexport const webkit = addExtra((loader.loadModule() || {}).webkit)\n\n// Other playwright module exports we simply re-export with lazy loading\nexport const _android = loader.lazyloadExportOrDie('_android')\nexport const _electron = loader.lazyloadExportOrDie('_electron')\nexport const request = loader.lazyloadExportOrDie('request')\nexport const selectors = loader.lazyloadExportOrDie('selectors')\nexport const devices = loader.lazyloadExportOrDie('devices')\nexport const errors = loader.lazyloadExportOrDie('errors')\n\n/** Playwright with plugin functionality */\nconst moduleExports: ExtraModuleExports & PlaywrightModuleExports = {\n // custom exports\n PlaywrightExtra,\n PlaywrightExtraClass,\n PluginList,\n addExtra,\n chromium,\n firefox,\n webkit,\n\n // vanilla exports\n _android,\n _electron,\n request,\n selectors,\n devices,\n errors\n}\n\nexport default moduleExports\n"],"names":["debug","loader"],"mappings":";;;;;;;AAEA;MACa,MAAM;IACjB,YAAmB,UAAkB,EAAS,YAAsB;QAAjD,eAAU,GAAV,UAAU,CAAQ;QAAS,iBAAY,GAAZ,YAAY,CAAU;KAAI;;;;;;;;;;;IAYjE,mBAAmB,CAA+B,UAAa;QACpE,MAAM,IAAI,GAAG,IAAI,CAAA;QACjB,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,CACpC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,IAAS,KAAK;YACrD,IAAI;YACJ,UAAU,MAAW,EAAE,GAAG,IAAW;gBACnC,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAA;gBACvD,MAAM,YAAY,GAAG,YAAmB,CAAA;gBACxC,MAAM,MAAM,GAAK,OAAe,CAAC,IAAI,CAAS,CAC5C,YAAY,IAAI,MAAM,EACtB,GAAG,IAAI,CACR,CAAA;gBACD,OAAO,MAAM,CAAA;aAC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Q,CAAC,CAACA,gBAAM,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;AAElE;AACA,MAAa,QAAQ,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;AAC9D,MAAa,SAAS,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;AAChE,MAAa,OAAO,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC5D,MAAa,SAAS,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;AAChE,MAAa,OAAO,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC5D,MAAa,MAAM,GAAGA,gBAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAE1D;AACA,MAAM,aAAa,GAAiD;;IAElE,eAAe;IACf,oBAAoB;IACpB,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,OAAO;IACP,MAAM;;IAGN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,OAAO;IACP,MAAM;CACP,CAAA;;;;;"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js new file mode 100644 index 0000000..90d5f35 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.errors = exports.devices = exports.selectors = exports.request = exports._electron = exports._android = exports.webkit = exports.firefox = exports.chromium = exports.addExtra = exports.PluginList = exports.PlaywrightExtraClass = exports.PlaywrightExtra = void 0; +const extra_1 = require("./extra"); +const plugins_1 = require("./plugins"); +const loader_1 = require("./helper/loader"); +var extra_2 = require("./extra"); +Object.defineProperty(exports, "PlaywrightExtra", { enumerable: true, get: function () { return extra_2.PlaywrightExtra; } }); +Object.defineProperty(exports, "PlaywrightExtraClass", { enumerable: true, get: function () { return extra_2.PlaywrightExtraClass; } }); +var plugins_2 = require("./plugins"); +Object.defineProperty(exports, "PluginList", { enumerable: true, get: function () { return plugins_2.PluginList; } }); +/** + * Augment the provided Playwright browser launcher with plugin functionality. + * + * Using `addExtra` will always create a fresh PlaywrightExtra instance. + * + * @example + * import playwright from 'playwright' + * import { addExtra } from 'playwright-extra' + * + * const chromium = addExtra(playwright.chromium) + * chromium.use(plugin) + * + * @param launcher - Playwright (or compatible) browser launcher + */ +const addExtra = (launcher) => new extra_1.PlaywrightExtra(launcher); +exports.addExtra = addExtra; +/** + * This object can be used to launch or connect to Chromium with plugin functionality. + * + * This default export will behave exactly the same as the regular playwright + * (just with extra plugin functionality) and can be used as a drop-in replacement. + * + * Behind the scenes it will try to require either the `playwright-core` + * or `playwright` module from the installed dependencies. + * + * @note + * Due to Node.js import caching this will result in a single + * PlaywrightExtra instance, even when used in different files. If you need multiple + * instances with different plugins please use `addExtra`. + * + * @example + * // javascript import + * const { chromium } = require('playwright-extra') + * + * // typescript/es6 module import + * import { chromium } from 'playwright-extra' + * + * // Add plugins + * chromium.use(...) + */ +exports.chromium = (0, exports.addExtra)((loader_1.playwrightLoader.loadModule() || {}).chromium); +/** + * This object can be used to launch or connect to Firefox with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +exports.firefox = (0, exports.addExtra)((loader_1.playwrightLoader.loadModule() || {}).firefox); +/** + * This object can be used to launch or connect to Webkit with plugin functionality + * @note This export will always return the same instance, if you wish to use multiple instances with different plugins use `addExtra` + */ +exports.webkit = (0, exports.addExtra)((loader_1.playwrightLoader.loadModule() || {}).webkit); +// Other playwright module exports we simply re-export with lazy loading +exports._android = loader_1.playwrightLoader.lazyloadExportOrDie('_android'); +exports._electron = loader_1.playwrightLoader.lazyloadExportOrDie('_electron'); +exports.request = loader_1.playwrightLoader.lazyloadExportOrDie('request'); +exports.selectors = loader_1.playwrightLoader.lazyloadExportOrDie('selectors'); +exports.devices = loader_1.playwrightLoader.lazyloadExportOrDie('devices'); +exports.errors = loader_1.playwrightLoader.lazyloadExportOrDie('errors'); +/** Playwright with plugin functionality */ +const moduleExports = { + // custom exports + PlaywrightExtra: extra_1.PlaywrightExtra, + PlaywrightExtraClass: extra_1.PlaywrightExtraClass, + PluginList: plugins_1.PluginList, + addExtra: exports.addExtra, + chromium: exports.chromium, + firefox: exports.firefox, + webkit: exports.webkit, + // vanilla exports + _android: exports._android, + _electron: exports._electron, + request: exports.request, + selectors: exports.selectors, + devices: exports.devices, + errors: exports.errors +}; +exports.default = moduleExports; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js.map new file mode 100644 index 0000000..6f67c35 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAEA,mCAA+D;AAC/D,uCAAsC;AACtC,4CAA4D;AAE5D,iCAA+D;AAAtD,wGAAA,eAAe,OAAA;AAAE,6GAAA,oBAAoB,OAAA;AAC9C,qCAAsC;AAA7B,qGAAA,UAAU,OAAA;AA+BnB;;;;;;;;;;;;;GAaG;AACI,MAAM,QAAQ,GAAG,CACtB,QAAmB,EACnB,EAAE,CAAC,IAAI,uBAAe,CAAC,QAAQ,CAAoC,CAAA;AAFxD,QAAA,QAAQ,YAEgD;AAErE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACU,QAAA,QAAQ,GAAG,IAAA,gBAAQ,EAAC,CAAC,yBAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAA;AACtE;;;GAGG;AACU,QAAA,OAAO,GAAG,IAAA,gBAAQ,EAAC,CAAC,yBAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,CAAA;AACpE;;;GAGG;AACU,QAAA,MAAM,GAAG,IAAA,gBAAQ,EAAC,CAAC,yBAAM,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;AAElE,wEAAwE;AAC3D,QAAA,QAAQ,GAAG,yBAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAA;AACjD,QAAA,SAAS,GAAG,yBAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;AACnD,QAAA,OAAO,GAAG,yBAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC/C,QAAA,SAAS,GAAG,yBAAM,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAA;AACnD,QAAA,OAAO,GAAG,yBAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;AAC/C,QAAA,MAAM,GAAG,yBAAM,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAA;AAE1D,2CAA2C;AAC3C,MAAM,aAAa,GAAiD;IAClE,iBAAiB;IACjB,eAAe,EAAf,uBAAe;IACf,oBAAoB,EAApB,4BAAoB;IACpB,UAAU,EAAV,oBAAU;IACV,QAAQ,EAAR,gBAAQ;IACR,QAAQ,EAAR,gBAAQ;IACR,OAAO,EAAP,eAAO;IACP,MAAM,EAAN,cAAM;IAEN,kBAAkB;IAClB,QAAQ,EAAR,gBAAQ;IACR,SAAS,EAAT,iBAAS;IACT,OAAO,EAAP,eAAO;IACP,SAAS,EAAT,iBAAS;IACT,OAAO,EAAP,eAAO;IACP,MAAM,EAAN,cAAM;CACP,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.d.ts new file mode 100644 index 0000000..da2c3b0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.d.ts @@ -0,0 +1,84 @@ +import { Plugin, PluginMethodName, PluginMethodFn, CompatiblePluginModule } from './types'; +export declare class PluginList { + private readonly _plugins; + private readonly _dependencyDefaults; + private readonly _dependencyResolution; + constructor(); + /** + * Get a list of all registered plugins. + */ + get list(): import("./types").PuppeteerExtraPlugin[]; + /** + * Get the names of all registered plugins. + */ + get names(): string[]; + /** Check if the shape of a plugin is correct or warn */ + protected isValidPluginInstance(plugin: Plugin): boolean; + /** Error callback in case calling a plugin method throws an error. Can be overwritten. */ + onPluginError(plugin: Plugin, method: PluginMethodName, err: Error): void; + /** + * Define default values for plugins implicitly required through the `dependencies` plugin stanza. + * + * @param dependencyPath - The string by which the dependency is listed (not the plugin name) + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' }) + */ + setDependencyDefaults(dependencyPath: string, opts: any): this; + /** + * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza. + * + * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with. + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin) + */ + setDependencyResolution(dependencyPath: string, pluginModule: CompatiblePluginModule): this; + /** Return all plugins using the supplied method */ + protected filterByMethod(methodName: PluginMethodName): import("./types").PuppeteerExtraPlugin[]; + /** Conditionally add puppeteer compatibility to values provided to the plugins */ + protected _addPuppeteerCompatIfNeeded(plugin: Plugin, method: TMethod, args: Parameters>): Parameters>; + /** + * Order plugins that have expressed a special placement requirement. + * + * This is useful/necessary for e.g. plugins that depend on the data from other plugins. + * + * @private + */ + protected order(): void; + /** + * Collects the exposed `data` property of all registered plugins. + * Will be reduced/flattened to a single array. + * + * Can be accessed by plugins that listed the `dataFromPlugins` requirement. + * + * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`). + * + * @see [PuppeteerExtraPlugin]/data + * @param name - Filter data by optional name + * + * @private + */ + protected getData(name?: string): any; + /** + * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports) + */ + protected resolvePluginsStanza(): void; + /** + * Handle `dependencies` stanza (which requires dynamic imports) + * + * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts + * + * @note + * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()` + * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()` + */ + protected resolveDependenciesStanza(): void; + /** + * Lightweight plugin dependency management to require plugins and code mods on demand. + * @private + */ + protected resolveDependencies(): void; +} diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js new file mode 100644 index 0000000..9c572b8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js @@ -0,0 +1,352 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PluginList = void 0; +const debug_1 = __importDefault(require("debug")); +const debug = (0, debug_1.default)('playwright-extra:plugins'); +const loader_1 = require("./helper/loader"); +const puppeteer_compatiblity_shim_1 = require("./puppeteer-compatiblity-shim"); +class PluginList { + constructor() { + this._plugins = []; + this._dependencyDefaults = new Map(); + this._dependencyResolution = new Map(); + } + /** + * Get a list of all registered plugins. + */ + get list() { + return this._plugins; + } + /** + * Get the names of all registered plugins. + */ + get names() { + return this._plugins.map(p => p.name); + } + /** + * Add a new plugin to the list (after checking if it's well-formed). + * + * @param plugin + * @internal + */ + add(plugin) { + var _a; + if (!this.isValidPluginInstance(plugin)) { + return false; + } + if (!!plugin.onPluginRegistered) { + plugin.onPluginRegistered({ framework: 'playwright' }); + } + // PuppeteerExtraPlugin: Populate `_childClassMembers` list containing methods defined by the plugin + if (!!plugin._registerChildClassMembers) { + plugin._registerChildClassMembers(Object.getPrototypeOf(plugin)); + } + if ((_a = plugin.requirements) === null || _a === void 0 ? void 0 : _a.has('dataFromPlugins')) { + plugin.getDataFromPlugins = this.getData.bind(this); + } + this._plugins.push(plugin); + return true; + } + /** Check if the shape of a plugin is correct or warn */ + isValidPluginInstance(plugin) { + if (!plugin || + typeof plugin !== 'object' || + !plugin._isPuppeteerExtraPlugin) { + console.error(`Warning: Plugin is not derived from PuppeteerExtraPlugin, ignoring.`, plugin); + return false; + } + if (!plugin.name) { + console.error(`Warning: Plugin with no name registering, ignoring.`, plugin); + return false; + } + return true; + } + /** Error callback in case calling a plugin method throws an error. Can be overwritten. */ + onPluginError(plugin, method, err) { + console.warn(`An error occured while executing "${method}" in plugin "${plugin.name}":`, err); + } + /** + * Define default values for plugins implicitly required through the `dependencies` plugin stanza. + * + * @param dependencyPath - The string by which the dependency is listed (not the plugin name) + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { vendor: 'Bob', renderer: 'Alice' }) + */ + setDependencyDefaults(dependencyPath, opts) { + this._dependencyDefaults.set(dependencyPath, opts); + return this; + } + /** + * Define custom plugin modules for plugins implicitly required through the `dependencies` plugin stanza. + * + * Using this will prevent dynamic imports from being used, which JS bundlers often have issues with. + * + * @example + * chromium.use(stealth) + * chromium.plugins.setDependencyResolution('stealth/evasions/webgl.vendor', VendorPlugin) + */ + setDependencyResolution(dependencyPath, pluginModule) { + this._dependencyResolution.set(dependencyPath, pluginModule); + return this; + } + /** + * Prepare plugins to be used (resolve dependencies, ordering) + * @internal + */ + prepare() { + this.resolveDependencies(); + this.order(); + } + /** Return all plugins using the supplied method */ + filterByMethod(methodName) { + return this._plugins.filter(plugin => { + // PuppeteerExtraPlugin: The base class will already define all methods, hence we need to do a different check + if (!!plugin._childClassMembers && + Array.isArray(plugin._childClassMembers)) { + return plugin._childClassMembers.includes(methodName); + } + return methodName in plugin; + }); + } + /** Conditionally add puppeteer compatibility to values provided to the plugins */ + _addPuppeteerCompatIfNeeded(plugin, method, args) { + const canUseShim = plugin._isPuppeteerExtraPlugin && !plugin.noPuppeteerShim; + const methodWhitelist = [ + 'onBrowser', + 'onPageCreated', + 'onPageClose', + 'afterConnect', + 'afterLaunch' + ]; + const shouldUseShim = methodWhitelist.includes(method); + if (!canUseShim || !shouldUseShim) { + return args; + } + debug('add puppeteer compatibility', plugin.name, method); + return [...args.map(arg => (0, puppeteer_compatiblity_shim_1.addPuppeteerCompat)(arg))]; + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Will not await results to dispatch events as fast as possible to all plugins. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + dispatch(method, ...args) { + var _a, _b; + const plugins = this.filterByMethod(method); + debug('dispatch', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + const fnType = (_b = (_a = plugin[method]) === null || _a === void 0 ? void 0 : _a.constructor) === null || _b === void 0 ? void 0 : _b.name; + debug('dispatch to plugin', { + plugin: plugin.name, + method, + fnType + }); + if (fnType === 'AsyncFunction') { + ; + plugin[method](...args).catch((err) => this.onPluginError(plugin, method, err)); + } + else { + ; + plugin[method](...args); + } + } + catch (err) { + this.onPluginError(plugin, method, err); + } + } + } + /** + * Dispatch plugin lifecycle events in a typesafe way. + * Only Plugins that expose the supplied property will be called. + * + * Can also be used to get a definite return value after passing it to plugins: + * Calls plugins sequentially and passes on a value (waterfall style). + * + * The plugins can either modify the value or return an updated one. + * Will return the latest, updated value which ran through all plugins. + * + * By convention only the first argument will be used as the updated value. + * + * @param method - The lifecycle method name + * @param args - Optional: Any arguments to be supplied to the plugin methods + * @internal + */ + async dispatchBlocking(method, ...args) { + const plugins = this.filterByMethod(method); + debug('dispatchBlocking', method, { + all: this._plugins.length, + filteredByMethod: plugins.length + }); + let retValue = null; + for (const plugin of plugins) { + try { + args = this._addPuppeteerCompatIfNeeded.bind(this)(plugin, method, args); + retValue = await plugin[method](...args); + // In case we got a return value use that as new first argument for followup function calls + if (retValue !== undefined) { + args[0] = retValue; + } + } + catch (err) { + this.onPluginError(plugin, method, err); + return retValue; + } + } + return retValue; + } + /** + * Order plugins that have expressed a special placement requirement. + * + * This is useful/necessary for e.g. plugins that depend on the data from other plugins. + * + * @private + */ + order() { + debug('order:before', this.names); + const runLast = this._plugins + .filter(p => { var _a; return (_a = p.requirements) === null || _a === void 0 ? void 0 : _a.has('runLast'); }) + .map(p => p.name); + for (const name of runLast) { + const index = this._plugins.findIndex(p => p.name === name); + this._plugins.push(this._plugins.splice(index, 1)[0]); + } + debug('order:after', this.names); + } + /** + * Collects the exposed `data` property of all registered plugins. + * Will be reduced/flattened to a single array. + * + * Can be accessed by plugins that listed the `dataFromPlugins` requirement. + * + * Implemented mainly for plugins that need data from other plugins (e.g. `user-preferences`). + * + * @see [PuppeteerExtraPlugin]/data + * @param name - Filter data by optional name + * + * @private + */ + getData(name) { + const data = this._plugins + .filter((p) => !!p.data) + .map((p) => (Array.isArray(p.data) ? p.data : [p.data])) + .reduce((acc, arr) => [...acc, ...arr], []); + return name ? data.filter((d) => d.name === name) : data; + } + /** + * Handle `plugins` stanza (already instantiated plugins that don't require dynamic imports) + */ + resolvePluginsStanza() { + debug('resolvePluginsStanza'); + const pluginNames = new Set(this.names); + this._plugins + .filter(p => !!p.plugins && p.plugins.length) + .filter(p => !pluginNames.has(p.name)) // TBD: Do we want to filter out existing? + .forEach(parent => { + ; + (parent.plugins || []).forEach(p => { + debug(parent.name, 'adding missing plugin', p.name); + this.add(p); + }); + }); + } + /** + * Handle `dependencies` stanza (which requires dynamic imports) + * + * Plugins can define `dependencies` as a Set or Array of dependency paths, or a Map with additional opts + * + * @note + * - The default opts for implicit dependencies can be defined using `setDependencyDefaults()` + * - Dynamic imports can be avoided by providing plugin modules with `setDependencyResolution()` + */ + resolveDependenciesStanza() { + debug('resolveDependenciesStanza'); + /** Attempt to dynamically require a plugin module */ + const requireDependencyOrDie = (parentName, dependencyPath) => { + // If the user provided the plugin module already we use that + if (this._dependencyResolution.has(dependencyPath)) { + return this._dependencyResolution.get(dependencyPath); + } + const possiblePrefixes = ['puppeteer-extra-plugin-']; // could be extended later + const isAlreadyPrefixed = possiblePrefixes.some(prefix => dependencyPath.startsWith(prefix)); + const packagePaths = []; + // If the dependency is not already prefixed we attempt to require all possible combinations to find one that works + if (!isAlreadyPrefixed) { + packagePaths.push(...possiblePrefixes.map(prefix => prefix + dependencyPath)); + } + // We always attempt to require the path verbatim (as a last resort) + packagePaths.push(dependencyPath); + const pluginModule = (0, loader_1.requirePackages)(packagePaths); + if (pluginModule) { + return pluginModule; + } + const explanation = ` +The plugin '${parentName}' listed '${dependencyPath}' as dependency, +which could not be found. Please install it: + +${packagePaths + .map(packagePath => `yarn add ${packagePath.split('/')[0]}`) + .join(`\n or:\n`)} + +Note: You don't need to require the plugin yourself, +unless you want to modify it's default settings. + +If your bundler has issues with dynamic imports take a look at '.plugins.setDependencyResolution()'. + `; + console.warn(explanation); + throw new Error('Plugin dependency not found'); + }; + const existingPluginNames = new Set(this.names); + const recursivelyLoadMissingDependencies = ({ name: parentName, dependencies }) => { + if (!dependencies) { + return; + } + const processDependency = (dependencyPath, opts) => { + const pluginModule = requireDependencyOrDie(parentName, dependencyPath); + opts = opts || this._dependencyDefaults.get(dependencyPath) || {}; + const plugin = pluginModule(opts); + if (existingPluginNames.has(plugin.name)) { + debug(parentName, '=> dependency already exists:', plugin.name); + return; + } + existingPluginNames.add(plugin.name); + debug(parentName, '=> adding new dependency:', plugin.name, opts); + this.add(plugin); + return recursivelyLoadMissingDependencies(plugin); + }; + if (dependencies instanceof Set || Array.isArray(dependencies)) { + return [...dependencies].forEach(dependencyPath => processDependency(dependencyPath)); + } + if (dependencies instanceof Map) { + // Note: `k,v => v,k` (Map + forEach will reverse the order) + return dependencies.forEach((v, k) => processDependency(k, v)); + } + }; + this.list.forEach(recursivelyLoadMissingDependencies); + } + /** + * Lightweight plugin dependency management to require plugins and code mods on demand. + * @private + */ + resolveDependencies() { + debug('resolveDependencies'); + this.resolvePluginsStanza(); + this.resolveDependenciesStanza(); + } +} +exports.PluginList = PluginList; +//# sourceMappingURL=plugins.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js.map new file mode 100644 index 0000000..3aaf194 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/plugins.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins.js","sourceRoot":"","sources":["../src/plugins.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,0BAA0B,CAAC,CAAA;AAU/C,4CAAiD;AACjD,+EAAkE;AAElE,MAAa,UAAU;IAMrB;QALiB,aAAQ,GAAa,EAAE,CAAA;QACvB,wBAAmB,GAAqB,IAAI,GAAG,EAAE,CAAA;QACjD,0BAAqB,GACpC,IAAI,GAAG,EAAE,CAAA;IAEI,CAAC;IAEhB;;OAEG;IACH,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACvC,CAAC;IAED;;;;;OAKG;IACI,GAAG,CAAC,MAAc;;QACvB,IAAI,CAAC,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YACvC,OAAO,KAAK,CAAA;SACb;QACD,IAAI,CAAC,CAAC,MAAM,CAAC,kBAAkB,EAAE;YAC/B,MAAM,CAAC,kBAAkB,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC,CAAA;SACvD;QACD,oGAAoG;QACpG,IAAI,CAAC,CAAC,MAAM,CAAC,0BAA0B,EAAE;YACvC,MAAM,CAAC,0BAA0B,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM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AC,GAAG,YAAY,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,CAChD,iBAAiB,CAAC,cAAc,CAAC,CAClC,CAAA;aACF;YACD,IAAI,YAAY,YAAY,GAAG,EAAE;gBAC/B,4DAA4D;gBAC5D,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;aAC/D;QACH,CAAC,CAAA;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAA;IACvD,CAAC;IAED;;;OAGG;IACO,mBAAmB;QAC3B,KAAK,CAAC,qBAAqB,CAAC,CAAA;QAC5B,IAAI,CAAC,oBAAoB,EAAE,CAAA;QAC3B,IAAI,CAAC,yBAAyB,EAAE,CAAA;IAClC,CAAC;CACF;AA7YD,gCA6YC"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.d.ts new file mode 100644 index 0000000..064a829 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.d.ts @@ -0,0 +1,25 @@ +import type * as pw from 'playwright-core'; +export declare type PlaywrightObject = pw.Page | pw.Frame | pw.Browser; +export interface PuppeteerBrowserShim { + isCompatShim?: boolean; + isPlaywright?: boolean; + pages?: pw.BrowserContext['pages']; + userAgent: () => Promise<'string'>; +} +export interface PuppeteerPageShim { + isCompatShim?: boolean; + isPlaywright?: boolean; + browser?: () => pw.Browser; + evaluateOnNewDocument?: pw.Page['addInitScript']; + _client: () => pw.CDPSession; +} +export declare const isPlaywrightPage: (obj: unknown) => obj is pw.Page; +export declare const isPlaywrightFrame: (obj: unknown) => obj is pw.Frame; +export declare const isPlaywrightBrowser: (obj: unknown) => obj is pw.Browser; +export declare const isPuppeteerCompat: (obj?: unknown) => obj is PlaywrightObject; +/** Augment a Playwright object with compatibility with certain Puppeteer methods */ +export declare function addPuppeteerCompat(object: Input): Input; +export declare function getPageCDPSession(page: pw.Page | pw.Frame): Promise; +export declare function getBrowserCDPSession(browser: pw.Browser): Promise; +export declare function createPageShim(page: pw.Page | pw.Frame): pw.Page | pw.Frame; +export declare function createBrowserShim(browser: pw.Browser): pw.Browser; diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js new file mode 100644 index 0000000..fd12979 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js @@ -0,0 +1,206 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createBrowserShim = exports.createPageShim = exports.getBrowserCDPSession = exports.getPageCDPSession = exports.addPuppeteerCompat = exports.isPuppeteerCompat = exports.isPlaywrightBrowser = exports.isPlaywrightFrame = exports.isPlaywrightPage = void 0; +const debug_1 = __importDefault(require("debug")); +const debug = (0, debug_1.default)('playwright-extra:puppeteer-compat'); +const isPlaywrightPage = (obj) => { + return 'unroute' in obj; +}; +exports.isPlaywrightPage = isPlaywrightPage; +const isPlaywrightFrame = (obj) => { + return ['parentFrame', 'frameLocator'].every(x => x in obj); +}; +exports.isPlaywrightFrame = isPlaywrightFrame; +const isPlaywrightBrowser = (obj) => { + return 'newContext' in obj; +}; +exports.isPlaywrightBrowser = isPlaywrightBrowser; +const isPuppeteerCompat = (obj) => { + return !!obj && typeof obj === 'object' && !!obj.isCompatShim; +}; +exports.isPuppeteerCompat = isPuppeteerCompat; +const cache = { + objectToShim: new Map(), + cdpSession: { + page: new Map(), + browser: new Map() + } +}; +/** Augment a Playwright object with compatibility with certain Puppeteer methods */ +function addPuppeteerCompat(object) { + if (!object || typeof object !== 'object') { + return object; + } + if (cache.objectToShim.has(object)) { + return cache.objectToShim.get(object); + } + if ((0, exports.isPuppeteerCompat)(object)) { + return object; + } + debug('addPuppeteerCompat', cache.objectToShim.size); + if ((0, exports.isPlaywrightPage)(object) || (0, exports.isPlaywrightFrame)(object)) { + const shim = createPageShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + if ((0, exports.isPlaywrightBrowser)(object)) { + const shim = createBrowserShim(object); + cache.objectToShim.set(object, shim); + return shim; + } + debug('Received unknown object:', Reflect.ownKeys(object)); + return object; +} +exports.addPuppeteerCompat = addPuppeteerCompat; +// Only chromium browsers support CDP +const dummyCDPClient = { + send: async (...args) => { + debug('dummy CDP client called', 'send', args); + }, + on: (...args) => { + debug('dummy CDP client called', 'on', args); + } +}; +async function getPageCDPSession(page) { + let session = cache.cdpSession.page.get(page); + if (session) { + debug('getPageCDPSession: use existing'); + return session; + } + debug('getPageCDPSession: use new'); + const context = (0, exports.isPlaywrightFrame)(page) + ? page.page().context() + : page.context(); + try { + session = await context.newCDPSession(page); + cache.cdpSession.page.set(page, session); + return session; + } + catch (err) { + debug('getPageCDPSession: error while creating session:', err.message); + debug('getPageCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +exports.getPageCDPSession = getPageCDPSession; +async function getBrowserCDPSession(browser) { + let session = cache.cdpSession.browser.get(browser); + if (session) { + debug('getBrowserCDPSession: use existing'); + return session; + } + debug('getBrowserCDPSession: use new'); + try { + session = await browser.newBrowserCDPSession(); + cache.cdpSession.browser.set(browser, session); + return session; + } + catch (err) { + debug('getBrowserCDPSession: error while creating session:', err.message); + debug('getBrowserCDPSession: Unable create CDP session (most likely a different browser than chromium) - returning a dummy'); + } + return dummyCDPClient; +} +exports.getBrowserCDPSession = getBrowserCDPSession; +function createPageShim(page) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(page, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('page - get', objId, prop); + if (prop === '_client') { + return () => ({ + send: async (method, params) => { + const session = await getPageCDPSession(page); + return await session.send(method, params); + }, + on: (event, listener) => { + getPageCDPSession(page).then(session => { + session.on(event, listener); + }); + } + }); + } + if (prop === 'setBypassCSP') { + return async (enabled) => { + const session = await getPageCDPSession(page); + return await session.send('Page.setBypassCSP', { + enabled + }); + }; + } + if (prop === 'setUserAgent') { + return async (userAgent, userAgentMetadata) => { + const session = await getPageCDPSession(page); + return await session.send('Emulation.setUserAgentOverride', { + userAgent, + userAgentMetadata + }); + }; + } + if (prop === 'browser') { + if ((0, exports.isPlaywrightPage)(page)) { + return () => { + let browser = page.context().browser(); + if (!browser) { + debug('page.browser() - not available, most likely due to launchPersistentContext'); + // Use a page shim as quick drop-in (so browser.userAgent() still works) + browser = page; + } + return addPuppeteerCompat(browser); + }; + } + } + if (prop === 'evaluateOnNewDocument') { + if ((0, exports.isPlaywrightPage)(page)) { + return async function (pageFunction, ...args) { + return await page.addInitScript(pageFunction, args[0]); + }; + } + } + // Only relevant when page is being used a pseudo stand-in for the browser object (launchPersistentContext) + if (prop === 'userAgent') { + return async (enabled) => { + const session = await getPageCDPSession(page); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} +exports.createPageShim = createPageShim; +function createBrowserShim(browser) { + const objId = Math.random().toString(36).substring(2, 7); + const shim = new Proxy(browser, { + get(target, prop) { + if (prop === 'isCompatShim' || prop === 'isPlaywright') { + return true; + } + debug('browser - get', objId, prop); + if (prop === 'pages') { + return () => browser + .contexts() + .flatMap(c => c.pages().map(page => addPuppeteerCompat(page))); + } + if (prop === 'userAgent') { + return async () => { + const session = await getBrowserCDPSession(browser); + const data = await session.send('Browser.getVersion'); + return data.userAgent; + }; + } + return Reflect.get(target, prop); + } + }); + return shim; +} +exports.createBrowserShim = createBrowserShim; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js.map new file mode 100644 index 0000000..2ead096 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/puppeteer-compatiblity-shim/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,mCAAmC,CAAC,CAAA;AAqBjD,MAAM,gBAAgB,GAAG,CAAC,GAAY,EAAkB,EAAE;IAC/D,OAAO,SAAS,IAAK,GAAe,CAAA;AACtC,CAAC,CAAA;AAFY,QAAA,gBAAgB,oBAE5B;AACM,MAAM,iBAAiB,GAAG,CAAC,GAAY,EAAmB,EAAE;IACjE,OAAO,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAK,GAAgB,CAAC,CAAA;AAC3E,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AACM,MAAM,mBAAmB,GAAG,CAAC,GAAY,EAAqB,EAAE;IACrE,OAAO,YAAY,IAAK,GAAkB,CAAA;AAC5C,CAAC,CAAA;AAFY,QAAA,mBAAmB,uBAE/B;AACM,MAAM,iBAAiB,GAAG,CAAC,GAAa,EAA2B,EAAE;IAC1E,OAAO,CAAC,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,CAAE,GAAW,CAAC,YAAY,CAAA;AACxE,CAAC,CAAA;AAFY,QAAA,iBAAiB,qBAE7B;AAED,MAAM,KAAK,GAAG;IACZ,YAAY,EAAE,IAAI,GAAG,EAAsC;IAC3D,UAAU,EAAE;QACV,IAAI,EAAE,IAAI,GAAG,EAAqC;QAClD,OAAO,EAAE,IAAI,GAAG,EAA6B;KAC9C;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oB,CAAC,CAAA;oBACrD,OAAO,IAAI,CAAC,SAAS,CAAA;gBACvB,CAAC,CAAA;aACF;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;QAClC,CAAC;KACF,CAAC,CAAA;IACF,OAAO,IAAI,CAAA;AACb,CAAC;AAzBD,8CAyBC"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/playwright-shim.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/playwright-shim.d.ts new file mode 100644 index 0000000..aae7fb4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/puppeteer-compatiblity-shim/playwright-shim.d.ts @@ -0,0 +1,11 @@ +// Playwright objects extended with puppeteer compatiblity shims + +import type {} from 'playwright-core' + +import type { PuppeteerPageShim, PuppeteerBrowserShim } from '.' + +declare module 'playwright-core' { + interface Page extends PuppeteerPageShim {} + interface Frame extends PuppeteerPageShim {} + interface Browser extends PuppeteerBrowserShim {} +} diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.d.ts b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.d.ts new file mode 100644 index 0000000..cc9d4b3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.d.ts @@ -0,0 +1,87 @@ +import type * as pw from 'playwright-core'; +declare type PropType = TObj[TProp]; +declare type PluginEnv = { + framework: 'playwright'; +}; +/** Strongly typed plugin lifecycle events for internal use */ +export declare abstract class PluginLifecycleMethods { + onPluginRegistered(env?: PluginEnv): Promise; + beforeLaunch(options: pw.LaunchOptions): Promise; + afterLaunch(browserOrContext?: pw.Browser | pw.BrowserContext): Promise; + beforeConnect(options: pw.ConnectOptions): Promise; + afterConnect(browser: pw.Browser): Promise; + onBrowser(browser: pw.Browser): Promise; + onPageCreated(page: pw.Page): Promise; + onPageClose(page: pw.Page): Promise; + onDisconnected(browser?: pw.Browser): Promise; + beforeContext(options?: pw.BrowserContextOptions, browser?: pw.Browser): Promise; + onContextCreated(context?: pw.BrowserContext, options?: pw.BrowserContextOptions): Promise; +} +/** A valid plugin method name */ +export declare type PluginMethodName = keyof PluginLifecycleMethods; +/** A valid plugin method function */ +export declare type PluginMethodFn = PropType; +declare type PluginRequirements = Set<'launch' | 'headful' | 'dataFromPlugins' | 'runLast'>; +declare type PluginDependencies = Set | Map | string[]; +interface PluginData { + name: string | { + [key: string]: any; + }; + value: { + [key: string]: any; + }; +} +export interface CompatiblePluginLifecycleMethods { + onPluginRegistered(...any: any[]): Promise | any; + beforeLaunch(...any: any[]): Promise | any; + afterLaunch(...any: any[]): Promise | any; + beforeConnect(...any: any[]): Promise | any; + afterConnect(...any: any[]): Promise | any; + onBrowser(...any: any[]): Promise | any; + onPageCreated(...any: any[]): Promise | any; + onPageClose(...any: any[]): Promise | any; + onDisconnected(...any: any[]): Promise | any; + beforeContext(...any: any[]): Promise | any; + onContextCreated(...any: any[]): Promise | any; +} +/** + * PuppeteerExtraPlugin interface, strongly typed for internal use + * @private + */ +export interface PuppeteerExtraPlugin extends Partial { + _isPuppeteerExtraPlugin: boolean; + name: string; + /** Disable the puppeteer compatibility shim for this plugin */ + noPuppeteerShim?: boolean; + requirements?: PluginRequirements; + dependencies?: PluginDependencies; + data?: PluginData[]; + getDataFromPlugins?(name?: string): void; + _registerChildClassMembers?(prototype: any): void; + _childClassMembers?: string[]; + plugins?: CompatiblePlugin[]; +} +/** + * Minimal compatible PuppeteerExtraPlugin interface + * @private + */ +export interface CompatiblePuppeteerPlugin extends Partial { + _isPuppeteerExtraPlugin: boolean; + name?: string; +} +export interface CompatiblePlaywrightPlugin extends Partial { + _isPlaywrightExtraPlugin: boolean; + name?: string; +} +export interface CompatibleExtraPlugin extends Partial { + _isExtraPlugin: boolean; + name?: string; +} +/** + * A compatible plugin + */ +export declare type CompatiblePlugin = CompatiblePuppeteerPlugin | CompatiblePlaywrightPlugin | CompatibleExtraPlugin; +export declare type CompatiblePluginModule = (...args: any[]) => CompatiblePlugin; +export declare type Plugin = PuppeteerExtraPlugin; +export declare type PluginModule = (...args: any[]) => Plugin; +export {}; diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js new file mode 100644 index 0000000..624adad --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PluginLifecycleMethods = void 0; +/** Strongly typed plugin lifecycle events for internal use */ +class PluginLifecycleMethods { + async onPluginRegistered(env) { } + async beforeLaunch(options) { } + async afterLaunch(browserOrContext) { } + async beforeConnect(options) { } + async afterConnect(browser) { } + async onBrowser(browser) { } + async onPageCreated(page) { } + async onPageClose(page) { } + async onDisconnected(browser) { } + // Playwright only at the moment + async beforeContext(options, browser) { } + async onContextCreated(context, options) { } +} +exports.PluginLifecycleMethods = PluginLifecycleMethods; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js.map b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js.map new file mode 100644 index 0000000..0e572ae --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/dist/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAKA,8DAA8D;AAC9D,MAAsB,sBAAsB;IAC1C,KAAK,CAAC,kBAAkB,CAAC,GAAe,IAAkB,CAAC;IAC3D,KAAK,CAAC,YAAY,CAChB,OAAyB,IACU,CAAC;IACtC,KAAK,CAAC,WAAW,CAAC,gBAAiD,IAAG,CAAC;IACvE,KAAK,CAAC,aAAa,CACjB,OAA0B,IACU,CAAC;IACvC,KAAK,CAAC,YAAY,CAAC,OAAmB,IAAG,CAAC;IAC1C,KAAK,CAAC,SAAS,CAAC,OAAmB,IAAG,CAAC;IACvC,KAAK,CAAC,aAAa,CAAC,IAAa,IAAG,CAAC;IACrC,KAAK,CAAC,WAAW,CAAC,IAAa,IAAG,CAAC;IACnC,KAAK,CAAC,cAAc,CAAC,OAAoB,IAAG,CAAC;IAC7C,gCAAgC;IAChC,KAAK,CAAC,aAAa,CACjB,OAAkC,EAClC,OAAoB,IACuB,CAAC;IAC9C,KAAK,CAAC,gBAAgB,CACpB,OAA2B,EAC3B,OAAkC,IACjC,CAAC;CACL;AAvBD,wDAuBC"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/package.json b/projects/org-skill-web-research/node_modules/playwright-extra/package.json new file mode 100644 index 0000000..267ed6c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/package.json @@ -0,0 +1,76 @@ +{ + "name": "playwright-extra", + "version": "4.3.6", + "description": "Teach playwright new tricks through plugins.", + "repository": "berstend/puppeteer-extra", + "homepage": "https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra#readme", + "author": "berstend", + "license": "MIT", + "typings": "dist/index.d.ts", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "files": [ + "dist" + ], + "scripts": { + "clean": "rimraf dist/*", + "prebuild": "run-s clean", + "build": "run-s build:tsc build:rollup ambient-dts", + "build:tsc": "tsc --module commonjs", + "build:rollup": "rollup -c rollup.config.ts", + "docs": "echo \"No docs\"", + "test": "yarn playwright test --config test/playwright.config.ts", + "test-ci": "run-s test", + "ambient-dts": "run-s ambient-dts-copy ambient-dts-fix-path", + "ambient-dts-copy": "copyfiles -u 1 \"src/**/*.d.ts\" dist", + "ambient-dts-fix-path": "replace-in-files --string='/// =12" + }, + "devDependencies": { + "@playwright/test": "^1.23.1", + "@types/debug": "^4.1.7", + "@types/node": "^18.0.0", + "esbuild": "^0.14.47", + "esbuild-register": "^3.3.3", + "npm-run-all": "^4.1.5", + "playwright": "1.24.2", + "prettier": "^2.7.1", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-anonymize-ua": "^2.4.5", + "rimraf": "^3.0.0", + "rollup": "^1.27.5", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-typescript2": "^0.25.2", + "typescript": "4.4.3" + }, + "dependencies": { + "debug": "^4.3.4" + }, + "peerDependencies": { + "playwright": "*", + "playwright-core": "*" + }, + "peerDependenciesMeta": { + "playwright": { + "optional": true + }, + "playwright-core": { + "optional": true + } + }, + "gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9" +} diff --git a/projects/org-skill-web-research/node_modules/playwright-extra/readme.md b/projects/org-skill-web-research/node_modules/playwright-extra/readme.md new file mode 100644 index 0000000..6dd4d7c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/playwright-extra/readme.md @@ -0,0 +1,282 @@ +# playwright-extra [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/berstend/puppeteer-extra/test.yml?branch=master&event=push)](https://github.com/berstend/puppeteer-extra/actions) [![Discord](https://img.shields.io/discord/737009125862408274)](https://extra.community) [![npm](https://img.shields.io/npm/v/playwright-extra.svg)](https://www.npmjs.com/package/playwright-extra) + +> A modular plugin framework for [playwright](https://github.com/microsoft/playwright) to enable cool [plugins](#plugins) through a clean interface. + +## Installation + +```bash +yarn add playwright playwright-extra +# - or - +npm install playwright playwright-extra +``` + +
+ Changelog + +> Please check the `announcements` channel in our [discord server](https://extra.community) until we've automated readme updates. :) + +- **v4.3** + - Rerelease due to versioning issues with previous beta packages +- **v3.3** + - Initial public release +
+ +## Quickstart + +```js +// playwright-extra is a drop-in replacement for playwright, +// it augments the installed playwright with plugin functionality +const { chromium } = require('playwright-extra') + +// Load the stealth plugin and use defaults (all tricks to hide playwright usage) +// Note: playwright-extra is compatible with most puppeteer-extra plugins +const stealth = require('puppeteer-extra-plugin-stealth')() + +// Add the plugin to playwright (any number of plugins can be added) +chromium.use(stealth) + +// That's it, the rest is playwright usage as normal 😊 +chromium.launch({ headless: true }).then(async browser => { + const page = await browser.newPage() + + console.log('Testing the stealth plugin..') + await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' }) + await page.screenshot({ path: 'stealth.png', fullPage: true }) + + console.log('All done, check the screenshot. ✨') + await browser.close() +}) +``` + +The above example uses the compatible [`stealth`](/packages/puppeteer-extra-plugin-stealth) plugin from puppeteer-extra, that plugin needs to be installed as well: + +```bash +yarn add puppeteer-extra-plugin-stealth +# - or - +npm install puppeteer-extra-plugin-stealth +``` + +If you'd like to see debug output just run your script like so: + +```bash +# macOS/Linux (Bash) +DEBUG=playwright-extra*,puppeteer-extra* node myscript.js + +# Windows (Powershell) +$env:DEBUG='playwright-extra*,puppeteer-extra*';node myscript.js +``` + +### More examples + +
+ TypeScript & ESM usage
+ +`playwright-extra` and most plugins are written in TS, so you get perfect type support out of the box. :) + +```ts +// playwright-extra is a drop-in replacement for playwright, +// it augments the installed playwright with plugin functionality +import { chromium } from 'playwright-extra' + +// Load the stealth plugin and use defaults (all tricks to hide playwright usage) +// Note: playwright-extra is compatible with most puppeteer-extra plugins +import StealthPlugin from 'puppeteer-extra-plugin-stealth' + +// Add the plugin to playwright (any number of plugins can be added) +chromium.use(StealthPlugin()) + +// ...(the rest of the quickstart code example is the same) +chromium.launch({ headless: true }).then(async browser => { + const page = await browser.newPage() + + console.log('Testing the stealth plugin..') + await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle' }) + await page.screenshot({ path: 'stealth.png', fullPage: true }) + + console.log('All done, check the screenshot. ✨') + await browser.close() +}) +``` + +New to Typescript? Here it is in 30 seconds or less 😄: + +```bash +# Optional: If you don't have yarn yet +npm i --global yarn + +# Optional: Create new package.json if it's a new project +yarn init -y + +# Add basic typescript dependencies +yarn add --dev typescript @types/node esbuild esbuild-register + +# Bootstrap a tsconfig.json +yarn tsc --init --target ES2020 --lib ES2020 --module commonjs --rootDir src --outDir dist + +# Add dependencies used in the quick start example +yarn add playwright playwright-extra puppeteer-extra-plugin-stealth + +# Create source folder for the .ts files +mkdir src + +# Now place the example code above in `src/index.ts` + +# Run the typescript code without the need of compiling it first +node -r esbuild-register src/index.ts + +# You can now add Typescript to your CV 🎉 +``` + +
+
+ Using different browsers
+ +```ts +// Any browser supported by playwright can be used with plugins +import { chromium, firefox, webkit } from 'playwright-extra' + +chromium.use(plugin) +firefox.use(plugin) +webkit.use(plugin) +``` + +
+
+ Multiple instances with different plugins
+ +Node.js imports are cached, therefore the default `chromium`, `firefox`, `webkit` export from `playwright-extra` will always return the same playwright instance. + +```ts +// Use `addExtra` to create a fresh and independent instance +import playwright from 'playwright' +import { addExtra } from 'playwright-extra' + +const chromium1 = addExtra(playwright.chromium) +const chromium2 = addExtra(playwright.chromium) + +chromium1.use(onePlugin) +chromium2.use(anotherPlugin) +// chromium1 and chromium2 are independent +``` + +
+ +--- + +## Plugins + +We're currently in the process of making the existing [puppeteer-extra](/packages/puppeteer-extra) plugins compatible with playwright-extra, the following plugins have been successfully tested already: + +### 🔥 [`puppeteer-extra-plugin-stealth`](/packages/puppeteer-extra-plugin-stealth) + +- Applies various evasion techniques to make detection of an automated browser harder +- Compatible with Puppeteer & Playwright and chromium based browsers + +
+  Example: Using stealth in Playwright with custom options + +```js +// The stealth plugin is optimized for chromium based browsers currently +import { chromium } from 'playwright-extra' + +import StealthPlugin from 'puppeteer-extra-plugin-stealth' +chromium.use(StealthPlugin()) + +// New way to overwrite the default options of stealth evasion plugins +// https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions +chromium.plugins.setDependencyDefaults('stealth/evasions/webgl.vendor', { + vendor: 'Bob', + renderer: 'Alice' +}) + +// That's it, the rest is playwright usage as normal 😊 +chromium.launch({ headless: true }).then(async browser => { + const page = await browser.newPage() + + console.log('Testing the webgl spoofing feature of the stealth plugin..') + await page.goto('https://webglreport.com', { waitUntil: 'networkidle' }) + await page.screenshot({ path: 'webgl.png', fullPage: true }) + + console.log('All done, check the screenshot. ✨') + await browser.close() +}) +``` + +
+ +### 🏴 [`puppeteer-extra-plugin-recaptcha`](/packages/puppeteer-extra-plugin-recaptcha) + +- Solves reCAPTCHAs and hCaptchas automatically, using a single line of code: `page.solveRecaptchas()` +- Compatible with Puppeteer & Playwright and all browsers (chromium, firefox, webkit) +
+  Example: Solving captchas in Playwright & Firefox + +```js +// Any browser (chromium, webkit, firefox) can be used +import { firefox } from 'playwright-extra' + +import RecaptchaPlugin from 'puppeteer-extra-plugin-recaptcha' +firefox.use( + RecaptchaPlugin({ + provider: { + id: '2captcha', + token: process.env.TWOCAPTCHA_TOKEN || 'YOUR_API_KEY' + } + }) +) + +// Works in headless as well, just so you can see it in action +firefox.launch({ headless: false }).then(async browser => { + const context = await browser.newContext() + const page = await context.newPage() + const url = 'https://www.google.com/recaptcha/api2/demo' + await page.goto(url, { waitUntil: 'networkidle' }) + + console.log('Solving captchas..') + await page.solveRecaptchas() + + await Promise.all([ + page.waitForNavigation({ waitUntil: 'networkidle' }), + page.click(`#recaptcha-demo-submit`) + ]) + + const content = await page.content() + const isSuccess = content.includes('Verification Success') + console.log('Done', { isSuccess }) + await browser.close() +}) +``` + +
+ +### 🆕 [`plugin-proxy-router`](/packages/plugin-proxy-router) + +- Use multiple proxies dynamically with flexible per-host routing and more +- Compatible with Puppeteer & Playwright and all browsers (chromium, firefox, webkit) + +**Notes** + +- If you're in need of adblocking use [this package](https://www.npmjs.com/package/@cliqz/adblocker-playwright) or [block resources natively](https://github.com/berstend/puppeteer-extra/wiki/Block-resources-without-request-interception) +- We're focussing on compatiblity with existing plugins at the moment, more documentation on how to write your own playwright-extra plugins will follow + +--- + +## Contributors + + + + + +--- + +## License + +Copyright © 2018 - 2023, [berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘](https://github.com/berstend). Released under the MIT License. + + + +[playwright-extra]: https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra +[puppeteer-extra]: https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra +[`puppeteer-extra`]: https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/LICENSE b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/LICENSE new file mode 100644 index 0000000..a53ecb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 berstend + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/index.js new file mode 100644 index 0000000..06b95fe --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/index.js @@ -0,0 +1,28 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Minimal stealth plugin template, not being used. :-) + * + * Feel free to copy this folder as the basis for additional detection evasion plugins. + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/_template' + } + + async onPageCreated(page) { + await page.evaluateOnNewDocument(() => { + console.debug('hello world') + }) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/readme.md new file mode 100644 index 0000000..29d95f6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_template/readme.md @@ -0,0 +1,19 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_template/index.js#L10-L24) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Minimal stealth plugin template, not being used. :-) + +Feel free to copy this folder as the basis for additional detection evasion plugins. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.js new file mode 100644 index 0000000..ba89d70 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.js @@ -0,0 +1,583 @@ +/** + * A set of shared utility functions specifically for the purpose of modifying native browser APIs without leaving traces. + * + * Meant to be passed down in puppeteer and used in the context of the page (everything in here runs in NodeJS as well as a browser). + * + * Note: If for whatever reason you need to use this outside of `puppeteer-extra`: + * Just remove the `module.exports` statement at the very bottom, the rest can be copy pasted into any browser context. + * + * Alternatively take a look at the `extract-stealth-evasions` package to create a finished bundle which includes these utilities. + * + */ +const utils = {} + +utils.init = () => { + utils.preloadCache() +} + +/** + * Wraps a JS Proxy Handler and strips it's presence from error stacks, in case the traps throw. + * + * The presence of a JS Proxy can be revealed as it shows up in error stack traces. + * + * @param {object} handler - The JS Proxy handler to wrap + */ +utils.stripProxyFromErrors = (handler = {}) => { + const newHandler = { + setPrototypeOf: function (target, proto) { + if (proto === null) + throw new TypeError('Cannot convert object to primitive value') + if (Object.getPrototypeOf(target) === Object.getPrototypeOf(proto)) { + throw new TypeError('Cyclic __proto__ value') + } + return Reflect.setPrototypeOf(target, proto) + } + } + // We wrap each trap in the handler in a try/catch and modify the error stack if they throw + const traps = Object.getOwnPropertyNames(handler) + traps.forEach(trap => { + newHandler[trap] = function () { + try { + // Forward the call to the defined proxy handler + return handler[trap].apply(this, arguments || []) + } catch (err) { + // Stack traces differ per browser, we only support chromium based ones currently + if (!err || !err.stack || !err.stack.includes(`at `)) { + throw err + } + + // When something throws within one of our traps the Proxy will show up in error stacks + // An earlier implementation of this code would simply strip lines with a blacklist, + // but it makes sense to be more surgical here and only remove lines related to our Proxy. + // We try to use a known "anchor" line for that and strip it with everything above it. + // If the anchor line cannot be found for some reason we fall back to our blacklist approach. + + const stripWithBlacklist = (stack, stripFirstLine = true) => { + const blacklist = [ + `at Reflect.${trap} `, // e.g. Reflect.get or Reflect.apply + `at Object.${trap} `, // e.g. Object.get or Object.apply + `at Object.newHandler. [as ${trap}] ` // caused by this very wrapper :-) + ] + return ( + err.stack + .split('\n') + // Always remove the first (file) line in the stack (guaranteed to be our proxy) + .filter((line, index) => !(index === 1 && stripFirstLine)) + // Check if the line starts with one of our blacklisted strings + .filter(line => !blacklist.some(bl => line.trim().startsWith(bl))) + .join('\n') + ) + } + + const stripWithAnchor = (stack, anchor) => { + const stackArr = stack.split('\n') + anchor = anchor || `at Object.newHandler. [as ${trap}] ` // Known first Proxy line in chromium + const anchorIndex = stackArr.findIndex(line => + line.trim().startsWith(anchor) + ) + if (anchorIndex === -1) { + return false // 404, anchor not found + } + // Strip everything from the top until we reach the anchor line + // Note: We're keeping the 1st line (zero index) as it's unrelated (e.g. `TypeError`) + stackArr.splice(1, anchorIndex) + return stackArr.join('\n') + } + + // Special cases due to our nested toString proxies + err.stack = err.stack.replace( + 'at Object.toString (', + 'at Function.toString (' + ) + if ((err.stack || '').includes('at Function.toString (')) { + err.stack = stripWithBlacklist(err.stack, false) + throw err + } + + // Try using the anchor method, fallback to blacklist if necessary + err.stack = stripWithAnchor(err.stack) || stripWithBlacklist(err.stack) + + throw err // Re-throw our now sanitized error + } + } + }) + return newHandler +} + +/** + * Strip error lines from stack traces until (and including) a known line the stack. + * + * @param {object} err - The error to sanitize + * @param {string} anchor - The string the anchor line starts with + */ +utils.stripErrorWithAnchor = (err, anchor) => { + const stackArr = err.stack.split('\n') + const anchorIndex = stackArr.findIndex(line => line.trim().startsWith(anchor)) + if (anchorIndex === -1) { + return err // 404, anchor not found + } + // Strip everything from the top until we reach the anchor line (remove anchor line as well) + // Note: We're keeping the 1st line (zero index) as it's unrelated (e.g. `TypeError`) + stackArr.splice(1, anchorIndex) + err.stack = stackArr.join('\n') + return err +} + +/** + * Replace the property of an object in a stealthy way. + * + * Note: You also want to work on the prototype of an object most often, + * as you'd otherwise leave traces (e.g. showing up in Object.getOwnPropertyNames(obj)). + * + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty + * + * @example + * replaceProperty(WebGLRenderingContext.prototype, 'getParameter', { value: "alice" }) + * // or + * replaceProperty(Object.getPrototypeOf(navigator), 'languages', { get: () => ['en-US', 'en'] }) + * + * @param {object} obj - The object which has the property to replace + * @param {string} propName - The property name to replace + * @param {object} descriptorOverrides - e.g. { value: "alice" } + */ +utils.replaceProperty = (obj, propName, descriptorOverrides = {}) => { + return Object.defineProperty(obj, propName, { + // Copy over the existing descriptors (writable, enumerable, configurable, etc) + ...(Object.getOwnPropertyDescriptor(obj, propName) || {}), + // Add our overrides (e.g. value, get()) + ...descriptorOverrides + }) +} + +/** + * Preload a cache of function copies and data. + * + * For a determined enough observer it would be possible to overwrite and sniff usage of functions + * we use in our internal Proxies, to combat that we use a cached copy of those functions. + * + * Note: Whenever we add a `Function.prototype.toString` proxy we should preload the cache before, + * by executing `utils.preloadCache()` before the proxy is applied (so we don't cause recursive lookups). + * + * This is evaluated once per execution context (e.g. window) + */ +utils.preloadCache = () => { + if (utils.cache) { + return + } + utils.cache = { + // Used in our proxies + Reflect: { + get: Reflect.get.bind(Reflect), + apply: Reflect.apply.bind(Reflect) + }, + // Used in `makeNativeString` + nativeToStringStr: Function.toString + '' // => `function toString() { [native code] }` + } +} + +/** + * Utility function to generate a cross-browser `toString` result representing native code. + * + * There's small differences: Chromium uses a single line, whereas FF & Webkit uses multiline strings. + * To future-proof this we use an existing native toString result as the basis. + * + * The only advantage we have over the other team is that our JS runs first, hence we cache the result + * of the native toString result once, so they cannot spoof it afterwards and reveal that we're using it. + * + * @example + * makeNativeString('foobar') // => `function foobar() { [native code] }` + * + * @param {string} [name] - Optional function name + */ +utils.makeNativeString = (name = '') => { + return utils.cache.nativeToStringStr.replace('toString', name || '') +} + +/** + * Helper function to modify the `toString()` result of the provided object. + * + * Note: Use `utils.redirectToString` instead when possible. + * + * There's a quirk in JS Proxies that will cause the `toString()` result to differ from the vanilla Object. + * If no string is provided we will generate a `[native code]` thing based on the name of the property object. + * + * @example + * patchToString(WebGLRenderingContext.prototype.getParameter, 'function getParameter() { [native code] }') + * + * @param {object} obj - The object for which to modify the `toString()` representation + * @param {string} str - Optional string used as a return value + */ +utils.patchToString = (obj, str = '') => { + const handler = { + apply: function (target, ctx) { + // This fixes e.g. `HTMLMediaElement.prototype.canPlayType.toString + ""` + if (ctx === Function.prototype.toString) { + return utils.makeNativeString('toString') + } + // `toString` targeted at our proxied Object detected + if (ctx === obj) { + // We either return the optional string verbatim or derive the most desired result automatically + return str || utils.makeNativeString(obj.name) + } + // Check if the toString protype of the context is the same as the global prototype, + // if not indicates that we are doing a check across different windows., e.g. the iframeWithdirect` test case + const hasSameProto = Object.getPrototypeOf( + Function.prototype.toString + ).isPrototypeOf(ctx.toString) // eslint-disable-line no-prototype-builtins + if (!hasSameProto) { + // Pass the call on to the local Function.prototype.toString instead + return ctx.toString() + } + return target.call(ctx) + } + } + + const toStringProxy = new Proxy( + Function.prototype.toString, + utils.stripProxyFromErrors(handler) + ) + utils.replaceProperty(Function.prototype, 'toString', { + value: toStringProxy + }) +} + +/** + * Make all nested functions of an object native. + * + * @param {object} obj + */ +utils.patchToStringNested = (obj = {}) => { + return utils.execRecursively(obj, ['function'], utils.patchToString) +} + +/** + * Redirect toString requests from one object to another. + * + * @param {object} proxyObj - The object that toString will be called on + * @param {object} originalObj - The object which toString result we wan to return + */ +utils.redirectToString = (proxyObj, originalObj) => { + const handler = { + apply: function (target, ctx) { + // This fixes e.g. `HTMLMediaElement.prototype.canPlayType.toString + ""` + if (ctx === Function.prototype.toString) { + return utils.makeNativeString('toString') + } + + // `toString` targeted at our proxied Object detected + if (ctx === proxyObj) { + const fallback = () => + originalObj && originalObj.name + ? utils.makeNativeString(originalObj.name) + : utils.makeNativeString(proxyObj.name) + + // Return the toString representation of our original object if possible + return originalObj + '' || fallback() + } + + if (typeof ctx === 'undefined' || ctx === null) { + return target.call(ctx) + } + + // Check if the toString protype of the context is the same as the global prototype, + // if not indicates that we are doing a check across different windows., e.g. the iframeWithdirect` test case + const hasSameProto = Object.getPrototypeOf( + Function.prototype.toString + ).isPrototypeOf(ctx.toString) // eslint-disable-line no-prototype-builtins + if (!hasSameProto) { + // Pass the call on to the local Function.prototype.toString instead + return ctx.toString() + } + + return target.call(ctx) + } + } + + const toStringProxy = new Proxy( + Function.prototype.toString, + utils.stripProxyFromErrors(handler) + ) + utils.replaceProperty(Function.prototype, 'toString', { + value: toStringProxy + }) +} + +/** + * All-in-one method to replace a property with a JS Proxy using the provided Proxy handler with traps. + * + * Will stealthify these aspects (strip error stack traces, redirect toString, etc). + * Note: This is meant to modify native Browser APIs and works best with prototype objects. + * + * @example + * replaceWithProxy(WebGLRenderingContext.prototype, 'getParameter', proxyHandler) + * + * @param {object} obj - The object which has the property to replace + * @param {string} propName - The name of the property to replace + * @param {object} handler - The JS Proxy handler to use + */ +utils.replaceWithProxy = (obj, propName, handler) => { + const originalObj = obj[propName] + const proxyObj = new Proxy(obj[propName], utils.stripProxyFromErrors(handler)) + + utils.replaceProperty(obj, propName, { value: proxyObj }) + utils.redirectToString(proxyObj, originalObj) + + return true +} +/** + * All-in-one method to replace a getter with a JS Proxy using the provided Proxy handler with traps. + * + * @example + * replaceGetterWithProxy(Object.getPrototypeOf(navigator), 'vendor', proxyHandler) + * + * @param {object} obj - The object which has the property to replace + * @param {string} propName - The name of the property to replace + * @param {object} handler - The JS Proxy handler to use + */ +utils.replaceGetterWithProxy = (obj, propName, handler) => { + const fn = Object.getOwnPropertyDescriptor(obj, propName).get + const fnStr = fn.toString() // special getter function string + const proxyObj = new Proxy(fn, utils.stripProxyFromErrors(handler)) + + utils.replaceProperty(obj, propName, { get: proxyObj }) + utils.patchToString(proxyObj, fnStr) + + return true +} + +/** + * All-in-one method to replace a getter and/or setter. Functions get and set + * of handler have one more argument that contains the native function. + * + * @example + * replaceGetterSetter(HTMLIFrameElement.prototype, 'contentWindow', handler) + * + * @param {object} obj - The object which has the property to replace + * @param {string} propName - The name of the property to replace + * @param {object} handlerGetterSetter - The handler with get and/or set + * functions + * @see https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty#description + */ +utils.replaceGetterSetter = (obj, propName, handlerGetterSetter) => { + const ownPropertyDescriptor = Object.getOwnPropertyDescriptor(obj, propName) + const handler = { ...ownPropertyDescriptor } + + if (handlerGetterSetter.get !== undefined) { + const nativeFn = ownPropertyDescriptor.get + handler.get = function() { + return handlerGetterSetter.get.call(this, nativeFn.bind(this)) + } + utils.redirectToString(handler.get, nativeFn) + } + + if (handlerGetterSetter.set !== undefined) { + const nativeFn = ownPropertyDescriptor.set + handler.set = function(newValue) { + handlerGetterSetter.set.call(this, newValue, nativeFn.bind(this)) + } + utils.redirectToString(handler.set, nativeFn) + } + + Object.defineProperty(obj, propName, handler) +} + +/** + * All-in-one method to mock a non-existing property with a JS Proxy using the provided Proxy handler with traps. + * + * Will stealthify these aspects (strip error stack traces, redirect toString, etc). + * + * @example + * mockWithProxy(chrome.runtime, 'sendMessage', function sendMessage() {}, proxyHandler) + * + * @param {object} obj - The object which has the property to replace + * @param {string} propName - The name of the property to replace or create + * @param {object} pseudoTarget - The JS Proxy target to use as a basis + * @param {object} handler - The JS Proxy handler to use + */ +utils.mockWithProxy = (obj, propName, pseudoTarget, handler) => { + const proxyObj = new Proxy(pseudoTarget, utils.stripProxyFromErrors(handler)) + + utils.replaceProperty(obj, propName, { value: proxyObj }) + utils.patchToString(proxyObj) + + return true +} + +/** + * All-in-one method to create a new JS Proxy with stealth tweaks. + * + * This is meant to be used whenever we need a JS Proxy but don't want to replace or mock an existing known property. + * + * Will stealthify certain aspects of the Proxy (strip error stack traces, redirect toString, etc). + * + * @example + * createProxy(navigator.mimeTypes.__proto__.namedItem, proxyHandler) // => Proxy + * + * @param {object} pseudoTarget - The JS Proxy target to use as a basis + * @param {object} handler - The JS Proxy handler to use + */ +utils.createProxy = (pseudoTarget, handler) => { + const proxyObj = new Proxy(pseudoTarget, utils.stripProxyFromErrors(handler)) + utils.patchToString(proxyObj) + + return proxyObj +} + +/** + * Helper function to split a full path to an Object into the first part and property. + * + * @example + * splitObjPath(`HTMLMediaElement.prototype.canPlayType`) + * // => {objName: "HTMLMediaElement.prototype", propName: "canPlayType"} + * + * @param {string} objPath - The full path to an object as dot notation string + */ +utils.splitObjPath = objPath => ({ + // Remove last dot entry (property) ==> `HTMLMediaElement.prototype` + objName: objPath.split('.').slice(0, -1).join('.'), + // Extract last dot entry ==> `canPlayType` + propName: objPath.split('.').slice(-1)[0] +}) + +/** + * Convenience method to replace a property with a JS Proxy using the provided objPath. + * + * Supports a full path (dot notation) to the object as string here, in case that makes it easier. + * + * @example + * replaceObjPathWithProxy('WebGLRenderingContext.prototype.getParameter', proxyHandler) + * + * @param {string} objPath - The full path to an object (dot notation string) to replace + * @param {object} handler - The JS Proxy handler to use + */ +utils.replaceObjPathWithProxy = (objPath, handler) => { + const { objName, propName } = utils.splitObjPath(objPath) + const obj = eval(objName) // eslint-disable-line no-eval + return utils.replaceWithProxy(obj, propName, handler) +} + +/** + * Traverse nested properties of an object recursively and apply the given function on a whitelist of value types. + * + * @param {object} obj + * @param {array} typeFilter - e.g. `['function']` + * @param {Function} fn - e.g. `utils.patchToString` + */ +utils.execRecursively = (obj = {}, typeFilter = [], fn) => { + function recurse(obj) { + for (const key in obj) { + if (obj[key] === undefined) { + continue + } + if (obj[key] && typeof obj[key] === 'object') { + recurse(obj[key]) + } else { + if (obj[key] && typeFilter.includes(typeof obj[key])) { + fn.call(this, obj[key]) + } + } + } + } + recurse(obj) + return obj +} + +/** + * Everything we run through e.g. `page.evaluate` runs in the browser context, not the NodeJS one. + * That means we cannot just use reference variables and functions from outside code, we need to pass everything as a parameter. + * + * Unfortunately the data we can pass is only allowed to be of primitive types, regular functions don't survive the built-in serialization process. + * This utility function will take an object with functions and stringify them, so we can pass them down unharmed as strings. + * + * We use this to pass down our utility functions as well as any other functions (to be able to split up code better). + * + * @see utils.materializeFns + * + * @param {object} fnObj - An object containing functions as properties + */ +utils.stringifyFns = (fnObj = { hello: () => 'world' }) => { + // Object.fromEntries() ponyfill (in 6 lines) - supported only in Node v12+, modern browsers are fine + // https://github.com/feross/fromentries + function fromEntries(iterable) { + return [...iterable].reduce((obj, [key, val]) => { + obj[key] = val + return obj + }, {}) + } + return (Object.fromEntries || fromEntries)( + Object.entries(fnObj) + .filter(([key, value]) => typeof value === 'function') + .map(([key, value]) => [key, value.toString()]) // eslint-disable-line no-eval + ) +} + +/** + * Utility function to reverse the process of `utils.stringifyFns`. + * Will materialize an object with stringified functions (supports classic and fat arrow functions). + * + * @param {object} fnStrObj - An object containing stringified functions as properties + */ +utils.materializeFns = (fnStrObj = { hello: "() => 'world'" }) => { + return Object.fromEntries( + Object.entries(fnStrObj).map(([key, value]) => { + if (value.startsWith('function')) { + // some trickery is needed to make oldschool functions work :-) + return [key, eval(`() => ${value}`)()] // eslint-disable-line no-eval + } else { + // arrow functions just work + return [key, eval(value)] // eslint-disable-line no-eval + } + }) + ) +} + +// Proxy handler templates for re-usability +utils.makeHandler = () => ({ + // Used by simple `navigator` getter evasions + getterValue: value => ({ + apply(target, ctx, args) { + // Let's fetch the value first, to trigger and escalate potential errors + // Illegal invocations like `navigator.__proto__.vendor` will throw here + utils.cache.Reflect.apply(...arguments) + return value + } + }) +}) + +/** + * Compare two arrays. + * + * @param {array} array1 - First array + * @param {array} array2 - Second array + */ +utils.arrayEquals = (array1, array2) => { + if (array1.length !== array2.length) { + return false + } + for (let i = 0; i < array1.length; ++i) { + if (array1[i] !== array2[i]) { + return false + } + } + return true +} + +/** + * Cache the method return according to its arguments. + * + * @param {Function} fn - A function that will be cached + */ +utils.memoize = fn => { + const cache = [] + return function(...args) { + if (!cache.some(c => utils.arrayEquals(c.key, args))) { + cache.push({ key: args, value: fn.apply(this, args) }) + } + return cache.find(c => utils.arrayEquals(c.key, args)).value + } +} + +// -- +// Stuff starting below this line is NodeJS specific. +// -- +module.exports = utils diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.test.js new file mode 100644 index 0000000..1d7cecc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/index.test.js @@ -0,0 +1,709 @@ +const test = require('ava') + +const { vanillaPuppeteer } = require('../../test/util') + +const utils = require('.') +const withUtils = require('./withUtils') + +/* global HTMLMediaElement WebGLRenderingContext */ + +test('splitObjPath: will do what it says', async t => { + const { objName, propName } = utils.splitObjPath( + 'HTMLMediaElement.prototype.canPlayType' + ) + t.is(objName, 'HTMLMediaElement.prototype') + t.is(propName, 'canPlayType') +}) + +test('makeNativeString: will do what it says', async t => { + utils.init() + t.is(utils.makeNativeString('bob'), 'function bob() { [native code] }') + t.is( + utils.makeNativeString('toString'), + 'function toString() { [native code] }' + ) + t.is(utils.makeNativeString(), 'function () { [native code] }') +}) + +test('replaceWithProxy: will work correctly', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await withUtils(page).evaluate(utils => { + const dummyProxyHandler = { + get(target, param) { + if (param && param === 'ping') { + return 'pong' + } + return utils.cache.Reflect.get(...(arguments || [])) + }, + apply() { + return utils.cache.Reflect.apply(...arguments) + } + } + utils.replaceWithProxy( + HTMLMediaElement.prototype, + 'canPlayType', + dummyProxyHandler + ) + return { + toString: HTMLMediaElement.prototype.canPlayType.toString(), + ping: HTMLMediaElement.prototype.canPlayType.ping + } + }) + t.deepEqual(test1, { + toString: 'function canPlayType() { [native code] }', + ping: 'pong' + }) +}) + +test('replaceObjPathWithProxy: will work correctly', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await withUtils(page).evaluate(utils => { + const dummyProxyHandler = { + get(target, param) { + if (param && param === 'ping') { + return 'pong' + } + return utils.cache.Reflect.get(...(arguments || [])) + }, + apply() { + return utils.cache.Reflect.apply(...arguments) + } + } + utils.replaceObjPathWithProxy( + 'HTMLMediaElement.prototype.canPlayType', + dummyProxyHandler + ) + return { + toString: HTMLMediaElement.prototype.canPlayType.toString(), + ping: HTMLMediaElement.prototype.canPlayType.ping + } + }) + t.deepEqual(test1, { + toString: 'function canPlayType() { [native code] }', + ping: 'pong' + }) +}) + +test('redirectToString: is battle hardened', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // Patch all documents including iframes + await withUtils(page).evaluateOnNewDocument(utils => { + // We redirect toString calls targeted at `canPlayType` to `getParameter`, + // so if everything works correctly we expect `getParameter` as response. + const proxyObj = HTMLMediaElement.prototype.canPlayType + const originalObj = WebGLRenderingContext.prototype.getParameter + + utils.redirectToString(proxyObj, originalObj) + }) + await page.goto('about:blank') + + const result = await withUtils(page).evaluate(utils => { + const iframe = document.createElement('iframe') + document.body.appendChild(iframe) + + return { + target: { + raw: HTMLMediaElement.prototype.canPlayType + '', + rawiframe: + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + '', + raw2: HTMLMediaElement.prototype.canPlayType.toString(), + rawiframe2: + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType.toString(), + direct: Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + directWithiframe: iframe.contentWindow.Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + iframeWithdirect: Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ), + iframeWithiframe: iframe.contentWindow.Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ) + }, + toString: { + obj: HTMLMediaElement.prototype.canPlayType.toString + '', + objiframe: + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType.toString + + '', + raw: Function.prototype.toString + '', + rawiframe: iframe.contentWindow.Function.prototype.toString + '', + direct: Function.prototype.toString.call(Function.prototype.toString), + directWithiframe: iframe.contentWindow.Function.prototype.toString.call( + Function.prototype.toString + ), + iframeWithdirect: Function.prototype.toString.call( + iframe.contentWindow.Function.prototype.toString + ), + iframeWithiframe: iframe.contentWindow.Function.prototype.toString.call( + iframe.contentWindow.Function.prototype.toString + ) + } + } + }) + t.deepEqual(result, { + target: { + raw: 'function getParameter() { [native code] }', + raw2: 'function getParameter() { [native code] }', + rawiframe: 'function getParameter() { [native code] }', + rawiframe2: 'function getParameter() { [native code] }', + direct: 'function getParameter() { [native code] }', + directWithiframe: 'function getParameter() { [native code] }', + iframeWithdirect: 'function getParameter() { [native code] }', + iframeWithiframe: 'function getParameter() { [native code] }' + }, + toString: { + obj: 'function toString() { [native code] }', + objiframe: 'function toString() { [native code] }', + raw: 'function toString() { [native code] }', + rawiframe: 'function toString() { [native code] }', + direct: 'function toString() { [native code] }', + directWithiframe: 'function toString() { [native code] }', + iframeWithdirect: 'function toString() { [native code] }', + iframeWithiframe: 'function toString() { [native code] }' + } + }) +}) + +test('redirectToString: has proper errors', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // Patch all documents including iframes + await withUtils(page).evaluateOnNewDocument(utils => { + // We redirect toString calls targeted at `canPlayType` to `getParameter`, + // so if everything works correctly we expect `getParameter` as response. + const proxyObj = HTMLMediaElement.prototype.canPlayType + const originalObj = WebGLRenderingContext.prototype.getParameter + + utils.redirectToString(proxyObj, originalObj) + }) + await page.goto('about:blank') + + const result = await withUtils(page).evaluate(utils => { + const evalErr = (str = '') => { + try { + // eslint-disable-next-line no-eval + return eval(str) + } catch (err) { + return err.toString() + } + } + + return { + blank: evalErr(`Function.prototype.toString.apply()`), + null: evalErr(`Function.prototype.toString.apply(null)`), + undef: evalErr(`Function.prototype.toString.apply(undefined)`), + emptyObject: evalErr(`Function.prototype.toString.apply({})`) + } + }) + t.deepEqual(result, { + blank: + "TypeError: Function.prototype.toString requires that 'this' be a Function", + null: "TypeError: Function.prototype.toString requires that 'this' be a Function", + undef: + "TypeError: Function.prototype.toString requires that 'this' be a Function", + emptyObject: + "TypeError: Function.prototype.toString requires that 'this' be a Function" + }) +}) + +test('patchToString: will work correctly', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // Test verbatim string replacement + const test1 = await withUtils(page).evaluate(utils => { + utils.patchToString(HTMLMediaElement.prototype.canPlayType, 'bob') + return HTMLMediaElement.prototype.canPlayType.toString() + }) + t.is(test1, 'bob') + + // Test automatic mode derived from `.name` + const test2 = await withUtils(page).evaluate(utils => { + utils.patchToString(HTMLMediaElement.prototype.canPlayType) + return HTMLMediaElement.prototype.canPlayType.toString() + }) + t.is(test2, 'function canPlayType() { [native code] }') + + // Make sure automatic mode derived from `.name` works with proxies + const test3 = await withUtils(page).evaluate(utils => { + HTMLMediaElement.prototype.canPlayType = new Proxy( + HTMLMediaElement.prototype.canPlayType, + {} + ) + utils.patchToString(HTMLMediaElement.prototype.canPlayType) + return HTMLMediaElement.prototype.canPlayType.toString() + }) + t.is(test3, 'function canPlayType() { [native code] }') + + // Actually verify there's an issue when using vanilla Proxies + const test4 = await withUtils(page).evaluate(utils => { + HTMLMediaElement.prototype.canPlayType = new Proxy( + HTMLMediaElement.prototype.canPlayType, + {} + ) + return HTMLMediaElement.prototype.canPlayType.toString() + }) + t.is(test4, 'function () { [native code] }') +}) + +function toStringTest(obj) { + obj = eval(obj) // eslint-disable-line no-eval + return ` +- obj.toString(): ${obj.toString()} +- obj.name: ${obj.name} +- obj.toString + "": ${obj.toString + ''} +- obj.toString.name: ${obj.toString.name} +- obj.valueOf + "": ${obj.valueOf + ''} +- obj.valueOf().name: ${obj.valueOf().name} +- Object.prototype.toString.apply(obj): ${Object.prototype.toString.apply(obj)} +- Function.prototype.toString.call(obj): ${Function.prototype.toString.call( + obj + )} +- Function.prototype.valueOf.call(obj) + "": ${ + Function.prototype.valueOf.call(obj) + '' + } +- obj.toString === Function.prototype.toString: ${ + obj.toString === Function.prototype.toString + } +`.trim() +} + +test('patchToString: passes all toString tests', async t => { + const toStringVanilla = await (async function () { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + return page.evaluate(toStringTest, 'HTMLMediaElement.prototype.canPlayType') + })() + const toStringStealth = await (async function () { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await withUtils(page).evaluate(utils => { + HTMLMediaElement.prototype.canPlayType = function canPlayType() {} + utils.patchToString(HTMLMediaElement.prototype.canPlayType) + }) + return page.evaluate(toStringTest, 'HTMLMediaElement.prototype.canPlayType') + })() + + // Check that the unmodified results are as expected + t.is( + toStringVanilla, + ` +- obj.toString(): function canPlayType() { [native code] } +- obj.name: canPlayType +- obj.toString + "": function toString() { [native code] } +- obj.toString.name: toString +- obj.valueOf + "": function valueOf() { [native code] } +- obj.valueOf().name: canPlayType +- Object.prototype.toString.apply(obj): [object Function] +- Function.prototype.toString.call(obj): function canPlayType() { [native code] } +- Function.prototype.valueOf.call(obj) + "": function canPlayType() { [native code] } +- obj.toString === Function.prototype.toString: true +`.trim() + ) + + // Make sure our customizations leave no trace + t.is(toStringVanilla, toStringStealth) +}) + +test('patchToString: passes stack trace tests', async t => { + const toStringStackTrace = () => { + try { + Object.create( + Object.getOwnPropertyDescriptor(Function.prototype, 'toString').get + ).toString() + } catch (err) { + return err.stack.split('\n').slice(0, 2).join('|') + } + return 'error not thrown' + } + + const toStringVanilla = await (async function () { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + return page.evaluate(toStringStackTrace) + })() + const toStringStealth = await (async function () { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await withUtils(page).evaluate(utils => { + HTMLMediaElement.prototype.canPlayType = function canPlayType() {} + utils.patchToString(HTMLMediaElement.prototype.canPlayType) + }) + return page.evaluate(toStringStackTrace) + })() + + // Check that the unmodified results are as expected + t.is( + toStringVanilla, + `TypeError: Object prototype may only be an Object or null: undefined| at Function.create ()`.trim() + ) + + // Make sure our customizations leave no trace + t.is(toStringVanilla, toStringStealth) +}) + +test('patchToString: vanilla has iframe issues', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // Only patch the main window + const result = await withUtils(page).evaluate(utils => { + utils.patchToString(HTMLMediaElement.prototype.canPlayType, 'bob') + + const iframe = document.createElement('iframe') + document.body.appendChild(iframe) + return { + direct: Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + directWithiframe: iframe.contentWindow.Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + iframeWithdirect: Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ), + iframeWithiframe: iframe.contentWindow.Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ) + } + }) + t.deepEqual(result, { + direct: 'bob', + directWithiframe: 'function canPlayType() { [native code] }', + iframeWithdirect: 'function canPlayType() { [native code] }', + iframeWithiframe: 'function canPlayType() { [native code] }' + }) +}) + +test('patchToString: stealth has no iframe issues', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // Patch all documents including iframes + await withUtils(page).evaluateOnNewDocument(utils => { + utils.patchToString(HTMLMediaElement.prototype.canPlayType, 'alice') + }) + await page.goto('about:blank') + + const result = await withUtils(page).evaluate(utils => { + const iframe = document.createElement('iframe') + document.body.appendChild(iframe) + return { + direct: Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + directWithiframe: iframe.contentWindow.Function.prototype.toString.call( + HTMLMediaElement.prototype.canPlayType + ), + iframeWithdirect: Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ), + iframeWithiframe: iframe.contentWindow.Function.prototype.toString.call( + iframe.contentWindow.HTMLMediaElement.prototype.canPlayType + ) + } + }) + t.deepEqual(result, { + direct: 'alice', + directWithiframe: 'alice', + iframeWithdirect: 'alice', + iframeWithiframe: 'alice' + }) +}) + +test('stripProxyFromErrors: will work correctly', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await withUtils(page).evaluate(utils => { + const getStack = prop => { + try { + prop.caller() // Will throw (HTMLMediaElement.prototype.canPlayType.caller) + return false + } catch (err) { + return err.stack + } + } + /** We need traps to show up in the error stack */ + const dummyProxyHandler = { + get() { + return utils.cache.Reflect.get(...(arguments || [])) + }, + apply() { + return utils.cache.Reflect.apply(...arguments) + } + } + const vanillaProxy = new Proxy( + HTMLMediaElement.prototype.canPlayType, + dummyProxyHandler + ) + const stealthProxy = new Proxy( + HTMLMediaElement.prototype.canPlayType, + utils.stripProxyFromErrors(dummyProxyHandler) + ) + + const stacks = { + vanilla: getStack(HTMLMediaElement.prototype.canPlayType), + vanillaProxy: getStack(vanillaProxy), + stealthProxy: getStack(stealthProxy) + } + return stacks + }) + + // Check that the untouched stuff behaves as expected + t.true(results.vanilla.includes(`TypeError: 'caller'`)) + t.false(results.vanilla.includes(`at Object.get`)) + + // Regression test: Make sure vanilla JS Proxies leak the stack trace + t.true(results.vanillaProxy.includes(`TypeError: 'caller'`)) + t.true(results.vanillaProxy.includes(`at Object.get`)) + + // Stealth tests + t.true(results.stealthProxy.includes(`TypeError: 'caller'`)) + t.false(results.stealthProxy.includes(`at Object.get`)) +}) + +test('replaceProperty: will work without traces', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await withUtils(page).evaluate(utils => { + utils.replaceProperty(Object.getPrototypeOf(navigator), 'languages', { + get: () => ['de-DE'] + }) + return { + propNames: Object.getOwnPropertyNames(navigator) + } + }) + t.false(results.propNames.includes('languages')) +}) + +test('cache: will prevent leaks through overriding methods', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await withUtils(page).evaluate(utils => { + const sniffResults = { + vanilla: false, + stealth: false + } + + const vanillaProxy = new Proxy( + {}, + { + get() { + return Reflect.get(...arguments) + } + } + ) + Reflect.get = () => (sniffResults.vanilla = true) + // trigger get trap + vanillaProxy.foo // eslint-disable-line + + const stealthProxy = new Proxy( + {}, + { + get() { + return utils.cache.Reflect.get(...arguments) // using cached copy + } + } + ) + Reflect.get = () => (sniffResults.stealth = true) + // trigger get trap + stealthProxy.foo // eslint-disable-line + + return sniffResults + }) + + t.deepEqual(results, { + vanilla: true, + stealth: false + }) +}) + +test('replaceWithProxy: will throw prototype errors', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('about:blank') + + const result = await withUtils(page).evaluate(utils => { + utils.replaceWithProxy(HTMLMediaElement.prototype, 'canPlayType', {}) + + const evalErr = (str = '') => { + try { + // eslint-disable-next-line no-eval + return eval(str) + } catch (err) { + return err.toString() + } + } + + return { + same: evalErr( + `Object.setPrototypeOf(HTMLMediaElement.prototype.canPlayType, HTMLMediaElement.prototype.canPlayType) + ""` + ), + sameString: evalErr( + `Object.setPrototypeOf(Function.prototype.toString, Function.prototype.toString) + ""` + ), + null: evalErr( + `Object.setPrototypeOf(Function.prototype.toString, null) + ""` + ), + undef: evalErr( + `Object.setPrototypeOf(Function.prototype.toString, undefined) + ""` + ), + none: evalErr(`Object.setPrototypeOf(Function.prototype.toString) + ""`) + } + }) + t.deepEqual(result, { + same: 'TypeError: Cyclic __proto__ value', + sameString: 'TypeError: Cyclic __proto__ value', + null: 'TypeError: Cannot convert object to primitive value', + undef: + 'TypeError: Object prototype may only be an Object or null: undefined', + none: 'TypeError: Object prototype may only be an Object or null: undefined' + }) +}) + +test('replaceGetterSetter', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('about:blank') + + const results = await withUtils(page).evaluate(utils => { + const getDetails = a => ({ + href: a.href, + typeof: typeof a.href, + in: 'href' in a, + keys: Object.keys(a), + // eslint-disable-next-line no-undef + prototypeKeys: Object.keys(HTMLAnchorElement.prototype), + getOwnPropertyNames: Object.getOwnPropertyNames(a), + prototypeGetOwnPropertyNames: Object.getOwnPropertyNames( + // eslint-disable-next-line no-undef + HTMLAnchorElement.prototype + ), + ownPropertyDescriptor: + undefined === Object.getOwnPropertyDescriptor(a, 'href'), + prototypeOwnPropertyDescriptor: Object.getOwnPropertyDescriptor( + // eslint-disable-next-line no-undef + HTMLAnchorElement.prototype, + 'href' + ), + ownPropertyDescriptors: Object.getOwnPropertyDescriptors(a, 'href'), + prototypeOwnPropertyDescriptors: Object.getOwnPropertyDescriptors( + // eslint-disable-next-line no-undef + HTMLAnchorElement.prototype, + 'href' + ), + getToString: Object.getOwnPropertyDescriptor( + // eslint-disable-next-line no-undef + HTMLAnchorElement.prototype, + 'href' + ).get.toString(), + setToString: Object.getOwnPropertyDescriptor( + // eslint-disable-next-line no-undef + HTMLAnchorElement.prototype, + 'href' + ).set.toString() + }) + + // Use native a.href. + const a1 = document.createElement('a') + a1.href = 'http://foo.com/' + const details1 = getDetails(a1) + + // Override a.href. + let href = '' + // eslint-disable-next-line no-undef + utils.replaceGetterSetter(HTMLAnchorElement.prototype, 'href', { + get: function() { + return href + }, + set: function(newValue) { + href = newValue + } + }) + + // Use overrided a.href. + const a2 = document.createElement('a') + a2.href = 'http://foo.com/' + const details2 = getDetails(a2) + + return [details1, details2] + }) + + t.deepEqual(results[1], results[0]) +}) + +test('arrayEquals', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('about:blank') + + const results = await withUtils(page).evaluate(utils => { + const obj = { foo: 'bar' } + return { + a: utils.arrayEquals(['a', 'Alpha'], ['a', 'Alpha']), + b: !utils.arrayEquals(['b', 'Beta'], ['b', 'Blue']), + c: !utils.arrayEquals(['c', { foo: 'bar' }], ['c', { foo: 'bar' }]), + d: utils.arrayEquals(['d', obj], ['d', obj]), + e: utils.arrayEquals([null], [null]), + f: utils.arrayEquals([undefined], [undefined]), + g: utils.arrayEquals([false], [false]) + } + }) + + t.deepEqual(results, { + a: true, + b: true, + c: true, + d: true, + e: true, + f: true, + g: true + }) +}) + +test('memoize', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('about:blank') + + const results = await withUtils(page).evaluate(utils => { + const objectify = utils.memoize((valueAdded, valueIgnored) => { + return { valueAdded } + }) + + const obj = { foo: 'bar' } + /* eslint-disable no-self-compare */ + return { + a: objectify('a', 'Alpha') === objectify('a', 'Alpha'), + b: objectify('b', 'Beta') !== objectify('b', 'Blue'), + c: objectify('c', { foo: 'bar' }) !== objectify('c', { foo: 'bar' }), + d: objectify('d', obj) === objectify('d', obj), + e: objectify(null) === objectify(null), + f: objectify(undefined) === objectify(undefined), + g: objectify(false) === objectify(false) + } + /* eslint-enable no-self-compare */ + }) + + t.deepEqual(results, { + a: true, + b: true, + c: true, + d: true, + e: true, + f: true, + g: true + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/readme.md new file mode 100644 index 0000000..02d9534 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/readme.md @@ -0,0 +1,288 @@ +## API + + + +#### Table of Contents + +- [utils()](#utils) + - [.stripProxyFromErrors(handler)](#stripproxyfromerrorshandler) + - [.stripErrorWithAnchor(err, anchor)](#striperrorwithanchorerr-anchor) + - [.replaceProperty(obj, propName, descriptorOverrides)](#replacepropertyobj-propname-descriptoroverrides) + - [.preloadCache()](#preloadcache) + - [.makeNativeString(name?)](#makenativestringname) + - [.patchToString(obj, str)](#patchtostringobj-str) + - [.patchToStringNested(obj)](#patchtostringnestedobj) + - [.redirectToString(proxyObj, originalObj)](#redirecttostringproxyobj-originalobj) + - [.replaceWithProxy(obj, propName, handler)](#replacewithproxyobj-propname-handler) + - [.mockWithProxy(obj, propName, pseudoTarget, handler)](#mockwithproxyobj-propname-pseudotarget-handler) + - [.createProxy(pseudoTarget, handler)](#createproxypseudotarget-handler) + - [.splitObjPath(objPath)](#splitobjpathobjpath) + - [.replaceObjPathWithProxy(objPath, handler)](#replaceobjpathwithproxyobjpath-handler) + - [.execRecursively(obj, typeFilter, fn)](#execrecursivelyobj-typefilter-fn) + - [.stringifyFns(fnObj)](#stringifyfnsfnobj) + - [.materializeFns(fnStrObj)](#materializefnsfnstrobj) + +### [utils()](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L12-L12) + +A set of shared utility functions specifically for the purpose of modifying native browser APIs without leaving traces. + +Meant to be passed down in puppeteer and used in the context of the page (everything in here runs in NodeJS as well as a browser). + +Note: If for whatever reason you need to use this outside of `puppeteer-extra`: +Just remove the `module.exports` statement at the very bottom, the rest can be copy pasted into any browser context. + +Alternatively take a look at the `extract-stealth-evasions` package to create a finished bundle which includes these utilities. + +--- + +#### .[stripProxyFromErrors(handler)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L21-L82) + +- `handler` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy handler to wrap (optional, default `{}`) + +Wraps a JS Proxy Handler and strips it's presence from error stacks, in case the traps throw. + +The presence of a JS Proxy can be revealed as it shows up in error stack traces. + +--- + +#### .[stripErrorWithAnchor(err, anchor)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L90-L101) + +- `err` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The error to sanitize +- `anchor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The string the anchor line starts with + +Strip error lines from stack traces until (and including) a known line the stack. + +--- + +#### .[replaceProperty(obj, propName, descriptorOverrides)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L120-L127) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object which has the property to replace +- `propName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The property name to replace +- `descriptorOverrides` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** e.g. { value: "alice" } (optional, default `{}`) + +Replace the property of an object in a stealthy way. + +Note: You also want to work on the prototype of an object most often, +as you'd otherwise leave traces (e.g. showing up in Object.getOwnPropertyNames(obj)). + +Example: + +```javascript +replaceProperty(WebGLRenderingContext.prototype, 'getParameter', { + value: 'alice' +}) +// or +replaceProperty(Object.getPrototypeOf(navigator), 'languages', { + get: () => ['en-US', 'en'] +}) +``` + +- **See: ** + +--- + +#### .[preloadCache()](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L137-L150) + +Preload a cache of function copies and data. + +For a determined enough observer it would be possible to overwrite and sniff usage of functions +we use in our internal Proxies, to combat that we use a cached copy of those functions. + +This is evaluated once per execution context (e.g. window) + +--- + +#### .[makeNativeString(name?)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L169-L173) + +- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Optional function name (optional, default `''`) + +Utility function to generate a cross-browser `toString` result representing native code. + +There's small differences: Chromium uses a single line, whereas FF & Webkit uses multiline strings. +To future-proof this we use an existing native toString result as the basis. + +The only advantage we have over the other team is that our JS runs first, hence we cache the result +of the native toString result once, so they cannot spoof it afterwards and reveal that we're using it. + +Note: Whenever we add a `Function.prototype.toString` proxy we should preload the cache before, +by executing `utils.preloadCache()` before the proxy is applied (so we don't cause recursive lookups). + +Example: + +```javascript +makeNativeString('foobar') // => `function foobar() { [native code] }` +``` + +--- + +#### .[patchToString(obj, str)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L189-L218) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object for which to modify the `toString()` representation +- `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Optional string used as a return value (optional, default `''`) + +Helper function to modify the `toString()` result of the provided object. + +Note: Use `utils.redirectToString` instead when possible. + +There's a quirk in JS Proxies that will cause the `toString()` result to differ from the vanilla Object. +If no string is provided we will generate a `[native code]` thing based on the name of the property object. + +Example: + +```javascript +patchToString( + WebGLRenderingContext.prototype.getParameter, + 'function getParameter() { [native code] }' +) +``` + +--- + +#### .[patchToStringNested(obj)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L225-L227) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`) + +Make all nested functions of an object native. + +--- + +#### .[redirectToString(proxyObj, originalObj)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L235-L272) + +- `proxyObj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object that toString will be called on +- `originalObj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object which toString result we wan to return + +Redirect toString requests from one object to another. + +--- + +#### .[replaceWithProxy(obj, propName, handler)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L287-L296) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object which has the property to replace +- `propName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the property to replace +- `handler` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy handler to use + +All-in-one method to replace a property with a JS Proxy using the provided Proxy handler with traps. + +Will stealthify these aspects (strip error stack traces, redirect toString, etc). +Note: This is meant to modify native Browser APIs and works best with prototype objects. + +Example: + +```javascript +replaceWithProxy(WebGLRenderingContext.prototype, 'getParameter', proxyHandler) +``` + +--- + +#### .[mockWithProxy(obj, propName, pseudoTarget, handler)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L311-L319) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The object which has the property to replace +- `propName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The name of the property to replace or create +- `pseudoTarget` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy target to use as a basis +- `handler` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy handler to use + +All-in-one method to mock a non-existing property with a JS Proxy using the provided Proxy handler with traps. + +Will stealthify these aspects (strip error stack traces, redirect toString, etc). + +Example: + +```javascript +mockWithProxy( + chrome.runtime, + 'sendMessage', + function sendMessage() {}, + proxyHandler +) +``` + +--- + +#### .[createProxy(pseudoTarget, handler)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L334-L340) + +- `pseudoTarget` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy target to use as a basis +- `handler` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy handler to use + +All-in-one method to create a new JS Proxy with stealth tweaks. + +This is meant to be used whenever we need a JS Proxy but don't want to replace or mock an existing known property. + +Will stealthify certain aspects of the Proxy (strip error stack traces, redirect toString, etc). + +Example: + +```javascript +createProxy(navigator.mimeTypes.__proto__.namedItem, proxyHandler) // => Proxy +``` + +--- + +#### .[splitObjPath(objPath)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L351-L359) + +- `objPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The full path to an object as dot notation string + +Helper function to split a full path to an Object into the first part and property. + +Example: + +```javascript +splitObjPath(`HTMLMediaElement.prototype.canPlayType`) +// => {objName: "HTMLMediaElement.prototype", propName: "canPlayType"} +``` + +--- + +#### .[replaceObjPathWithProxy(objPath, handler)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L372-L376) + +- `objPath` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The full path to an object (dot notation string) to replace +- `handler` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** The JS Proxy handler to use + +Convenience method to replace a property with a JS Proxy using the provided objPath. + +Supports a full path (dot notation) to the object as string here, in case that makes it easier. + +Example: + +```javascript +replaceObjPathWithProxy( + 'WebGLRenderingContext.prototype.getParameter', + proxyHandler +) +``` + +--- + +#### .[execRecursively(obj, typeFilter, fn)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L385-L402) + +- `obj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`) +- `typeFilter` **[array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)** e.g. `['function']` (optional, default `[]`) +- `fn` **[Function](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function)** e.g. `utils.patchToString` + +Traverse nested properties of an object recursively and apply the given function on a whitelist of value types. + +--- + +#### .[stringifyFns(fnObj)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L417-L431) + +- `fnObj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object containing functions as properties (optional, default `{hello:()=>'world'}`) + +Everything we run through e.g. `page.evaluate` runs in the browser context, not the NodeJS one. +That means we cannot just use reference variables and functions from outside code, we need to pass everything as a parameter. + +Unfortunately the data we can pass is only allowed to be of primitive types, regular functions don't survive the built-in serialization process. +This utility function will take an object with functions and stringify them, so we can pass them down unharmed as strings. + +We use this to pass down our utility functions as well as any other functions (to be able to split up code better). + +- **See: utils.materializeFns** + +--- + +#### .[materializeFns(fnStrObj)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/_utils/index.js#L439-L451) + +- `fnStrObj` **[object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object containing stringified functions as properties (optional, default `{hello:"() => 'world'"}`) + +Utility function to reverse the process of `utils.stringifyFns`. +Will materialize an object with stringified functions (supports classic and fat arrow functions). + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/withUtils.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/withUtils.js new file mode 100644 index 0000000..6ae8993 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/_utils/withUtils.js @@ -0,0 +1,49 @@ +const utils = require('./index') + +/** + * Wrap a page with utilities. + * + * @param {Puppeteer.Page} page + */ +module.exports = page => ({ + /** + * Simple `page.evaluate` replacement to preload utils + */ + evaluate: async function (mainFunction, ...args) { + return page.evaluate( + ({ _utilsFns, _mainFunction, _args }) => { + // Add this point we cannot use our utililty functions as they're just strings, we need to materialize them first + const utils = Object.fromEntries( + Object.entries(_utilsFns).map(([key, value]) => [key, eval(value)]) // eslint-disable-line no-eval + ) + utils.init() + return eval(_mainFunction)(utils, ..._args) // eslint-disable-line no-eval + }, + { + _utilsFns: utils.stringifyFns(utils), + _mainFunction: mainFunction.toString(), + _args: args || [] + } + ) + }, + /** + * Simple `page.evaluateOnNewDocument` replacement to preload utils + */ + evaluateOnNewDocument: async function (mainFunction, ...args) { + return page.evaluateOnNewDocument( + ({ _utilsFns, _mainFunction, _args }) => { + // Add this point we cannot use our utililty functions as they're just strings, we need to materialize them first + const utils = Object.fromEntries( + Object.entries(_utilsFns).map(([key, value]) => [key, eval(value)]) // eslint-disable-line no-eval + ) + utils.init() + return eval(_mainFunction)(utils, ..._args) // eslint-disable-line no-eval + }, + { + _utilsFns: utils.stringifyFns(utils), + _mainFunction: mainFunction.toString(), + _args: args || [] + } + ) + } +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.js new file mode 100644 index 0000000..481b527 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.js @@ -0,0 +1,100 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Mock the `chrome.app` object if not available (e.g. when running headless). + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/chrome.app' + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument(utils => { + if (!window.chrome) { + // Use the exact property descriptor found in headful Chrome + // fetch it via `Object.getOwnPropertyDescriptor(window, 'chrome')` + Object.defineProperty(window, 'chrome', { + writable: true, + enumerable: true, + configurable: false, // note! + value: {} // We'll extend that later + }) + } + + // That means we're running headful and don't need to mock anything + if ('app' in window.chrome) { + return // Nothing to do here + } + + const makeError = { + ErrorInInvocation: fn => { + const err = new TypeError(`Error in invocation of app.${fn}()`) + return utils.stripErrorWithAnchor( + err, + `at ${fn} (eval at ` + ) + } + } + + // There's a some static data in that property which doesn't seem to change, + // we should periodically check for updates: `JSON.stringify(window.app, null, 2)` + const STATIC_DATA = JSON.parse( + ` +{ + "isInstalled": false, + "InstallState": { + "DISABLED": "disabled", + "INSTALLED": "installed", + "NOT_INSTALLED": "not_installed" + }, + "RunningState": { + "CANNOT_RUN": "cannot_run", + "READY_TO_RUN": "ready_to_run", + "RUNNING": "running" + } +} + `.trim() + ) + + window.chrome.app = { + ...STATIC_DATA, + + get isInstalled() { + return false + }, + + getDetails: function getDetails() { + if (arguments.length) { + throw makeError.ErrorInInvocation(`getDetails`) + } + return null + }, + getIsInstalled: function getDetails() { + if (arguments.length) { + throw makeError.ErrorInInvocation(`getIsInstalled`) + } + return false + }, + runningState: function getDetails() { + if (arguments.length) { + throw makeError.ErrorInInvocation(`runningState`) + } + return 'cannot_run' + } + } + utils.patchToStringNested(window.chrome.app) + }) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.test.js new file mode 100644 index 0000000..e940a95 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.test.js @@ -0,0 +1,71 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +/* global chrome */ + +test('stealth: will add convincing chrome.app object', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin({})) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const catchErr = (fn, ...args) => { + try { + return fn.apply(this, args) + } catch ({ name, message, stack }) { + return { name, message, stack } + } + } + + return { + app: { + exists: window.chrome && 'app' in window.chrome, + toString: chrome.app.toString(), + deepToString: chrome.app.runningState.toString() + }, + data: { + getIsInstalled: chrome.app.getIsInstalled(), + runningState: chrome.app.runningState(), + getDetails: chrome.app.getDetails(), + InstallState: chrome.app.InstallState, + RunningState: chrome.app.RunningState + }, + errors: { + getIsInstalled: catchErr(chrome.app.getDetails, 'foo').message, + stackOK: !catchErr(chrome.app.getDetails, 'foo').stack.includes( + 'at getDetails' + ) + } + } + }) + + t.deepEqual(results, { + app: { + exists: true, + toString: '[object Object]', + deepToString: 'function getDetails() { [native code] }' + }, + data: { + InstallState: { + DISABLED: 'disabled', + INSTALLED: 'installed', + NOT_INSTALLED: 'not_installed' + }, + RunningState: { + CANNOT_RUN: 'cannot_run', + READY_TO_RUN: 'ready_to_run', + RUNNING: 'running' + }, + getDetails: null, + getIsInstalled: false, + runningState: 'cannot_run' + }, + errors: { + getIsInstalled: 'Error in invocation of app.getDetails()', + stackOK: true + } + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/readme.md new file mode 100644 index 0000000..e88fa4d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.app/readme.md @@ -0,0 +1,17 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.app/index.js#L11-L97) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Mock the `chrome.app` object if not available (e.g. when running headless). + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.js new file mode 100644 index 0000000..59765dc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.js @@ -0,0 +1,73 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Mock the `chrome.csi` function if not available (e.g. when running headless). + * It's a deprecated (but unfortunately still existing) chrome specific API to fetch browser timings. + * + * Internally chromium switched the implementation to use the WebPerformance API, + * so we can do the same to create a fully functional mock. :-) + * + * Note: We're using the deprecated PerformanceTiming API instead of the new Navigation Timing Level 2 API on purpopse. + * + * @see https://bugs.chromium.org/p/chromium/issues/detail?id=113048 + * @see https://codereview.chromium.org/2456293003/ + * @see https://developers.google.com/web/updates/2017/12/chrome-loadtimes-deprecated + * @see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming + * @see https://source.chromium.org/chromium/chromium/src/+/master:chrome/renderer/loadtimes_extension_bindings.cc;l=124?q=loadtimes&ss=chromium + * @see `chrome.loadTimes` evasion + * + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/chrome.csi' + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument(utils => { + if (!window.chrome) { + // Use the exact property descriptor found in headful Chrome + // fetch it via `Object.getOwnPropertyDescriptor(window, 'chrome')` + Object.defineProperty(window, 'chrome', { + writable: true, + enumerable: true, + configurable: false, // note! + value: {} // We'll extend that later + }) + } + + // That means we're running headful and don't need to mock anything + if ('csi' in window.chrome) { + return // Nothing to do here + } + + // Check that the Navigation Timing API v1 is available, we need that + if (!window.performance || !window.performance.timing) { + return + } + + const { timing } = window.performance + + window.chrome.csi = function() { + return { + onloadT: timing.domContentLoadedEventEnd, + startE: timing.navigationStart, + pageT: Date.now() - timing.navigationStart, + tran: 15 // Transition type or something + } + } + utils.patchToString(window.chrome.csi) + }) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.test.js new file mode 100644 index 0000000..4c6fff3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.test.js @@ -0,0 +1,48 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +/* global chrome */ + +test('stealth: will add functional chrome.csi function mock', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + runOnInsecureOrigins: true // for testing + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const { timing } = window.performance + const csi = window.chrome.csi() + + return { + csi: { + exists: window.chrome && 'csi' in window.chrome, + toString: chrome.csi.toString() + }, + dataOK: { + onloadT: csi.onloadT === timing.domContentLoadedEventEnd, + startE: csi.startE === timing.navigationStart, + pageT: Number.isInteger(csi.pageT), + tran: Number.isInteger(csi.tran) + } + } + }) + + t.deepEqual(results, { + csi: { + exists: true, + toString: 'function () { [native code] }' + }, + dataOK: { + onloadT: true, + pageT: true, + startE: true, + tran: true + } + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/readme.md new file mode 100644 index 0000000..a9ccdac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.csi/readme.md @@ -0,0 +1,30 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.csi/index.js#L25-L70) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Mock the `chrome.csi` function if not available (e.g. when running headless). +It's a deprecated (but unfortunately still existing) chrome specific API to fetch browser timings. + +Internally chromium switched the implementation to use the WebPerformance API, +so we can do the same to create a fully functional mock. :-) + +Note: We're using the deprecated PerformanceTiming API instead of the new Navigation Timing Level 2 API on purpopse. + +- **See: ** +- **See: ** +- **See: ** +- **See: ** +- **See: ** +- **See: `chrome.loadTimes` evasion** + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.js new file mode 100644 index 0000000..c9b3081 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.js @@ -0,0 +1,167 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Mock the `chrome.loadTimes` function if not available (e.g. when running headless). + * It's a deprecated (but unfortunately still existing) chrome specific API to fetch browser timings and connection info. + * + * Internally chromium switched the implementation to use the WebPerformance API, + * so we can do the same to create a fully functional mock. :-) + * + * Note: We're using the deprecated PerformanceTiming API instead of the new Navigation Timing Level 2 API on purpopse. + * + * @see https://developers.google.com/web/updates/2017/12/chrome-loadtimes-deprecated + * @see https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming + * @see https://source.chromium.org/chromium/chromium/src/+/master:chrome/renderer/loadtimes_extension_bindings.cc;l=124?q=loadtimes&ss=chromium + * @see `chrome.csi` evasion + * + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/chrome.loadTimes' + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument( + (utils, { opts }) => { + if (!window.chrome) { + // Use the exact property descriptor found in headful Chrome + // fetch it via `Object.getOwnPropertyDescriptor(window, 'chrome')` + Object.defineProperty(window, 'chrome', { + writable: true, + enumerable: true, + configurable: false, // note! + value: {} // We'll extend that later + }) + } + + // That means we're running headful and don't need to mock anything + if ('loadTimes' in window.chrome) { + return // Nothing to do here + } + + // Check that the Navigation Timing API v1 + v2 is available, we need that + if ( + !window.performance || + !window.performance.timing || + !window.PerformancePaintTiming + ) { + return + } + + const { performance } = window + + // Some stuff is not available on about:blank as it requires a navigation to occur, + // let's harden the code to not fail then: + const ntEntryFallback = { + nextHopProtocol: 'h2', + type: 'other' + } + + // The API exposes some funky info regarding the connection + const protocolInfo = { + get connectionInfo() { + const ntEntry = + performance.getEntriesByType('navigation')[0] || ntEntryFallback + return ntEntry.nextHopProtocol + }, + get npnNegotiatedProtocol() { + // NPN is deprecated in favor of ALPN, but this implementation returns the + // HTTP/2 or HTTP2+QUIC/39 requests negotiated via ALPN. + const ntEntry = + performance.getEntriesByType('navigation')[0] || ntEntryFallback + return ['h2', 'hq'].includes(ntEntry.nextHopProtocol) + ? ntEntry.nextHopProtocol + : 'unknown' + }, + get navigationType() { + const ntEntry = + performance.getEntriesByType('navigation')[0] || ntEntryFallback + return ntEntry.type + }, + get wasAlternateProtocolAvailable() { + // The Alternate-Protocol header is deprecated in favor of Alt-Svc + // (https://www.mnot.net/blog/2016/03/09/alt-svc), so technically this + // should always return false. + return false + }, + get wasFetchedViaSpdy() { + // SPDY is deprecated in favor of HTTP/2, but this implementation returns + // true for HTTP/2 or HTTP2+QUIC/39 as well. + const ntEntry = + performance.getEntriesByType('navigation')[0] || ntEntryFallback + return ['h2', 'hq'].includes(ntEntry.nextHopProtocol) + }, + get wasNpnNegotiated() { + // NPN is deprecated in favor of ALPN, but this implementation returns true + // for HTTP/2 or HTTP2+QUIC/39 requests negotiated via ALPN. + const ntEntry = + performance.getEntriesByType('navigation')[0] || ntEntryFallback + return ['h2', 'hq'].includes(ntEntry.nextHopProtocol) + } + } + + const { timing } = window.performance + + // Truncate number to specific number of decimals, most of the `loadTimes` stuff has 3 + function toFixed(num, fixed) { + var re = new RegExp('^-?\\d+(?:.\\d{0,' + (fixed || -1) + '})?') + return num.toString().match(re)[0] + } + + const timingInfo = { + get firstPaintAfterLoadTime() { + // This was never actually implemented and always returns 0. + return 0 + }, + get requestTime() { + return timing.navigationStart / 1000 + }, + get startLoadTime() { + return timing.navigationStart / 1000 + }, + get commitLoadTime() { + return timing.responseStart / 1000 + }, + get finishDocumentLoadTime() { + return timing.domContentLoadedEventEnd / 1000 + }, + get finishLoadTime() { + return timing.loadEventEnd / 1000 + }, + get firstPaintTime() { + const fpEntry = performance.getEntriesByType('paint')[0] || { + startTime: timing.loadEventEnd / 1000 // Fallback if no navigation occured (`about:blank`) + } + return toFixed( + (fpEntry.startTime + performance.timeOrigin) / 1000, + 3 + ) + } + } + + window.chrome.loadTimes = function() { + return { + ...protocolInfo, + ...timingInfo + } + } + utils.patchToString(window.chrome.loadTimes) + }, + { + opts: this.opts + } + ) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.test.js new file mode 100644 index 0000000..151850c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.test.js @@ -0,0 +1,63 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +/* global chrome */ + +test('stealth: will add functional chrome.loadTimes function mock', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin({})) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const loadTimes = window.chrome.loadTimes() + + return { + loadTimes: { + exists: window.chrome && 'loadTimes' in window.chrome, + toString: chrome.loadTimes.toString() + }, + dataOK: { + connectionInfo: 'connectionInfo' in loadTimes, + npnNegotiatedProtocol: 'npnNegotiatedProtocol' in loadTimes, + navigationType: 'navigationType' in loadTimes, + wasAlternateProtocolAvailable: + 'wasAlternateProtocolAvailable' in loadTimes, + wasFetchedViaSpdy: 'wasFetchedViaSpdy' in loadTimes, + wasNpnNegotiated: 'wasNpnNegotiated' in loadTimes, + + firstPaintAfterLoadTime: 'firstPaintAfterLoadTime' in loadTimes, + requestTime: 'requestTime' in loadTimes, + startLoadTime: 'startLoadTime' in loadTimes, + commitLoadTime: 'commitLoadTime' in loadTimes, + finishDocumentLoadTime: 'finishDocumentLoadTime' in loadTimes, + finishLoadTime: 'finishLoadTime' in loadTimes, + firstPaintTime: 'firstPaintTime' in loadTimes + } + } + }) + + t.deepEqual(results, { + loadTimes: { + exists: true, + toString: 'function () { [native code] }' + }, + dataOK: { + commitLoadTime: true, + connectionInfo: true, + finishDocumentLoadTime: true, + finishLoadTime: true, + firstPaintAfterLoadTime: true, + firstPaintTime: true, + navigationType: true, + npnNegotiatedProtocol: true, + requestTime: true, + startLoadTime: true, + wasAlternateProtocolAvailable: true, + wasFetchedViaSpdy: true, + wasNpnNegotiated: true + } + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/readme.md new file mode 100644 index 0000000..8bf3d94 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/readme.md @@ -0,0 +1,28 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.loadTimes/index.js#L23-L164) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Mock the `chrome.loadTimes` function if not available (e.g. when running headless). +It's a deprecated (but unfortunately still existing) chrome specific API to fetch browser timings and connection info. + +Internally chromium switched the implementation to use the WebPerformance API, +so we can do the same to create a fully functional mock. :-) + +Note: We're using the deprecated PerformanceTiming API instead of the new Navigation Timing Level 2 API on purpopse. + +- **See: ** +- **See: ** +- **See: ** +- **See: `chrome.csi` evasion** + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js new file mode 100644 index 0000000..e42fb2f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js @@ -0,0 +1,254 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +const STATIC_DATA = require('./staticData.json') + +/** + * Mock the `chrome.runtime` object if not available (e.g. when running headless) and on a secure site. + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/chrome.runtime' + } + + get defaults() { + return { runOnInsecureOrigins: false } // Override for testing + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument( + (utils, { opts, STATIC_DATA }) => { + if (!window.chrome) { + // Use the exact property descriptor found in headful Chrome + // fetch it via `Object.getOwnPropertyDescriptor(window, 'chrome')` + Object.defineProperty(window, 'chrome', { + writable: true, + enumerable: true, + configurable: false, // note! + value: {} // We'll extend that later + }) + } + + // That means we're running headful and don't need to mock anything + const existsAlready = 'runtime' in window.chrome + // `chrome.runtime` is only exposed on secure origins + const isNotSecure = !window.location.protocol.startsWith('https') + if (existsAlready || (isNotSecure && !opts.runOnInsecureOrigins)) { + return // Nothing to do here + } + + window.chrome.runtime = { + // There's a bunch of static data in that property which doesn't seem to change, + // we should periodically check for updates: `JSON.stringify(window.chrome.runtime, null, 2)` + ...STATIC_DATA, + // `chrome.runtime.id` is extension related and returns undefined in Chrome + get id() { + return undefined + }, + // These two require more sophisticated mocks + connect: null, + sendMessage: null + } + + const makeCustomRuntimeErrors = (preamble, method, extensionId) => ({ + NoMatchingSignature: new TypeError( + preamble + `No matching signature.` + ), + MustSpecifyExtensionID: new TypeError( + preamble + + `${method} called from a webpage must specify an Extension ID (string) for its first argument.` + ), + InvalidExtensionID: new TypeError( + preamble + `Invalid extension id: '${extensionId}'` + ) + }) + + // Valid Extension IDs are 32 characters in length and use the letter `a` to `p`: + // https://source.chromium.org/chromium/chromium/src/+/master:components/crx_file/id_util.cc;drc=14a055ccb17e8c8d5d437fe080faba4c6f07beac;l=90 + const isValidExtensionID = str => + str.length === 32 && str.toLowerCase().match(/^[a-p]+$/) + + /** Mock `chrome.runtime.sendMessage` */ + const sendMessageHandler = { + apply: function(target, ctx, args) { + const [extensionId, options, responseCallback] = args || [] + + // Define custom errors + const errorPreamble = `Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function responseCallback): ` + const Errors = makeCustomRuntimeErrors( + errorPreamble, + `chrome.runtime.sendMessage()`, + extensionId + ) + + // Check if the call signature looks ok + const noArguments = args.length === 0 + const tooManyArguments = args.length > 4 + const incorrectOptions = options && typeof options !== 'object' + const incorrectResponseCallback = + responseCallback && typeof responseCallback !== 'function' + if ( + noArguments || + tooManyArguments || + incorrectOptions || + incorrectResponseCallback + ) { + throw Errors.NoMatchingSignature + } + + // At least 2 arguments are required before we even validate the extension ID + if (args.length < 2) { + throw Errors.MustSpecifyExtensionID + } + + // Now let's make sure we got a string as extension ID + if (typeof extensionId !== 'string') { + throw Errors.NoMatchingSignature + } + + if (!isValidExtensionID(extensionId)) { + throw Errors.InvalidExtensionID + } + + return undefined // Normal behavior + } + } + utils.mockWithProxy( + window.chrome.runtime, + 'sendMessage', + function sendMessage() {}, + sendMessageHandler + ) + + /** + * Mock `chrome.runtime.connect` + * + * @see https://developer.chrome.com/apps/runtime#method-connect + */ + const connectHandler = { + apply: function(target, ctx, args) { + const [extensionId, connectInfo] = args || [] + + // Define custom errors + const errorPreamble = `Error in invocation of runtime.connect(optional string extensionId, optional object connectInfo): ` + const Errors = makeCustomRuntimeErrors( + errorPreamble, + `chrome.runtime.connect()`, + extensionId + ) + + // Behavior differs a bit from sendMessage: + const noArguments = args.length === 0 + const emptyStringArgument = args.length === 1 && extensionId === '' + if (noArguments || emptyStringArgument) { + throw Errors.MustSpecifyExtensionID + } + + const tooManyArguments = args.length > 2 + const incorrectConnectInfoType = + connectInfo && typeof connectInfo !== 'object' + + if (tooManyArguments || incorrectConnectInfoType) { + throw Errors.NoMatchingSignature + } + + const extensionIdIsString = typeof extensionId === 'string' + if (extensionIdIsString && extensionId === '') { + throw Errors.MustSpecifyExtensionID + } + if (extensionIdIsString && !isValidExtensionID(extensionId)) { + throw Errors.InvalidExtensionID + } + + // There's another edge-case here: extensionId is optional so we might find a connectInfo object as first param, which we need to validate + const validateConnectInfo = ci => { + // More than a first param connectInfo as been provided + if (args.length > 1) { + throw Errors.NoMatchingSignature + } + // An empty connectInfo has been provided + if (Object.keys(ci).length === 0) { + throw Errors.MustSpecifyExtensionID + } + // Loop over all connectInfo props an check them + Object.entries(ci).forEach(([k, v]) => { + const isExpected = ['name', 'includeTlsChannelId'].includes(k) + if (!isExpected) { + throw new TypeError( + errorPreamble + `Unexpected property: '${k}'.` + ) + } + const MismatchError = (propName, expected, found) => + TypeError( + errorPreamble + + `Error at property '${propName}': Invalid type: expected ${expected}, found ${found}.` + ) + if (k === 'name' && typeof v !== 'string') { + throw MismatchError(k, 'string', typeof v) + } + if (k === 'includeTlsChannelId' && typeof v !== 'boolean') { + throw MismatchError(k, 'boolean', typeof v) + } + }) + } + if (typeof extensionId === 'object') { + validateConnectInfo(extensionId) + throw Errors.MustSpecifyExtensionID + } + + // Unfortunately even when the connect fails Chrome will return an object with methods we need to mock as well + return utils.patchToStringNested(makeConnectResponse()) + } + } + utils.mockWithProxy( + window.chrome.runtime, + 'connect', + function connect() {}, + connectHandler + ) + + function makeConnectResponse() { + const onSomething = () => ({ + addListener: function addListener() {}, + dispatch: function dispatch() {}, + hasListener: function hasListener() {}, + hasListeners: function hasListeners() { + return false + }, + removeListener: function removeListener() {} + }) + + const response = { + name: '', + sender: undefined, + disconnect: function disconnect() {}, + onDisconnect: onSomething(), + onMessage: onSomething(), + postMessage: function postMessage() { + if (!arguments.length) { + throw new TypeError(`Insufficient number of arguments.`) + } + throw new Error(`Attempting to use a disconnected port object`) + } + } + return response + } + }, + { + opts: this.opts, + STATIC_DATA + } + ) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.test.js new file mode 100644 index 0000000..6de94d7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.test.js @@ -0,0 +1,286 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +const STATIC_DATA = require('./staticData.json') + +/* global chrome */ + +test('vanilla: is chrome false', async t => { + const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line + const { pageFnResult: chrome, hasChrome } = await getVanillaFingerPrint( + pageFn + ) + t.is(hasChrome, false) + t.false(chrome instanceof Object) + t.is(chrome, undefined) +}) + +test('stealth: is chrome true', async t => { + const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line + const { pageFnResult: chrome, hasChrome } = await getStealthFingerPrint( + Plugin, + pageFn + ) + t.is(hasChrome, true) + t.true(chrome instanceof Object) +}) + +test('stealth: will add convincing chrome.runtime object', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + runOnInsecureOrigins: true // for testing + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + // + + const results = await page.evaluate(() => { + const catchErr = (fn, ...args) => { + try { + return fn.apply(this, args) + } catch (err) { + return err.toString() + } + } + + return { + runtime: { + exists: window.chrome && 'runtime' in window.chrome, + toString: chrome.runtime.toString() + }, + staticData: { + OnInstalledReason: chrome.runtime.OnInstalledReason, + OnRestartRequiredReason: chrome.runtime.OnRestartRequiredReason, + PlatformArch: chrome.runtime.PlatformArch, + PlatformNaclArch: chrome.runtime.PlatformNaclArch, + PlatformOs: chrome.runtime.PlatformOs, + RequestUpdateCheckStatus: chrome.runtime.RequestUpdateCheckStatus + }, + id: { + exists: 'id' in chrome.runtime, + undefined: chrome.runtime.id === undefined + }, + sendMessage: { + exists: 'sendMessage' in chrome.runtime, + name: chrome.runtime.sendMessage.name, + toString1: chrome.runtime.sendMessage + '', + toString2: chrome.runtime.sendMessage.toString(), + validIdWorks: + chrome.runtime.sendMessage('nckgahadagoaajjgafhacjanaoiihapd', '') === + undefined + }, + sendMessageErrors: { + noArg: catchErr(chrome.runtime.sendMessage), + singleArg: catchErr(chrome.runtime.sendMessage, ''), + tooManyArg: catchErr( + chrome.runtime.sendMessage, + '', + '', + '', + '', + '', + '' + ), + incorrectArg: catchErr(chrome.runtime.sendMessage, '', '', {}, ''), + noValidID: catchErr(chrome.runtime.sendMessage, 'foo', '') + } + } + }) + + const bla = `TypeError: Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function responseCallback)` + t.deepEqual(results, { + runtime: { + exists: true, + toString: '[object Object]' + }, + staticData: STATIC_DATA, + id: { + exists: true, + undefined: true + }, + sendMessage: { + exists: true, + name: 'sendMessage', + toString1: 'function sendMessage() { [native code] }', + toString2: 'function sendMessage() { [native code] }', + validIdWorks: true + }, + sendMessageErrors: { + noArg: `${bla}: No matching signature.`, + singleArg: `${bla}: chrome.runtime.sendMessage() called from a webpage must specify an Extension ID (string) for its first argument.`, + tooManyArg: `${bla}: No matching signature.`, + incorrectArg: `${bla}: No matching signature.`, + noValidID: `${bla}: Invalid extension id: 'foo'` + } + }) +}) + +test('stealth: will add convincing chrome.runtime.connect', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + runOnInsecureOrigins: true // for testing + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const catchErr = (fn, ...args) => { + try { + return fn.apply(this, args) + } catch (err) { + return err.toString() + } + } + + return { + connect: { + exists: 'connect' in chrome.runtime, + name: chrome.runtime.connect.name, + toString1: chrome.runtime.connect + '', + toString2: chrome.runtime.connect.toString(), + validIdWorks: + chrome.runtime.connect('nckgahadagoaajjgafhacjanaoiihapd') !== + undefined + }, + connectErrors: { + noArg: catchErr(chrome.runtime.connect), + singleArg: catchErr(chrome.runtime.connect, ''), + tooManyArg: catchErr(chrome.runtime.connect, '', '', '', '', '', ''), + incorrectArg: catchErr(chrome.runtime.connect, '', '', {}, ''), + noValidID: catchErr(chrome.runtime.connect, 'foo', ''), + connectInfoFirst: { + emptyObject: catchErr(chrome.runtime.connect, {}), + tooManyArg: catchErr(chrome.runtime.connect, {}, {}), + unexpectedProp: catchErr(chrome.runtime.connect, { wtf: true }), + invalidName: catchErr(chrome.runtime.connect, { name: 666 }), + invalidTLS: catchErr(chrome.runtime.connect, { + includeTlsChannelId: 777 + }), + invalidBoth: catchErr(chrome.runtime.connect, { + name: 666, + includeTlsChannelId: 777 + }), + validName: catchErr(chrome.runtime.connect, { name: 'foo' }), + missingExtensionId: catchErr(chrome.runtime.connect, { + name: 'bob', + includeTlsChannelId: false + }) + } + } + } + }) + + const bla = `TypeError: Error in invocation of runtime.connect(optional string extensionId, optional object connectInfo)` + t.deepEqual(results, { + connect: { + exists: true, + name: 'connect', + toString1: 'function connect() { [native code] }', + toString2: 'function connect() { [native code] }', + validIdWorks: true + }, + connectErrors: { + noArg: `${bla}: chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.`, + singleArg: `${bla}: chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.`, + tooManyArg: `${bla}: No matching signature.`, + incorrectArg: `${bla}: No matching signature.`, + noValidID: `${bla}: Invalid extension id: 'foo'`, + connectInfoFirst: { + emptyObject: `${bla}: chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.`, + tooManyArg: `${bla}: No matching signature.`, + unexpectedProp: `${bla}: Unexpected property: 'wtf'.`, + invalidName: `${bla}: Error at property 'name': Invalid type: expected string, found number.`, + invalidTLS: `${bla}: Error at property 'includeTlsChannelId': Invalid type: expected boolean, found number.`, + invalidBoth: `${bla}: Error at property 'name': Invalid type: expected string, found number.`, + validName: `${bla}: chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.`, + missingExtensionId: `${bla}: chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.` + } + } + }) +}) + +test('stealth: will add convincing chrome.runtime.connect response', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + runOnInsecureOrigins: true // for testing + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const connectResponse = chrome.runtime.connect( + 'nckgahadagoaajjgafhacjanaoiihapd' + ) + + return { + connectResponse: { + exists: !!connectResponse, + toString1: connectResponse + '', + toString2: connectResponse.toString(), + nestedToString: connectResponse.onDisconnect.addListener + '' + }, + disconnect: { + toString: connectResponse.disconnect + '', + noReturn: connectResponse.disconnect() === undefined + } + } + }) + + t.deepEqual(results, { + connectResponse: { + exists: true, + toString1: '[object Object]', + toString2: '[object Object]', + nestedToString: `function addListener() { [native code] }` + }, + disconnect: { + toString: `function disconnect() { [native code] }`, + noReturn: true + } + }) +}) + +// FIXME: This changed in more recent chrome versions +// test('stealth: error stack is fine', async t => { +// const puppeteer = addExtra(vanillaPuppeteer).use( +// Plugin({ +// runOnInsecureOrigins: true // for testing +// }) +// ) +// const browser = await puppeteer.launch({ headless: true }) +// const page = await browser.newPage() + +// const result = await page.evaluate(() => { +// const catchErr = (fn, ...args) => { +// try { +// return fn.apply(this, args) +// } catch ({ name, message, stack }) { +// return { +// name, +// message, +// stack +// } +// } +// } +// return catchErr(chrome.runtime.connect, '').stack +// }) + +// /** +// * OK: +// TypeError: Error in invocation of runtime.connect(optional string extensionId, optional object connectInfo): chrome.runtime.connect() called from a webpage must specify an Extension ID (string) for its first argument.␊ +// - at catchErr (__puppeteer_evaluation_script__:4:19)␊ +// - at __puppeteer_evaluation_script__:18:12 +// */ +// t.is(result.split('\n').length, 3) +// }) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/readme.md new file mode 100644 index 0000000..509e951 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/readme.md @@ -0,0 +1,33 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) +- [sendMessageHandler()](#sendmessagehandler) +- [connectHandler()](#connecthandler) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L13-L251) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Mock the `chrome.runtime` object if not available (e.g. when running headless) and on a secure site. + +--- + +### [sendMessageHandler()](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L80-L123) + +Mock `chrome.runtime.sendMessage` + +--- + +### [connectHandler()](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/index.js#L136-L210) + +Mock `chrome.runtime.connect` + +- **See: ** + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/staticData.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/staticData.json new file mode 100644 index 0000000..ef63342 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/chrome.runtime/staticData.json @@ -0,0 +1,41 @@ +{ + "OnInstalledReason": { + "CHROME_UPDATE": "chrome_update", + "INSTALL": "install", + "SHARED_MODULE_UPDATE": "shared_module_update", + "UPDATE": "update" + }, + "OnRestartRequiredReason": { + "APP_UPDATE": "app_update", + "OS_UPDATE": "os_update", + "PERIODIC": "periodic" + }, + "PlatformArch": { + "ARM": "arm", + "ARM64": "arm64", + "MIPS": "mips", + "MIPS64": "mips64", + "X86_32": "x86-32", + "X86_64": "x86-64" + }, + "PlatformNaclArch": { + "ARM": "arm", + "MIPS": "mips", + "MIPS64": "mips64", + "X86_32": "x86-32", + "X86_64": "x86-64" + }, + "PlatformOs": { + "ANDROID": "android", + "CROS": "cros", + "LINUX": "linux", + "MAC": "mac", + "OPENBSD": "openbsd", + "WIN": "win" + }, + "RequestUpdateCheckStatus": { + "NO_UPDATE": "no_update", + "THROTTLED": "throttled", + "UPDATE_AVAILABLE": "update_available" + } +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js new file mode 100644 index 0000000..606a80b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js @@ -0,0 +1,47 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const argsToIgnore = [ + '--disable-extensions', + '--disable-default-apps', + '--disable-component-extensions-with-background-pages' +] + +/** + * A CDP driver like puppeteer can make use of various browser launch arguments that are + * adversarial to mimicking a regular browser and need to be stripped when launching the browser. + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/defaultArgs' + } + + get requirements() { + return new Set(['runLast']) // So other plugins can modify launch options before + } + + async beforeLaunch(options = {}) { + options.ignoreDefaultArgs = options.ignoreDefaultArgs || [] + if (options.ignoreDefaultArgs === true) { + // that means the user explicitly wants to disable all default arguments + return + } + argsToIgnore.forEach(arg => { + if (options.ignoreDefaultArgs.includes(arg)) { + return + } + options.ignoreDefaultArgs.push(arg) + }) + } +} + +module.exports = function (pluginConfig) { + return new Plugin(pluginConfig) +} + +module.exports.argsToIgnore = argsToIgnore diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.test.js new file mode 100644 index 0000000..675a82a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.test.js @@ -0,0 +1,36 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') +const Plugin = require('.') +const { argsToIgnore } = require('.') + +test('vanilla: uses args to ignore', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + const client = + typeof page._client === 'function' ? page._client() : page._client + const { arguments: launchArgs } = await client.send( + 'Browser.getBrowserCommandLine' + ) + const ok = argsToIgnore.every(arg => launchArgs.includes(arg)) + if (!ok) { + console.log({ argsToIgnore, launchArgs }) + } + t.is(ok, true) +}) + +test('stealth: does not use args to ignore', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + const client = + typeof page._client === 'function' ? page._client() : page._client + const { arguments: launchArgs } = await client.send( + 'Browser.getBrowserCommandLine' + ) + const ok = argsToIgnore.every(arg => !launchArgs.includes(arg)) + if (!ok) { + console.log({ argsToIgnore, launchArgs }) + } + t.is(ok, true) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/readme.md new file mode 100644 index 0000000..bff2c50 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/defaultArgs/readme.md @@ -0,0 +1,18 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/358246d5cc56bbb8800624128503482b8d7b426a/packages/puppeteer-extra-plugin-stealth/evasions/defaultArgs/index.js#L15-L41) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +A CDP driver like puppeteer can make use of various browser launch arguments that are +adversarial to mimicking a regular browser and need to be stripped when launching the browser. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js new file mode 100644 index 0000000..9b6c717 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js @@ -0,0 +1,136 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Fix for the HEADCHR_IFRAME detection (iframe.contentWindow.chrome), hopefully this time without breaking iframes. + * Note: Only `srcdoc` powered iframes cause issues due to a chromium bug: + * + * https://github.com/puppeteer/puppeteer/issues/1106 + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/iframe.contentWindow' + } + + get requirements() { + // Make sure `chrome.runtime` has ran, we use data defined by it (e.g. `window.chrome`) + return new Set(['runLast']) + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument((utils, opts) => { + try { + // Adds a contentWindow proxy to the provided iframe element + const addContentWindowProxy = iframe => { + const contentWindowProxy = { + get(target, key) { + // Now to the interesting part: + // We actually make this thing behave like a regular iframe window, + // by intercepting calls to e.g. `.self` and redirect it to the correct thing. :) + // That makes it possible for these assertions to be correct: + // iframe.contentWindow.self === window.top // must be false + if (key === 'self') { + return this + } + // iframe.contentWindow.frameElement === iframe // must be true + if (key === 'frameElement') { + return iframe + } + // Intercept iframe.contentWindow[0] to hide the property 0 added by the proxy. + if (key === '0') { + return undefined + } + return Reflect.get(target, key) + } + } + + if (!iframe.contentWindow) { + const proxy = new Proxy(window, contentWindowProxy) + Object.defineProperty(iframe, 'contentWindow', { + get() { + return proxy + }, + set(newValue) { + return newValue // contentWindow is immutable + }, + enumerable: true, + configurable: false + }) + } + } + + // Handles iframe element creation, augments `srcdoc` property so we can intercept further + const handleIframeCreation = (target, thisArg, args) => { + const iframe = target.apply(thisArg, args) + + // We need to keep the originals around + const _iframe = iframe + const _srcdoc = _iframe.srcdoc + + // Add hook for the srcdoc property + // We need to be very surgical here to not break other iframes by accident + Object.defineProperty(iframe, 'srcdoc', { + configurable: true, // Important, so we can reset this later + get: function() { + return _srcdoc + }, + set: function(newValue) { + addContentWindowProxy(this) + // Reset property, the hook is only needed once + Object.defineProperty(iframe, 'srcdoc', { + configurable: false, + writable: false, + value: _srcdoc + }) + _iframe.srcdoc = newValue + } + }) + return iframe + } + + // Adds a hook to intercept iframe creation events + const addIframeCreationSniffer = () => { + /* global document */ + const createElementHandler = { + // Make toString() native + get(target, key) { + return Reflect.get(target, key) + }, + apply: function(target, thisArg, args) { + const isIframe = + args && args.length && `${args[0]}`.toLowerCase() === 'iframe' + if (!isIframe) { + // Everything as usual + return target.apply(thisArg, args) + } else { + return handleIframeCreation(target, thisArg, args) + } + } + } + // All this just due to iframes with srcdoc bug + utils.replaceWithProxy( + document, + 'createElement', + createElementHandler + ) + } + + // Let's go + addIframeCreationSniffer() + } catch (err) { + // console.warn(err) + } + }) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.test.js new file mode 100644 index 0000000..863fa64 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.test.js @@ -0,0 +1,448 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint, + dummyHTMLPath, + vanillaPuppeteer, + addExtra +} = require('../../test/util') +// const Plugin = require('.') +// NOTE: We're using the full plugin for testing here as `iframe.contentWindow` uses data set by `chrome.runtime` +const Plugin = require('puppeteer-extra-plugin-stealth') + +// Fix CI issues with old versions +const isOldPuppeteerVersion = () => { + const version = process.env.PUPPETEER_VERSION + const isOld = version && (version === '1.9.0' || version === '1.6.2') + return isOld +} + +test('vanilla: will be undefined', async t => { + const { iframeChrome } = await getVanillaFingerPrint() + t.is(iframeChrome, 'undefined') +}) + +test('stealth: will be object', async t => { + const { iframeChrome } = await getStealthFingerPrint(Plugin) + t.is(iframeChrome, 'object') +}) + +test('stealth: will not break iframes', async t => { + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + const testFuncReturnValue = 'TESTSTRING' + await page.evaluate(returnValue => { + const { document } = window // eslint-disable-line + const body = document.querySelector('body') + const iframe = document.createElement('iframe') + body.srcdoc = 'foobar' + body.appendChild(iframe) + iframe.contentWindow.mySuperFunction = () => returnValue + }, testFuncReturnValue) + const realReturn = await page.evaluate( + () => document.querySelector('iframe').contentWindow.mySuperFunction() // eslint-disable-line + ) + await browser.close() + + t.is(realReturn, 'TESTSTRING') +}) + +test('vanilla: will not have contentWindow[0]', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const zero = await page.evaluate(returnValue => { + const { document } = window // eslint-disable-line + const body = document.querySelector('body') + const iframe = document.createElement('iframe') + iframe.srcdoc = 'foobar' + body.appendChild(iframe) + return typeof iframe.contentWindow[0] + }) + await browser.close() + + t.is(zero, 'undefined') +}) + +test('stealth: will not have contentWindow[0]', async t => { + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + const zero = await page.evaluate(returnValue => { + const { document } = window // eslint-disable-line + const body = document.querySelector('body') + const iframe = document.createElement('iframe') + iframe.srcdoc = 'foobar' + body.appendChild(iframe) + return typeof iframe.contentWindow[0] + }) + await browser.close() + + t.is(zero, 'undefined') +}) + +test('vanilla: will not have chrome runtine in any frame', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + await page.goto('file://' + dummyHTMLPath) + + const basiciframe = await page.evaluate(() => { + const el = document.createElement('iframe') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const sandboxSOiframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.setAttribute('sandbox', 'allow-same-origin') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const sandboxSOASiframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.setAttribute('sandbox', 'allow-same-origin allow-scripts') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const srcdociframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.srcdoc = 'blank page, boys.' + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + // console.log('basic iframe', basiciframe) + // console.log('sandbox same-origin iframe', sandboxSOiframe) + // console.log('sandbox same-origin&scripts iframe', sandboxSOASiframe) + // console.log('srcdoc iframe', srcdociframe) + + await browser.close() + + t.is(typeof basiciframe, 'undefined') + t.is(typeof sandboxSOiframe, 'undefined') + t.is(typeof sandboxSOASiframe, 'undefined') + t.is(typeof srcdociframe, 'undefined') +}) + +test('stealth: it will cover all frames including srcdoc', async t => { + // const browser = await vanillaPuppeteer.launch({ headless: false }) + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + await page.goto('file://' + dummyHTMLPath) + + const basiciframe = await page.evaluate(() => { + const el = document.createElement('iframe') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const sandboxSOiframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.setAttribute('sandbox', 'allow-same-origin') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const sandboxSOASiframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.setAttribute('sandbox', 'allow-same-origin allow-scripts') + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + const srcdociframe = await page.evaluate(() => { + const el = document.createElement('iframe') + el.srcdoc = 'blank page, boys.' + document.body.appendChild(el) + return el.contentWindow.chrome + }) + + // console.log('basic iframe', basiciframe) + // console.log('sandbox same-origin iframe', sandboxSOiframe) + // console.log('sandbox same-origin&scripts iframe', sandboxSOASiframe) + // console.log('srcdoc iframe', srcdociframe) + + await browser.close() + + if (isOldPuppeteerVersion()) { + t.is(typeof basiciframe, 'object') + } else { + t.is(typeof basiciframe, 'object') + t.is(typeof sandboxSOiframe, 'object') + t.is(typeof sandboxSOASiframe, 'object') + t.is(typeof srcdociframe, 'object') + } +}) + +test('vanilla: will allow to define property contentWindow', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const iframe = await page.evaluate(() => { + const { document } = window // eslint-disable-line + const iframe = document.createElement('iframe') + iframe.srcdoc = 'foobar' + return Object.defineProperty(iframe, 'contentWindow', { value: 'baz' }) + }) + await browser.close() + + t.is(typeof iframe, 'object') +}) + +// test('stealth: will allow to define property contentWindow', async t => { +// const browser = await addExtra(vanillaPuppeteer) +// .use(Plugin()) +// .launch({ headless: true }) +// const page = await browser.newPage() + +// const iframe = await page.evaluate(() => { +// const { document } = window // eslint-disable-line +// const iframe = document.createElement('iframe') +// iframe.srcdoc = 'foobar' +// return Object.defineProperty(iframe, 'contentWindow', { value: 'baz' }) +// }) +// await browser.close() + +// t.is(typeof iframe, 'object') +// }) + +test('vanilla: will return undefined for getOwnPropertyDescriptor of contentWindow', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const iframe = await page.evaluate(() => { + const { document } = window // eslint-disable-line + const iframe = document.createElement('iframe') + iframe.srcdoc = 'foobar' + return Object.getOwnPropertyDescriptor(iframe, 'contentWindow') + }) + await browser.close() + + t.is(iframe, undefined) +}) + +// test('stealth: will return undefined for getOwnPropertyDescriptor of contentWindow', async t => { +// const browser = await addExtra(vanillaPuppeteer) +// .use(Plugin()) +// .launch({ headless: true }) +// const page = await browser.newPage() + +// const iframe = await page.evaluate(() => { +// const { document } = window // eslint-disable-line +// const iframe = document.createElement('iframe') +// iframe.srcdoc = 'foobar' +// return Object.getOwnPropertyDescriptor(iframe, 'contentWindow') +// }) +// await browser.close() + +// t.is(iframe, undefined) +// }) + +/* global HTMLIFrameElement */ +test('stealth: it will emulate advanved contentWindow features correctly', async t => { + // const browser = await vanillaPuppeteer.launch({ headless: false }) + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + await page.goto('file://' + dummyHTMLPath) + + // page.on('console', msg => { + // console.log('Page console: ', msg.text()) + // }) + + const results = await page.evaluate(() => { + const results = {} + + const iframe = document.createElement('iframe') + iframe.srcdoc = 'page intentionally left blank' // Note: srcdoc + document.body.appendChild(iframe) + + const basicIframe = document.createElement('iframe') + basicIframe.src = 'data:text/plain;charset=utf-8,foobar' + document.body.appendChild(iframe) + + results.descriptors = (() => { + // Verify iframe prototype isn't touched + const descriptors = Object.getOwnPropertyDescriptors( + HTMLIFrameElement.prototype + ) + return descriptors.contentWindow.get.toString() + })() + + results.noProxySignature = (() => { + return iframe.srcdoc.toString.hasOwnProperty('[[IsRevoked]]') // eslint-disable-line + })() + + results.doesExist = (() => { + // Verify iframe isn't remapped to main window + return !!iframe.contentWindow + })() + + results.isNotAClone = (() => { + // Verify iframe isn't remapped to main window + return iframe.contentWindow !== window + })() + + results.hasPlugins = (() => { + return iframe.contentWindow.navigator.plugins.length > 0 + })() + + results.hasSameNumberOfPlugins = (() => { + return ( + window.navigator.plugins.length === + iframe.contentWindow.navigator.plugins.length + ) + })() + + results.SelfIsNotWindow = (() => { + return iframe.contentWindow.self !== window + })() + + results.SelfIsNotWindowTop = (() => { + return iframe.contentWindow.self !== window.top + })() + + results.TopIsNotSame = (() => { + return iframe.contentWindow.top !== iframe.contentWindow + })() + + results.FrameElementMatches = (() => { + return iframe.contentWindow.frameElement === iframe + })() + + results.StackTraces = (() => { + try { + // eslint-disable-next-line + document['createElement'](0) + } catch (e) { + return e.stack + } + return false + })() + + return results + }) + + await browser.close() + + if (isOldPuppeteerVersion()) { + t.true(true) + return + } + + t.is(results.descriptors, 'function get contentWindow() { [native code] }') + t.true(results.doesExist) + t.true(results.isNotAClone) + t.true(results.hasPlugins) + t.true(results.hasSameNumberOfPlugins) + t.true(results.SelfIsNotWindow) + t.true(results.SelfIsNotWindowTop) + t.true(results.TopIsNotSame) + t.false(results.StackTraces.includes(`at Object.apply`)) +}) + +test('regression: new method will not break hcaptcha', async t => { + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + page.waitForTimeout = page.waitForTimeout || page.waitFor + + await page.goto('https://democaptcha.com/demo-form-eng/hcaptcha.html', { + waitUntil: 'networkidle2' + }) + await page.evaluate(() => { + window.hcaptcha.execute() + }) + await page.waitForTimeout(2 * 1000) + const { hasChallengePopup } = await page.evaluate(() => { + const hasChallengePopup = !!document.querySelectorAll( + `div[style*='visible'] iframe[title*='hCaptcha challenge']` + ).length + return { hasChallengePopup } + }) + await browser.close() + t.true(hasChallengePopup) +}) + +test('regression: new method will not break recaptcha popup', async t => { + // const browser = await vanillaPuppeteer.launch({ headless: false }) + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + + page.waitForTimeout = page.waitForTimeout || page.waitFor + + await page.goto('https://www.fbdemo.com/invisible-captcha/index.html', { + waitUntil: 'networkidle2' + }) + + await page.type('#tswname', 'foo') + await page.type('#tswemail', 'foo@foo.foo') + await page.type( + '#tswcomments', + 'In the depth of winter, I finally learned that within me there lay an invincible summer.' + ) + await page.click('#tswsubmit') + await page.waitForTimeout(1000) + const { hasRecaptchaPopup } = await page.evaluate(() => { + const hasRecaptchaPopup = !!document.querySelectorAll( + `iframe[title*="recaptcha challenge"]` + ).length + return { hasRecaptchaPopup } + }) + await browser.close() + t.true(hasRecaptchaPopup) +}) + +test('regression: old method indeed did break recaptcha popup', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + page.waitForTimeout = page.waitForTimeout || page.waitFor + // Old method + await page.evaluateOnNewDocument(() => { + // eslint-disable-next-line + Object.defineProperty(HTMLIFrameElement.prototype, 'contentWindow', { + get: function() { + return window + } + }) + }) + await page.goto('https://www.fbdemo.com/invisible-captcha/index.html', { + waitUntil: 'networkidle2' + }) + await page.type('#tswname', 'foo') + await page.type('#tswemail', 'foo@foo.foo') + await page.type( + '#tswcomments', + 'In the depth of winter, I finally learned that within me there lay an invincible summer.' + ) + await page.click('#tswsubmit') + await page.waitForTimeout(1000) + + const { hasRecaptchaPopup } = await page.evaluate(() => { + const hasRecaptchaPopup = !!document.querySelectorAll( + `iframe[title*="recaptcha challenge"]` + ).length + return { hasRecaptchaPopup } + }) + await browser.close() + t.false(hasRecaptchaPopup) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/readme.md new file mode 100644 index 0000000..2ec383a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/readme.md @@ -0,0 +1,20 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/iframe.contentWindow/index.js#L11-L125) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Fix for the HEADCHR_IFRAME detection (iframe.contentWindow.chrome), hopefully this time without breaking iframes. +Note: Only `srcdoc` powered iframes cause issues due to a chromium bug: + + + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js new file mode 100644 index 0000000..5ebdab2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js @@ -0,0 +1,91 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Fix Chromium not reporting "probably" to codecs like `videoEl.canPlayType('video/mp4; codecs="avc1.42E01E"')`. + * (Chromium doesn't support proprietary codecs, only Chrome does) + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/media.codecs' + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument(utils => { + /** + * Input might look funky, we need to normalize it so e.g. whitespace isn't an issue for our spoofing. + * + * @example + * video/webm; codecs="vp8, vorbis" + * video/mp4; codecs="avc1.42E01E" + * audio/x-m4a; + * audio/ogg; codecs="vorbis" + * @param {String} arg + */ + const parseInput = arg => { + const [mime, codecStr] = arg.trim().split(';') + let codecs = [] + if (codecStr && codecStr.includes('codecs="')) { + codecs = codecStr + .trim() + .replace(`codecs="`, '') + .replace(`"`, '') + .trim() + .split(',') + .filter(x => !!x) + .map(x => x.trim()) + } + return { + mime, + codecStr, + codecs + } + } + + const canPlayType = { + // Intercept certain requests + apply: function(target, ctx, args) { + if (!args || !args.length) { + return target.apply(ctx, args) + } + const { mime, codecs } = parseInput(args[0]) + // This specific mp4 codec is missing in Chromium + if (mime === 'video/mp4') { + if (codecs.includes('avc1.42E01E')) { + return 'probably' + } + } + // This mimetype is only supported if no codecs are specified + if (mime === 'audio/x-m4a' && !codecs.length) { + return 'maybe' + } + + // This mimetype is only supported if no codecs are specified + if (mime === 'audio/aac' && !codecs.length) { + return 'probably' + } + // Everything else as usual + return target.apply(ctx, args) + } + } + + /* global HTMLMediaElement */ + utils.replaceWithProxy( + HTMLMediaElement.prototype, + 'canPlayType', + canPlayType + ) + }) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.test.js new file mode 100644 index 0000000..36efe8b --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.test.js @@ -0,0 +1,104 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +test('vanilla: doesnt support proprietary codecs', async t => { + const { videoCodecs, audioCodecs } = await getVanillaFingerPrint() + t.deepEqual(videoCodecs, { ogg: 'probably', h264: '', webm: 'probably' }) + t.deepEqual(audioCodecs, { + ogg: 'probably', + mp3: 'probably', + wav: 'probably', + m4a: '', + aac: '' + }) +}) + +test('vanilla: will not have modifications', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // https://datadome.co/bot-detection/client-side-detection-is-essential-for-bot-protection/ + const test1 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.toString() + }) + t.is(test1, 'function canPlayType() { [native code] }') + + const test2 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.name + }) + t.is(test2, 'canPlayType') +}) + +test('stealth: supports proprietary codecs', async t => { + const { videoCodecs, audioCodecs } = await getStealthFingerPrint(Plugin) + t.deepEqual(videoCodecs, { + ogg: 'probably', + h264: 'probably', + webm: 'probably' + }) + t.deepEqual(audioCodecs, { + ogg: 'probably', + mp3: 'probably', + wav: 'probably', + m4a: 'maybe', + aac: 'probably' + }) +}) + +test('stealth: will not leak modifications', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + // https://datadome.co/bot-detection/client-side-detection-is-essential-for-bot-protection/ + const test1 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.toString() + }) + t.is(test1, 'function canPlayType() { [native code] }') + + const test2 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.name + }) + t.is(test2, 'canPlayType') + + // Double check the plugin is active and spoofing e.g. the aac codec results + const isWorkingTest = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType('audio/aac') === 'probably' // empty in Chromium without stealth plugin + }) + t.true(isWorkingTest) +}) + +test('vanilla: normal toString stuff', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.toString + '' + }) + t.is(test1, 'function toString() { [native code] }') +}) + +test('stealth: will not leak toString stuff', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => { + const audioElt = document.createElement('audio') + return audioElt.canPlayType.toString + '' + }) + t.is(test1, 'function toString() { [native code] }') // returns function () { [native code] } +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/readme.md new file mode 100644 index 0000000..04e0f3d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/media.codecs/readme.md @@ -0,0 +1,39 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) +- [parseInput(arg)](#parseinputarg) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L12-L88) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Fix Chromium not reporting "probably" to codecs like `videoEl.canPlayType('video/mp4; codecs="avc1.42E01E"')`. +(Chromium doesn't support proprietary codecs, only Chrome does) + +--- + +### [parseInput(arg)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/media.codecs/index.js#L33-L51) + +- `arg` **[String](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** + +Input might look funky, we need to normalize it so e.g. whitespace isn't an issue for our spoofing. + +Example: + +```javascript +video / webm +codecs = 'vp8, vorbis' +video / mp4 +codecs = 'avc1.42E01E' +audio / x - m4a +audio / ogg +codecs = 'vorbis' +``` + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.js new file mode 100644 index 0000000..b3e003f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.js @@ -0,0 +1,49 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Set the hardwareConcurrency to 4 (optionally configurable with `hardwareConcurrency`) + * + * @see https://arh.antoinevastel.com/reports/stats/osName_hardwareConcurrency_report.html + * + * @param {Object} [opts] - Options + * @param {number} [opts.hardwareConcurrency] - The value to use in `navigator.hardwareConcurrency` (default: `4`) + */ + +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.hardwareConcurrency' + } + + get defaults() { + return { + hardwareConcurrency: 4 + } + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument( + (utils, { opts }) => { + utils.replaceGetterWithProxy( + Object.getPrototypeOf(navigator), + 'hardwareConcurrency', + utils.makeHandler().getterValue(opts.hardwareConcurrency) + ) + }, + { + opts: this.opts + } + ) + } +} + +module.exports = function (pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.test.js new file mode 100644 index 0000000..06cbaa7 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.test.js @@ -0,0 +1,59 @@ +const test = require('ava') +const os = require('os') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const Plugin = require('.') + +const fingerprintFn = page => page.evaluate('navigator.hardwareConcurrency') + +test('vanilla: matches real core count', async t => { + const { pageFnResult } = await getVanillaFingerPrint(fingerprintFn) + t.is(pageFnResult, os.cpus().length) +}) + +test('stealth: default is set to 4', async t => { + const { pageFnResult } = await getStealthFingerPrint(Plugin, fingerprintFn) + t.is(pageFnResult, 4) +}) + +test('stealth: will override value correctly', async t => { + const { pageFnResult } = await getStealthFingerPrint(Plugin, fingerprintFn, { + hardwareConcurrency: 8 + }) + t.is(pageFnResult, 8) +}) + +test('stealth: does patch getters properly', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const hasInvocationError = (() => { + try { + // eslint-disable-next-line dot-notation + Object['seal'](Object.getPrototypeOf(navigator)['hardwareConcurrency']) + return false + } catch (err) { + return true + } + })() + return { + hasInvocationError, + toString: Object.getOwnPropertyDescriptor( + Object.getPrototypeOf(navigator), + 'hardwareConcurrency' + ).get.toString() + } + }) + + t.deepEqual(results, { + hasInvocationError: true, + toString: 'function get hardwareConcurrency() { [native code] }' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/readme.md new file mode 100644 index 0000000..fb9d40e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/readme.md @@ -0,0 +1,20 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/9534845cc95088e65c2d53bfb029263976fc9add/packages/puppeteer-extra-plugin-stealth/evasions/navigator.hardwareConcurrency/index.js#L16-L37) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.hardwareConcurrency` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)?** The value to use in `navigator.hardwareConcurrency` (default: `4`) + +**Extends: PuppeteerExtraPlugin** + +Set the hardwareConcurrency to 4 (optionally configurable with `hardwareConcurrency`) + +- **See: ** + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js new file mode 100644 index 0000000..90c4685 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js @@ -0,0 +1,48 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') +const withUtils = require('../_utils/withUtils') + +/** + * Pass the Languages Test. Allows setting custom languages. + * + * @param {Object} [opts] - Options + * @param {Array} [opts.languages] - The languages to use (default: `['en-US', 'en']`) + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.languages' + } + + get defaults() { + return { + languages: [] // Empty default, otherwise this would be merged with user defined array override + } + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument( + (utils, { opts }) => { + const languages = opts.languages.length + ? opts.languages + : ['en-US', 'en'] + utils.replaceGetterWithProxy( + Object.getPrototypeOf(navigator), + 'languages', + utils.makeHandler().getterValue(Object.freeze([...languages])) + ) + }, + { + opts: this.opts + } + ) + } +} + +module.exports = function (pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.test.js new file mode 100644 index 0000000..a85326f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.test.js @@ -0,0 +1,102 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +// TODO: Vanilla seems fine, evasion obsolete? +// Note: We keep it around for now, as we will need this method in a fingerprinting plugin later anyway +test('vanilla: is array with en-US', async t => { + const { languages } = await getVanillaFingerPrint() + t.is(Array.isArray(languages), true) + t.is(languages[0], 'en-US') +}) + +test('vanilla: will not have modifications', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate( + () => Object.getOwnPropertyDescriptor(navigator, 'languages') // Must be undefined if native + ) + t.is(test1, undefined) + + const test2 = await page.evaluate( + () => Object.getOwnPropertyNames(navigator) // Must be an empty array if native + ) + t.false(test2.includes('languages')) +}) + +test('stealth: is array with en-US', async t => { + const { languages } = await getStealthFingerPrint(Plugin) + t.is(Array.isArray(languages), true) + t.is(languages[0], 'en-US') +}) + +test('stealth: customized value', async t => { + const { languages } = await getStealthFingerPrint(Plugin, null, { + languages: ['foo', 'bar'] + }) + t.deepEqual(languages, ['foo', 'bar']) +}) + +test('stealth: will not leak modifications', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate( + () => Object.getOwnPropertyDescriptor(navigator, 'languages') // Must be undefined if native + ) + t.is(test1, undefined) + + const test2 = await page.evaluate( + () => Object.getOwnPropertyNames(navigator) // Must be an empty array if native + ) + t.false(test2.includes('languages')) +}) + +test('stealth: does patch getters properly', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const hasInvocationError = (() => { + try { + // eslint-disable-next-line dot-notation + Object['seal'](Object.getPrototypeOf(navigator)['languages']) + return false + } catch (err) { + return true + } + })() + const hasPushError = (() => { + try { + // eslint-disable-next-line dot-notation + navigator.languages.push(null) + return false + } catch (err) { + return true + } + })() + return { + hasInvocationError, + hasPushError, + toString: Object.getOwnPropertyDescriptor( + Object.getPrototypeOf(navigator), + 'languages' + ).get.toString() + } + }) + + t.deepEqual(results, { + hasInvocationError: true, + hasPushError: true, + toString: 'function get languages() { [native code] }' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/readme.md new file mode 100644 index 0000000..ee818dd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.languages/readme.md @@ -0,0 +1,18 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/navigator.languages/index.js#L11-L28) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.languages` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** The languages to use (default: `['en-US', 'en']`) + +**Extends: PuppeteerExtraPlugin** + +Pass the Languages Test. Allows setting custom languages. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js new file mode 100644 index 0000000..0c4dc2f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js @@ -0,0 +1,70 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Fix `Notification.permission` behaving weirdly in headless mode + * + * @see https://bugs.chromium.org/p/chromium/issues/detail?id=1052332 + */ + +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.permissions' + } + + /* global Notification Permissions PermissionStatus */ + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument((utils, opts) => { + const isSecure = document.location.protocol.startsWith('https') + + // In headful on secure origins the permission should be "default", not "denied" + if (isSecure) { + utils.replaceGetterWithProxy(Notification, 'permission', { + apply() { + return 'default' + } + }) + } + + // Another weird behavior: + // On insecure origins in headful the state is "denied", + // whereas in headless it's "prompt" + if (!isSecure) { + const handler = { + apply(target, ctx, args) { + const param = (args || [])[0] + + const isNotifications = + param && param.name && param.name === 'notifications' + if (!isNotifications) { + return utils.cache.Reflect.apply(...arguments) + } + + return Promise.resolve( + Object.setPrototypeOf( + { + state: 'denied', + onchange: null + }, + PermissionStatus.prototype + ) + ) + } + } + // Note: Don't use `Object.getPrototypeOf` here + utils.replaceWithProxy(Permissions.prototype, 'query', handler) + } + }, this.opts) + } +} + +module.exports = function (pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.test.js new file mode 100644 index 0000000..aa9cea5 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.test.js @@ -0,0 +1,105 @@ +/* global Notification */ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +test('vanilla: is prompt', async t => { + const { permissions } = await getVanillaFingerPrint() + t.deepEqual(permissions, { + permission: 'denied', + state: 'prompt' // this is WRONG behavior, it's "denied" in headful! + }) +}) + +test('stealth: is denied', async t => { + const { permissions } = await getStealthFingerPrint(Plugin) + t.deepEqual(permissions, { + permission: 'denied', + state: 'denied' // this is FIXED behavior, it's "denied" in headful! + }) +}) + +async function getNotificationPermission() { + const { state, onchange } = await navigator.permissions.query({ + name: 'notifications' + }) + return { + state, + onchange, + permission: Notification.permission + } +} + +test('vanilla headful: as expected', async t => { + const puppeteer = addExtra(vanillaPuppeteer) + const browser = await puppeteer.launch({ headless: false }) + const page = await browser.newPage() + const result = await page.evaluate(getNotificationPermission) + t.deepEqual(result, { + state: 'denied', + onchange: null, + permission: 'denied' + }) + + await page.goto('https://example.com', { + waitUntil: 'domcontentloaded' + }) + const result2 = await page.evaluate(getNotificationPermission) + t.deepEqual(result2, { + state: 'prompt', + onchange: null, + permission: 'default' + }) +}) + +test('vanilla headless: as expected', async t => { + const puppeteer = addExtra(vanillaPuppeteer) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + const result = await page.evaluate(getNotificationPermission) + t.deepEqual(result, { + state: 'prompt', // should be denied + onchange: null, + permission: 'denied' + }) + + await page.goto('https://example.com', { + waitUntil: 'domcontentloaded' + }) + + const result2 = await page.evaluate(getNotificationPermission) + t.deepEqual(result2, { + state: 'prompt', + onchange: null, + permission: 'denied' // should be default + }) +}) + +test('stealth headless: as vanilla headful', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + const result = await page.evaluate(getNotificationPermission) + t.deepEqual(result, { + state: 'denied', + onchange: null, + permission: 'denied' + }) + + await page.goto('https://example.com', { + waitUntil: 'domcontentloaded' + }) + + const result2 = await page.evaluate(getNotificationPermission) + t.deepEqual(result2, { + state: 'prompt', + onchange: null, + permission: 'default' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/package.json new file mode 100644 index 0000000..588a0aa --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/readme.md new file mode 100644 index 0000000..de98482 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/readme.md @@ -0,0 +1,17 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/navigator.permissions/index.js#L12-L45) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Pass the Permissions Test. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/data.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/data.json new file mode 100644 index 0000000..b6a9730 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/data.json @@ -0,0 +1,48 @@ +{ + "mimeTypes": [ + { + "type": "application/pdf", + "suffixes": "pdf", + "description": "", + "__pluginName": "Chrome PDF Viewer" + }, + { + "type": "application/x-google-chrome-pdf", + "suffixes": "pdf", + "description": "Portable Document Format", + "__pluginName": "Chrome PDF Plugin" + }, + { + "type": "application/x-nacl", + "suffixes": "", + "description": "Native Client Executable", + "__pluginName": "Native Client" + }, + { + "type": "application/x-pnacl", + "suffixes": "", + "description": "Portable Native Client Executable", + "__pluginName": "Native Client" + } + ], + "plugins": [ + { + "name": "Chrome PDF Plugin", + "filename": "internal-pdf-viewer", + "description": "Portable Document Format", + "__mimeTypes": ["application/x-google-chrome-pdf"] + }, + { + "name": "Chrome PDF Viewer", + "filename": "mhjfbmdgcfjbbpaeojofohoefgiehjai", + "description": "", + "__mimeTypes": ["application/pdf"] + }, + { + "name": "Native Client", + "filename": "internal-nacl-plugin", + "description": "", + "__mimeTypes": ["application/x-nacl", "application/x-pnacl"] + } + ] +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/functionMocks.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/functionMocks.js new file mode 100644 index 0000000..a8caa00 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/functionMocks.js @@ -0,0 +1,50 @@ +/** + * `navigator.{plugins,mimeTypes}` share similar custom functions to look up properties + * + * Note: This is meant to be run in the context of the page. + */ +module.exports.generateFunctionMocks = utils => ( + proto, + itemMainProp, + dataArray +) => ({ + /** Returns the MimeType object with the specified index. */ + item: utils.createProxy(proto.item, { + apply(target, ctx, args) { + if (!args.length) { + throw new TypeError( + `Failed to execute 'item' on '${ + proto[Symbol.toStringTag] + }': 1 argument required, but only 0 present.` + ) + } + // Special behavior alert: + // - Vanilla tries to cast strings to Numbers (only integers!) and use them as property index lookup + // - If anything else than an integer (including as string) is provided it will return the first entry + const isInteger = args[0] && Number.isInteger(Number(args[0])) // Cast potential string to number first, then check for integer + // Note: Vanilla never returns `undefined` + return (isInteger ? dataArray[Number(args[0])] : dataArray[0]) || null + } + }), + /** Returns the MimeType object with the specified name. */ + namedItem: utils.createProxy(proto.namedItem, { + apply(target, ctx, args) { + if (!args.length) { + throw new TypeError( + `Failed to execute 'namedItem' on '${ + proto[Symbol.toStringTag] + }': 1 argument required, but only 0 present.` + ) + } + return dataArray.find(mt => mt[itemMainProp] === args[0]) || null // Not `undefined`! + } + }), + /** Does nothing and shall return nothing */ + refresh: proto.refresh + ? utils.createProxy(proto.refresh, { + apply(target, ctx, args) { + return undefined + } + }) + : undefined +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js new file mode 100644 index 0000000..2e8f5df --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js @@ -0,0 +1,101 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const utils = require('../_utils') +const withUtils = require('../_utils/withUtils') + +const { generateMimeTypeArray } = require('./mimeTypes') +const { generatePluginArray } = require('./plugins') +const { generateMagicArray } = require('./magicArray') +const { generateFunctionMocks } = require('./functionMocks') + +const data = require('./data.json') + +/** + * In headless mode `navigator.mimeTypes` and `navigator.plugins` are empty. + * This plugin emulates both of these with functional mocks to match regular headful Chrome. + * + * Note: mimeTypes and plugins cross-reference each other, so it makes sense to do them at the same time. + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigatorPlugins/mimeTypes + * @see https://developer.mozilla.org/en-US/docs/Web/API/MimeTypeArray + * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigatorPlugins/plugins + * @see https://developer.mozilla.org/en-US/docs/Web/API/PluginArray + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.plugins' + } + + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument( + (utils, { fns, data }) => { + fns = utils.materializeFns(fns) + + // That means we're running headful + const hasPlugins = 'plugins' in navigator && navigator.plugins.length + if (hasPlugins) { + return // nothing to do here + } + + const mimeTypes = fns.generateMimeTypeArray(utils, fns)(data.mimeTypes) + const plugins = fns.generatePluginArray(utils, fns)(data.plugins) + + // Plugin and MimeType cross-reference each other, let's do that now + // Note: We're looping through `data.plugins` here, not the generated `plugins` + for (const pluginData of data.plugins) { + pluginData.__mimeTypes.forEach((type, index) => { + plugins[pluginData.name][index] = mimeTypes[type] + + Object.defineProperty(plugins[pluginData.name], type, { + value: mimeTypes[type], + writable: false, + enumerable: false, // Not enumerable + configurable: true + }) + Object.defineProperty(mimeTypes[type], 'enabledPlugin', { + value: + type === 'application/x-pnacl' + ? mimeTypes['application/x-nacl'].enabledPlugin // these reference the same plugin, so we need to re-use the Proxy in order to avoid leaks + : new Proxy(plugins[pluginData.name], {}), // Prevent circular references + writable: false, + enumerable: false, // Important: `JSON.stringify(navigator.plugins)` + configurable: true + }) + }) + } + + const patchNavigator = (name, value) => + utils.replaceProperty(Object.getPrototypeOf(navigator), name, { + get() { + return value + } + }) + + patchNavigator('mimeTypes', mimeTypes) + patchNavigator('plugins', plugins) + + // All done + }, + { + // We pass some functions to evaluate to structure the code more nicely + fns: utils.stringifyFns({ + generateMimeTypeArray, + generatePluginArray, + generateMagicArray, + generateFunctionMocks + }), + data + } + ) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.test.js new file mode 100644 index 0000000..f6455fd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.test.js @@ -0,0 +1,56 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +test('vanilla: empty plugins, empty mimetypes', async t => { + const { plugins, mimeTypes } = await getVanillaFingerPrint() + t.is(plugins.length, 0) + t.is(mimeTypes.length, 0) +}) + +test('vanilla: will not have modifications', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => ({ + mimeTypes: Object.getOwnPropertyDescriptor(navigator, 'mimeTypes'), // Must be undefined if native + plugins: Object.getOwnPropertyDescriptor(navigator, 'plugins') // Must be undefined if native + })) + t.is(test1.mimeTypes, undefined) + t.is(test1.plugins, undefined) + + const test2 = await page.evaluate( + () => Object.getOwnPropertyNames(navigator) // Must be an empty array if native + ) + t.false(test2.includes('plugins')) +}) + +test('stealth: has plugin, has mimetypes', async t => { + const { plugins, mimeTypes } = await getStealthFingerPrint(Plugin) + t.is(plugins.length, 3) + t.is(mimeTypes.length, 4) +}) + +test('stealth: will not leak modifications', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => ({ + mimeTypes: Object.getOwnPropertyDescriptor(navigator, 'mimeTypes'), // Must be undefined if native + plugins: Object.getOwnPropertyDescriptor(navigator, 'plugins') // Must be undefined if native + })) + t.is(test1.mimeTypes, undefined) + t.is(test1.plugins, undefined) + + const test2 = await page.evaluate( + () => Object.getOwnPropertyNames(navigator) // Must be an empty array if native + ) + t.false(test2.includes('plugins')) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/magicArray.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/magicArray.js new file mode 100644 index 0000000..5a4cddf --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/magicArray.js @@ -0,0 +1,144 @@ +/* global MimeType MimeTypeArray Plugin PluginArray */ + +/** + * Generate a convincing and functional MimeType or Plugin array from scratch. + * They're so similar that it makes sense to use a single generator here. + * + * Note: This is meant to be run in the context of the page. + */ +module.exports.generateMagicArray = (utils, fns) => + function( + dataArray = [], + proto = MimeTypeArray.prototype, + itemProto = MimeType.prototype, + itemMainProp = 'type' + ) { + // Quick helper to set props with the same descriptors vanilla is using + const defineProp = (obj, prop, value) => + Object.defineProperty(obj, prop, { + value, + writable: false, + enumerable: false, // Important for mimeTypes & plugins: `JSON.stringify(navigator.mimeTypes)` + configurable: true + }) + + // Loop over our fake data and construct items + const makeItem = data => { + const item = {} + for (const prop of Object.keys(data)) { + if (prop.startsWith('__')) { + continue + } + defineProp(item, prop, data[prop]) + } + return patchItem(item, data) + } + + const patchItem = (item, data) => { + let descriptor = Object.getOwnPropertyDescriptors(item) + + // Special case: Plugins have a magic length property which is not enumerable + // e.g. `navigator.plugins[i].length` should always be the length of the assigned mimeTypes + if (itemProto === Plugin.prototype) { + descriptor = { + ...descriptor, + length: { + value: data.__mimeTypes.length, + writable: false, + enumerable: false, + configurable: true // Important to be able to use the ownKeys trap in a Proxy to strip `length` + } + } + } + + // We need to spoof a specific `MimeType` or `Plugin` object + const obj = Object.create(itemProto, descriptor) + + // Virtually all property keys are not enumerable in vanilla + const blacklist = [...Object.keys(data), 'length', 'enabledPlugin'] + return new Proxy(obj, { + ownKeys(target) { + return Reflect.ownKeys(target).filter(k => !blacklist.includes(k)) + }, + getOwnPropertyDescriptor(target, prop) { + if (blacklist.includes(prop)) { + return undefined + } + return Reflect.getOwnPropertyDescriptor(target, prop) + } + }) + } + + const magicArray = [] + + // Loop through our fake data and use that to create convincing entities + dataArray.forEach(data => { + magicArray.push(makeItem(data)) + }) + + // Add direct property access based on types (e.g. `obj['application/pdf']`) afterwards + magicArray.forEach(entry => { + defineProp(magicArray, entry[itemMainProp], entry) + }) + + // This is the best way to fake the type to make sure this is false: `Array.isArray(navigator.mimeTypes)` + const magicArrayObj = Object.create(proto, { + ...Object.getOwnPropertyDescriptors(magicArray), + + // There's one ugly quirk we unfortunately need to take care of: + // The `MimeTypeArray` prototype has an enumerable `length` property, + // but headful Chrome will still skip it when running `Object.getOwnPropertyNames(navigator.mimeTypes)`. + // To strip it we need to make it first `configurable` and can then overlay a Proxy with an `ownKeys` trap. + length: { + value: magicArray.length, + writable: false, + enumerable: false, + configurable: true // Important to be able to use the ownKeys trap in a Proxy to strip `length` + } + }) + + // Generate our functional function mocks :-) + const functionMocks = fns.generateFunctionMocks(utils)( + proto, + itemMainProp, + magicArray + ) + + // We need to overlay our custom object with a JS Proxy + const magicArrayObjProxy = new Proxy(magicArrayObj, { + get(target, key = '') { + // Redirect function calls to our custom proxied versions mocking the vanilla behavior + if (key === 'item') { + return functionMocks.item + } + if (key === 'namedItem') { + return functionMocks.namedItem + } + if (proto === PluginArray.prototype && key === 'refresh') { + return functionMocks.refresh + } + // Everything else can pass through as normal + return utils.cache.Reflect.get(...arguments) + }, + ownKeys(target) { + // There are a couple of quirks where the original property demonstrates "magical" behavior that makes no sense + // This can be witnessed when calling `Object.getOwnPropertyNames(navigator.mimeTypes)` and the absense of `length` + // My guess is that it has to do with the recent change of not allowing data enumeration and this being implemented weirdly + // For that reason we just completely fake the available property names based on our data to match what regular Chrome is doing + // Specific issues when not patching this: `length` property is available, direct `types` props (e.g. `obj['application/pdf']`) are missing + const keys = [] + const typeProps = magicArray.map(mt => mt[itemMainProp]) + typeProps.forEach((_, i) => keys.push(`${i}`)) + typeProps.forEach(propName => keys.push(propName)) + return keys + }, + getOwnPropertyDescriptor(target, prop) { + if (prop === 'length') { + return undefined + } + return Reflect.getOwnPropertyDescriptor(target, prop) + } + }) + + return magicArrayObjProxy + } diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.js new file mode 100644 index 0000000..a6c4263 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.js @@ -0,0 +1,18 @@ +/* global MimeType MimeTypeArray */ + +/** + * Generate a convincing and functional MimeTypeArray (with mime types) from scratch. + * + * Note: This is meant to be run in the context of the page. + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigatorPlugins/mimeTypes + * @see https://developer.mozilla.org/en-US/docs/Web/API/MimeTypeArray + */ +module.exports.generateMimeTypeArray = (utils, fns) => mimeTypesData => { + return fns.generateMagicArray(utils, fns)( + mimeTypesData, + MimeTypeArray.prototype, + MimeType.prototype, + 'type' + ) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.test.js new file mode 100644 index 0000000..23a4c9a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/mimeTypes.test.js @@ -0,0 +1,208 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +test('stealth: will have convincing mimeTypes', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + // We need to help serializing the error or it won't survive being sent back from `page.evaluate` + const catchErr = function(fn, ...args) { + try { + return fn.apply(this, args) + } catch ({ name, message, stack }) { + return { name, message, stack, str: stack.split('\n')[0] } + } + } + + return { + mimeTypes: { + exists: 'mimeTypes' in navigator, + isArray: Array.isArray(navigator.mimeTypes), + length: navigator.mimeTypes.length, + // value: navigator.mimeTypes, + toString: navigator.mimeTypes.toString(), + toStringProto: navigator.mimeTypes.__proto__.toString(), // eslint-disable-line no-proto + protoSymbol: navigator.mimeTypes.__proto__[Symbol.toStringTag], // eslint-disable-line no-proto + // valueOf: navigator.mimeTypes.valueOf(), + valueOfSame: navigator.mimeTypes.valueOf() === navigator.mimeTypes, + json: JSON.stringify(navigator.mimeTypes), + hasPropPush: 'push' in navigator.mimeTypes, + hasPropLength: 'length' in navigator.mimeTypes, + hasLengthDescriptor: !!Object.getOwnPropertyDescriptor( + navigator.mimeTypes, + 'length' + ), + propertyNames: JSON.stringify( + Object.getOwnPropertyNames(navigator.mimeTypes) + ), + lengthInProps: Object.getOwnPropertyNames(navigator.mimeTypes).includes( + 'length' + ), + keys: JSON.stringify(Object.keys(navigator.mimeTypes)), + namedPropsAuthentic: (function() { + navigator.mimeTypes.alice = 'bob' + return navigator.mimeTypes.namedItem('alice') === null // true on chrome + })(), + loopResult: (function() { + let res = '' + for (var bK = 0; bK < window.navigator.mimeTypes.length; bK++) + bK === window.navigator.mimeTypes.length - 1 + ? (res += window.navigator.mimeTypes[bK].type) + : (res += window.navigator.mimeTypes[bK].type + ',') + return res + })() + }, + namedItem: { + exists: 'namedItem' in navigator.mimeTypes, + toString: navigator.mimeTypes.namedItem.toString(), + resultNotFound: navigator.mimeTypes.namedItem('foo'), + resultFound: navigator.mimeTypes // eslint-disable-line no-proto + .namedItem('application/pdf') + .__proto__.toString(), + errors: { + // For whatever weird reason the normal context doesn't suffice, we need to bind this to `navigator.mimeTypes` + noArgs: catchErr.bind(navigator.mimeTypes)( + navigator.mimeTypes.namedItem + ).str, + noStackLeaks: !catchErr + .bind(navigator.mimeTypes)(navigator.mimeTypes.namedItem) + .stack.includes(`.apply`), + protoCall: catchErr.bind(navigator.mimeTypes)( + navigator.mimeTypes.__proto__.namedItem // eslint-disable-line no-proto + ).str + } + }, + item: { + exists: 'item' in navigator.mimeTypes, + toString: navigator.mimeTypes.item.toString(), + resultNotFound: navigator.mimeTypes.item('madness').type, + resultNotFoundNumberString: navigator.mimeTypes.item('777'), + resultEmptyString: navigator.mimeTypes.item('').type, + resultByNumberString: navigator.mimeTypes.item('2').type, + resultByNumberStringZero: navigator.mimeTypes.item('0').type, + resultByNumber: navigator.mimeTypes.item(2).type, + resultNull: navigator.mimeTypes.item(null).type, + resultFound: navigator.mimeTypes.item('application/x-nacl').type, + resultBrackets: navigator.mimeTypes['application/x-pnacl'].type, + errors: { + // For whatever weird reason the normal context doesn't suffice, we need to bind this to `navigator.mimeTypes` + noArgs: catchErr.bind(navigator.mimeTypes)(navigator.mimeTypes.item) + .str, + noStackLeaks: !catchErr + .bind(navigator.mimeTypes)(navigator.mimeTypes.item) + .stack.includes(`.apply`), + protoCall: catchErr.bind(navigator.mimeTypes)( + navigator.mimeTypes.__proto__.item // eslint-disable-line no-proto + ).str + } + } + } + }) + + t.deepEqual(results.mimeTypes, { + exists: true, + hasPropPush: false, + hasPropLength: true, + hasLengthDescriptor: false, + isArray: false, + json: `{"0":{},"1":{},"2":{},"3":{}}`, + keys: `["0","1","2","3"]`, + length: 4, + lengthInProps: false, + loopResult: + 'application/pdf,application/x-google-chrome-pdf,application/x-nacl,application/x-pnacl', + namedPropsAuthentic: true, + propertyNames: `["0","1","2","3","application/pdf","application/x-google-chrome-pdf","application/x-nacl","application/x-pnacl"]`, + protoSymbol: 'MimeTypeArray', + toString: '[object MimeTypeArray]', + toStringProto: '[object MimeTypeArray]', + valueOfSame: true + }) + + t.deepEqual(results.namedItem, { + exists: true, + toString: 'function namedItem() { [native code] }', + resultFound: '[object MimeType]', + resultNotFound: null, + + errors: { + noArgs: + "TypeError: Failed to execute 'namedItem' on 'MimeTypeArray': 1 argument required, but only 0 present.", + noStackLeaks: true, + protoCall: 'TypeError: Illegal invocation' + } + }) + + t.deepEqual(results.item, { + exists: true, + resultBrackets: 'application/x-pnacl', + resultByNumber: 'application/x-nacl', + resultByNumberString: 'application/x-nacl', + resultByNumberStringZero: 'application/pdf', + resultEmptyString: 'application/pdf', + resultFound: 'application/pdf', + resultNotFound: 'application/pdf', + resultNotFoundNumberString: null, + resultNull: 'application/pdf', + toString: 'function item() { [native code] }', + errors: { + noArgs: + "TypeError: Failed to execute 'item' on 'MimeTypeArray': 1 argument required, but only 0 present.", + noStackLeaks: true, + protoCall: 'TypeError: Illegal invocation' + } + }) +}) + +test('stealth: will have convincing mimeType entry', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => ({ + mimeType: { + exists: !!navigator.mimeTypes[0], + toString: navigator.mimeTypes[0].toString(), + toStringProto: navigator.mimeTypes[0].__proto__.toString(), // eslint-disable-line no-proto + protoSymbol: navigator.mimeTypes[0].__proto__[Symbol.toStringTag], // eslint-disable-line no-proto + enabledPlugin: !!navigator.mimeTypes[0].enabledPlugin, // should not throw + enabledPlugin2: !!navigator.mimeTypes['application/pdf'].enabledPlugin, // should not throw + enabledPlugins: !!navigator.mimeTypes[0].enabledPlugins, // regression: should not exist (anymore) + pdfPlugin: JSON.stringify( + navigator.mimeTypes['application/pdf'].enabledPlugin + ), + length: !!navigator.mimeTypes[0].length, // should not throw and return mimeTypes length + lengthDescriptor: !!Object.getOwnPropertyDescriptor( + navigator.mimeTypes[0], + 'length' + ), + json: JSON.stringify(navigator.mimeTypes[0]), + propertyNames: JSON.stringify( + Object.getOwnPropertyNames(navigator.mimeTypes[0]) + ), + nested: + navigator.mimeTypes['application/pdf'].enabledPlugin[0].enabledPlugin[0] + .enabledPlugin[0].enabledPlugin[0].enabledPlugin[0].suffixes + } + })) + t.deepEqual(results.mimeType, { + exists: true, + protoSymbol: 'MimeType', + toString: '[object MimeType]', + toStringProto: '[object MimeType]', + enabledPlugin: true, + enabledPlugin2: true, + enabledPlugins: false, + pdfPlugin: '{"0":{}}', + length: false, + lengthDescriptor: false, + json: '{}', + propertyNames: '[]', + nested: 'pdf' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.js new file mode 100644 index 0000000..48fc483 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.js @@ -0,0 +1,18 @@ +/* global Plugin PluginArray */ + +/** + * Generate a convincing and functional PluginArray (with plugins) from scratch. + * + * Note: This is meant to be run in the context of the page. + * + * @see https://developer.mozilla.org/en-US/docs/Web/API/NavigatorPlugins/plugins + * @see https://developer.mozilla.org/en-US/docs/Web/API/PluginArray + */ +module.exports.generatePluginArray = (utils, fns) => pluginsData => { + return fns.generateMagicArray(utils, fns)( + pluginsData, + PluginArray.prototype, + Plugin.prototype, + 'name' + ) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.test.js new file mode 100644 index 0000000..119be59 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/plugins.test.js @@ -0,0 +1,184 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') + +test('stealth: will have convincing plugins', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + // We need to help serializing the error or it won't survive being sent back from `page.evaluate` + const catchErr = function(fn, ...args) { + try { + return fn.apply(this, args) + } catch ({ name, message, stack }) { + return { name, message, stack, str: stack.split('\n')[0] } + } + } + + return { + plugins: { + exists: 'plugins' in navigator, + isArray: Array.isArray(navigator.plugins), + length: navigator.plugins.length, + // value: navigator.plugins, + toString: navigator.plugins.toString(), + toStringProto: navigator.plugins.__proto__.toString(), // eslint-disable-line no-proto + protoSymbol: navigator.plugins.__proto__[Symbol.toStringTag], // eslint-disable-line no-proto + // valueOf: navigator.plugins.valueOf(), + valueOfSame: navigator.plugins.valueOf() === navigator.plugins, + json: JSON.stringify(navigator.plugins), + hasPropPush: 'push' in navigator.plugins, + hasPropLength: 'length' in navigator.plugins, + hasLengthDescriptor: !!Object.getOwnPropertyDescriptor( + navigator.plugins, + 'length' + ), + propertyNames: JSON.stringify( + Object.getOwnPropertyNames(navigator.plugins) + ), + lengthInProps: Object.getOwnPropertyNames(navigator.plugins).includes( + 'length' + ), + keys: JSON.stringify(Object.keys(navigator.plugins)), + loopResult: [...navigator.plugins].map(p => p.name).join(',') + }, + namedItem: { + exists: 'namedItem' in navigator.plugins, + toString: navigator.plugins.namedItem.toString(), + resultNotFound: navigator.plugins.namedItem('foo'), + resultFound: navigator.plugins // eslint-disable-line no-proto + .namedItem('Chrome PDF Viewer') + .__proto__.toString(), + errors: { + // For whatever weird reason the normal context doesn't suffice, we need to bind this to `navigator.plugins` + noArgs: catchErr.bind(navigator.plugins)(navigator.plugins.namedItem) + .str, + noStackLeaks: !catchErr + .bind(navigator.plugins)(navigator.plugins.namedItem) + .stack.includes(`.apply`), + protoCall: catchErr.bind(navigator.plugins)( + navigator.plugins.__proto__.namedItem // eslint-disable-line no-proto + ).str + } + }, + item: { + exists: 'item' in navigator.plugins, + toString: navigator.plugins.item.toString(), + resultNotFound: navigator.plugins.item('madness').name, + resultNotFoundNumberString: navigator.plugins.item('777'), + resultEmptyString: navigator.plugins.item('').name, + resultByNumberString: navigator.plugins.item('2').name, + resultByNumberStringZero: navigator.plugins.item('0').name, + resultByNumber: navigator.plugins.item(2).name, + resultNull: navigator.plugins.item(null).name, + resultFound: navigator.plugins.item('application/x-nacl').name, + errors: { + // For whatever weird reason the normal context doesn't suffice, we need to bind this to `navigator.plugins` + noArgs: catchErr.bind(navigator.plugins)(navigator.plugins.item).str, + noStackLeaks: !catchErr + .bind(navigator.plugins)(navigator.plugins.item) + .stack.includes(`.apply`), + protoCall: catchErr.bind(navigator.plugins)( + navigator.plugins.__proto__.item // eslint-disable-line no-proto + ).str + } + } + } + }) + + t.deepEqual(results.plugins, { + exists: true, + hasPropLength: true, + hasLengthDescriptor: false, + hasPropPush: false, + isArray: false, + json: `{"0":{"0":{}},"1":{"0":{}},"2":{"0":{},"1":{}}}`, + keys: `["0","1","2"]`, + length: 3, + lengthInProps: false, + loopResult: 'Chrome PDF Plugin,Chrome PDF Viewer,Native Client', + propertyNames: `["0","1","2","Chrome PDF Plugin","Chrome PDF Viewer","Native Client"]`, + protoSymbol: 'PluginArray', + toString: '[object PluginArray]', + toStringProto: '[object PluginArray]', + valueOfSame: true + }) + + t.deepEqual(results.namedItem, { + exists: true, + toString: 'function namedItem() { [native code] }', + resultFound: '[object Plugin]', + resultNotFound: null, + + errors: { + noArgs: + "TypeError: Failed to execute 'namedItem' on 'PluginArray': 1 argument required, but only 0 present.", + noStackLeaks: true, + protoCall: 'TypeError: Illegal invocation' + } + }) + + t.deepEqual(results.item, { + exists: true, + resultByNumber: 'Native Client', + resultByNumberString: 'Native Client', + resultByNumberStringZero: 'Chrome PDF Plugin', + resultEmptyString: 'Chrome PDF Plugin', + resultFound: 'Chrome PDF Plugin', + resultNotFound: 'Chrome PDF Plugin', + resultNotFoundNumberString: null, + resultNull: 'Chrome PDF Plugin', + toString: 'function item() { [native code] }', + errors: { + noArgs: + "TypeError: Failed to execute 'item' on 'PluginArray': 1 argument required, but only 0 present.", + noStackLeaks: true, + protoCall: 'TypeError: Illegal invocation' + } + }) +}) + +test('stealth: will have convincing plugin entry', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => ({ + plugins: { + exists: !!navigator.plugins[0], + toString: navigator.plugins[0].toString(), + toStringProto: navigator.plugins[0].__proto__.toString(), // eslint-disable-line no-proto + protoSymbol: navigator.plugins[0].__proto__[Symbol.toStringTag], // eslint-disable-line no-proto + length: navigator.plugins[0].length, // should not throw and return mimeTypes length + lengthDescriptor: Object.getOwnPropertyDescriptor( + navigator.plugins[0], + 'length' + ) + }, + plugin: { + mtIndex: !!navigator.plugins[0][0], // mimeType should be accessible through index + mtNamed: !!navigator.plugins[0]['application/x-google-chrome-pdf'], // mimeType should be accessible through name + json: JSON.stringify(navigator.plugins[0]), + propertyNames: JSON.stringify( + Object.getOwnPropertyNames(navigator.plugins[0]) + ) + } + })) + t.deepEqual(results.plugins, { + exists: true, + protoSymbol: 'Plugin', + toString: '[object Plugin]', + toStringProto: '[object Plugin]', + length: 1 + }) + t.deepEqual(results.plugin, { + mtIndex: true, + mtNamed: true, + json: '{"0":{}}', + propertyNames: '["0","application/x-google-chrome-pdf"]' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/readme.md new file mode 100644 index 0000000..feb9636 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/readme.md @@ -0,0 +1,25 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/navigator.plugins/index.js#L26-L88) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +In headless mode `navigator.mimeTypes` and `navigator.plugins` are empty. +This plugin emulates both of these with functional mocks to match regular headful Chrome. + +Note: mimeTypes and plugins cross-reference each other, so it makes sense to do them at the same time. + +- **See: ** +- **See: ** +- **See: ** +- **See: ** + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.js new file mode 100644 index 0000000..7f7e153 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.js @@ -0,0 +1,66 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * By default puppeteer will have a fixed `navigator.vendor` property. + * + * This plugin makes it possible to change this property. + * + * @example + * const puppeteer = require("puppeteer-extra") + * + * const StealthPlugin = require("puppeteer-extra-plugin-stealth") + * const stealth = StealthPlugin() + * // Remove this specific stealth plugin from the default set + * stealth.enabledEvasions.delete("navigator.vendor") + * puppeteer.use(stealth) + * + * // Stealth plugins are just regular `puppeteer-extra` plugins and can be added as such + * const NavigatorVendorPlugin = require("puppeteer-extra-plugin-stealth/evasions/navigator.vendor") + * const nvp = NavigatorVendorPlugin({ vendor: 'Apple Computer, Inc.' }) // Custom vendor + * puppeteer.use(nvp) + * + * @param {Object} [opts] - Options + * @param {string} [opts.vendor] - The vendor to use in `navigator.vendor` (default: `Google Inc.`) + * + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.vendor' + } + + get defaults() { + return { + vendor: 'Google Inc.' + } + } + + async onPageCreated(page) { + this.debug('onPageCreated', { + opts: this.opts + }) + + await withUtils(page).evaluateOnNewDocument( + (utils, { opts }) => { + utils.replaceGetterWithProxy( + Object.getPrototypeOf(navigator), + 'vendor', + utils.makeHandler().getterValue(opts.vendor) + ) + }, + { + opts: this.opts + } + ) + } // onPageCreated +} + +const defaultExport = opts => new Plugin(opts) +module.exports = defaultExport diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.test.js new file mode 100644 index 0000000..0b3dccd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.test.js @@ -0,0 +1,69 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') +const Plugin = require('.') + +test('vanilla: navigator.vendor is always Google Inc.', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const vendor = await page.evaluate(() => navigator.vendor) + t.is(vendor, 'Google Inc.') +}) + +test('stealth: navigator.vendor set to custom value', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ vendor: 'Apple Computer, Inc.' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const vendor = await page.evaluate(() => navigator.vendor) + t.is(vendor, 'Apple Computer, Inc.') +}) + +test('stealth: will not leak modifications', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate( + () => Object.getOwnPropertyDescriptor(navigator, 'vendor') // Must be undefined if native + ) + t.is(test1, undefined) + + const test2 = await page.evaluate( + () => Object.getOwnPropertyNames(navigator) // Must be an empty array if native + ) + t.false(test2.includes('vendor')) +}) + +test('stealth: does patch getters properly', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const results = await page.evaluate(() => { + const hasInvocationError = (() => { + try { + // eslint-disable-next-line dot-notation + Object['seal'](Object.getPrototypeOf(navigator)['vendor']) + return false + } catch (err) { + return true + } + })() + return { + hasInvocationError, + toString: Object.getOwnPropertyDescriptor( + Object.getPrototypeOf(navigator), + 'vendor' + ).get.toString() + } + }) + + t.deepEqual(results, { + hasInvocationError: true, + toString: 'function get vendor() { [native code] }' + }) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/readme.md new file mode 100644 index 0000000..c5e5277 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/readme.md @@ -0,0 +1,37 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/navigator.vendor/index.js#L28-L55) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.vendor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The vendor to use in `navigator.vendor` (default: `Google Inc.`) + +**Extends: PuppeteerExtraPlugin** + +By default puppeteer will have a fixed `navigator.vendor` property. + +This plugin makes it possible to change this property. + +Example: + +```javascript +const puppeteer = require('puppeteer-extra') + +const StealthPlugin = require('puppeteer-extra-plugin-stealth') +const stealth = StealthPlugin() +// Remove this specific stealth plugin from the default set +stealth.enabledEvasions.delete('navigator.vendor') +puppeteer.use(stealth) + +// Stealth plugins are just regular `puppeteer-extra` plugins and can be added as such +const NavigatorVendorPlugin = require('puppeteer-extra-plugin-stealth/evasions/navigator.vendor') +const nvp = NavigatorVendorPlugin({ vendor: 'Apple Computer, Inc.' }) // Custom vendor +puppeteer.use(nvp) +``` + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js new file mode 100644 index 0000000..cb9c8a2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js @@ -0,0 +1,48 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Pass the Webdriver Test. + * Will delete `navigator.webdriver` property. + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/navigator.webdriver' + } + + async onPageCreated(page) { + await page.evaluateOnNewDocument(() => { + if (navigator.webdriver === false) { + // Post Chrome 89.0.4339.0 and already good + } else if (navigator.webdriver === undefined) { + // Pre Chrome 89.0.4339.0 and already good + } else { + // Pre Chrome 88.0.4291.0 and needs patching + delete Object.getPrototypeOf(navigator).webdriver + } + }) + } + + // Post Chrome 88.0.4291.0 + // Note: this will add an infobar to Chrome with a warning that an unsupported flag is set + // To remove this bar on Linux, run: mkdir -p /etc/opt/chrome/policies/managed && echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' > /etc/opt/chrome/policies/managed/managed_policies.json + async beforeLaunch(options) { + // If disable-blink-features is already passed, append the AutomationControlled switch + const idx = options.args.findIndex((arg) => arg.startsWith('--disable-blink-features=')); + if (idx !== -1) { + const arg = options.args[idx]; + options.args[idx] = `${arg},AutomationControlled`; + } else { + options.args.push('--disable-blink-features=AutomationControlled'); + } + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.test.js new file mode 100644 index 0000000..f147757 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.test.js @@ -0,0 +1,44 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra, compareLooseVersionStrings } = require('../../test/util') +const Plugin = require('.') + +function getExpectedValue(looseVersionString) { + if (compareLooseVersionStrings(looseVersionString, '89.0.4339.0') >= 0) { + return false + } else { + return undefined + } +} + +test('vanilla: navigator.webdriver is defined', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const data = await page.evaluate(() => navigator.webdriver) + t.is(data, true) +}) + +test('stealth: navigator.webdriver is undefined', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const data = await page.evaluate(() => navigator.webdriver) + // XXX: launch this test multiple times with browsers of different versions? + t.is(data, getExpectedValue(await browser.version())) +}) + +// https://github.com/berstend/puppeteer-extra/pull/130 +test('stealth: regression: wont kill other navigator methods', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + try { + const data = await page.evaluate(() => navigator.javaEnabled()) + t.is(data, false) + } catch (err) { + t.is(err, undefined) + } +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/readme.md new file mode 100644 index 0000000..e027601 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/readme.md @@ -0,0 +1,18 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/navigator.webdriver/index.js#L9-L23) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Pass the Webdriver Test. +Will delete `navigator.webdriver` property. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/readme.md new file mode 100644 index 0000000..0de1e2e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/readme.md @@ -0,0 +1,13 @@ +# puppeteer-extra-plugin-stealth/evasions + +Various detection evasion plugins for `puppeteer-extra-plugin-stealth`. + +You can bypass the main module and require specific evasion plugins yourself, if you wish to do so: + +```es6 +puppeteer.use( + require('puppeteer-extra-plugin-stealth/evasions/console.debug')() +) +``` + +If you want to add a new evasion technique I suggest you look at the [template](./_template/) to kickstart things. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/_fixtures/test.html b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/_fixtures/test.html new file mode 100644 index 0000000..89b4c0f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/_fixtures/test.html @@ -0,0 +1,37 @@ + + + + + Page Title + + + +

Please use `document.querySelector`..

+ + + + diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js new file mode 100644 index 0000000..cebe4f4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js @@ -0,0 +1,83 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Strip sourceURL from scripts injected by puppeteer. + * It can be used to identify the presence of pptr via stacktraces. + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/sourceurl' + } + + async onPageCreated(page) { + const client = + page && typeof page._client === 'function' ? page._client() : page._client + if (!client) { + this.debug('Warning, missing properties to intercept CDP.', { page }) + return + } + + // Intercept CDP commands and strip identifying and unnecessary sourceURL + // https://github.com/puppeteer/puppeteer/blob/9b3005c105995cd267fdc7fb95b78aceab82cf0e/new-docs/puppeteer.cdpsession.md + const debug = this.debug + client.send = (function(originalMethod, context) { + return async function() { + const [method, paramArgs] = arguments || [] + const next = async () => { + try { + return await originalMethod.apply(context, [method, paramArgs]) + } catch (error) { + // This seems to happen sometimes when redirects cause other outstanding requests to be cut short + if ( + error instanceof Error && + error.message.includes( + `Protocol error (Network.getResponseBody): No resource with given identifier found` + ) + ) { + debug( + `Caught and ignored an error about a missing network resource.`, + { error } + ) + } else { + throw error + } + } + } + + if (!method || !paramArgs) { + return next() + } + + // To find the methods/props in question check `_evaluateInternal` at: + // https://github.com/puppeteer/puppeteer/blob/main/src/common/ExecutionContext.ts#L186 + const methodsToPatch = { + 'Runtime.evaluate': 'expression', + 'Runtime.callFunctionOn': 'functionDeclaration' + } + const SOURCE_URL_SUFFIX = + '//# sourceURL=__puppeteer_evaluation_script__' + + if (!methodsToPatch[method] || !paramArgs[methodsToPatch[method]]) { + return next() + } + + debug('Stripping sourceURL', { method }) + paramArgs[methodsToPatch[method]] = paramArgs[ + methodsToPatch[method] + ].replace(SOURCE_URL_SUFFIX, '') + + return next() + } + })(client.send, client) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.test.js new file mode 100644 index 0000000..ff05aeb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.test.js @@ -0,0 +1,54 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') +const Plugin = require('.') + +const TEST_HTML_FILE = require('path').join(__dirname, './_fixtures/test.html') + +test('vanilla: sourceurl is leaking', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('file://' + TEST_HTML_FILE, { waitUntil: 'load' }) + + // Trigger test + await page.$('title') + + const result = await page.evaluate( + () => document.querySelector('#result').innerText + ) + t.is(result, 'FAIL') + + const result2 = await page.evaluate(() => { + try { + Function.prototype.toString.apply({}) + } catch (err) { + return err.stack + } + }) + t.true(result2.includes('__puppeteer_evaluation_script')) +}) + +test('stealth: sourceurl is not leaking', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + await page.goto('file://' + TEST_HTML_FILE, { waitUntil: 'load' }) + + // Trigger test + await page.$('title') + + const result = await page.evaluate( + () => document.querySelector('#result').innerText + ) + t.is(result, 'PASS') + + const result2 = await page.evaluate(() => { + try { + Function.prototype.toString.apply({}) + } catch (err) { + return err.stack + } + }) + t.false(result2.includes('__puppeteer_evaluation_script')) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/readme.md new file mode 100644 index 0000000..1dcae63 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/sourceurl/readme.md @@ -0,0 +1,18 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/sourceurl/index.js#L9-L58) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Strip sourceURL from scripts injected by puppeteer. +It can be used to identify the presence of pptr via stacktraces. + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.js new file mode 100644 index 0000000..0c2d386 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.js @@ -0,0 +1,208 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Fixes the UserAgent info (composed of UA string, Accept-Language, Platform, and UA hints). + * + * If you don't provide any values this plugin will default to using the regular UserAgent string (while stripping the headless part). + * Default language is set to "en-US,en", the other settings match the UserAgent string. + * If you are running on Linux, it will mask the settins to look like Windows. This behavior can be disabled with the `maskLinux` option. + * + * By default puppeteer will not set a `Accept-Language` header in headless: + * It's (theoretically) possible to fix that using either `page.setExtraHTTPHeaders` or a `--lang` launch arg. + * Unfortunately `page.setExtraHTTPHeaders` will lowercase everything and launch args are not always available. :) + * + * In addition, the `navigator.platform` property is always set to the host value, e.g. `Linux` which makes detection very easy. + * + * Note: You cannot use the regular `page.setUserAgent()` puppeteer call in your code, + * as it will reset the language and platform values you set with this plugin. + * + * @example + * const puppeteer = require("puppeteer-extra") + * + * const StealthPlugin = require("puppeteer-extra-plugin-stealth") + * const stealth = StealthPlugin() + * // Remove this specific stealth plugin from the default set + * stealth.enabledEvasions.delete("user-agent-override") + * puppeteer.use(stealth) + * + * // Stealth plugins are just regular `puppeteer-extra` plugins and can be added as such + * const UserAgentOverride = require("puppeteer-extra-plugin-stealth/evasions/user-agent-override") + * // Define custom UA and locale + * const ua = UserAgentOverride({ userAgent: "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)", locale: "de-DE,de" }) + * puppeteer.use(ua) + * + * @param {Object} [opts] - Options + * @param {string} [opts.userAgent] - The user agent to use (default: browser.userAgent()) + * @param {string} [opts.locale] - The locale to use in `Accept-Language` header and in `navigator.languages` (default: `en-US,en`) + * @param {boolean} [opts.maskLinux] - Wether to hide Linux as platform in the user agent or not - true by default + * + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + + this._headless = false + } + + get name() { + return 'stealth/evasions/user-agent-override' + } + + get dependencies() { + return new Set(['user-preferences']) + } + + get defaults() { + return { + userAgent: null, + locale: 'en-US,en', + maskLinux: true + } + } + + async onPageCreated(page) { + // Determine the full user agent string, strip the "Headless" part + let ua = + this.opts.userAgent || + (await page.browser().userAgent()).replace('HeadlessChrome/', 'Chrome/') + + if ( + this.opts.maskLinux && + ua.includes('Linux') && + !ua.includes('Android') // Skip Android user agents since they also contain Linux + ) { + ua = ua.replace(/\(([^)]+)\)/, '(Windows NT 10.0; Win64; x64)') // Replace the first part in parentheses with Windows data + } + + // Full version number from Chrome + const uaVersion = ua.includes('Chrome/') + ? ua.match(/Chrome\/([\d|.]+)/)[1] + : (await page.browser().version()).match(/\/([\d|.]+)/)[1] + + // Get platform identifier (short or long version) + const _getPlatform = (extended = false) => { + if (ua.includes('Mac OS X')) { + return extended ? 'Mac OS X' : 'MacIntel' + } else if (ua.includes('Android')) { + return 'Android' + } else if (ua.includes('Linux')) { + return 'Linux' + } else { + return extended ? 'Windows' : 'Win32' + } + } + + // Source in C++: https://source.chromium.org/chromium/chromium/src/+/master:components/embedder_support/user_agent_utils.cc;l=55-100 + const _getBrands = () => { + const seed = uaVersion.split('.')[0] // the major version number of Chrome + + const order = [ + [0, 1, 2], + [0, 2, 1], + [1, 0, 2], + [1, 2, 0], + [2, 0, 1], + [2, 1, 0] + ][seed % 6] + const escapedChars = [' ', ' ', ';'] + + const greaseyBrand = `${escapedChars[order[0]]}Not${ + escapedChars[order[1]] + }A${escapedChars[order[2]]}Brand` + + const greasedBrandVersionList = [] + greasedBrandVersionList[order[0]] = { + brand: greaseyBrand, + version: '99' + } + greasedBrandVersionList[order[1]] = { + brand: 'Chromium', + version: seed + } + greasedBrandVersionList[order[2]] = { + brand: 'Google Chrome', + version: seed + } + + return greasedBrandVersionList + } + + // Return OS version + const _getPlatformVersion = () => { + if (ua.includes('Mac OS X ')) { + return ua.match(/Mac OS X ([^)]+)/)[1] + } else if (ua.includes('Android ')) { + return ua.match(/Android ([^;]+)/)[1] + } else if (ua.includes('Windows ')) { + return ua.match(/Windows .*?([\d|.]+);?/)[1] + } else { + return '' + } + } + + // Get architecture, this seems to be empty on mobile and x86 on desktop + const _getPlatformArch = () => (_getMobile() ? '' : 'x86') + + // Return the Android model, empty on desktop + const _getPlatformModel = () => + _getMobile() ? ua.match(/Android.*?;\s([^)]+)/)[1] : '' + + const _getMobile = () => ua.includes('Android') + + const override = { + userAgent: ua, + platform: _getPlatform(), + userAgentMetadata: { + brands: _getBrands(), + fullVersion: uaVersion, + platform: _getPlatform(true), + platformVersion: _getPlatformVersion(), + architecture: _getPlatformArch(), + model: _getPlatformModel(), + mobile: _getMobile() + } + } + + // In case of headless, override the acceptLanguage in CDP. + // This is not preferred, as it messed up the header order. + // On headful, we set the user preference language setting instead. + if (this._headless) { + override.acceptLanguage = this.opts.locale || 'en-US,en' + } + + this.debug('onPageCreated - Will set these user agent options', { + override, + opts: this.opts + }) + + const client = + typeof page._client === 'function' ? page._client() : page._client + client.send('Network.setUserAgentOverride', override) + } + + async beforeLaunch(options) { + // Check if launched headless + this._headless = options.headless + } + + async beforeConnect() { + // Treat browsers using connect() as headless browsers + this._headless = true + } + + get data() { + return [ + { + name: 'userPreferences', + value: { + intl: { accept_languages: this.opts.locale || 'en-US,en' } + } + } + ] + } +} + +const defaultExport = opts => new Plugin(opts) +module.exports = defaultExport diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.test.js new file mode 100644 index 0000000..f528007 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.test.js @@ -0,0 +1,324 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('../../test/util') +const Plugin = require('.') + +// Fixed since 2.1.1? +// test('vanilla: Accept-Language header is missing', async t => { +// const browser = await vanillaPuppeteer.launch({ headless: true }) +// const page = await browser.newPage() +// await page.goto('http://httpbin.org/headers') + +// const content = await page.content() +// t.true(content.includes(`"User-Agent"`)) +// t.false(content.includes(`"Accept-Language"`)) +// }) + +test('vanilla: User-Agent header contains HeadlessChrome', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('http://httpbin.org/headers') + + const content = await page.content() + t.true(content.includes(`"User-Agent"`)) + t.true(content.includes(`HeadlessChrome`)) +}) + +test('vanilla: navigator.languages is always en-US', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + const lang = await page.evaluate(() => navigator.languages) + t.true(lang.length === 1 && lang[0] === 'en-US') +}) + +test('vanilla: navigator.platform set to host platform', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const platform = await page.evaluate(() => navigator.platform) + switch (process.platform) { + case 'linux': + t.true(platform.includes('Linux')) // TravisCI + break + case 'darwin': + t.true(platform === 'MacIntel') + break + case 'win32': + t.true(platform === 'Win32') + break + default: + t.true(platform === process.platform) + } +}) + +test('stealth: Accept-Language header with default locale', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('http://httpbin.org/headers') + + const content = await page.content() + t.true(content.includes(`"User-Agent"`)) + t.true(content.includes(`"Accept-Language": "en-US,en;q=0.9"`)) +}) + +test('stealth: Accept-Language header with optional locale', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ locale: 'de-DE,de' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('http://httpbin.org/headers') + + const content = await page.content() + t.true(content.includes(`"User-Agent"`)) + t.true(content.includes(`"Accept-Language": "de-DE,de;q=0.9"`)) +}) + +test('stealth: User-Agent header does not contain HeadlessChrome', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('http://httpbin.org/headers') + + const content = await page.content() + t.true(content.includes(`"User-Agent"`)) + t.false(content.includes(`HeadlessChrome`)) +}) + +test('stealth: User-Agent header with custom userAgent', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ userAgent: 'MyFunkyUA/1.0' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('http://httpbin.org/headers') + + const content = await page.content() + t.true(content.includes(`"User-Agent": "MyFunkyUA/1.0"`)) +}) + +test('stealth: navigator.languages with default locale', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const lang = await page.evaluate(() => navigator.languages) + t.true(lang.length === 2 && lang[0] === 'en-US' && lang[1] === 'en') +}) + +test('stealth: navigator.languages with custom locale', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ locale: 'de-DE,de' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const langs = await page.evaluate(() => navigator.languages) + t.deepEqual(langs, ['de-DE', 'de']) + const lang = await page.evaluate(() => navigator.language) + t.deepEqual(lang, 'de-DE') +}) + +test('stealth: navigator.platform with maskLinux true (default)', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + userAgent: + 'Mozilla/5.0 (X11; Ubuntu; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.9.9999.99 Safari/537.36' + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const platform = await page.evaluate(() => navigator.platform) + t.true(platform === 'Win32') +}) + +test('stealth: navigator.platform with maskLinux false', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + userAgent: + 'Mozilla/5.0 (X11; Ubuntu; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.9.9999.99 Safari/537.36', + maskLinux: false + }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const platform = await page.evaluate(() => navigator.platform) + t.true(platform === 'Linux') +}) + +const _testUAHint = async (userAgent, locale) => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ userAgent, locale }) + ) + + const browser = await puppeteer.launch({ + headless: false, // only works on headful + args: ['--enable-features=UserAgentClientHint'] + }) + + const majorVersion = parseInt( + (await browser.version()).match(/\/([^\.]+)/)[1] + ) + if (majorVersion < 88) { + return null // Skip test on browsers that don't support UA hints + } + + const page = await browser.newPage() + + await page.goto('https://headers.cf/headers/?format=raw') + + return page +} + +test('stealth: test if UA hints are correctly set - Windows 10', async t => { + const page = await _testUAHint( + 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.9999.99 Safari/537.36', + 'en-AU' + ) + if (!page) { + t.true(true) // skip + return + } + const firstLoad = await page.content() + t.true( + firstLoad.includes( + `sec-ch-ua: "Google Chrome";v="99", " Not;A Brand";v="99", "Chromium";v="99"` + ) + ) + t.true(firstLoad.includes(`Accept-Language: en-AU`)) + + await page.reload() + const secondLoad = await page.content() + if (secondLoad.includes('sec-ch-ua-full-version')) { + t.true(secondLoad.includes('sec-ch-ua-mobile: ?0')) + t.true(secondLoad.includes('sec-ch-ua-full-version: "99.0.9999.99"')) + t.true(secondLoad.includes('sec-ch-ua-arch: "x86"')) + t.true(secondLoad.includes('sec-ch-ua-platform: "Windows"')) + t.true(secondLoad.includes('sec-ch-ua-platform-version: "10.0"')) + t.true(secondLoad.includes('sec-ch-ua-model: ""')) + } +}) + +test('stealth: test if UA hints are correctly set - macOS 11', async t => { + const page = await _testUAHint( + 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.9999.99 Safari/537.36', + 'de-DE' + ) + if (!page) { + t.true(true) // skip + return + } + const firstLoad = await page.content() + t.true( + firstLoad.includes( + `sec-ch-ua: "Google Chrome";v="99", " Not;A Brand";v="99", "Chromium";v="99"` + ) + ) + t.true(firstLoad.includes(`Accept-Language: de-DE`)) + + await page.reload() + const secondLoad = await page.content() + if (secondLoad.includes('sec-ch-ua-full-version')) { + t.true(secondLoad.includes('sec-ch-ua-mobile: ?0')) + t.true(secondLoad.includes('sec-ch-ua-full-version: "99.0.9999.99"')) + t.true(secondLoad.includes('sec-ch-ua-arch: "x86"')) + t.true(secondLoad.includes('sec-ch-ua-platform: "Mac OS X"')) + t.true(secondLoad.includes('sec-ch-ua-platform-version: "11_1_0"')) + t.true(secondLoad.includes('sec-ch-ua-model: ""')) + } +}) + +test('stealth: test if UA hints are correctly set - Android 10', async t => { + const page = await _testUAHint( + 'Mozilla/5.0 (Linux; Android 10; SM-P205) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.9999.99 Safari/537.36', + 'nl-NL' + ) + if (!page) { + t.true(true) // skip + return + } + const firstLoad = await page.content() + t.true( + firstLoad.includes( + `sec-ch-ua: "Google Chrome";v="99", " Not;A Brand";v="99", "Chromium";v="99"` + ) + ) + t.true(firstLoad.includes(`Accept-Language: nl-NL`)) + + await page.reload() + const secondLoad = await page.content() + + if (secondLoad.includes('sec-ch-ua-full-version')) { + t.true(secondLoad.includes('sec-ch-ua-mobile: ?1')) + t.true(secondLoad.includes('sec-ch-ua-full-version: "99.0.9999.99"')) + t.true(secondLoad.includes('sec-ch-ua-arch: ""')) + t.true(secondLoad.includes('sec-ch-ua-platform: "Android"')) + t.true(secondLoad.includes('sec-ch-ua-platform-version: "10"')) + t.true(secondLoad.includes('sec-ch-ua-model: "SM-P205"')) + } +}) + +async function userAgentData() { + if (!('userAgentData' in navigator)) { + return undefined + } + + // https://wicg.github.io/ua-client-hints/#getHighEntropyValues + const UADataProps = ['brands', 'mobile'] + const UADataValues = [ + 'architecture', // "arm" + 'bitness', // "64" + 'model', // "X644GTM" + 'platform', // "PhoneOS" + 'platformVersion', // "10A" + 'uaFullVersion' // "73.32.AGX.5" + ] + + const highEntropy = await navigator.userAgentData.getHighEntropyValues( + UADataValues + ) + + const result = { + ...highEntropy, + ...Object.fromEntries(UADataProps.map(k => [k, navigator.userAgentData[k]])) + } + return result +} + +test('stealth: test if UA hints are correctly set - Windows 10 Generic', async t => { + const userAgent = + 'Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.9999.99 Safari/537.36' + const locale = 'en-AU' + + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ + userAgent, + locale + }) + ) + const browser = await puppeteer.launch({ + headless: true + }) + + const majorVersion = parseInt( + (await browser.version()).match(/\/([^\.]+)/)[1] + ) + if (majorVersion < 90) { + t.truthy('foo') + console.log('Skipping test, browser version too old', majorVersion) + return + } + const page = await browser.newPage() + await page.goto('https://example.com') // secure context + + const results = await page.evaluate(userAgentData) + t.is(results.platform, 'Windows') + t.is(results.platformVersion, '10.0') + t.is(results.uaFullVersion, '99.0.9999.99') + + const language = await page.evaluate(() => navigator.language) + t.is(language, locale) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/readme.md new file mode 100644 index 0000000..90a2d9a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/user-agent-override/readme.md @@ -0,0 +1,54 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/ab0047d1af7dc38412744abdb61bcfc35c42dc34/packages/puppeteer-extra-plugin-stealth/evasions/user-agent-override/index.js#L42-L203) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.userAgent` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The user agent to use (default: browser.userAgent()) + - `opts.locale` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The locale to use in `Accept-Language` header and in `navigator.languages` (default: `en-US,en`) + - `opts.maskLinux` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?** Wether to hide Linux as platform in the user agent or not - true by default + +**Extends: PuppeteerExtraPlugin** + +Fixes the UserAgent info (composed of UA string, Accept-Language, Platform, and UA hints). + +If you don't provide any values this plugin will default to using the regular UserAgent string (while stripping the headless part). +Default language is set to "en-US,en", the other settings match the UserAgent string. +If you are running on Linux, it will mask the settins to look like Windows. This behavior can be disabled with the `maskLinux` option. + +By default puppeteer will not set a `Accept-Language` header in headless: +It's (theoretically) possible to fix that using either `page.setExtraHTTPHeaders` or a `--lang` launch arg. +Unfortunately `page.setExtraHTTPHeaders` will lowercase everything and launch args are not always available. :) + +In addition, the `navigator.platform` property is always set to the host value, e.g. `Linux` which makes detection very easy. + +Note: You cannot use the regular `page.setUserAgent()` puppeteer call in your code, +as it will reset the language and platform values you set with this plugin. + +Example: + +```javascript +const puppeteer = require('puppeteer-extra') + +const StealthPlugin = require('puppeteer-extra-plugin-stealth') +const stealth = StealthPlugin() +// Remove this specific stealth plugin from the default set +stealth.enabledEvasions.delete('user-agent-override') +puppeteer.use(stealth) + +// Stealth plugins are just regular `puppeteer-extra` plugins and can be added as such +const UserAgentOverride = require('puppeteer-extra-plugin-stealth/evasions/user-agent-override') +// Define custom UA and locale +const ua = UserAgentOverride({ + userAgent: 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)', + locale: 'de-DE,de' +}) +puppeteer.use(ua) +``` + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js new file mode 100644 index 0000000..626d9dd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js @@ -0,0 +1,59 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +const withUtils = require('../_utils/withUtils') + +/** + * Fix WebGL Vendor/Renderer being set to Google in headless mode + * + * Example data (Apple Retina MBP 13): {vendor: "Intel Inc.", renderer: "Intel(R) Iris(TM) Graphics 6100"} + * + * @param {Object} [opts] - Options + * @param {string} [opts.vendor] - The vendor string to use (default: `Intel Inc.`) + * @param {string} [opts.renderer] - The renderer string (default: `Intel Iris OpenGL Engine`) + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/webgl.vendor' + } + + /* global WebGLRenderingContext WebGL2RenderingContext */ + async onPageCreated(page) { + await withUtils(page).evaluateOnNewDocument((utils, opts) => { + const getParameterProxyHandler = { + apply: function(target, ctx, args) { + const param = (args || [])[0] + const result = utils.cache.Reflect.apply(target, ctx, args) + // UNMASKED_VENDOR_WEBGL + if (param === 37445) { + return opts.vendor || 'Intel Inc.' // default in headless: Google Inc. + } + // UNMASKED_RENDERER_WEBGL + if (param === 37446) { + return opts.renderer || 'Intel Iris OpenGL Engine' // default in headless: Google SwiftShader + } + return result + } + } + + // There's more than one WebGL rendering context + // https://developer.mozilla.org/en-US/docs/Web/API/WebGL2RenderingContext#Browser_compatibility + // To find out the original values here: Object.getOwnPropertyDescriptors(WebGLRenderingContext.prototype.getParameter) + const addProxy = (obj, propName) => { + utils.replaceWithProxy(obj, propName, getParameterProxyHandler) + } + // For whatever weird reason loops don't play nice with Object.defineProperty, here's the next best thing: + addProxy(WebGLRenderingContext.prototype, 'getParameter') + addProxy(WebGL2RenderingContext.prototype, 'getParameter') + }, this.opts) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.test.js new file mode 100644 index 0000000..7e0a01e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.test.js @@ -0,0 +1,222 @@ +const test = require('ava') + +const { + getVanillaFingerPrint, + getStealthFingerPrint +} = require('../../test/util') +const { vanillaPuppeteer, addExtra } = require('../../test/util') + +const Plugin = require('.') +const { errors } = require('puppeteer') + +// FIXME: This changed in more recent chrome versions +// test('vanilla: videoCard is Google Inc', async t => { +// const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line +// const { videoCard } = await getVanillaFingerPrint(pageFn) +// t.deepEqual(videoCard, ['Google Inc.', 'Google SwiftShader']) +// }) + +test('stealth: videoCard is Intel Inc', async t => { + const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line + const { videoCard } = await getStealthFingerPrint(Plugin, pageFn) + t.deepEqual(videoCard, ['Intel Inc.', 'Intel Iris OpenGL Engine']) +}) + +test('stealth: customized values', async t => { + const pageFn = async page => await page.evaluate(() => window.chrome) // eslint-disable-line + const { videoCard } = await getStealthFingerPrint(Plugin, pageFn, { + vendor: 'foo', + renderer: 'bar' + }) + t.deepEqual(videoCard, ['foo', 'bar']) +}) + +/* global WebGLRenderingContext */ +async function extendedTests() { + const results = {} + + async function test(name, fn) { + const detectionPassed = await fn() + if (detectionPassed) console.log(`Chrome headless detected via ${name}`) + results[name] = detectionPassed + } + + const canvas = document.createElement('canvas') + const context = canvas.getContext('webgl') + + await test('descriptorsOK', _ => { + const descriptors = Object.getOwnPropertyDescriptors( + WebGLRenderingContext.prototype + ) + const str = descriptors.getParameter.toString() + return str === `[object Object]` + }) + + await test('toStringOK', _ => { + const str = context.getParameter.toString() + return str === `function getParameter() { [native code] }` + }) + + await test('toStringOK2', _ => { + const str = WebGLRenderingContext.prototype.getParameter.toString() + return str === `function getParameter() { [native code] }` + }) + + // Make sure we not reveal our proxy through errors + await test('errorOK', _ => { + try { + return context.getParameter() + } catch (err) { + return !err.stack.includes(`at Object.apply`) + } + }) + + // Should not throw (that was old stealth behavior) + await test('elementOK', _ => { + try { + return context.getParameter(123) === null + } catch (_) { + return false + } + }) + + return results +} + +test('vanilla: webgl is native', async t => { + const pageFn = async page => { + // page.on('console', msg => { + // console.log('Page console: ', msg.text()) + // }) + return await page.evaluate(extendedTests) // eslint-disable-line + } + const { pageFnResult: result } = await getVanillaFingerPrint(pageFn) + + const wasHeadlessDetected = Object.values(result).some(e => e === false) + if (wasHeadlessDetected) { + console.log(result) + } + t.false(wasHeadlessDetected) +}) + +test('stealth: webgl is native', async t => { + const pageFn = async page => await page.evaluate(extendedTests) // eslint-disable-line + const { pageFnResult: result } = await getStealthFingerPrint(Plugin, pageFn) + + const wasHeadlessDetected = Object.values(result).some(e => e === false) + if (wasHeadlessDetected) { + console.log(result) + } + t.false(wasHeadlessDetected) +}) + +/** + * A very simple method to retrieve the name of the default videocard of the system + * using webgl. + * + * Example (Apple Retina MBP 13): {vendor: "Intel Inc.", renderer: "Intel(R) Iris(TM) Graphics 6100"} + * + * @see https://stackoverflow.com/questions/49267764/how-to-get-the-video-card-driver-name-using-javascript-browser-side + * @returns {Object} + */ +function getVideoCardInfo(context = 'webgl') { + const gl = document.createElement('canvas').getContext(context) + if (!gl) { + return { + error: 'no webgl' + } + } + const debugInfo = gl.getExtension('WEBGL_debug_renderer_info') + if (debugInfo) { + return { + vendor: gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL), + renderer: gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) + } + } + return { + error: 'no WEBGL_debug_renderer_info' + } +} + +test('stealth: handles WebGLRenderingContext', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const videoCardInfo = await page.evaluate(getVideoCardInfo, 'webgl') + t.is(videoCardInfo.error, undefined) + t.is(videoCardInfo.vendor, 'Intel Inc.') + t.is(videoCardInfo.renderer, 'Intel Iris OpenGL Engine') +}) + +test('stealth: handles WebGL2RenderingContext', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const videoCardInfo = await page.evaluate(getVideoCardInfo, 'webgl2') + t.is(videoCardInfo.error, undefined) + t.is(videoCardInfo.vendor, 'Intel Inc.') + t.is(videoCardInfo.renderer, 'Intel Iris OpenGL Engine') +}) + +test('vanilla: normal toString stuff', async t => { + const browser = await vanillaPuppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => { + return WebGLRenderingContext.prototype.getParameter.toString + '' + }) + t.is(test1, 'function toString() { [native code] }') + + const test2 = await page.evaluate(() => { + return WebGLRenderingContext.prototype.getParameter.toString() + }) + t.is(test2, 'function getParameter() { [native code] }') +}) + +test('stealth: will not leak toString stuff', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use(Plugin()) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const test1 = await page.evaluate(() => { + return WebGLRenderingContext.prototype.getParameter.toString + '' + }) + t.is(test1, 'function toString() { [native code] }') // returns function () { [native code] } + + const test2 = await page.evaluate(() => { + return WebGLRenderingContext.prototype.getParameter.toString() + }) + t.is(test2, 'function getParameter() { [native code] }') +}) + +test('stealth: sets user opts correctly', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ vendor: 'alice', renderer: 'bob' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const videoCardInfo = await page.evaluate(getVideoCardInfo, 'webgl') + t.is(videoCardInfo.error, undefined) + t.is(videoCardInfo.vendor, 'alice') + t.is(videoCardInfo.renderer, 'bob') +}) + +test('stealth: does not affect protoype', async t => { + const puppeteer = addExtra(vanillaPuppeteer).use( + Plugin({ vendor: 'alice', renderer: 'bob' }) + ) + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + + const result = await page.evaluate(() => { + try { + return WebGLRenderingContext.prototype.getParameter(37445) + } catch (err) { + return err.message + } + }) + t.is(result, 'Illegal invocation') +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/readme.md new file mode 100644 index 0000000..bb225d4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/readme.md @@ -0,0 +1,21 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/webgl.vendor/index.js#L17-L55) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.vendor` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The vendor string to use (default: `Intel Inc.`) + - `opts.renderer` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** The renderer string (default: `Intel Iris OpenGL Engine`) + +**Extends: PuppeteerExtraPlugin** + +Fix WebGL Vendor/Renderer being set to Google in headless mode + +Example data (Apple Retina MBP 13): {vendor: "Intel Inc.", renderer: "Intel(R) Iris(TM) Graphics 6100"} + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js new file mode 100644 index 0000000..71ba39a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js @@ -0,0 +1,44 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Fix missing window.outerWidth/window.outerHeight in headless mode + * Will also set the viewport to match window size, unless specified by user + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth/evasions/window.outerdimensions' + } + + async onPageCreated(page) { + // Chrome returns undefined, Firefox false + await page.evaluateOnNewDocument(() => { + try { + if (window.outerWidth && window.outerHeight) { + return // nothing to do here + } + const windowFrame = 85 // probably OS and WM dependent + window.outerWidth = window.innerWidth + window.outerHeight = window.innerHeight + windowFrame + } catch (err) {} + }) + } + + async beforeLaunch(options) { + // Have viewport match window size, unless specified by user + // https://github.com/GoogleChrome/puppeteer/issues/3688 + if (!('defaultViewport' in options)) { + options.defaultViewport = null + } + return options + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/package.json new file mode 100644 index 0000000..18c15ea --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/package.json @@ -0,0 +1,4 @@ +{ + "private": true, + "main": "index.js" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/readme.md new file mode 100644 index 0000000..4144040 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/readme.md @@ -0,0 +1,18 @@ +## API + + + +#### Table of Contents + +- [class: Plugin](#class-plugin) + +### class: [Plugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/evasions/window.outerdimensions/index.js#L9-L40) + +- `opts` (optional, default `{}`) + +**Extends: PuppeteerExtraPlugin** + +Fix missing window.outerWidth/window.outerHeight in headless mode +Will also set the viewport to match window size, unless specified by user + +--- diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/detect-headless.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/detect-headless.js new file mode 100644 index 0000000..bfa5b8f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/detect-headless.js @@ -0,0 +1,97 @@ +'use strict' + +// taken from: https://github.com/paulirish/headless-cat-n-mouse/blob/master/detect-headless.js +// initial detects from @antoinevastel +// http://antoinevastel.github.io/bot%20detection/2018/01/17/detect-chrome-headless-v2.html + +module.exports = async function() { + const results = {} + + async function test(name, fn) { + const detectionPassed = await fn() + if (detectionPassed) { + console.log(`WARNING: Chrome headless detected via ${name}`) + } else { + console.log(`PASS: Chrome headless NOT detected via ${name}`) + } + results[name] = detectionPassed + } + + await test('userAgent', _ => { + return /HeadlessChrome/.test(window.navigator.userAgent) + }) + + // Detects the --enable-automation || --headless flags + // Will return true in headful if --enable-automation is provided + await test('navigator.webdriver present', _ => { + return 'webdriver' in navigator + }) + + await test('window.chrome missing', _ => { + return /Chrome/.test(window.navigator.userAgent) && !window.chrome + }) + + await test('permissions API', async _ => { + const permissionStatus = await navigator.permissions.query({ + name: 'notifications' + }) + // eslint-disable-next-line + return ( + Notification.permission === 'denied' && // eslint-disable-line no-undef + permissionStatus.state === 'prompt' + ) + }) + + await test('permissions API overriden', _ => { + const permissions = window.navigator.permissions + if (permissions.query.toString() !== 'function query() { [native code] }') + return true + if ( + permissions.query.toString.toString() !== + 'function toString() { [native code] }' + ) + return true + if ( + permissions.query.toString.hasOwnProperty('[[Handler]]') && // eslint-disable-line no-prototype-builtins + permissions.query.toString.hasOwnProperty('[[Target]]') && // eslint-disable-line no-prototype-builtins + permissions.query.toString.hasOwnProperty('[[IsRevoked]]') // eslint-disable-line no-prototype-builtins + ) + return true + if (permissions.hasOwnProperty('query')) return true // eslint-disable-line no-prototype-builtins + }) + + await test('navigator.plugins empty', _ => { + return navigator.plugins.length === 0 + }) + + await test('navigator.languages blank', _ => { + return navigator.languages === '' + }) + + await test('iFrame for fresh window object', _ => { + // evaluateOnNewDocument scripts don't apply within [srcdoc] (or [sandbox]) iframes + // https://github.com/GoogleChrome/puppeteer/issues/1106#issuecomment-359313898 + const iframe = document.createElement('iframe') + iframe.srcdoc = 'page intentionally left blank' + document.body.appendChild(iframe) + + // Here we would need to rerun all tests with `iframe.contentWindow` as `window` + // Example: + return iframe.contentWindow.navigator.plugins.length === 0 + }) + + // This detects that a devtools protocol agent is attached. + // So it will also pass true in headful Chrome if the devtools window is attached + await test('toString', _ => { + let gotYou = 0 + const spooky = /./ + spooky.toString = function() { + gotYou++ + return 'spooky' + } + console.debug(spooky) + return gotYou > 1 + }) + + return results +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test1.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test1.js new file mode 100644 index 0000000..7bc3996 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test1.js @@ -0,0 +1,23 @@ +'use strict' + +const puppeteer = require('puppeteer-extra') +puppeteer.use(require('puppeteer-extra-plugin-stealth')()) + +const detectHeadless = require('./detect-headless') + +;(async () => { + const browser = await puppeteer.launch({ args: ['--no-sandbox'] }) + const page = await browser.newPage() + page.on('console', msg => { + console.log('Page console: ', msg.text()) + }) + + await page.goto('about:blank') + const detectionResults = await page.evaluate(detectHeadless) + console.assert( + Object.keys(detectionResults).length, + 'No detection results returned.' + ) + + await browser.close() +})() diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test2.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test2.js new file mode 100644 index 0000000..4a19392 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/examples/test2.js @@ -0,0 +1,26 @@ +'use strict' + +const puppeteer = require('puppeteer-extra') +// Enable stealth plugin +puppeteer.use(require('puppeteer-extra-plugin-stealth')()) +;(async () => { + // Launch the browser in headless mode and set up a page. + const browser = await puppeteer.launch({ + args: ['--no-sandbox'], + headless: true + }) + const page = await browser.newPage() + + // Navigate to the page that will perform the tests. + const testUrl = + 'https://intoli.com/blog/' + + 'not-possible-to-block-chrome-headless/chrome-headless-test.html' + await page.goto(testUrl) + + // Save a screenshot of the results. + const screenshotPath = '/tmp/headless-test-result.png' + await page.screenshot({ path: screenshotPath }) + console.log('have a look at the screenshot:', screenshotPath) + + await browser.close() +})() diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.d.ts b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.d.ts new file mode 100644 index 0000000..8612943 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.d.ts @@ -0,0 +1,111 @@ +export = defaultExport; +declare function defaultExport(opts?: { + enabledEvasions?: Set; +}): StealthPlugin; +declare const StealthPlugin_base: typeof import("puppeteer-extra-plugin").PuppeteerExtraPlugin; +/** + * Stealth mode: Applies various techniques to make detection of headless puppeteer harder. 💯 + * + * ### Purpose + * There are a couple of ways the use of puppeteer can easily be detected by a target website. + * The addition of `HeadlessChrome` to the user-agent being only the most obvious one. + * + * The goal of this plugin is to be the definite companion to puppeteer to avoid + * detection, applying new techniques as they surface. + * + * As this cat & mouse game is in it's infancy and fast-paced the plugin + * is kept as flexibile as possible, to support quick testing and iterations. + * + * ### Modularity + * This plugin uses `puppeteer-extra`'s dependency system to only require + * code mods for evasions that have been enabled, to keep things modular and efficient. + * + * The `stealth` plugin is a convenience wrapper that requires multiple [evasion techniques](./evasions/) + * automatically and comes with defaults. You could also bypass the main module and require + * specific evasion plugins yourself, if you whish to do so (as they're standalone `puppeteer-extra` plugins): + * + * ```es6 + * // bypass main module and require a specific stealth plugin directly: + * puppeteer.use(require('puppeteer-extra-plugin-stealth/evasions/console.debug')()) + * ``` + * + * ### Contributing + * PRs are welcome, if you want to add a new evasion technique I suggest you + * look at the [template](./evasions/_template) to kickstart things. + * + * ### Kudos + * Thanks to [Evan Sangaline](https://intoli.com/blog/not-possible-to-block-chrome-headless/) and [Paul Irish](https://github.com/paulirish/headless-cat-n-mouse) for kickstarting the discussion! + * + * --- + * + * @todo + * - white-/blacklist with url globs (make this a generic plugin method?) + * - dynamic whitelist based on function evaluation + * + * @example + * const puppeteer = require('puppeteer-extra') + * // Enable stealth plugin with all evasions + * puppeteer.use(require('puppeteer-extra-plugin-stealth')()) + * + * + * ;(async () => { + * // Launch the browser in headless mode and set up a page. + * const browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: true }) + * const page = await browser.newPage() + * + * // Navigate to the page that will perform the tests. + * const testUrl = 'https://intoli.com/blog/' + + * 'not-possible-to-block-chrome-headless/chrome-headless-test.html' + * await page.goto(testUrl) + * + * // Save a screenshot of the results. + * const screenshotPath = '/tmp/headless-test-result.png' + * await page.screenshot({path: screenshotPath}) + * console.log('have a look at the screenshot:', screenshotPath) + * + * await browser.close() + * })() + * + * @param {Object} [opts] - Options + * @param {Set} [opts.enabledEvasions] - Specify which evasions to use (by default all) + * + */ +declare class StealthPlugin extends StealthPlugin_base { + constructor(opts?: {}); + get defaults(): { + availableEvasions: Set; + enabledEvasions: Set; + }; + /** + * Get all available evasions. + * + * Please look into the [evasions directory](./evasions/) for an up to date list. + * + * @type {Set} - A Set of all available evasions. + * + * @example + * const pluginStealth = require('puppeteer-extra-plugin-stealth')() + * console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' } + * puppeteer.use(pluginStealth) + */ + get availableEvasions(): Set; + /** + * @private + */ + set enabledEvasions(arg: Set); + /** + * Get all enabled evasions. + * + * Enabled evasions can be configured either through `opts` or by modifying this property. + * + * @type {Set} - A Set of all enabled evasions. + * + * @example + * // Remove specific evasion from enabled ones dynamically + * const pluginStealth = require('puppeteer-extra-plugin-stealth')() + * pluginStealth.enabledEvasions.delete('console.debug') + * puppeteer.use(pluginStealth) + */ + get enabledEvasions(): Set; + onBrowser(browser: any): Promise; +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.js new file mode 100644 index 0000000..eaf3c5e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.js @@ -0,0 +1,177 @@ +'use strict' + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Stealth mode: Applies various techniques to make detection of headless puppeteer harder. 💯 + * + * ### Purpose + * There are a couple of ways the use of puppeteer can easily be detected by a target website. + * The addition of `HeadlessChrome` to the user-agent being only the most obvious one. + * + * The goal of this plugin is to be the definite companion to puppeteer to avoid + * detection, applying new techniques as they surface. + * + * As this cat & mouse game is in it's infancy and fast-paced the plugin + * is kept as flexibile as possible, to support quick testing and iterations. + * + * ### Modularity + * This plugin uses `puppeteer-extra`'s dependency system to only require + * code mods for evasions that have been enabled, to keep things modular and efficient. + * + * The `stealth` plugin is a convenience wrapper that requires multiple [evasion techniques](./evasions/) + * automatically and comes with defaults. You could also bypass the main module and require + * specific evasion plugins yourself, if you whish to do so (as they're standalone `puppeteer-extra` plugins): + * + * ```es6 + * // bypass main module and require a specific stealth plugin directly: + * puppeteer.use(require('puppeteer-extra-plugin-stealth/evasions/console.debug')()) + * ``` + * + * ### Contributing + * PRs are welcome, if you want to add a new evasion technique I suggest you + * look at the [template](./evasions/_template) to kickstart things. + * + * ### Kudos + * Thanks to [Evan Sangaline](https://intoli.com/blog/not-possible-to-block-chrome-headless/) and [Paul Irish](https://github.com/paulirish/headless-cat-n-mouse) for kickstarting the discussion! + * + * --- + * + * @todo + * - white-/blacklist with url globs (make this a generic plugin method?) + * - dynamic whitelist based on function evaluation + * + * @example + * const puppeteer = require('puppeteer-extra') + * // Enable stealth plugin with all evasions + * puppeteer.use(require('puppeteer-extra-plugin-stealth')()) + * + * + * ;(async () => { + * // Launch the browser in headless mode and set up a page. + * const browser = await puppeteer.launch({ args: ['--no-sandbox'], headless: true }) + * const page = await browser.newPage() + * + * // Navigate to the page that will perform the tests. + * const testUrl = 'https://intoli.com/blog/' + + * 'not-possible-to-block-chrome-headless/chrome-headless-test.html' + * await page.goto(testUrl) + * + * // Save a screenshot of the results. + * const screenshotPath = '/tmp/headless-test-result.png' + * await page.screenshot({path: screenshotPath}) + * console.log('have a look at the screenshot:', screenshotPath) + * + * await browser.close() + * })() + * + * @param {Object} [opts] - Options + * @param {Set} [opts.enabledEvasions] - Specify which evasions to use (by default all) + * + */ +class StealthPlugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'stealth' + } + + get defaults() { + const availableEvasions = new Set([ + 'chrome.app', + 'chrome.csi', + 'chrome.loadTimes', + 'chrome.runtime', + 'defaultArgs', + 'iframe.contentWindow', + 'media.codecs', + 'navigator.hardwareConcurrency', + 'navigator.languages', + 'navigator.permissions', + 'navigator.plugins', + 'navigator.webdriver', + 'sourceurl', + 'user-agent-override', + 'webgl.vendor', + 'window.outerdimensions' + ]) + return { + availableEvasions, + // Enable all available evasions by default + enabledEvasions: new Set([...availableEvasions]) + } + } + + /** + * Requires evasion techniques dynamically based on configuration. + * + * @private + */ + get dependencies() { + return new Set( + [...this.opts.enabledEvasions].map(e => `${this.name}/evasions/${e}`) + ) + } + + /** + * Get all available evasions. + * + * Please look into the [evasions directory](./evasions/) for an up to date list. + * + * @type {Set} - A Set of all available evasions. + * + * @example + * const pluginStealth = require('puppeteer-extra-plugin-stealth')() + * console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' } + * puppeteer.use(pluginStealth) + */ + get availableEvasions() { + return this.defaults.availableEvasions + } + + /** + * Get all enabled evasions. + * + * Enabled evasions can be configured either through `opts` or by modifying this property. + * + * @type {Set} - A Set of all enabled evasions. + * + * @example + * // Remove specific evasion from enabled ones dynamically + * const pluginStealth = require('puppeteer-extra-plugin-stealth')() + * pluginStealth.enabledEvasions.delete('console.debug') + * puppeteer.use(pluginStealth) + */ + get enabledEvasions() { + return this.opts.enabledEvasions + } + + /** + * @private + */ + set enabledEvasions(evasions) { + this.opts.enabledEvasions = evasions + } + + async onBrowser(browser) { + if (browser && browser.setMaxListeners) { + // Increase event emitter listeners to prevent MaxListenersExceededWarning + browser.setMaxListeners(30) + } + } +} + +/** + * Default export, PuppeteerExtraStealthPlugin + * + * @param {Object} [opts] - Options + * @param {Set} [opts.enabledEvasions] - Specify which evasions to use (by default all) + */ +const defaultExport = opts => new StealthPlugin(opts) +module.exports = defaultExport + +// const moduleExport = defaultExport +// moduleExport.StealthPlugin = StealthPlugin +// module.exports = moduleExport diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.test.js new file mode 100644 index 0000000..eff5e9f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/index.test.js @@ -0,0 +1,54 @@ +'use strict' + +const PLUGIN_NAME = 'stealth' + +const test = require('ava') + +const Plugin = require('.') + +test('is a function', async t => { + t.is(typeof Plugin, 'function') +}) + +test('should have the basic class members', async t => { + const instance = Plugin() + t.is(instance.name, PLUGIN_NAME) + t.true(instance._isPuppeteerExtraPlugin) +}) + +test('should have the public child class members', async t => { + const instance = Plugin() + const prototype = Object.getPrototypeOf(instance) + const childClassMembers = Object.getOwnPropertyNames(prototype) + + t.true(childClassMembers.includes('constructor')) + t.true(childClassMembers.includes('name')) + t.true(childClassMembers.includes('name')) + t.true(childClassMembers.includes('defaults')) + t.true(childClassMembers.includes('availableEvasions')) + t.true(childClassMembers.includes('enabledEvasions')) + t.is(childClassMembers.length, 7) +}) + +test('should have opts with default values', async t => { + const instance = Plugin() + t.deepEqual(instance.opts.enabledEvasions, instance.availableEvasions) +}) + +test('should add all dependencies dynamically', async t => { + const instance = Plugin() + const deps = new Set( + [...instance.opts.enabledEvasions].map(e => `${PLUGIN_NAME}/evasions/${e}`) + ) + t.deepEqual(instance.dependencies, deps) +}) + +test('should add all dependencies dynamically including changes', async t => { + const instance = Plugin() + const fakeDep = 'foobar' + instance.enabledEvasions = new Set([fakeDep]) + t.deepEqual( + instance.dependencies, + new Set([`${PLUGIN_NAME}/evasions/${fakeDep}`]) + ) +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/package.json new file mode 100644 index 0000000..29f7972 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/package.json @@ -0,0 +1,71 @@ +{ + "name": "puppeteer-extra-plugin-stealth", + "version": "2.11.2", + "description": "Stealth mode: Applies various techniques to make detection of headless puppeteer harder.", + "main": "index.js", + "typings": "index.d.ts", + "repository": "berstend/puppeteer-extra", + "homepage": "https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth#readme", + "author": "berstend", + "license": "MIT", + "scripts": { + "docs": "run-s docs-for-plugin postdocs-for-plugin docs-for-evasions postdocs-for-evasions types", + "docs-for-plugin": "documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API index.js", + "postdocs-for-plugin": "npx prettier --write readme.md", + "docs-for-evasions": "cd ./evasions && loop \"documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API index.js\"", + "postdocs-for-evasions": "cd ./evasions && loop \"npx prettier --write readme.md\"", + "lint": "eslint --ext .js .", + "test:js": "ava --concurrency 2 -v", + "test": "run-p test:js", + "test-ci": "run-s test:js", + "types": "npx --package typescript@3.7 tsc --emitDeclarationOnly --declaration --allowJs index.js" + }, + "engines": { + "node": ">=8" + }, + "keywords": [ + "puppeteer", + "puppeteer-extra", + "puppeteer-extra-plugin", + "stealth", + "stealth-mode", + "detection-evasion", + "crawler", + "chrome", + "headless", + "pupeteer" + ], + "ava": { + "files": [ + "!test/util.js", + "!test/fixtures/sw.js" + ] + }, + "devDependencies": { + "ava": "2.4.0", + "documentation-markdown-themes": "^12.1.5", + "fpcollect": "^1.0.4", + "fpscanner": "^0.1.5", + "loop": "^3.0.6", + "npm-run-all": "^4.1.5", + "puppeteer": "9" + }, + "dependencies": { + "debug": "^4.1.1", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-preferences": "^2.4.1" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "puppeteer-extra": { + "optional": true + }, + "playwright-extra": { + "optional": true + } + }, + "gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/readme.md new file mode 100644 index 0000000..913b99d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/readme.md @@ -0,0 +1,329 @@ +# puppeteer-extra-plugin-stealth [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/berstend/puppeteer-extra/test.yml?branch=master&event=push) [![Discord](https://img.shields.io/discord/737009125862408274)](https://extra.community) [![npm](https://img.shields.io/npm/v/puppeteer-extra-plugin-stealth.svg)](https://www.npmjs.com/package/puppeteer-extra-plugin-stealth) + +> A plugin for [puppeteer-extra](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra) and [playwright-extra](https://github.com/berstend/puppeteer-extra/tree/master/packages/playwright-extra) to prevent detection. + +

+ +## Install + +```bash +yarn add puppeteer-extra-plugin-stealth +# - or - +npm install puppeteer-extra-plugin-stealth +``` + +If this is your first [puppeteer-extra](https://github.com/berstend/puppeteer-extra) plugin here's everything you need: + +```bash +yarn add puppeteer puppeteer-extra puppeteer-extra-plugin-stealth +# - or - +npm install puppeteer puppeteer-extra puppeteer-extra-plugin-stealth +``` + +## Usage + +```js +// puppeteer-extra is a drop-in replacement for puppeteer, +// it augments the installed puppeteer with plugin functionality +const puppeteer = require('puppeteer-extra') + +// add stealth plugin and use defaults (all evasion techniques) +const StealthPlugin = require('puppeteer-extra-plugin-stealth') +puppeteer.use(StealthPlugin()) + +// puppeteer usage as normal +puppeteer.launch({ headless: true }).then(async browser => { + console.log('Running tests..') + const page = await browser.newPage() + await page.goto('https://bot.sannysoft.com') + await page.waitForTimeout(5000) + await page.screenshot({ path: 'testresult.png', fullPage: true }) + await browser.close() + console.log(`All done, check the screenshot. ✨`) +}) +``` + +
+ TypeScript usage
+ +> `puppeteer-extra` and most plugins are written in TS, +> so you get perfect type support out of the box. :) + +```ts +import puppeteer from 'puppeteer-extra' +import StealthPlugin from 'puppeteer-extra-plugin-stealth' + +puppeteer + .use(StealthPlugin()) + .launch({ headless: true }) + .then(async browser => { + const page = await browser.newPage() + await page.goto('https://bot.sannysoft.com') + await page.waitForTimeout(5000) + await page.screenshot({ path: 'stealth.png', fullPage: true }) + await browser.close() + }) +``` + +> Please check this [wiki](https://github.com/berstend/puppeteer-extra/wiki/TypeScript-usage) entry in case you have TypeScript related import issues. + +

+ +> Please check out the [main documentation](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra) to learn more about `puppeteer-extra` (Firefox usage, other Plugins, etc). + +## Status + +- ✅ **`puppeteer-extra` with stealth passes all public bot tests.** + +Please note: I consider this a friendly competition in a rather interesting cat and mouse game. If the other team (👋) wants to detect headless chromium there are still ways to do that (at least I noticed a few, which I'll tackle in future updates). + +It's probably impossible to prevent all ways to detect headless chromium, but it should be possible to make it so difficult that it becomes cost-prohibitive or triggers too many false-positives to be feasible. + +If something new comes up or you experience a problem, please do your homework and create a PR in a respectful way (this is Github, not reddit) or I might not be motivated to help. :) + +## Changelog + +> 🎁 **Note:** Until we've automated changelog updates in markdown files please follow the `#announcements` channel in our [discord server](https://discord.gg/vz7PeKk) for the latest updates and changelog info. + +_Older changelog:_ + +#### `v2.4.7` + +- New: `user-agent-override` - Used to set a stealthy UA string, language & platform. This also fixes issues with the prior method of setting the `Accept-Language` header through request interception ([#104](https://github.com/berstend/puppeteer-extra/pull/104), kudos to [@Niek](https://github.com/Niek)) +- New: `navigator.vendor` - Makes it possible to optionally override navigator.vendor ([#110](https://github.com/berstend/puppeteer-extra/pull/110), thanks [@Niek](https://github.com/Niek)) +- Improved: `navigator.webdriver`: Now uses ES6 Proxies to pass `instanceof` tests ([#117](https://github.com/berstend/puppeteer-extra/pull/117), thanks [@aabbccsmith](https://github.com/aabbccsmith)) +- Removed: `user-agent`, `accept-language` (now obsolete) + +#### `v2.4.2` / `v2.4.1` + +- Improved: `iframe.contentWindow` - We now proxy the original window object and smartly redirect calls that might reveal it's true identity, as opposed to mocking it like peasants :) +- Improved: `accept-language` - More robust and it's now possible to [set a custom locale](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions/accept-language#readme) if needed. +- ⭐️ Passes the [headless-cat-n-mouse](https://github.com/paulirish/headless-cat-n-mouse) test + +#### `v2.4.0` + +Let's ring the bell for round 2 in this cat and mouse fight 😄 + +- New: All evasions now have a specific before and after test to make make this whole topic less voodoo +- New: `media.codecs` - we spoof the presence of proprietary codecs in Chromium now +- New & improved: `iframe.contentWindow` - Found a way to fix `srcdoc` frame based detection without breaking recaptcha inline popup & other iframes (please report any issues) +- New: `accept-language` - Adds a missing `Accept-Language` header in headless (capitalized correctly, `page.setExtraHTTPHeaders` is all lowercase which can be detected) +- Improved: `chrome.runtime` - More extensive mocking of the chrome object +- ⭐️ All [fpscanner](https://antoinevastel.com/bots/) tests are now green, as well as all [intoli](https://bot.sannysoft.com) tests and the [`areyouheadless`](https://arh.antoinevastel.com/bots/areyouheadless) test + +
+ v2.1.2
+ +- Improved: `navigator.plugins` - we fully emulate plugins/mimetypes in headless now 🎉 +- New: `webgl.vendor` - is otherwise set to "Google" in headless +- New: `window.outerdimensions` - fix missing window.outerWidth/outerHeight and viewport +- Fixed: `navigator.webdriver` now returns undefined instead of false + +
+ +## Test results (red is bad) + +#### Vanilla puppeteer without stealth 😢 + + + + + + + + + + +
Chromium + headless
Chromium + headful
Chrome + headless
Chrome + headful
+ +#### Puppeteer with stealth plugin 💯 + + + + + + + + + + +
Chromium + headless
Chromium + headful
Chrome + headless
Chrome + headful
+ +> Note: The `MQ_SCREEN` test is broken on their page (will fail in regular Chrome as well). + +Tests have been done using [this test site](https://bot.sannysoft.com/) and [these scripts](./stealthtests/). + +#### Improved reCAPTCHA v3 scores + +Using stealth also seems to help with maintaining a normal [reCAPTCHA v3 score](https://developers.google.com/recaptcha/docs/v3#score). + + + + + + + + +
Regular Puppeteer

Stealth Puppeteer

+ +Note: The [official test](https://recaptcha-demo.appspot.com/recaptcha-v3-request-scores.php) is to be taken with a grain of salt, as the score is calculated individually per site and multiple other factors (past behaviour, IP address, etc). Based on anecdotal observations it still seems to work as a rough indicator. + +_**Tip:** Have a look at the [recaptcha plugin](https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-recaptcha) if you have issues with reCAPTCHAs._ + +## API + + + +#### Table of Contents + +- [puppeteer-extra-plugin-stealth \[ ](#puppeteer-extra-plugin-stealth---) + - [Install](#install) + - [Usage](#usage) + - [Status](#status) + - [Changelog](#changelog) + - [`v2.4.7`](#v247) + - [`v2.4.2` / `v2.4.1`](#v242--v241) + - [`v2.4.0`](#v240) + - [Test results (red is bad)](#test-results-red-is-bad) + - [Vanilla puppeteer without stealth 😢](#vanilla-puppeteer-without-stealth-) + - [Puppeteer with stealth plugin 💯](#puppeteer-with-stealth-plugin-) + - [Improved reCAPTCHA v3 scores](#improved-recaptcha-v3-scores) + - [API](#api) + - [Table of Contents](#table-of-contents) + - [class: StealthPlugin](#class-stealthplugin) + - [Purpose](#purpose) + - [Modularity](#modularity) + - [Contributing](#contributing) + - [Kudos](#kudos) + - [.availableEvasions](#availableevasions) + - [.enabledEvasions](#enabledevasions) + - [defaultExport(opts?)](#defaultexportopts) + - [License](#license) + +### class: [StealthPlugin](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/index.js#L72-L162) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options (optional, default `{}`) + - `opts.enabledEvasions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Specify which evasions to use (by default all) + +**Extends: PuppeteerExtraPlugin** + +Stealth mode: Applies various techniques to make detection of headless puppeteer harder. 💯 + +#### Purpose + +There are a couple of ways the use of puppeteer can easily be detected by a target website. +The addition of `HeadlessChrome` to the user-agent being only the most obvious one. + +The goal of this plugin is to be the definite companion to puppeteer to avoid +detection, applying new techniques as they surface. + +As this cat & mouse game is in it's infancy and fast-paced the plugin +is kept as flexibile as possible, to support quick testing and iterations. + +#### Modularity + +This plugin uses `puppeteer-extra`'s dependency system to only require +code mods for evasions that have been enabled, to keep things modular and efficient. + +The `stealth` plugin is a convenience wrapper that requires multiple [evasion techniques](./evasions/) +automatically and comes with defaults. You could also bypass the main module and require +specific evasion plugins yourself, if you whish to do so (as they're standalone `puppeteer-extra` plugins): + +```es6 +// bypass main module and require a specific stealth plugin directly: +puppeteer.use( + require('puppeteer-extra-plugin-stealth/evasions/console.debug')() +) +``` + +#### Contributing + +PRs are welcome, if you want to add a new evasion technique I suggest you +look at the [template](./evasions/_template) to kickstart things. + +#### Kudos + +Thanks to [Evan Sangaline](https://intoli.com/blog/not-possible-to-block-chrome-headless/) and [Paul Irish](https://github.com/paulirish/headless-cat-n-mouse) for kickstarting the discussion! + +--- + +Example: + +```javascript +const puppeteer = require('puppeteer-extra') +// Enable stealth plugin with all evasions +puppeteer.use(require('puppeteer-extra-plugin-stealth')()) +;(async () => { + // Launch the browser in headless mode and set up a page. + const browser = await puppeteer.launch({ + args: ['--no-sandbox'], + headless: true + }) + const page = await browser.newPage() + + // Navigate to the page that will perform the tests. + const testUrl = + 'https://intoli.com/blog/' + + 'not-possible-to-block-chrome-headless/chrome-headless-test.html' + await page.goto(testUrl) + + // Save a screenshot of the results. + const screenshotPath = '/tmp/headless-test-result.png' + await page.screenshot({ path: screenshotPath }) + console.log('have a look at the screenshot:', screenshotPath) + + await browser.close() +})() +``` + +--- + +#### .[availableEvasions](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/index.js#L128-L130) + +Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** + +Get all available evasions. + +Please look into the [evasions directory](./evasions/) for an up to date list. + +Example: + +```javascript +const pluginStealth = require('puppeteer-extra-plugin-stealth')() +console.log(pluginStealth.availableEvasions) // => Set { 'user-agent', 'console.debug' } +puppeteer.use(pluginStealth) +``` + +--- + +#### .[enabledEvasions](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/index.js#L145-L147) + +Type: **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** + +Get all enabled evasions. + +Enabled evasions can be configured either through `opts` or by modifying this property. + +Example: + +```javascript +// Remove specific evasion from enabled ones dynamically +const pluginStealth = require('puppeteer-extra-plugin-stealth')() +pluginStealth.enabledEvasions.delete('console.debug') +puppeteer.use(pluginStealth) +``` + +--- + +### [defaultExport(opts?)](https://github.com/berstend/puppeteer-extra/blob/e6133619b051febed630ada35241664eba59b9fa/packages/puppeteer-extra-plugin-stealth/index.js#L170-L170) + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)?** Options + - `opts.enabledEvasions` **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>?** Specify which evasions to use (by default all) + +Default export, PuppeteerExtraStealthPlugin + +--- + +## License + +Copyright © 2018 - 2023, [berstend̡̲̫̹̠̖͚͓̔̄̓̐̄͛̀͘](mailto:github@berstend.com?subject=[GitHub]%20PuppeteerExtra). Released under the MIT License. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/cat-and-mouse.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/cat-and-mouse.test.js new file mode 100644 index 0000000..14b8e55 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/cat-and-mouse.test.js @@ -0,0 +1,162 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra, compareLooseVersionStrings } = require('./util') +const Plugin = require('..') + +// Fix CI issues with old versions +const isOldPuppeteerVersion = () => { + const version = process.env.PUPPETEER_VERSION + const isOld = version && (version === '1.9.0' || version === '1.6.2') + return isOld +} + +/* global HTMLIFrameElement */ +/* global Notification */ +test('stealth: will pass Paul Irish', async t => { + const browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + const page = await browser.newPage() + await page.exposeFunction('compareLooseVersionStrings', compareLooseVersionStrings) + const detectionResults = await page.evaluate(detectHeadless) + await browser.close() + + if (isOldPuppeteerVersion()) { + t.true(true) + return + } + + const wasHeadlessDetected = Object.values(detectionResults).some(Boolean) + if (wasHeadlessDetected) { + console.log(detectionResults) + } + t.false(wasHeadlessDetected) +}) + +async function detectHeadless() { + const results = {} + + async function test(name, fn) { + const detectionPassed = await fn() + if (detectionPassed) console.log(`Chrome headless detected via ${name}`) + results[name] = detectionPassed + } + + await test('userAgent', _ => { + return /HeadlessChrome/.test(window.navigator.userAgent) + }) + + // navigator.webdriver behavior change since release 89.0.4339.0. See also #448 + if (await compareLooseVersionStrings(navigator.userAgent, '89.0.4339.0') >= 0) { + await test('navigator.webdriver is not false', _ => { + return navigator.webdriver !== false + }) + } else { + // Detects the --enable-automation || --headless flags + // Will return true in headful if --enable-automation is provided + await test('navigator.webdriver present', _ => { + return 'webdriver' in navigator + }) + + await test('navigator.webdriver not undefined', _ => { + return navigator.webdriver !== undefined + }) + + /* eslint-disable no-proto */ + await test('navigator.webdriver property overridden', _ => { + return ( + Object.getOwnPropertyDescriptor(navigator.__proto__, 'webdriver') !== + undefined + ) + }) + + await test('navigator.webdriver prop detected', _ => { + for (const prop in navigator) { + if (prop === 'webdriver') { + return true + } + } + return false + }) + } + + await test('window.chrome missing', _ => { + return /Chrome/.test(window.navigator.userAgent) && !window.chrome + }) + + await test('permissions API', async _ => { + const permissionStatus = await navigator.permissions.query({ + name: 'notifications' + }) + return ( + Notification.permission === 'denied' && + permissionStatus.state === 'prompt' + ) + }) + + await test('permissions API overriden', _ => { + const permissions = window.navigator.permissions + if (permissions.query.toString() !== 'function query() { [native code] }') + return true + if ( + permissions.query.toString.toString() !== + 'function toString() { [native code] }' + ) + return true + if ( + permissions.query.toString.hasOwnProperty('[[Handler]]') && // eslint-disable-line + permissions.query.toString.hasOwnProperty('[[Target]]') && // eslint-disable-line + permissions.query.toString.hasOwnProperty('[[IsRevoked]]') // eslint-disable-line + ) + return true + if (permissions.hasOwnProperty('query')) return true // eslint-disable-line + }) + + await test('navigator.plugins empty', _ => { + return navigator.plugins.length === 0 + }) + + await test('navigator.languages blank', _ => { + return navigator.languages === '' + }) + + await test('iFrame for fresh window object', _ => { + // evaluateOnNewDocument scripts don't apply within [srcdoc] (or [sandbox]) iframes + // https://github.com/GoogleChrome/puppeteer/issues/1106#issuecomment-359313898 + const iframe = document.createElement('iframe') + iframe.srcdoc = 'page intentionally left blank' + document.body.appendChild(iframe) + + // Verify iframe prototype isn't touched + const descriptors = Object.getOwnPropertyDescriptors( + HTMLIFrameElement.prototype + ) + + if ( + descriptors.contentWindow.get.toString() !== + 'function get contentWindow() { [native code] }' + ) + return true + // Verify iframe isn't remapped to main window + if (iframe.contentWindow === window) return true + + // Here we would need to rerun all tests with `iframe.contentWindow` as `window` + // Example: + return iframe.contentWindow.navigator.plugins.length === 0 + }) + + // This detects that a devtools protocol agent is attached. + // So it will also pass true in headful Chrome if the devtools window is attached + await test('toString', _ => { + let gotYou = 0 + const spooky = /./ + spooky.toString = function() { + gotYou++ + return 'spooky' + } + console.debug(spooky) + return gotYou > 1 + }) + + return results +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy-with-service-worker.html b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy-with-service-worker.html new file mode 100644 index 0000000..ae19a2d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy-with-service-worker.html @@ -0,0 +1,22 @@ + + + + + title foo + + + + +

Test page with service worker

+ + diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy.html b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy.html new file mode 100644 index 0000000..664f46f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/dummy.html @@ -0,0 +1,11 @@ + + + + + title foo + + + +

Test page

+ + diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/sw.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/sw.js new file mode 100644 index 0000000..df4dab9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fixtures/sw.js @@ -0,0 +1 @@ +// Left empty diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fpscanner.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fpscanner.test.js new file mode 100644 index 0000000..8dfd3b1 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/fpscanner.test.js @@ -0,0 +1,52 @@ +const test = require('ava') + +const fpscanner = require('fpscanner') + +const { getVanillaFingerPrint, getStealthFingerPrint, compareLooseVersionStrings } = require('./util') +const Plugin = require('../.') + +// Fix CI issues with old versions +const isOldPuppeteerVersion = () => { + const version = process.env.PUPPETEER_VERSION + if (!version) { + return false + } + if (version === '1.9.0' || version === '1.6.2') { + return true + } + return false +} + +test('vanilla: will fail multiple fpscanner tests', async t => { + const fingerPrint = await getVanillaFingerPrint() + const testedFingerPrints = fpscanner.analyseFingerprint(fingerPrint) + const failedChecks = Object.values(testedFingerPrints).filter( + val => val.consistent < 3 + ) + + if (isOldPuppeteerVersion()) { + t.is(failedChecks.length, 8) + } else { + t.is(failedChecks.length, 7) + } +}) + +test('stealth: will not fail a single fpscanner test', async t => { + const fingerPrint = await getStealthFingerPrint(Plugin) + const testedFingerPrints = fpscanner.analyseFingerprint(fingerPrint) + const failedChecks = Object.values(testedFingerPrints).filter( + val => val.consistent < 3 + ) + + if (failedChecks.length) { + console.warn('The following fingerprints failed:', failedChecks) + } + + if (compareLooseVersionStrings(fingerPrint.userAgent, '89.0.4339.0') >= 0) { + // Updated navigator.webdriver behavior breaks the fpscanner tests. + t.is(failedChecks.length, 1) + t.is(failedChecks[0].name, 'WEBDRIVER') + } else { + t.is(failedChecks.length, 0) + } +}) diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/service-worker.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/service-worker.test.js new file mode 100644 index 0000000..b27e4e6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/service-worker.test.js @@ -0,0 +1,112 @@ +const test = require('ava') + +const { vanillaPuppeteer, addExtra } = require('./util') +const Plugin = require('..') +const http = require('http') +const fs = require('fs') +const path = require('path') + +// Create a simple HTTP server. Service Workers cannot be served from file:// URIs +const httpServer = async () => { + const server = await http + .createServer((req, res) => { + let contents, type + + if (req.url === '/sw.js') { + contents = fs.readFileSync(path.join(__dirname, './fixtures/sw.js')) + type = 'application/javascript' + } else { + contents = fs.readFileSync( + path.join(__dirname, './fixtures/dummy-with-service-worker.html') + ) + type = 'text/html' + } + + res.setHeader('Content-Type', type) + res.writeHead(200) + res.end(contents) + }) + .listen(0) // random free port + + return `http://127.0.0.1:${server.address().port}/` +} + +let browser, page, worker + +test.before(async t => { + const address = await httpServer() + console.log(`Server is running on port ${address}`) + + browser = await addExtra(vanillaPuppeteer) + .use(Plugin()) + .launch({ headless: true }) + page = await browser.newPage() + + worker = new Promise(resolve => { + browser.on('targetcreated', async target => { + if (target.type() === 'service_worker') { + resolve(target.worker()) + } + }) + }) + + await page.goto(address) + worker = await worker +}) + +test.after(async t => { + await browser.close() +}) + +test.skip('stealth: inconsistencies between page and worker', async t => { + const pageFP = await page.evaluate(detectFingerprint) + const workerFP = await worker.evaluate(detectFingerprint) + + t.deepEqual(pageFP, workerFP) +}) + +test.serial.skip('stealth: creepjs has good trust score', async t => { + page.goto('https://abrahamjuliot.github.io/creepjs/') + + const score = await ( + await ( + await page.waitForSelector('#fingerprint-data .unblurred') + ).getProperty('textContent') + ).jsonValue() + + t.true( + parseInt(score) > 80, + `The creepjs score is: ${parseInt(score)}% but it should be at least 80%` + ) +}) + +/* global OffscreenCanvas */ +function detectFingerprint() { + const results = {} + + const props = [ + 'userAgent', + 'language', + 'hardwareConcurrency', + 'deviceMemory', + 'languages', + 'platform' + ] + props.forEach(el => { + results[el] = navigator[el].toString() + }) + + const canvasOffscreenWebgl = new OffscreenCanvas(256, 256) + const contextWebgl = canvasOffscreenWebgl.getContext('webgl') + const rendererInfo = contextWebgl.getExtension('WEBGL_debug_renderer_info') + results.webglVendor = contextWebgl.getParameter( + rendererInfo.UNMASKED_VENDOR_WEBGL + ) + results.webglRenderer = contextWebgl.getParameter( + rendererInfo.UNMASKED_RENDERER_WEBGL + ) + + results.timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone + + return results +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/util.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/util.js new file mode 100644 index 0000000..6a7cce2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-stealth/test/util.js @@ -0,0 +1,65 @@ +const assert = require('assert') +const vanillaPuppeteer = require('puppeteer') +const { addExtra } = require('puppeteer-extra') + +const fpCollectPath = require.resolve('fpcollect/dist/fpCollect.min.js') + +const getFingerPrintFromPage = async page => { + return page.evaluate(() => fpCollect.generateFingerprint()) // eslint-disable-line +} + +const dummyHTMLPath = require('path').join(__dirname, './fixtures/dummy.html') + +const getFingerPrint = async (puppeteer, pageFn) => { + const browser = await puppeteer.launch({ headless: true }) + const page = await browser.newPage() + await page.goto('file://' + dummyHTMLPath) + await page.addScriptTag({ path: fpCollectPath }) + const fingerPrint = await getFingerPrintFromPage(page) + + let pageFnResult = null + if (pageFn) { + pageFnResult = await pageFn(page) + } + + await browser.close() + return { ...fingerPrint, pageFnResult } +} + +const getVanillaFingerPrint = async pageFn => + getFingerPrint(vanillaPuppeteer, pageFn) +const getStealthFingerPrint = async (Plugin, pageFn, pluginOptions = null) => + getFingerPrint(addExtra(vanillaPuppeteer).use(Plugin(pluginOptions)), pageFn) + +// Expecting the input string to be in one of these formats: +// - The UA string +// - The shorter version string from Puppeteers browser.version() +// - The shortest four-integer string +const parseLooseVersionString = looseVersionString => looseVersionString + .match(/(\d+\.){3}\d+/)[0] + .split('.') + .map(x => parseInt(x)) + +const compareLooseVersionStrings = (version0, version1) => { + const parsed0 = parseLooseVersionString(version0) + const parsed1 = parseLooseVersionString(version1) + assert(parsed0.length == 4) + assert(parsed1.length == 4) + for (let i = 0; i < parsed0.length; i++) { + if (parsed0[i] < parsed1[i]) { + return -1 + } else if (parsed0[i] > parsed1[i]) { + return 1 + } + } + return 0 +} + +module.exports = { + getVanillaFingerPrint, + getStealthFingerPrint, + dummyHTMLPath, + vanillaPuppeteer, + addExtra, + compareLooseVersionStrings +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/LICENSE b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/LICENSE new file mode 100644 index 0000000..a53ecb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 berstend + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/index.js new file mode 100644 index 0000000..935505a --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/index.js @@ -0,0 +1,130 @@ +'use strict' + +const util = require('util') +const fs = require('fs') +const fse = require('fs-extra') +const os = require('os') +const path = require('path') +const rimraf = require('rimraf') +const debug = require('debug')('puppeteer-extra-plugin:user-data-dir') +const mkdtempAsync = util.promisify(fs.mkdtemp) +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * + * Further reading: + * https://chromium.googlesource.com/chromium/src/+/master/docs/user_data_dir.md + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + + this._userDataDir = null + this._isTemporary = false + + const defaults = { + deleteTemporary: true, + deleteExisting: false, + files: [] + } + // Follow Puppeteers temporary user data dir naming convention by default + defaults.folderPath = os.tmpdir() + defaults.folderPrefix = 'puppeteer_dev_profile-' + + this._opts = Object.assign(defaults, opts) + debug('initialized', this._opts) + } + + get name() { + return 'user-data-dir' + } + + get requirements() { + return new Set(['runLast', 'dataFromPlugins']) + } + + get shouldDeleteDirectory() { + if (this._isTemporary && this._opts.deleteTemporary) { + return true + } + return this._opts.deleteExisting + } + + get temporaryDirectoryPath() { + return path.join(this._opts.folderPath, this._opts.folderPrefix) + } + + get defaultProfilePath() { + return path.join(this._userDataDir, 'Default') + } + + async makeTemporaryDirectory() { + this._userDataDir = await mkdtempAsync(this.temporaryDirectoryPath) + this._isTemporary = true + } + + deleteUserDataDir() { + debug('removeUserDataDir', this._userDataDir) + + if (!this._userDataDir) { + debug('No userDataDir, not running rimraf') + return + } + + // We're using rimraf here because it throw errors and don't seem to freeze the process + // If ressources busy or locked by chrome try again 4 times, then give up. overall a timout of 400ms + rimraf( + this._userDataDir, + { + maxBusyTries: 4 + }, + err => { + debug(err) + } + ) + } + + async writeFilesToProfile() { + const filesFromPlugins = this.getDataFromPlugins('userDataDirFile').map( + d => d.value + ) + const files = [].concat(filesFromPlugins, this._opts.files) + if (!files.length) { + return + } + for (const file of files) { + if (file.target !== 'Profile') { + console.warn(`Warning: Ignoring file with invalid target`, file) + continue + } + const filePath = path.join(this.defaultProfilePath, file.file) + try { + await fse.outputFile(filePath, file.contents) + debug(`Wrote file`, filePath) + } catch (err) { + console.warn('Warning: Failure writing file', filePath, file, err) + } + } + } + + async beforeLaunch(options) { + this._userDataDir = options.userDataDir + if (!this._userDataDir) { + await this.makeTemporaryDirectory() + options.userDataDir = this._userDataDir + debug('created custom dir', options.userDataDir) + } + await this.writeFilesToProfile() + } + + async onDisconnected() { + debug('onDisconnected') + if (this.shouldDeleteDirectory) { + this.deleteUserDataDir() + } + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/package.json new file mode 100644 index 0000000..39de229 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/package.json @@ -0,0 +1,53 @@ +{ + "name": "puppeteer-extra-plugin-user-data-dir", + "version": "2.4.1", + "description": "Custom user data directory for puppeteer.", + "main": "index.js", + "repository": "berstend/puppeteer-extra", + "author": "berstend", + "license": "MIT", + "scripts": { + "docs": "node -e 0", + "lint": "eslint --ext .js .", + "test": "run-p lint", + "test-ci": "run-s test" + }, + "engines": { + "node": ">=8" + }, + "keywords": [ + "puppeteer", + "puppeteer-extra", + "puppeteer-extra-plugin", + "user-data", + "userDataDir", + "profile", + "chrome", + "headless", + "pupeteer" + ], + "devDependencies": { + "ava": "2.4.0", + "npm-run-all": "^4.1.5", + "puppeteer": "^2.0.0" + }, + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^10.0.0", + "puppeteer-extra-plugin": "^3.2.3", + "rimraf": "^3.0.2" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "puppeteer-extra": { + "optional": true + }, + "playwright-extra": { + "optional": true + } + }, + "gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/readme.md new file mode 100644 index 0000000..76845f3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-data-dir/readme.md @@ -0,0 +1,30 @@ +# puppeteer-extra-plugin-user-data-dir + +> A plugin for [puppeteer-extra](https://github.com/berstend/puppeteer-extra). + +### Install + +```bash +yarn add puppeteer-extra-plugin-user-data-dir +``` + +## API + + + +#### Table of Contents + +- [Plugin](#plugin) + +### [Plugin](https://github.com/berstend/puppeteer-extra/blob/db57ea66cf10d407cf63af387892492e495a84f2/packages/puppeteer-extra-plugin-user-data-dir/index.js#L19-L113) + +**Extends: PuppeteerExtraPlugin** + +Further reading: + + +Type: `function (opts)` + +- `opts` (optional, default `{}`) + +* * * diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/LICENSE b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/LICENSE new file mode 100644 index 0000000..a53ecb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 berstend + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/index.js new file mode 100644 index 0000000..90aa478 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/index.js @@ -0,0 +1,81 @@ +'use strict' + +const merge = require('deepmerge') + +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +/** + * Launch puppeteer with arbitrary user preferences. + * + * The user defined preferences will be merged with preferences set by other plugins. + * Plugins can add user preferences by exposing a data entry with the name `userPreferences`. + * + * Overview: + * https://chromium.googlesource.com/chromium/src/+/master/chrome/common/pref_names.cc + * + * @param {Object} opts - Options + * @param {Object} [opts.userPrefs={}] - An object containing the preferences. + * + * @example + * const puppeteer = require('puppeteer-extra') + * puppeteer.use(require('puppeteer-extra-plugin-user-preferences')({userPrefs: { + * webkit: { + * webprefs: { + * default_font_size: 22 + * } + * } + * }})) + * const browser = await puppeteer.launch() + */ +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + this._userPrefsFromPlugins = {} + + const defaults = { + userPrefs: {} + } + + this._opts = Object.assign(defaults, opts) + } + + get name() { + return 'user-preferences' + } + + get requirements() { + return new Set(['runLast', 'dataFromPlugins']) + } + + get dependencies() { + return new Set(['user-data-dir']) + } + + get data() { + return [ + { + name: 'userDataDirFile', + value: { + target: 'Profile', + file: 'Preferences', + contents: JSON.stringify(this.combinedPrefs, null, 2) + } + } + ] + } + + get combinedPrefs() { + return merge(this._opts.userPrefs, this._userPrefsFromPlugins) + } + + async beforeLaunch(options) { + this._userPrefsFromPlugins = merge.all( + this.getDataFromPlugins('userPreferences').map(d => d.value) + ) + this.debug('_userPrefsFromPlugins', this._userPrefsFromPlugins) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/package.json new file mode 100644 index 0000000..2c70fcb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/package.json @@ -0,0 +1,52 @@ +{ + "name": "puppeteer-extra-plugin-user-preferences", + "version": "2.4.1", + "description": "Launch puppeteer with arbitrary user preferences.", + "main": "index.js", + "repository": "berstend/puppeteer-extra", + "author": "berstend", + "license": "MIT", + "scripts": { + "docs": "node -e 0", + "lint": "eslint --ext .js .", + "test": "run-p lint", + "test-ci": "run-s test" + }, + "engines": { + "node": ">=8" + }, + "keywords": [ + "puppeteer", + "puppeteer-extra", + "puppeteer-extra-plugin", + "user-prefs", + "user-preferences", + "chrome", + "headless", + "pupeteer" + ], + "devDependencies": { + "ava": "2.4.0", + "npm-run-all": "^4.1.5", + "puppeteer": "^2.0.0" + }, + "dependencies": { + "debug": "^4.1.1", + "deepmerge": "^4.2.2", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-data-dir": "^2.4.1" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "puppeteer-extra": { + "optional": true + }, + "playwright-extra": { + "optional": true + } + }, + "gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/readme.md new file mode 100644 index 0000000..34e8f63 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin-user-preferences/readme.md @@ -0,0 +1,50 @@ +# puppeteer-extra-plugin-user-preferences + +> A plugin for [puppeteer-extra](https://github.com/berstend/puppeteer-extra). + +### Install + +```bash +yarn add puppeteer-extra-plugin-user-preferences +``` + +## API + + + +#### Table of Contents + +- [Plugin](#plugin) + +### [Plugin](https://github.com/berstend/puppeteer-extra/blob/db57ea66cf10d407cf63af387892492e495a84f2/packages/puppeteer-extra-plugin-user-preferences/index.js#L30-L73) + +**Extends: PuppeteerExtraPlugin** + +Launch puppeteer with arbitrary user preferences. + +The user defined preferences will be merged with preferences set by other plugins. +Plugins can add user preferences by exposing a data entry with the name `userPreferences`. + +Overview: + + +Type: `function (opts)` + +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Options (optional, default `{}`) + - `opts.userPrefs` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** An object containing the preferences. (optional, default `{}`) + +Example: + +```javascript +const puppeteer = require('puppeteer-extra') +puppeteer.use(require('puppeteer-extra-plugin-user-preferences')({userPrefs: { + webkit: { + webprefs: { + default_font_size: 22 + } + } +}})) +const browser = await puppeteer.launch() +``` + +* * * diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/LICENSE b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/LICENSE new file mode 100644 index 0000000..a53ecb8 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 berstend + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js new file mode 100644 index 0000000..4c86e34 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js @@ -0,0 +1,533 @@ +/*! + * puppeteer-extra-plugin v3.2.2 by berstend + * https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin + * @license MIT + */ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var debug = _interopDefault(require('debug')); + +/** @private */ +const merge = require('merge-deep'); +/** + * Base class for `puppeteer-extra` plugins. + * + * Provides convenience methods to avoid boilerplate. + * + * All common `puppeteer` browser events will be bound to + * the plugin instance, if a respectively named class member is found. + * + * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well. + * + * @example + * // hello-world-plugin.js + * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + * + * class Plugin extends PuppeteerExtraPlugin { + * constructor (opts = { }) { super(opts) } + * + * get name () { return 'hello-world' } + * + * async onPageCreated (page) { + * this.debug('page created', page.url()) + * const ua = await page.browser().userAgent() + * this.debug('user agent', ua) + * } + * } + * + * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) } + * + * + * // foo.js + * const puppeteer = require('puppeteer-extra') + * puppeteer.use(require('./hello-world-plugin')()) + * + * ;(async () => { + * const browser = await puppeteer.launch({headless: false}) + * const page = await browser.newPage() + * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'}) + * await browser.close() + * })() + * + */ +class PuppeteerExtraPlugin { + constructor(opts) { + this._debugBase = debug(`puppeteer-extra-plugin:base:${this.name}`); + this._childClassMembers = []; + this._opts = merge(this.defaults, opts || {}); + this._debugBase('Initialized.'); + } + /** + * Plugin name (required). + * + * Convention: + * - Package: `puppeteer-extra-plugin-anonymize-ua` + * - Name: `anonymize-ua` + * + * @example + * get name () { return 'anonymize-ua' } + */ + get name() { + throw new Error('Plugin must override "name"'); + } + /** + * Plugin defaults (optional). + * + * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation). + * + * The result of merging defaults with user supplied options can be accessed through `this.opts`. + * + * @see [[opts]] + * + * @example + * get defaults () { + * return { + * stripHeadless: true, + * makeWindows: true, + * customFn: null + * } + * } + * + * // Users can overwrite plugin defaults during instantiation: + * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false })) + */ + get defaults() { + return {}; + } + /** + * Plugin requirements (optional). + * + * Signal certain plugin requirements to the base class and the user. + * + * Currently supported: + * - `launch` + * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`), + * will output a warning to the user. + * - `headful` + * - If the plugin doesn't work in `headless: true` mode, + * will output a warning to the user. + * - `dataFromPlugins` + * - In case the plugin requires data from other plugins. + * will enable usage of `this.getDataFromPlugins()`. + * - `runLast` + * - In case the plugin prefers to run after the others. + * Useful when the plugin needs data from others. + * + * @example + * get requirements () { + * return new Set(['runLast', 'dataFromPlugins']) + * } + */ + get requirements() { + return new Set([]); + } + /** + * Plugin dependencies (optional). + * + * Missing plugins will be required() by puppeteer-extra. + * + * @example + * get dependencies () { + * return new Set(['user-preferences']) + * } + * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded. + */ + get dependencies() { + return new Set([]); + } + /** + * Plugin data (optional). + * + * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins, + * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`). + * + * Convention: `[ {name: 'Any name', value: 'Any value'} ]` + * + * @see [[getDataFromPlugins]] + * + * @example + * // plugin1.js + * get data () { + * return [ + * { + * name: 'userPreferences', + * value: { foo: 'bar' } + * }, + * { + * name: 'userPreferences', + * value: { hello: 'world' } + * } + * ] + * + * // plugin2.js + * get requirements () { return new Set(['dataFromPlugins']) } + * + * async beforeLaunch () { + * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) + * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] + * } + */ + get data() { + return []; + } + /** + * Access the plugin options (usually the `defaults` merged with user defined options) + * + * To skip the auto-merging of defaults with user supplied opts don't define a `defaults` + * property and set the `this._opts` Object in your plugin constructor directly. + * + * @see [[defaults]] + * + * @example + * get defaults () { return { foo: "bar" } } + * + * async onPageCreated (page) { + * this.debug(this.opts.foo) // => bar + * } + */ + get opts() { + return this._opts; + } + /** + * Convenience debug logger based on the [debug] module. + * Will automatically namespace the logging output to the plugin package name. + * [debug]: https://www.npmjs.com/package/debug + * + * ```bash + * # toggle output using environment variables + * DEBUG=puppeteer-extra-plugin: node foo.js + * # to debug all the things: + * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js + * ``` + * + * @example + * this.debug('hello world') + * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world' + */ + get debug() { + return debug(`puppeteer-extra-plugin:${this.name}`); + } + /** + * Before a new browser instance is created/launched. + * + * Can be used to modify the puppeteer launch options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @example + * async beforeLaunch (options) { + * if (this.opts.flashPluginPath) { + * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) + * } + * } + * + * @param options - Puppeteer launch options + */ + async beforeLaunch(options) { + // noop + } + /** + * After the browser has launched. + * + * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created. + * In order to make the plugins as stateless as possible don't store a reference to the browser instance + * in the plugin but rather consider alternatives. + * + * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`. + * + * Alternatively you could expose a class method that takes a browser instance as a parameter to work with: + * + * ```es6 + * const fancyPlugin = require('puppeteer-extra-plugin-fancy')() + * puppeteer.use(fancyPlugin) + * const browser = await puppeteer.launch() + * await fancyPlugin.killBrowser(browser) + * ``` + * + * @param browser - The `puppeteer` browser instance. + * @param opts.options - Puppeteer launch options used. + * + * @example + * async afterLaunch (browser, opts) { + * this.debug('browser has been launched', opts.options) + * } + */ + async afterLaunch(browser, opts = { options: {} }) { + // noop + } + /** + * Before connecting to an existing browser instance. + * + * Can be used to modify the puppeteer connect options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @param {Object} options - Puppeteer connect options + * @return {Object=} + */ + async beforeConnect(options) { + // noop + } + /** + * After connecting to an existing browser instance. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + * @param {Object} opts + * @param {Object} opts.options - Puppeteer connect options used. + * + */ + async afterConnect(browser, opts = {}) { + // noop + } + /** + * Called when a browser instance is available. + * + * This applies to both `puppeteer.launch()` and `puppeteer.connect()`. + * + * Convenience method created for plugins that need access to a browser instance + * and don't mind if it has been created through `launch` or `connect`. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + */ + async onBrowser(browser, opts) { + // noop + } + /** + * Called when a target is created, for example when a new page is opened by window.open or browser.newPage. + * + * > Note: This includes target creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetCreated(target) { + // noop + } + /** + * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience. + * + * > Note: This includes page creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + * + * @example + * async onPageCreated (page) { + * let ua = await page.browser().userAgent() + * if (this.opts.stripHeadless) { + * ua = ua.replace('HeadlessChrome/', 'Chrome/') + * } + * this.debug('new ua', ua) + * await page.setUserAgent(ua) + * } + */ + async onPageCreated(page) { + // noop + } + /** + * Called when the url of a target changes. + * + * > Note: This includes target changes in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetChanged(target) { + // noop + } + /** + * Called when a target is destroyed, for example when a page is closed. + * + * > Note: This includes target destructions in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetDestroyed(target) { + // noop + } + /** + * Called when Puppeteer gets disconnected from the Chromium instance. + * + * This might happen because of one of the following: + * - Chromium is closed or crashed + * - The `browser.disconnect` method was called + */ + async onDisconnected() { + // noop + } + /** + * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved + * and should be used instead of `onClose`. + * + * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios. + * In order for plugins to clean up properly (e.g. deleting temporary files) + * the `onClose` method had been introduced. + * + * > Note: Might be called multiple times on exit. + * + * > Note: This only includes browser instances created through `.launch()`. + */ + async onClose() { + // noop + } + /** + * After the plugin has been registered in `puppeteer-extra`. + * + * Normally right after `puppeteer.use(plugin)` is called + */ + async onPluginRegistered() { + // noop + } + /** + * Helper method to retrieve `data` objects from other plugins. + * + * A plugin needs to state the `dataFromPlugins` requirement + * in order to use this method. Will be mapped to `puppeteer.getPluginData`. + * + * @param name - Filter data by `name` property + * + * @see [data] + * @see [requirements] + */ + getDataFromPlugins(name) { + return []; + } + /** + * Will match plugin dependencies against all currently registered plugins. + * Is being called by `puppeteer-extra` and used to require missing dependencies. + * + * @param {Array} plugins + * @return {Set} - list of missing plugin names + * + * @private + */ + _getMissingDependencies(plugins) { + const pluginNames = new Set(plugins.map((p) => p.name)); + const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); + return missing; + } + /** + * Conditionally bind browser/process events to class members. + * The idea is to reduce event binding boilerplate in plugins. + * + * For efficiency we make sure the plugin is using the respective event + * by checking the child class members before registering the listener. + * + * @param {} browser + * @param {Object} opts - Options + * @param {string} opts.context - Puppeteer context (launch/connect) + * @param {Object} [opts.options] - Puppeteer launch or connect options + * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with + * + * @private + */ + async _bindBrowserEvents(browser, opts = {}) { + if (this._hasChildClassMember('onTargetCreated') || + this._hasChildClassMember('onPageCreated')) { + browser.on('targetcreated', this._onTargetCreated.bind(this)); + } + if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) { + browser.on('targetchanged', this.onTargetChanged.bind(this)); + } + if (this._hasChildClassMember('onTargetDestroyed') && + this.onTargetDestroyed) { + browser.on('targetdestroyed', this.onTargetDestroyed.bind(this)); + } + if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) { + browser.on('disconnected', this.onDisconnected.bind(this)); + } + if (opts.context === 'launch' && this._hasChildClassMember('onClose')) { + // The disconnect event has been improved since puppeteer v1.6.0 + // onClose is being kept mostly for legacy reasons + if (this.onClose) { + process.on('exit', this.onClose.bind(this)); + browser.on('disconnected', this.onClose.bind(this)); + if (opts.options.handleSIGINT !== false) { + process.on('SIGINT', this.onClose.bind(this)); + } + if (opts.options.handleSIGTERM !== false) { + process.on('SIGTERM', this.onClose.bind(this)); + } + if (opts.options.handleSIGHUP !== false) { + process.on('SIGHUP', this.onClose.bind(this)); + } + } + } + if (opts.context === 'launch' && this.afterLaunch) { + await this.afterLaunch(browser, opts); + } + if (opts.context === 'connect' && this.afterConnect) { + await this.afterConnect(browser, opts); + } + if (this.onBrowser) + await this.onBrowser(browser, opts); + } + /** + * @private + */ + async _onTargetCreated(target) { + if (this.onTargetCreated) + await this.onTargetCreated(target); + // Pre filter pages for plugin developers convenience + if (target.type() === 'page') { + try { + const page = await target.page(); + if (!page) { + return; + } + const validPage = 'isClosed' in page && !page.isClosed(); + if (this.onPageCreated && validPage) { + await this.onPageCreated(page); + } + } + catch (err) { + console.error(err); + } + } + } + /** + * @private + */ + _register(prototype) { + this._registerChildClassMembers(prototype); + if (this.onPluginRegistered) + this.onPluginRegistered(); + } + /** + * @private + */ + _registerChildClassMembers(prototype) { + this._childClassMembers = Object.getOwnPropertyNames(prototype); + } + /** + * @private + */ + _hasChildClassMember(name) { + return !!this._childClassMembers.includes(name); + } + /** + * @private + */ + get _isPuppeteerExtraPlugin() { + return true; + } +} + +exports.PuppeteerExtraPlugin = PuppeteerExtraPlugin; +//# sourceMappingURL=index.cjs.js.map diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js.map b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js.map new file mode 100644 index 0000000..776887c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.cjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs.js","sources":["../src/index.ts"],"sourcesContent":["import debug, { Debugger } from 'debug'\nimport * as Puppeteer from './puppeteer'\n\n/** @private */\nconst merge = require('merge-deep')\n\nexport interface PluginOptions {\n [key: string]: any\n}\nexport interface PluginData {\n name: {\n [key: string]: any\n }\n value: {\n [key: string]: any\n }\n}\n\nexport type PluginDependencies = Set\nexport type PluginRequirements = Set<\n 'launch' | 'headful' | 'dataFromPlugins' | 'runLast'\n>\n\n/**\n * Base class for `puppeteer-extra` plugins.\n *\n * Provides convenience methods to avoid boilerplate.\n *\n * All common `puppeteer` browser events will be bound to\n * the plugin instance, if a respectively named class member is found.\n *\n * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well.\n *\n * @example\n * // hello-world-plugin.js\n * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')\n *\n * class Plugin extends PuppeteerExtraPlugin {\n * constructor (opts = { }) { super(opts) }\n *\n * get name () { return 'hello-world' }\n *\n * async onPageCreated (page) {\n * this.debug('page created', page.url())\n * const ua = await page.browser().userAgent()\n * this.debug('user agent', ua)\n * }\n * }\n *\n * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) }\n *\n *\n * // foo.js\n * const puppeteer = require('puppeteer-extra')\n * puppeteer.use(require('./hello-world-plugin')())\n *\n * ;(async () => {\n * const browser = await puppeteer.launch({headless: false})\n * const page = await browser.newPage()\n * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'})\n * await browser.close()\n * })()\n *\n */\nexport abstract class PuppeteerExtraPlugin {\n /** @private */\n private _debugBase: Debugger\n /** @private */\n private _opts: PluginOptions\n /** @private */\n private _childClassMembers: string[]\n\n constructor(opts?: PluginOptions) {\n this._debugBase = debug(`puppeteer-extra-plugin:base:${this.name}`)\n this._childClassMembers = []\n\n this._opts = merge(this.defaults, opts || {})\n\n this._debugBase('Initialized.')\n }\n\n /**\n * Plugin name (required).\n *\n * Convention:\n * - Package: `puppeteer-extra-plugin-anonymize-ua`\n * - Name: `anonymize-ua`\n *\n * @example\n * get name () { return 'anonymize-ua' }\n */\n get name(): string {\n throw new Error('Plugin must override \"name\"')\n }\n\n /**\n * Plugin defaults (optional).\n *\n * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation).\n *\n * The result of merging defaults with user supplied options can be accessed through `this.opts`.\n *\n * @see [[opts]]\n *\n * @example\n * get defaults () {\n * return {\n * stripHeadless: true,\n * makeWindows: true,\n * customFn: null\n * }\n * }\n *\n * // Users can overwrite plugin defaults during instantiation:\n * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))\n */\n get defaults(): PluginOptions {\n return {}\n }\n\n /**\n * Plugin requirements (optional).\n *\n * Signal certain plugin requirements to the base class and the user.\n *\n * Currently supported:\n * - `launch`\n * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`),\n * will output a warning to the user.\n * - `headful`\n * - If the plugin doesn't work in `headless: true` mode,\n * will output a warning to the user.\n * - `dataFromPlugins`\n * - In case the plugin requires data from other plugins.\n * will enable usage of `this.getDataFromPlugins()`.\n * - `runLast`\n * - In case the plugin prefers to run after the others.\n * Useful when the plugin needs data from others.\n *\n * @example\n * get requirements () {\n * return new Set(['runLast', 'dataFromPlugins'])\n * }\n */\n get requirements(): PluginRequirements {\n return new Set([])\n }\n\n /**\n * Plugin dependencies (optional).\n *\n * Missing plugins will be required() by puppeteer-extra.\n *\n * @example\n * get dependencies () {\n * return new Set(['user-preferences'])\n * }\n * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.\n */\n get dependencies(): PluginDependencies {\n return new Set([])\n }\n\n /**\n * Plugin data (optional).\n *\n * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,\n * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`).\n *\n * Convention: `[ {name: 'Any name', value: 'Any value'} ]`\n *\n * @see [[getDataFromPlugins]]\n *\n * @example\n * // plugin1.js\n * get data () {\n * return [\n * {\n * name: 'userPreferences',\n * value: { foo: 'bar' }\n * },\n * {\n * name: 'userPreferences',\n * value: { hello: 'world' }\n * }\n * ]\n *\n * // plugin2.js\n * get requirements () { return new Set(['dataFromPlugins']) }\n *\n * async beforeLaunch () {\n * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value)\n * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ]\n * }\n */\n get data(): PluginData[] {\n return []\n }\n\n /**\n * Access the plugin options (usually the `defaults` merged with user defined options)\n *\n * To skip the auto-merging of defaults with user supplied opts don't define a `defaults`\n * property and set the `this._opts` Object in your plugin constructor directly.\n *\n * @see [[defaults]]\n *\n * @example\n * get defaults () { return { foo: \"bar\" } }\n *\n * async onPageCreated (page) {\n * this.debug(this.opts.foo) // => bar\n * }\n */\n get opts(): PluginOptions {\n return this._opts\n }\n\n /**\n * Convenience debug logger based on the [debug] module.\n * Will automatically namespace the logging output to the plugin package name.\n * [debug]: https://www.npmjs.com/package/debug\n *\n * ```bash\n * # toggle output using environment variables\n * DEBUG=puppeteer-extra-plugin: node foo.js\n * # to debug all the things:\n * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js\n * ```\n *\n * @example\n * this.debug('hello world')\n * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'\n */\n get debug(): Debugger {\n return debug(`puppeteer-extra-plugin:${this.name}`)\n }\n\n /**\n * Before a new browser instance is created/launched.\n *\n * Can be used to modify the puppeteer launch options by modifying or returning them.\n *\n * Plugins using this method will be called in sequence to each\n * be able to update the launch options.\n *\n * @example\n * async beforeLaunch (options) {\n * if (this.opts.flashPluginPath) {\n * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`)\n * }\n * }\n *\n * @param options - Puppeteer launch options\n */\n async beforeLaunch(options: any) {\n // noop\n }\n\n /**\n * After the browser has launched.\n *\n * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created.\n * In order to make the plugins as stateless as possible don't store a reference to the browser instance\n * in the plugin but rather consider alternatives.\n *\n * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`.\n *\n * Alternatively you could expose a class method that takes a browser instance as a parameter to work with:\n *\n * ```es6\n * const fancyPlugin = require('puppeteer-extra-plugin-fancy')()\n * puppeteer.use(fancyPlugin)\n * const browser = await puppeteer.launch()\n * await fancyPlugin.killBrowser(browser)\n * ```\n *\n * @param browser - The `puppeteer` browser instance.\n * @param opts.options - Puppeteer launch options used.\n *\n * @example\n * async afterLaunch (browser, opts) {\n * this.debug('browser has been launched', opts.options)\n * }\n */\n async afterLaunch(\n browser: Puppeteer.Browser,\n opts = { options: {} as Puppeteer.LaunchOptions }\n ) {\n // noop\n }\n\n /**\n * Before connecting to an existing browser instance.\n *\n * Can be used to modify the puppeteer connect options by modifying or returning them.\n *\n * Plugins using this method will be called in sequence to each\n * be able to update the launch options.\n *\n * @param {Object} options - Puppeteer connect options\n * @return {Object=}\n */\n async beforeConnect(options: Puppeteer.ConnectOptions) {\n // noop\n }\n\n /**\n * After connecting to an existing browser instance.\n *\n * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n *\n * @param browser - The `puppeteer` browser instance.\n * @param {Object} opts\n * @param {Object} opts.options - Puppeteer connect options used.\n *\n */\n async afterConnect(browser: Puppeteer.Browser, opts = {}) {\n // noop\n }\n\n /**\n * Called when a browser instance is available.\n *\n * This applies to both `puppeteer.launch()` and `puppeteer.connect()`.\n *\n * Convenience method created for plugins that need access to a browser instance\n * and don't mind if it has been created through `launch` or `connect`.\n *\n * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n *\n * @param browser - The `puppeteer` browser instance.\n */\n public async onBrowser(browser: Puppeteer.Browser, opts: any): Promise {\n // noop\n }\n\n /**\n * Called when a target is created, for example when a new page is opened by window.open or browser.newPage.\n *\n * > Note: This includes target creations in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetCreated(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience.\n *\n * > Note: This includes page creations in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n *\n * @example\n * async onPageCreated (page) {\n * let ua = await page.browser().userAgent()\n * if (this.opts.stripHeadless) {\n * ua = ua.replace('HeadlessChrome/', 'Chrome/')\n * }\n * this.debug('new ua', ua)\n * await page.setUserAgent(ua)\n * }\n */\n async onPageCreated(page: Puppeteer.Page) {\n // noop\n }\n\n /**\n * Called when the url of a target changes.\n *\n * > Note: This includes target changes in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetChanged(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Called when a target is destroyed, for example when a page is closed.\n *\n * > Note: This includes target destructions in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetDestroyed(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Called when Puppeteer gets disconnected from the Chromium instance.\n *\n * This might happen because of one of the following:\n * - Chromium is closed or crashed\n * - The `browser.disconnect` method was called\n */\n async onDisconnected() {\n // noop\n }\n\n /**\n * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved\n * and should be used instead of `onClose`.\n *\n * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios.\n * In order for plugins to clean up properly (e.g. deleting temporary files)\n * the `onClose` method had been introduced.\n *\n * > Note: Might be called multiple times on exit.\n *\n * > Note: This only includes browser instances created through `.launch()`.\n */\n async onClose() {\n // noop\n }\n\n /**\n * After the plugin has been registered in `puppeteer-extra`.\n *\n * Normally right after `puppeteer.use(plugin)` is called\n */\n async onPluginRegistered() {\n // noop\n }\n\n /**\n * Helper method to retrieve `data` objects from other plugins.\n *\n * A plugin needs to state the `dataFromPlugins` requirement\n * in order to use this method. Will be mapped to `puppeteer.getPluginData`.\n *\n * @param name - Filter data by `name` property\n *\n * @see [data]\n * @see [requirements]\n */\n getDataFromPlugins(name?: string): PluginData[] {\n return []\n }\n\n /**\n * Will match plugin dependencies against all currently registered plugins.\n * Is being called by `puppeteer-extra` and used to require missing dependencies.\n *\n * @param {Array} plugins\n * @return {Set} - list of missing plugin names\n *\n * @private\n */\n _getMissingDependencies(plugins: any) {\n const pluginNames = new Set(plugins.map((p: any) => p.name))\n const missing = new Set(\n Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))\n )\n return missing\n }\n\n /**\n * Conditionally bind browser/process events to class members.\n * The idea is to reduce event binding boilerplate in plugins.\n *\n * For efficiency we make sure the plugin is using the respective event\n * by checking the child class members before registering the listener.\n *\n * @param {} browser\n * @param {Object} opts - Options\n * @param {string} opts.context - Puppeteer context (launch/connect)\n * @param {Object} [opts.options] - Puppeteer launch or connect options\n * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with\n *\n * @private\n */\n async _bindBrowserEvents(browser: Puppeteer.Browser, opts: any = {}) {\n if (\n this._hasChildClassMember('onTargetCreated') ||\n this._hasChildClassMember('onPageCreated')\n ) {\n browser.on('targetcreated', this._onTargetCreated.bind(this))\n }\n if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) {\n browser.on('targetchanged', this.onTargetChanged.bind(this))\n }\n if (\n this._hasChildClassMember('onTargetDestroyed') &&\n this.onTargetDestroyed\n ) {\n browser.on('targetdestroyed', this.onTargetDestroyed.bind(this))\n }\n if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) {\n browser.on('disconnected', this.onDisconnected.bind(this))\n }\n if (opts.context === 'launch' && this._hasChildClassMember('onClose')) {\n // The disconnect event has been improved since puppeteer v1.6.0\n // onClose is being kept mostly for legacy reasons\n if (this.onClose) {\n process.on('exit', this.onClose.bind(this))\n browser.on('disconnected', this.onClose.bind(this))\n\n if (opts.options.handleSIGINT !== false) {\n process.on('SIGINT', this.onClose.bind(this))\n }\n if (opts.options.handleSIGTERM !== false) {\n process.on('SIGTERM', this.onClose.bind(this))\n }\n if (opts.options.handleSIGHUP !== false) {\n process.on('SIGHUP', this.onClose.bind(this))\n }\n }\n }\n if (opts.context === 'launch' && this.afterLaunch) {\n await this.afterLaunch(browser, opts)\n }\n if (opts.context === 'connect' && this.afterConnect) {\n await this.afterConnect(browser, opts)\n }\n if (this.onBrowser) await this.onBrowser(browser, opts)\n }\n\n /**\n * @private\n */\n async _onTargetCreated(target: Puppeteer.Target) {\n if (this.onTargetCreated) await this.onTargetCreated(target)\n // Pre filter pages for plugin developers convenience\n if (target.type() === 'page') {\n try {\n const page = await target.page()\n if (!page) {\n return\n }\n const validPage = 'isClosed' in page && !page.isClosed()\n if (this.onPageCreated && validPage) {\n await this.onPageCreated(page)\n }\n } catch (err) {\n console.error(err)\n }\n }\n }\n\n /**\n * @private\n */\n _register(prototype: any) {\n this._registerChildClassMembers(prototype)\n if (this.onPluginRegistered) this.onPluginRegistered()\n }\n\n /**\n * @private\n */\n _registerChildClassMembers(prototype: any) {\n this._childClassMembers = Object.getOwnPropertyNames(prototype)\n }\n\n /**\n * @private\n */\n _hasChildClassMember(name: string) {\n return !!this._childClassMembers.includes(name)\n }\n\n /**\n * @private\n */\n get _isPuppeteerExtraPlugin() {\n return true\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAGA;AACA,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAmBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyCsB,oBAAoB;IAQxC,YAAY,IAAoB;QAC9B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,+BAA+B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACnE,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAE5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,CAAA;QAE7C,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,CAAA;KAChC;;;;;;;;;;;IAYD,IAAI,IAAI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--git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.d.ts b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.d.ts new file mode 100644 index 0000000..c3fd8cd --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.d.ts @@ -0,0 +1,420 @@ +import { Debugger } from 'debug'; +import * as Puppeteer from './puppeteer'; +export interface PluginOptions { + [key: string]: any; +} +export interface PluginData { + name: { + [key: string]: any; + }; + value: { + [key: string]: any; + }; +} +export declare type PluginDependencies = Set; +export declare type PluginRequirements = Set<'launch' | 'headful' | 'dataFromPlugins' | 'runLast'>; +/** + * Base class for `puppeteer-extra` plugins. + * + * Provides convenience methods to avoid boilerplate. + * + * All common `puppeteer` browser events will be bound to + * the plugin instance, if a respectively named class member is found. + * + * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well. + * + * @example + * // hello-world-plugin.js + * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + * + * class Plugin extends PuppeteerExtraPlugin { + * constructor (opts = { }) { super(opts) } + * + * get name () { return 'hello-world' } + * + * async onPageCreated (page) { + * this.debug('page created', page.url()) + * const ua = await page.browser().userAgent() + * this.debug('user agent', ua) + * } + * } + * + * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) } + * + * + * // foo.js + * const puppeteer = require('puppeteer-extra') + * puppeteer.use(require('./hello-world-plugin')()) + * + * ;(async () => { + * const browser = await puppeteer.launch({headless: false}) + * const page = await browser.newPage() + * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'}) + * await browser.close() + * })() + * + */ +export declare abstract class PuppeteerExtraPlugin { + /** @private */ + private _debugBase; + /** @private */ + private _opts; + /** @private */ + private _childClassMembers; + constructor(opts?: PluginOptions); + /** + * Plugin name (required). + * + * Convention: + * - Package: `puppeteer-extra-plugin-anonymize-ua` + * - Name: `anonymize-ua` + * + * @example + * get name () { return 'anonymize-ua' } + */ + get name(): string; + /** + * Plugin defaults (optional). + * + * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation). + * + * The result of merging defaults with user supplied options can be accessed through `this.opts`. + * + * @see [[opts]] + * + * @example + * get defaults () { + * return { + * stripHeadless: true, + * makeWindows: true, + * customFn: null + * } + * } + * + * // Users can overwrite plugin defaults during instantiation: + * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false })) + */ + get defaults(): PluginOptions; + /** + * Plugin requirements (optional). + * + * Signal certain plugin requirements to the base class and the user. + * + * Currently supported: + * - `launch` + * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`), + * will output a warning to the user. + * - `headful` + * - If the plugin doesn't work in `headless: true` mode, + * will output a warning to the user. + * - `dataFromPlugins` + * - In case the plugin requires data from other plugins. + * will enable usage of `this.getDataFromPlugins()`. + * - `runLast` + * - In case the plugin prefers to run after the others. + * Useful when the plugin needs data from others. + * + * @example + * get requirements () { + * return new Set(['runLast', 'dataFromPlugins']) + * } + */ + get requirements(): PluginRequirements; + /** + * Plugin dependencies (optional). + * + * Missing plugins will be required() by puppeteer-extra. + * + * @example + * get dependencies () { + * return new Set(['user-preferences']) + * } + * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded. + */ + get dependencies(): PluginDependencies; + /** + * Plugin data (optional). + * + * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins, + * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`). + * + * Convention: `[ {name: 'Any name', value: 'Any value'} ]` + * + * @see [[getDataFromPlugins]] + * + * @example + * // plugin1.js + * get data () { + * return [ + * { + * name: 'userPreferences', + * value: { foo: 'bar' } + * }, + * { + * name: 'userPreferences', + * value: { hello: 'world' } + * } + * ] + * + * // plugin2.js + * get requirements () { return new Set(['dataFromPlugins']) } + * + * async beforeLaunch () { + * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) + * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] + * } + */ + get data(): PluginData[]; + /** + * Access the plugin options (usually the `defaults` merged with user defined options) + * + * To skip the auto-merging of defaults with user supplied opts don't define a `defaults` + * property and set the `this._opts` Object in your plugin constructor directly. + * + * @see [[defaults]] + * + * @example + * get defaults () { return { foo: "bar" } } + * + * async onPageCreated (page) { + * this.debug(this.opts.foo) // => bar + * } + */ + get opts(): PluginOptions; + /** + * Convenience debug logger based on the [debug] module. + * Will automatically namespace the logging output to the plugin package name. + * [debug]: https://www.npmjs.com/package/debug + * + * ```bash + * # toggle output using environment variables + * DEBUG=puppeteer-extra-plugin: node foo.js + * # to debug all the things: + * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js + * ``` + * + * @example + * this.debug('hello world') + * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world' + */ + get debug(): Debugger; + /** + * Before a new browser instance is created/launched. + * + * Can be used to modify the puppeteer launch options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @example + * async beforeLaunch (options) { + * if (this.opts.flashPluginPath) { + * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) + * } + * } + * + * @param options - Puppeteer launch options + */ + beforeLaunch(options: any): Promise; + /** + * After the browser has launched. + * + * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created. + * In order to make the plugins as stateless as possible don't store a reference to the browser instance + * in the plugin but rather consider alternatives. + * + * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`. + * + * Alternatively you could expose a class method that takes a browser instance as a parameter to work with: + * + * ```es6 + * const fancyPlugin = require('puppeteer-extra-plugin-fancy')() + * puppeteer.use(fancyPlugin) + * const browser = await puppeteer.launch() + * await fancyPlugin.killBrowser(browser) + * ``` + * + * @param browser - The `puppeteer` browser instance. + * @param opts.options - Puppeteer launch options used. + * + * @example + * async afterLaunch (browser, opts) { + * this.debug('browser has been launched', opts.options) + * } + */ + afterLaunch(browser: Puppeteer.Browser, opts?: { + options: Puppeteer.LaunchOptions; + }): Promise; + /** + * Before connecting to an existing browser instance. + * + * Can be used to modify the puppeteer connect options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @param {Object} options - Puppeteer connect options + * @return {Object=} + */ + beforeConnect(options: Puppeteer.ConnectOptions): Promise; + /** + * After connecting to an existing browser instance. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + * @param {Object} opts + * @param {Object} opts.options - Puppeteer connect options used. + * + */ + afterConnect(browser: Puppeteer.Browser, opts?: {}): Promise; + /** + * Called when a browser instance is available. + * + * This applies to both `puppeteer.launch()` and `puppeteer.connect()`. + * + * Convenience method created for plugins that need access to a browser instance + * and don't mind if it has been created through `launch` or `connect`. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + */ + onBrowser(browser: Puppeteer.Browser, opts: any): Promise; + /** + * Called when a target is created, for example when a new page is opened by window.open or browser.newPage. + * + * > Note: This includes target creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + onTargetCreated(target: Puppeteer.Target): Promise; + /** + * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience. + * + * > Note: This includes page creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + * + * @example + * async onPageCreated (page) { + * let ua = await page.browser().userAgent() + * if (this.opts.stripHeadless) { + * ua = ua.replace('HeadlessChrome/', 'Chrome/') + * } + * this.debug('new ua', ua) + * await page.setUserAgent(ua) + * } + */ + onPageCreated(page: Puppeteer.Page): Promise; + /** + * Called when the url of a target changes. + * + * > Note: This includes target changes in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + onTargetChanged(target: Puppeteer.Target): Promise; + /** + * Called when a target is destroyed, for example when a page is closed. + * + * > Note: This includes target destructions in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + onTargetDestroyed(target: Puppeteer.Target): Promise; + /** + * Called when Puppeteer gets disconnected from the Chromium instance. + * + * This might happen because of one of the following: + * - Chromium is closed or crashed + * - The `browser.disconnect` method was called + */ + onDisconnected(): Promise; + /** + * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved + * and should be used instead of `onClose`. + * + * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios. + * In order for plugins to clean up properly (e.g. deleting temporary files) + * the `onClose` method had been introduced. + * + * > Note: Might be called multiple times on exit. + * + * > Note: This only includes browser instances created through `.launch()`. + */ + onClose(): Promise; + /** + * After the plugin has been registered in `puppeteer-extra`. + * + * Normally right after `puppeteer.use(plugin)` is called + */ + onPluginRegistered(): Promise; + /** + * Helper method to retrieve `data` objects from other plugins. + * + * A plugin needs to state the `dataFromPlugins` requirement + * in order to use this method. Will be mapped to `puppeteer.getPluginData`. + * + * @param name - Filter data by `name` property + * + * @see [data] + * @see [requirements] + */ + getDataFromPlugins(name?: string): PluginData[]; + /** + * Will match plugin dependencies against all currently registered plugins. + * Is being called by `puppeteer-extra` and used to require missing dependencies. + * + * @param {Array} plugins + * @return {Set} - list of missing plugin names + * + * @private + */ + _getMissingDependencies(plugins: any): Set; + /** + * Conditionally bind browser/process events to class members. + * The idea is to reduce event binding boilerplate in plugins. + * + * For efficiency we make sure the plugin is using the respective event + * by checking the child class members before registering the listener. + * + * @param {} browser + * @param {Object} opts - Options + * @param {string} opts.context - Puppeteer context (launch/connect) + * @param {Object} [opts.options] - Puppeteer launch or connect options + * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with + * + * @private + */ + _bindBrowserEvents(browser: Puppeteer.Browser, opts?: any): Promise; + /** + * @private + */ + _onTargetCreated(target: Puppeteer.Target): Promise; + /** + * @private + */ + _register(prototype: any): void; + /** + * @private + */ + _registerChildClassMembers(prototype: any): void; + /** + * @private + */ + _hasChildClassMember(name: string): boolean; + /** + * @private + */ + get _isPuppeteerExtraPlugin(): boolean; +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js new file mode 100644 index 0000000..2c62e9c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js @@ -0,0 +1,527 @@ +/*! + * puppeteer-extra-plugin v3.2.2 by berstend + * https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin + * @license MIT + */ +import debug from 'debug'; + +/** @private */ +const merge = require('merge-deep'); +/** + * Base class for `puppeteer-extra` plugins. + * + * Provides convenience methods to avoid boilerplate. + * + * All common `puppeteer` browser events will be bound to + * the plugin instance, if a respectively named class member is found. + * + * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well. + * + * @example + * // hello-world-plugin.js + * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + * + * class Plugin extends PuppeteerExtraPlugin { + * constructor (opts = { }) { super(opts) } + * + * get name () { return 'hello-world' } + * + * async onPageCreated (page) { + * this.debug('page created', page.url()) + * const ua = await page.browser().userAgent() + * this.debug('user agent', ua) + * } + * } + * + * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) } + * + * + * // foo.js + * const puppeteer = require('puppeteer-extra') + * puppeteer.use(require('./hello-world-plugin')()) + * + * ;(async () => { + * const browser = await puppeteer.launch({headless: false}) + * const page = await browser.newPage() + * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'}) + * await browser.close() + * })() + * + */ +class PuppeteerExtraPlugin { + constructor(opts) { + this._debugBase = debug(`puppeteer-extra-plugin:base:${this.name}`); + this._childClassMembers = []; + this._opts = merge(this.defaults, opts || {}); + this._debugBase('Initialized.'); + } + /** + * Plugin name (required). + * + * Convention: + * - Package: `puppeteer-extra-plugin-anonymize-ua` + * - Name: `anonymize-ua` + * + * @example + * get name () { return 'anonymize-ua' } + */ + get name() { + throw new Error('Plugin must override "name"'); + } + /** + * Plugin defaults (optional). + * + * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation). + * + * The result of merging defaults with user supplied options can be accessed through `this.opts`. + * + * @see [[opts]] + * + * @example + * get defaults () { + * return { + * stripHeadless: true, + * makeWindows: true, + * customFn: null + * } + * } + * + * // Users can overwrite plugin defaults during instantiation: + * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false })) + */ + get defaults() { + return {}; + } + /** + * Plugin requirements (optional). + * + * Signal certain plugin requirements to the base class and the user. + * + * Currently supported: + * - `launch` + * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`), + * will output a warning to the user. + * - `headful` + * - If the plugin doesn't work in `headless: true` mode, + * will output a warning to the user. + * - `dataFromPlugins` + * - In case the plugin requires data from other plugins. + * will enable usage of `this.getDataFromPlugins()`. + * - `runLast` + * - In case the plugin prefers to run after the others. + * Useful when the plugin needs data from others. + * + * @example + * get requirements () { + * return new Set(['runLast', 'dataFromPlugins']) + * } + */ + get requirements() { + return new Set([]); + } + /** + * Plugin dependencies (optional). + * + * Missing plugins will be required() by puppeteer-extra. + * + * @example + * get dependencies () { + * return new Set(['user-preferences']) + * } + * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded. + */ + get dependencies() { + return new Set([]); + } + /** + * Plugin data (optional). + * + * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins, + * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`). + * + * Convention: `[ {name: 'Any name', value: 'Any value'} ]` + * + * @see [[getDataFromPlugins]] + * + * @example + * // plugin1.js + * get data () { + * return [ + * { + * name: 'userPreferences', + * value: { foo: 'bar' } + * }, + * { + * name: 'userPreferences', + * value: { hello: 'world' } + * } + * ] + * + * // plugin2.js + * get requirements () { return new Set(['dataFromPlugins']) } + * + * async beforeLaunch () { + * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) + * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] + * } + */ + get data() { + return []; + } + /** + * Access the plugin options (usually the `defaults` merged with user defined options) + * + * To skip the auto-merging of defaults with user supplied opts don't define a `defaults` + * property and set the `this._opts` Object in your plugin constructor directly. + * + * @see [[defaults]] + * + * @example + * get defaults () { return { foo: "bar" } } + * + * async onPageCreated (page) { + * this.debug(this.opts.foo) // => bar + * } + */ + get opts() { + return this._opts; + } + /** + * Convenience debug logger based on the [debug] module. + * Will automatically namespace the logging output to the plugin package name. + * [debug]: https://www.npmjs.com/package/debug + * + * ```bash + * # toggle output using environment variables + * DEBUG=puppeteer-extra-plugin: node foo.js + * # to debug all the things: + * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js + * ``` + * + * @example + * this.debug('hello world') + * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world' + */ + get debug() { + return debug(`puppeteer-extra-plugin:${this.name}`); + } + /** + * Before a new browser instance is created/launched. + * + * Can be used to modify the puppeteer launch options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @example + * async beforeLaunch (options) { + * if (this.opts.flashPluginPath) { + * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) + * } + * } + * + * @param options - Puppeteer launch options + */ + async beforeLaunch(options) { + // noop + } + /** + * After the browser has launched. + * + * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created. + * In order to make the plugins as stateless as possible don't store a reference to the browser instance + * in the plugin but rather consider alternatives. + * + * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`. + * + * Alternatively you could expose a class method that takes a browser instance as a parameter to work with: + * + * ```es6 + * const fancyPlugin = require('puppeteer-extra-plugin-fancy')() + * puppeteer.use(fancyPlugin) + * const browser = await puppeteer.launch() + * await fancyPlugin.killBrowser(browser) + * ``` + * + * @param browser - The `puppeteer` browser instance. + * @param opts.options - Puppeteer launch options used. + * + * @example + * async afterLaunch (browser, opts) { + * this.debug('browser has been launched', opts.options) + * } + */ + async afterLaunch(browser, opts = { options: {} }) { + // noop + } + /** + * Before connecting to an existing browser instance. + * + * Can be used to modify the puppeteer connect options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @param {Object} options - Puppeteer connect options + * @return {Object=} + */ + async beforeConnect(options) { + // noop + } + /** + * After connecting to an existing browser instance. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + * @param {Object} opts + * @param {Object} opts.options - Puppeteer connect options used. + * + */ + async afterConnect(browser, opts = {}) { + // noop + } + /** + * Called when a browser instance is available. + * + * This applies to both `puppeteer.launch()` and `puppeteer.connect()`. + * + * Convenience method created for plugins that need access to a browser instance + * and don't mind if it has been created through `launch` or `connect`. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + */ + async onBrowser(browser, opts) { + // noop + } + /** + * Called when a target is created, for example when a new page is opened by window.open or browser.newPage. + * + * > Note: This includes target creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetCreated(target) { + // noop + } + /** + * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience. + * + * > Note: This includes page creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + * + * @example + * async onPageCreated (page) { + * let ua = await page.browser().userAgent() + * if (this.opts.stripHeadless) { + * ua = ua.replace('HeadlessChrome/', 'Chrome/') + * } + * this.debug('new ua', ua) + * await page.setUserAgent(ua) + * } + */ + async onPageCreated(page) { + // noop + } + /** + * Called when the url of a target changes. + * + * > Note: This includes target changes in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetChanged(target) { + // noop + } + /** + * Called when a target is destroyed, for example when a page is closed. + * + * > Note: This includes target destructions in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetDestroyed(target) { + // noop + } + /** + * Called when Puppeteer gets disconnected from the Chromium instance. + * + * This might happen because of one of the following: + * - Chromium is closed or crashed + * - The `browser.disconnect` method was called + */ + async onDisconnected() { + // noop + } + /** + * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved + * and should be used instead of `onClose`. + * + * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios. + * In order for plugins to clean up properly (e.g. deleting temporary files) + * the `onClose` method had been introduced. + * + * > Note: Might be called multiple times on exit. + * + * > Note: This only includes browser instances created through `.launch()`. + */ + async onClose() { + // noop + } + /** + * After the plugin has been registered in `puppeteer-extra`. + * + * Normally right after `puppeteer.use(plugin)` is called + */ + async onPluginRegistered() { + // noop + } + /** + * Helper method to retrieve `data` objects from other plugins. + * + * A plugin needs to state the `dataFromPlugins` requirement + * in order to use this method. Will be mapped to `puppeteer.getPluginData`. + * + * @param name - Filter data by `name` property + * + * @see [data] + * @see [requirements] + */ + getDataFromPlugins(name) { + return []; + } + /** + * Will match plugin dependencies against all currently registered plugins. + * Is being called by `puppeteer-extra` and used to require missing dependencies. + * + * @param {Array} plugins + * @return {Set} - list of missing plugin names + * + * @private + */ + _getMissingDependencies(plugins) { + const pluginNames = new Set(plugins.map((p) => p.name)); + const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); + return missing; + } + /** + * Conditionally bind browser/process events to class members. + * The idea is to reduce event binding boilerplate in plugins. + * + * For efficiency we make sure the plugin is using the respective event + * by checking the child class members before registering the listener. + * + * @param {} browser + * @param {Object} opts - Options + * @param {string} opts.context - Puppeteer context (launch/connect) + * @param {Object} [opts.options] - Puppeteer launch or connect options + * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with + * + * @private + */ + async _bindBrowserEvents(browser, opts = {}) { + if (this._hasChildClassMember('onTargetCreated') || + this._hasChildClassMember('onPageCreated')) { + browser.on('targetcreated', this._onTargetCreated.bind(this)); + } + if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) { + browser.on('targetchanged', this.onTargetChanged.bind(this)); + } + if (this._hasChildClassMember('onTargetDestroyed') && + this.onTargetDestroyed) { + browser.on('targetdestroyed', this.onTargetDestroyed.bind(this)); + } + if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) { + browser.on('disconnected', this.onDisconnected.bind(this)); + } + if (opts.context === 'launch' && this._hasChildClassMember('onClose')) { + // The disconnect event has been improved since puppeteer v1.6.0 + // onClose is being kept mostly for legacy reasons + if (this.onClose) { + process.on('exit', this.onClose.bind(this)); + browser.on('disconnected', this.onClose.bind(this)); + if (opts.options.handleSIGINT !== false) { + process.on('SIGINT', this.onClose.bind(this)); + } + if (opts.options.handleSIGTERM !== false) { + process.on('SIGTERM', this.onClose.bind(this)); + } + if (opts.options.handleSIGHUP !== false) { + process.on('SIGHUP', this.onClose.bind(this)); + } + } + } + if (opts.context === 'launch' && this.afterLaunch) { + await this.afterLaunch(browser, opts); + } + if (opts.context === 'connect' && this.afterConnect) { + await this.afterConnect(browser, opts); + } + if (this.onBrowser) + await this.onBrowser(browser, opts); + } + /** + * @private + */ + async _onTargetCreated(target) { + if (this.onTargetCreated) + await this.onTargetCreated(target); + // Pre filter pages for plugin developers convenience + if (target.type() === 'page') { + try { + const page = await target.page(); + if (!page) { + return; + } + const validPage = 'isClosed' in page && !page.isClosed(); + if (this.onPageCreated && validPage) { + await this.onPageCreated(page); + } + } + catch (err) { + console.error(err); + } + } + } + /** + * @private + */ + _register(prototype) { + this._registerChildClassMembers(prototype); + if (this.onPluginRegistered) + this.onPluginRegistered(); + } + /** + * @private + */ + _registerChildClassMembers(prototype) { + this._childClassMembers = Object.getOwnPropertyNames(prototype); + } + /** + * @private + */ + _hasChildClassMember(name) { + return !!this._childClassMembers.includes(name); + } + /** + * @private + */ + get _isPuppeteerExtraPlugin() { + return true; + } +} + +export { PuppeteerExtraPlugin }; +//# sourceMappingURL=index.esm.js.map diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js.map b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js.map new file mode 100644 index 0000000..3feb782 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.esm.js","sources":["../src/index.ts"],"sourcesContent":["import debug, { Debugger } from 'debug'\nimport * as Puppeteer from './puppeteer'\n\n/** @private */\nconst merge = require('merge-deep')\n\nexport interface PluginOptions {\n [key: string]: any\n}\nexport interface PluginData {\n name: {\n [key: string]: any\n }\n value: {\n [key: string]: any\n }\n}\n\nexport type PluginDependencies = Set\nexport type PluginRequirements = Set<\n 'launch' | 'headful' | 'dataFromPlugins' | 'runLast'\n>\n\n/**\n * Base class for `puppeteer-extra` plugins.\n *\n * Provides convenience methods to avoid boilerplate.\n *\n * All common `puppeteer` browser events will be bound to\n * the plugin instance, if a respectively named class member is found.\n *\n * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well.\n *\n * @example\n * // hello-world-plugin.js\n * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin')\n *\n * class Plugin extends PuppeteerExtraPlugin {\n * constructor (opts = { }) { super(opts) }\n *\n * get name () { return 'hello-world' }\n *\n * async onPageCreated (page) {\n * this.debug('page created', page.url())\n * const ua = await page.browser().userAgent()\n * this.debug('user agent', ua)\n * }\n * }\n *\n * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) }\n *\n *\n * // foo.js\n * const puppeteer = require('puppeteer-extra')\n * puppeteer.use(require('./hello-world-plugin')())\n *\n * ;(async () => {\n * const browser = await puppeteer.launch({headless: false})\n * const page = await browser.newPage()\n * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'})\n * await browser.close()\n * })()\n *\n */\nexport abstract class PuppeteerExtraPlugin {\n /** @private */\n private _debugBase: Debugger\n /** @private */\n private _opts: PluginOptions\n /** @private */\n private _childClassMembers: string[]\n\n constructor(opts?: PluginOptions) {\n this._debugBase = debug(`puppeteer-extra-plugin:base:${this.name}`)\n this._childClassMembers = []\n\n this._opts = merge(this.defaults, opts || {})\n\n this._debugBase('Initialized.')\n }\n\n /**\n * Plugin name (required).\n *\n * Convention:\n * - Package: `puppeteer-extra-plugin-anonymize-ua`\n * - Name: `anonymize-ua`\n *\n * @example\n * get name () { return 'anonymize-ua' }\n */\n get name(): string {\n throw new Error('Plugin must override \"name\"')\n }\n\n /**\n * Plugin defaults (optional).\n *\n * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation).\n *\n * The result of merging defaults with user supplied options can be accessed through `this.opts`.\n *\n * @see [[opts]]\n *\n * @example\n * get defaults () {\n * return {\n * stripHeadless: true,\n * makeWindows: true,\n * customFn: null\n * }\n * }\n *\n * // Users can overwrite plugin defaults during instantiation:\n * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false }))\n */\n get defaults(): PluginOptions {\n return {}\n }\n\n /**\n * Plugin requirements (optional).\n *\n * Signal certain plugin requirements to the base class and the user.\n *\n * Currently supported:\n * - `launch`\n * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`),\n * will output a warning to the user.\n * - `headful`\n * - If the plugin doesn't work in `headless: true` mode,\n * will output a warning to the user.\n * - `dataFromPlugins`\n * - In case the plugin requires data from other plugins.\n * will enable usage of `this.getDataFromPlugins()`.\n * - `runLast`\n * - In case the plugin prefers to run after the others.\n * Useful when the plugin needs data from others.\n *\n * @example\n * get requirements () {\n * return new Set(['runLast', 'dataFromPlugins'])\n * }\n */\n get requirements(): PluginRequirements {\n return new Set([])\n }\n\n /**\n * Plugin dependencies (optional).\n *\n * Missing plugins will be required() by puppeteer-extra.\n *\n * @example\n * get dependencies () {\n * return new Set(['user-preferences'])\n * }\n * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded.\n */\n get dependencies(): PluginDependencies {\n return new Set([])\n }\n\n /**\n * Plugin data (optional).\n *\n * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins,\n * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`).\n *\n * Convention: `[ {name: 'Any name', value: 'Any value'} ]`\n *\n * @see [[getDataFromPlugins]]\n *\n * @example\n * // plugin1.js\n * get data () {\n * return [\n * {\n * name: 'userPreferences',\n * value: { foo: 'bar' }\n * },\n * {\n * name: 'userPreferences',\n * value: { hello: 'world' }\n * }\n * ]\n *\n * // plugin2.js\n * get requirements () { return new Set(['dataFromPlugins']) }\n *\n * async beforeLaunch () {\n * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value)\n * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ]\n * }\n */\n get data(): PluginData[] {\n return []\n }\n\n /**\n * Access the plugin options (usually the `defaults` merged with user defined options)\n *\n * To skip the auto-merging of defaults with user supplied opts don't define a `defaults`\n * property and set the `this._opts` Object in your plugin constructor directly.\n *\n * @see [[defaults]]\n *\n * @example\n * get defaults () { return { foo: \"bar\" } }\n *\n * async onPageCreated (page) {\n * this.debug(this.opts.foo) // => bar\n * }\n */\n get opts(): PluginOptions {\n return this._opts\n }\n\n /**\n * Convenience debug logger based on the [debug] module.\n * Will automatically namespace the logging output to the plugin package name.\n * [debug]: https://www.npmjs.com/package/debug\n *\n * ```bash\n * # toggle output using environment variables\n * DEBUG=puppeteer-extra-plugin: node foo.js\n * # to debug all the things:\n * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js\n * ```\n *\n * @example\n * this.debug('hello world')\n * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world'\n */\n get debug(): Debugger {\n return debug(`puppeteer-extra-plugin:${this.name}`)\n }\n\n /**\n * Before a new browser instance is created/launched.\n *\n * Can be used to modify the puppeteer launch options by modifying or returning them.\n *\n * Plugins using this method will be called in sequence to each\n * be able to update the launch options.\n *\n * @example\n * async beforeLaunch (options) {\n * if (this.opts.flashPluginPath) {\n * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`)\n * }\n * }\n *\n * @param options - Puppeteer launch options\n */\n async beforeLaunch(options: any) {\n // noop\n }\n\n /**\n * After the browser has launched.\n *\n * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created.\n * In order to make the plugins as stateless as possible don't store a reference to the browser instance\n * in the plugin but rather consider alternatives.\n *\n * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`.\n *\n * Alternatively you could expose a class method that takes a browser instance as a parameter to work with:\n *\n * ```es6\n * const fancyPlugin = require('puppeteer-extra-plugin-fancy')()\n * puppeteer.use(fancyPlugin)\n * const browser = await puppeteer.launch()\n * await fancyPlugin.killBrowser(browser)\n * ```\n *\n * @param browser - The `puppeteer` browser instance.\n * @param opts.options - Puppeteer launch options used.\n *\n * @example\n * async afterLaunch (browser, opts) {\n * this.debug('browser has been launched', opts.options)\n * }\n */\n async afterLaunch(\n browser: Puppeteer.Browser,\n opts = { options: {} as Puppeteer.LaunchOptions }\n ) {\n // noop\n }\n\n /**\n * Before connecting to an existing browser instance.\n *\n * Can be used to modify the puppeteer connect options by modifying or returning them.\n *\n * Plugins using this method will be called in sequence to each\n * be able to update the launch options.\n *\n * @param {Object} options - Puppeteer connect options\n * @return {Object=}\n */\n async beforeConnect(options: Puppeteer.ConnectOptions) {\n // noop\n }\n\n /**\n * After connecting to an existing browser instance.\n *\n * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n *\n * @param browser - The `puppeteer` browser instance.\n * @param {Object} opts\n * @param {Object} opts.options - Puppeteer connect options used.\n *\n */\n async afterConnect(browser: Puppeteer.Browser, opts = {}) {\n // noop\n }\n\n /**\n * Called when a browser instance is available.\n *\n * This applies to both `puppeteer.launch()` and `puppeteer.connect()`.\n *\n * Convenience method created for plugins that need access to a browser instance\n * and don't mind if it has been created through `launch` or `connect`.\n *\n * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin.\n *\n * @param browser - The `puppeteer` browser instance.\n */\n public async onBrowser(browser: Puppeteer.Browser, opts: any): Promise {\n // noop\n }\n\n /**\n * Called when a target is created, for example when a new page is opened by window.open or browser.newPage.\n *\n * > Note: This includes target creations in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetCreated(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience.\n *\n * > Note: This includes page creations in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n *\n * @example\n * async onPageCreated (page) {\n * let ua = await page.browser().userAgent()\n * if (this.opts.stripHeadless) {\n * ua = ua.replace('HeadlessChrome/', 'Chrome/')\n * }\n * this.debug('new ua', ua)\n * await page.setUserAgent(ua)\n * }\n */\n async onPageCreated(page: Puppeteer.Page) {\n // noop\n }\n\n /**\n * Called when the url of a target changes.\n *\n * > Note: This includes target changes in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetChanged(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Called when a target is destroyed, for example when a page is closed.\n *\n * > Note: This includes target destructions in incognito browser contexts.\n *\n * > Note: This includes browser instances created through `.launch()` as well as `.connect()`.\n *\n * @param {Puppeteer.Target} target\n */\n async onTargetDestroyed(target: Puppeteer.Target) {\n // noop\n }\n\n /**\n * Called when Puppeteer gets disconnected from the Chromium instance.\n *\n * This might happen because of one of the following:\n * - Chromium is closed or crashed\n * - The `browser.disconnect` method was called\n */\n async onDisconnected() {\n // noop\n }\n\n /**\n * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved\n * and should be used instead of `onClose`.\n *\n * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios.\n * In order for plugins to clean up properly (e.g. deleting temporary files)\n * the `onClose` method had been introduced.\n *\n * > Note: Might be called multiple times on exit.\n *\n * > Note: This only includes browser instances created through `.launch()`.\n */\n async onClose() {\n // noop\n }\n\n /**\n * After the plugin has been registered in `puppeteer-extra`.\n *\n * Normally right after `puppeteer.use(plugin)` is called\n */\n async onPluginRegistered() {\n // noop\n }\n\n /**\n * Helper method to retrieve `data` objects from other plugins.\n *\n * A plugin needs to state the `dataFromPlugins` requirement\n * in order to use this method. Will be mapped to `puppeteer.getPluginData`.\n *\n * @param name - Filter data by `name` property\n *\n * @see [data]\n * @see [requirements]\n */\n getDataFromPlugins(name?: string): PluginData[] {\n return []\n }\n\n /**\n * Will match plugin dependencies against all currently registered plugins.\n * Is being called by `puppeteer-extra` and used to require missing dependencies.\n *\n * @param {Array} plugins\n * @return {Set} - list of missing plugin names\n *\n * @private\n */\n _getMissingDependencies(plugins: any) {\n const pluginNames = new Set(plugins.map((p: any) => p.name))\n const missing = new Set(\n Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))\n )\n return missing\n }\n\n /**\n * Conditionally bind browser/process events to class members.\n * The idea is to reduce event binding boilerplate in plugins.\n *\n * For efficiency we make sure the plugin is using the respective event\n * by checking the child class members before registering the listener.\n *\n * @param {} browser\n * @param {Object} opts - Options\n * @param {string} opts.context - Puppeteer context (launch/connect)\n * @param {Object} [opts.options] - Puppeteer launch or connect options\n * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with\n *\n * @private\n */\n async _bindBrowserEvents(browser: Puppeteer.Browser, opts: any = {}) {\n if (\n this._hasChildClassMember('onTargetCreated') ||\n this._hasChildClassMember('onPageCreated')\n ) {\n browser.on('targetcreated', this._onTargetCreated.bind(this))\n }\n if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) {\n browser.on('targetchanged', this.onTargetChanged.bind(this))\n }\n if (\n this._hasChildClassMember('onTargetDestroyed') &&\n this.onTargetDestroyed\n ) {\n browser.on('targetdestroyed', this.onTargetDestroyed.bind(this))\n }\n if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) {\n browser.on('disconnected', this.onDisconnected.bind(this))\n }\n if (opts.context === 'launch' && this._hasChildClassMember('onClose')) {\n // The disconnect event has been improved since puppeteer v1.6.0\n // onClose is being kept mostly for legacy reasons\n if (this.onClose) {\n process.on('exit', this.onClose.bind(this))\n browser.on('disconnected', this.onClose.bind(this))\n\n if (opts.options.handleSIGINT !== false) {\n process.on('SIGINT', this.onClose.bind(this))\n }\n if (opts.options.handleSIGTERM !== false) {\n process.on('SIGTERM', this.onClose.bind(this))\n }\n if (opts.options.handleSIGHUP !== false) {\n process.on('SIGHUP', this.onClose.bind(this))\n }\n }\n }\n if (opts.context === 'launch' && this.afterLaunch) {\n await this.afterLaunch(browser, opts)\n }\n if (opts.context === 'connect' && this.afterConnect) {\n await this.afterConnect(browser, opts)\n }\n if (this.onBrowser) await this.onBrowser(browser, opts)\n }\n\n /**\n * @private\n */\n async _onTargetCreated(target: Puppeteer.Target) {\n if (this.onTargetCreated) await this.onTargetCreated(target)\n // Pre filter pages for plugin developers convenience\n if (target.type() === 'page') {\n try {\n const page = await target.page()\n if (!page) {\n return\n }\n const validPage = 'isClosed' in page && !page.isClosed()\n if (this.onPageCreated && validPage) {\n await this.onPageCreated(page)\n }\n } catch (err) {\n console.error(err)\n }\n }\n }\n\n /**\n * @private\n */\n _register(prototype: any) {\n this._registerChildClassMembers(prototype)\n if (this.onPluginRegistered) this.onPluginRegistered()\n }\n\n /**\n * @private\n */\n _registerChildClassMembers(prototype: any) {\n this._childClassMembers = Object.getOwnPropertyNames(prototype)\n }\n\n /**\n * @private\n */\n _hasChildClassMember(name: string) {\n return !!this._childClassMembers.includes(name)\n }\n\n /**\n * @private\n */\n get _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Z,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACnB;SACF;KACF;;;;IAKD,SAAS,CAAC,SAAc;QACtB,IAAI,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAA;QAC1C,IAAI,IAAI,CAAC,kBAAkB;YAAE,IAAI,CAAC,kBAAkB,EAAE,CAAA;KACvD;;;;IAKD,0BAA0B,CAAC,SAAc;QACvC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;KAChE;;;;IAKD,oBAAoB,CAAC,IAAY;QAC/B,OAAO,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;KAChD;;;;IAKD,IAAI,uBAAuB;QACzB,OAAO,IAAI,CAAA;KACZ;;;;;"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js new file mode 100644 index 0000000..d8ef6f4 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js @@ -0,0 +1,526 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PuppeteerExtraPlugin = void 0; +const debug_1 = __importDefault(require("debug")); +/** @private */ +const merge = require('merge-deep'); +/** + * Base class for `puppeteer-extra` plugins. + * + * Provides convenience methods to avoid boilerplate. + * + * All common `puppeteer` browser events will be bound to + * the plugin instance, if a respectively named class member is found. + * + * Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well. + * + * @example + * // hello-world-plugin.js + * const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + * + * class Plugin extends PuppeteerExtraPlugin { + * constructor (opts = { }) { super(opts) } + * + * get name () { return 'hello-world' } + * + * async onPageCreated (page) { + * this.debug('page created', page.url()) + * const ua = await page.browser().userAgent() + * this.debug('user agent', ua) + * } + * } + * + * module.exports = function (pluginConfig) { return new Plugin(pluginConfig) } + * + * + * // foo.js + * const puppeteer = require('puppeteer-extra') + * puppeteer.use(require('./hello-world-plugin')()) + * + * ;(async () => { + * const browser = await puppeteer.launch({headless: false}) + * const page = await browser.newPage() + * await page.goto('http://example.com', {waitUntil: 'domcontentloaded'}) + * await browser.close() + * })() + * + */ +class PuppeteerExtraPlugin { + constructor(opts) { + this._debugBase = (0, debug_1.default)(`puppeteer-extra-plugin:base:${this.name}`); + this._childClassMembers = []; + this._opts = merge(this.defaults, opts || {}); + this._debugBase('Initialized.'); + } + /** + * Plugin name (required). + * + * Convention: + * - Package: `puppeteer-extra-plugin-anonymize-ua` + * - Name: `anonymize-ua` + * + * @example + * get name () { return 'anonymize-ua' } + */ + get name() { + throw new Error('Plugin must override "name"'); + } + /** + * Plugin defaults (optional). + * + * If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation). + * + * The result of merging defaults with user supplied options can be accessed through `this.opts`. + * + * @see [[opts]] + * + * @example + * get defaults () { + * return { + * stripHeadless: true, + * makeWindows: true, + * customFn: null + * } + * } + * + * // Users can overwrite plugin defaults during instantiation: + * puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false })) + */ + get defaults() { + return {}; + } + /** + * Plugin requirements (optional). + * + * Signal certain plugin requirements to the base class and the user. + * + * Currently supported: + * - `launch` + * - If the plugin only supports locally created browser instances (no `puppeteer.connect()`), + * will output a warning to the user. + * - `headful` + * - If the plugin doesn't work in `headless: true` mode, + * will output a warning to the user. + * - `dataFromPlugins` + * - In case the plugin requires data from other plugins. + * will enable usage of `this.getDataFromPlugins()`. + * - `runLast` + * - In case the plugin prefers to run after the others. + * Useful when the plugin needs data from others. + * + * @example + * get requirements () { + * return new Set(['runLast', 'dataFromPlugins']) + * } + */ + get requirements() { + return new Set([]); + } + /** + * Plugin dependencies (optional). + * + * Missing plugins will be required() by puppeteer-extra. + * + * @example + * get dependencies () { + * return new Set(['user-preferences']) + * } + * // Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded. + */ + get dependencies() { + return new Set([]); + } + /** + * Plugin data (optional). + * + * Plugins can expose data (an array of objects), which in turn can be consumed by other plugins, + * that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`). + * + * Convention: `[ {name: 'Any name', value: 'Any value'} ]` + * + * @see [[getDataFromPlugins]] + * + * @example + * // plugin1.js + * get data () { + * return [ + * { + * name: 'userPreferences', + * value: { foo: 'bar' } + * }, + * { + * name: 'userPreferences', + * value: { hello: 'world' } + * } + * ] + * + * // plugin2.js + * get requirements () { return new Set(['dataFromPlugins']) } + * + * async beforeLaunch () { + * const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) + * this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] + * } + */ + get data() { + return []; + } + /** + * Access the plugin options (usually the `defaults` merged with user defined options) + * + * To skip the auto-merging of defaults with user supplied opts don't define a `defaults` + * property and set the `this._opts` Object in your plugin constructor directly. + * + * @see [[defaults]] + * + * @example + * get defaults () { return { foo: "bar" } } + * + * async onPageCreated (page) { + * this.debug(this.opts.foo) // => bar + * } + */ + get opts() { + return this._opts; + } + /** + * Convenience debug logger based on the [debug] module. + * Will automatically namespace the logging output to the plugin package name. + * [debug]: https://www.npmjs.com/package/debug + * + * ```bash + * # toggle output using environment variables + * DEBUG=puppeteer-extra-plugin: node foo.js + * # to debug all the things: + * DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js + * ``` + * + * @example + * this.debug('hello world') + * // will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world' + */ + get debug() { + return (0, debug_1.default)(`puppeteer-extra-plugin:${this.name}`); + } + /** + * Before a new browser instance is created/launched. + * + * Can be used to modify the puppeteer launch options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @example + * async beforeLaunch (options) { + * if (this.opts.flashPluginPath) { + * options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) + * } + * } + * + * @param options - Puppeteer launch options + */ + async beforeLaunch(options) { + // noop + } + /** + * After the browser has launched. + * + * Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created. + * In order to make the plugins as stateless as possible don't store a reference to the browser instance + * in the plugin but rather consider alternatives. + * + * E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`. + * + * Alternatively you could expose a class method that takes a browser instance as a parameter to work with: + * + * ```es6 + * const fancyPlugin = require('puppeteer-extra-plugin-fancy')() + * puppeteer.use(fancyPlugin) + * const browser = await puppeteer.launch() + * await fancyPlugin.killBrowser(browser) + * ``` + * + * @param browser - The `puppeteer` browser instance. + * @param opts.options - Puppeteer launch options used. + * + * @example + * async afterLaunch (browser, opts) { + * this.debug('browser has been launched', opts.options) + * } + */ + async afterLaunch(browser, opts = { options: {} }) { + // noop + } + /** + * Before connecting to an existing browser instance. + * + * Can be used to modify the puppeteer connect options by modifying or returning them. + * + * Plugins using this method will be called in sequence to each + * be able to update the launch options. + * + * @param {Object} options - Puppeteer connect options + * @return {Object=} + */ + async beforeConnect(options) { + // noop + } + /** + * After connecting to an existing browser instance. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + * @param {Object} opts + * @param {Object} opts.options - Puppeteer connect options used. + * + */ + async afterConnect(browser, opts = {}) { + // noop + } + /** + * Called when a browser instance is available. + * + * This applies to both `puppeteer.launch()` and `puppeteer.connect()`. + * + * Convenience method created for plugins that need access to a browser instance + * and don't mind if it has been created through `launch` or `connect`. + * + * > Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + * + * @param browser - The `puppeteer` browser instance. + */ + async onBrowser(browser, opts) { + // noop + } + /** + * Called when a target is created, for example when a new page is opened by window.open or browser.newPage. + * + * > Note: This includes target creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetCreated(target) { + // noop + } + /** + * Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience. + * + * > Note: This includes page creations in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + * + * @example + * async onPageCreated (page) { + * let ua = await page.browser().userAgent() + * if (this.opts.stripHeadless) { + * ua = ua.replace('HeadlessChrome/', 'Chrome/') + * } + * this.debug('new ua', ua) + * await page.setUserAgent(ua) + * } + */ + async onPageCreated(page) { + // noop + } + /** + * Called when the url of a target changes. + * + * > Note: This includes target changes in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetChanged(target) { + // noop + } + /** + * Called when a target is destroyed, for example when a page is closed. + * + * > Note: This includes target destructions in incognito browser contexts. + * + * > Note: This includes browser instances created through `.launch()` as well as `.connect()`. + * + * @param {Puppeteer.Target} target + */ + async onTargetDestroyed(target) { + // noop + } + /** + * Called when Puppeteer gets disconnected from the Chromium instance. + * + * This might happen because of one of the following: + * - Chromium is closed or crashed + * - The `browser.disconnect` method was called + */ + async onDisconnected() { + // noop + } + /** + * **Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved + * and should be used instead of `onClose`. + * + * In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios. + * In order for plugins to clean up properly (e.g. deleting temporary files) + * the `onClose` method had been introduced. + * + * > Note: Might be called multiple times on exit. + * + * > Note: This only includes browser instances created through `.launch()`. + */ + async onClose() { + // noop + } + /** + * After the plugin has been registered in `puppeteer-extra`. + * + * Normally right after `puppeteer.use(plugin)` is called + */ + async onPluginRegistered() { + // noop + } + /** + * Helper method to retrieve `data` objects from other plugins. + * + * A plugin needs to state the `dataFromPlugins` requirement + * in order to use this method. Will be mapped to `puppeteer.getPluginData`. + * + * @param name - Filter data by `name` property + * + * @see [data] + * @see [requirements] + */ + getDataFromPlugins(name) { + return []; + } + /** + * Will match plugin dependencies against all currently registered plugins. + * Is being called by `puppeteer-extra` and used to require missing dependencies. + * + * @param {Array} plugins + * @return {Set} - list of missing plugin names + * + * @private + */ + _getMissingDependencies(plugins) { + const pluginNames = new Set(plugins.map((p) => p.name)); + const missing = new Set(Array.from(this.dependencies.values()).filter(x => !pluginNames.has(x))); + return missing; + } + /** + * Conditionally bind browser/process events to class members. + * The idea is to reduce event binding boilerplate in plugins. + * + * For efficiency we make sure the plugin is using the respective event + * by checking the child class members before registering the listener. + * + * @param {} browser + * @param {Object} opts - Options + * @param {string} opts.context - Puppeteer context (launch/connect) + * @param {Object} [opts.options] - Puppeteer launch or connect options + * @param {Array} [opts.defaultArgs] - The default flags that Chromium will be launched with + * + * @private + */ + async _bindBrowserEvents(browser, opts = {}) { + if (this._hasChildClassMember('onTargetCreated') || + this._hasChildClassMember('onPageCreated')) { + browser.on('targetcreated', this._onTargetCreated.bind(this)); + } + if (this._hasChildClassMember('onTargetChanged') && this.onTargetChanged) { + browser.on('targetchanged', this.onTargetChanged.bind(this)); + } + if (this._hasChildClassMember('onTargetDestroyed') && + this.onTargetDestroyed) { + browser.on('targetdestroyed', this.onTargetDestroyed.bind(this)); + } + if (this._hasChildClassMember('onDisconnected') && this.onDisconnected) { + browser.on('disconnected', this.onDisconnected.bind(this)); + } + if (opts.context === 'launch' && this._hasChildClassMember('onClose')) { + // The disconnect event has been improved since puppeteer v1.6.0 + // onClose is being kept mostly for legacy reasons + if (this.onClose) { + process.on('exit', this.onClose.bind(this)); + browser.on('disconnected', this.onClose.bind(this)); + if (opts.options.handleSIGINT !== false) { + process.on('SIGINT', this.onClose.bind(this)); + } + if (opts.options.handleSIGTERM !== false) { + process.on('SIGTERM', this.onClose.bind(this)); + } + if (opts.options.handleSIGHUP !== false) { + process.on('SIGHUP', this.onClose.bind(this)); + } + } + } + if (opts.context === 'launch' && this.afterLaunch) { + await this.afterLaunch(browser, opts); + } + if (opts.context === 'connect' && this.afterConnect) { + await this.afterConnect(browser, opts); + } + if (this.onBrowser) + await this.onBrowser(browser, opts); + } + /** + * @private + */ + async _onTargetCreated(target) { + if (this.onTargetCreated) + await this.onTargetCreated(target); + // Pre filter pages for plugin developers convenience + if (target.type() === 'page') { + try { + const page = await target.page(); + if (!page) { + return; + } + const validPage = 'isClosed' in page && !page.isClosed(); + if (this.onPageCreated && validPage) { + await this.onPageCreated(page); + } + } + catch (err) { + console.error(err); + } + } + } + /** + * @private + */ + _register(prototype) { + this._registerChildClassMembers(prototype); + if (this.onPluginRegistered) + this.onPluginRegistered(); + } + /** + * @private + */ + _registerChildClassMembers(prototype) { + this._childClassMembers = Object.getOwnPropertyNames(prototype); + } + /** + * @private + */ + _hasChildClassMember(name) { + return !!this._childClassMembers.includes(name); + } + /** + * @private + */ + get _isPuppeteerExtraPlugin() { + return true; + } +} +exports.PuppeteerExtraPlugin = PuppeteerExtraPlugin; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js.map b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js.map new file mode 100644 index 0000000..d3227bc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAuC;AAGvC,eAAe;AACf,MAAM,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,CAAA;AAmBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,MAAsB,oBAAoB;IAQxC,YAAY,IAAoB;QAC9B,IAAI,CAAC,UAAU,GAAG,IAAA,eAAK,EAAC,+BAA+B,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACnE,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAA;QAE5B,IAAI,C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U,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAA;gBACxD,IAAI,IAAI,CAAC,aAAa,IAAI,SAAS,EAAE;oBACnC,MAAM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;iBAC/B;aACF;YAAC,OAAO,GAAG,EAAE;gBACZ,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;aACnB;SACF;IACH,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,SAAc;QACtB,IAAI,CAAC,0BAA0B,CAAC,SAAS,CAAC,CAAA;QAC1C,IAAI,IAAI,CAAC,kBAAkB;YAAE,IAAI,CAAC,kBAAkB,EAAE,CAAA;IACxD,CAAC;IAED;;OAEG;IACH,0BAA0B,CAAC,SAAc;QACvC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,mBAAmB,CAAC,SAAS,CAAC,CAAA;IACjE,CAAC;IAED;;OAEG;IACH,oBAAoB,CAAC,IAAY;QAC/B,OAAO,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;IACjD,CAAC;IAED;;OAEG;IACH,IAAI,uBAAuB;QACzB,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAngBD,oDAmgBC"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.d.ts b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js new file mode 100644 index 0000000..a705588 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js @@ -0,0 +1,115 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const ava_1 = __importDefault(require("ava")); +const _1 = require("."); +(0, ava_1.default)('is a function', async (t) => { + t.is(typeof _1.PuppeteerExtraPlugin, 'function'); +}); +(0, ava_1.default)('will throw without a name', async (t) => { + class Derived extends _1.PuppeteerExtraPlugin { + } + const error = await t.throws(() => new Derived()); + t.is(error.message, `Plugin must override "name"`); +}); +(0, ava_1.default)('should have the basic class members', async (t) => { + const pluginName = 'hello-world'; + class Plugin extends _1.PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts); + } + get name() { + return pluginName; + } + } + const instance = new Plugin(); + t.is(instance.name, pluginName); + t.true(instance.requirements instanceof Set); + t.true(instance.dependencies instanceof Set); + t.true(instance.data instanceof Array); + t.true(instance.defaults instanceof Object); + t.is(instance.data.length, 0); + t.true(instance.debug instanceof Function); + t.is(instance.debug.namespace, `puppeteer-extra-plugin:${pluginName}`); + t.true(instance._isPuppeteerExtraPlugin); +}); +(0, ava_1.default)('should have the public class members', async (t) => { + const pluginName = 'hello-world'; + class Plugin extends _1.PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts); + } + get name() { + return pluginName; + } + } + const instance = new Plugin(); + t.true(instance.beforeLaunch instanceof Function); + t.true(instance.afterLaunch instanceof Function); + t.true(instance.onTargetCreated instanceof Function); + t.true(instance.onBrowser instanceof Function); + t.true(instance.onPageCreated instanceof Function); + t.true(instance.onTargetChanged instanceof Function); + t.true(instance.onTargetDestroyed instanceof Function); + t.true(instance.onDisconnected instanceof Function); + t.true(instance.onClose instanceof Function); + t.true(instance.onPluginRegistered instanceof Function); + t.true(instance.getDataFromPlugins instanceof Function); +}); +(0, ava_1.default)('should have the internal class members', async (t) => { + const pluginName = 'hello-world'; + class Plugin extends _1.PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts); + } + get name() { + return pluginName; + } + } + const instance = new Plugin(); + t.true(instance._getMissingDependencies instanceof Function); + t.true(instance._bindBrowserEvents instanceof Function); + t.true(instance._onTargetCreated instanceof Function); + t.true(instance._register instanceof Function); + t.true(instance._registerChildClassMembers instanceof Function); + t.true(instance._hasChildClassMember instanceof Function); +}); +(0, ava_1.default)('should merge opts with defaults automatically', async (t) => { + const pluginName = 'hello-world'; + const pluginDefaults = { foo: 'bar', foo2: 'bar2', extra1: 123 }; + const userOpts = { foo2: 'bob', extra2: 666 }; + class Plugin extends _1.PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts); + } + get name() { + return pluginName; + } + get defaults() { + return pluginDefaults; + } + } + const instance = new Plugin(userOpts); + t.deepEqual(instance.defaults, pluginDefaults); + t.is(instance.opts.foo, pluginDefaults.foo); + t.is(instance.opts.foo2, userOpts.foo2); + t.is(instance.opts.extra1, pluginDefaults.extra1); + t.is(instance.opts.extra2, userOpts.extra2); +}); +(0, ava_1.default)('should have opts when defaults is not defined', async (t) => { + const pluginName = 'hello-world'; + const userOpts = { foo2: 'bob', extra2: 666 }; + class Plugin extends _1.PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts); + } + get name() { + return pluginName; + } + } + const instance = new Plugin(userOpts); + t.deepEqual(instance.opts, userOpts); +}); +//# sourceMappingURL=index.test.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js.map b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js.map new file mode 100644 index 0000000..ed6d576 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/index.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../src/index.test.ts"],"names":[],"mappings":";;;;;AAAA,8CAAsB;AAEtB,wBAAwC;AAExC,IAAA,aAAI,EAAC,eAAe,EAAE,KAAK,EAAC,CAAC,EAAC,EAAE;IAC9B,CAAC,CAAC,EAAE,CAAC,OAAO,uBAAoB,EAAE,UAAU,CA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AE,QAAQ,CAAC,CAAA;AACtC,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.d.ts b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.d.ts new file mode 100644 index 0000000..6c0c19c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.d.ts @@ -0,0 +1,5 @@ +export { Browser } from 'puppeteer'; +export { Page } from 'puppeteer'; +export { Target } from 'puppeteer'; +export { ConnectOptions } from 'puppeteer'; +export { LaunchOptions } from 'puppeteer'; diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js new file mode 100644 index 0000000..b8013a6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js @@ -0,0 +1,13 @@ +"use strict"; +// A wildcard import would result in a `require("puppeteer")` statement +// at the top of the transpiled js file, not what we want. :-/ +// "import type" is a solution here but requires TS >= v3.8 which we don't want to require yet as a minimum. +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Target = exports.Page = exports.Browser = void 0; +var puppeteer_1 = require("puppeteer"); +Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return puppeteer_1.Browser; } }); +var puppeteer_2 = require("puppeteer"); +Object.defineProperty(exports, "Page", { enumerable: true, get: function () { return puppeteer_2.Page; } }); +var puppeteer_3 = require("puppeteer"); +Object.defineProperty(exports, "Target", { enumerable: true, get: function () { return puppeteer_3.Target; } }); +//# sourceMappingURL=puppeteer.js.map \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js.map b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js.map new file mode 100644 index 0000000..8798177 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/dist/puppeteer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"puppeteer.js","sourceRoot":"","sources":["../src/puppeteer.ts"],"names":[],"mappings":";AAAA,uEAAuE;AACvE,8DAA8D;AAC9D,4GAA4G;;;AAE5G,uCAAmC;AAA1B,oGAAA,OAAO,OAAA;AAChB,uCAAgC;AAAvB,iGAAA,IAAI,OAAA;AACb,uCAAkC;AAAzB,mGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/package.json b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/package.json new file mode 100644 index 0000000..b3936dc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/package.json @@ -0,0 +1,82 @@ +{ + "name": "puppeteer-extra-plugin", + "version": "3.2.3", + "description": "Base class for puppeteer-extra plugins.", + "main": "dist/index.cjs.js", + "module": "dist/index.esm.js", + "typings": "dist/index.d.ts", + "files": [ + "dist" + ], + "repository": "berstend/puppeteer-extra", + "homepage": "https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin", + "author": "berstend", + "license": "MIT", + "scripts": { + "clean": "rimraf dist/*", + "prebuild": "run-s clean", + "build": "run-s build:tsc build:rollup", + "build:tsc": "tsc --module commonjs", + "build:rollup": "rollup -c rollup.config.ts", + "docs": "documentation readme --quiet --shallow --github --markdown-theme transitivebs --readme-file readme.md --section API ./src/index.ts", + "postdocs": "npx prettier --write readme.md", + "test": "ava -v --config ava.config-ts.js", + "pretest-ci": "run-s build", + "test-ci": "ava --fail-fast -v" + }, + "engines": { + "node": ">=9.11.2" + }, + "prettier": { + "printWidth": 80, + "semi": false, + "singleQuote": true + }, + "keywords": [ + "puppeteer", + "puppeteer-extra", + "puppeteer-extra-plugin", + "ua", + "user-agent", + "chrome", + "headless", + "pupeteer" + ], + "devDependencies": { + "@types/node": "14.14.34", + "@types/puppeteer": "*", + "ava": "2.4.0", + "documentation-markdown-themes": "^12.1.5", + "npm-run-all": "^4.1.5", + "puppeteer": "9", + "rimraf": "^3.0.0", + "rollup": "^1.27.5", + "rollup-plugin-commonjs": "^10.1.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-sourcemaps": "^0.4.2", + "rollup-plugin-typescript2": "^0.25.2", + "ts-node": "^8.5.4", + "tslint": "^5.12.1", + "tslint-config-prettier": "^1.18.0", + "tslint-config-standard": "^9.0.0", + "typescript": "4.4.3" + }, + "dependencies": { + "@types/debug": "^4.1.0", + "debug": "^4.1.1", + "merge-deep": "^3.0.1" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "puppeteer-extra": { + "optional": true + }, + "playwright-extra": { + "optional": true + } + }, + "gitHead": "2f4a357f233b35a7a20f16ce007f5ef3f62765b9" +} diff --git a/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/readme.md b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/readme.md new file mode 100644 index 0000000..4c41fb0 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/puppeteer-extra-plugin/readme.md @@ -0,0 +1,509 @@ +# puppeteer-extra-plugin [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/berstend/puppeteer-extra/test.yml?branch=master&event=push)](https://github.com/berstend/puppeteer-extra/actions) [![Discord](https://img.shields.io/discord/737009125862408274)](https://extra.community) [![npm](https://img.shields.io/npm/v/puppeteer-extra-plugin.svg)](https://www.npmjs.com/package/puppeteer-extra-plugin) + +## Installation + +```bash +yarn add puppeteer-extra-plugin +``` + +## Changelog + +
+ v3.0.1
+ +- Now written in TypeScript 🎉 +- **Breaking change:** Now using a named export: + +```js +// Before +const PuppeteerExtraPlugin = require('puppeteer-extra-plugin') + +// After (>= v3.0.1) +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') +``` + +
+ +## API + + + +#### Table of Contents + +- [puppeteer-extra-plugin ![GitHub Workflow Status](https://github.com/berstend/puppeteer-extra/actions) [![Discord](https://img.shields.io/discord/737009125862408274)](https://extra.community) [![npm](https://img.shields.io/npm/v/puppeteer-extra-plugin.svg)](https://www.npmjs.com/package/puppeteer-extra-plugin)](#puppeteer-extra-plugin---) + - [Installation](#installation) + - [Changelog](#changelog) + - [API](#api) + - [Table of Contents](#table-of-contents) + - [class: PuppeteerExtraPlugin](#class-puppeteerextraplugin) + - [.name](#name) + - [.defaults](#defaults) + - [.requirements](#requirements) + - [.dependencies](#dependencies) + - [.data](#data) + - [.opts](#opts) + - [.debug](#debug) + - [.beforeLaunch(options)](#beforelaunchoptions) + - [.afterLaunch(browser, opts)](#afterlaunchbrowser-opts) + - [.beforeConnect(options)](#beforeconnectoptions) + - [.afterConnect(browser, opts)](#afterconnectbrowser-opts) + - [.onBrowser(browser, opts)](#onbrowserbrowser-opts) + - [.onTargetCreated(target)](#ontargetcreatedtarget) + - [.onPageCreated(page, target)](#onpagecreatedpage-target) + - [.onTargetChanged(target)](#ontargetchangedtarget) + - [.onTargetDestroyed(target)](#ontargetdestroyedtarget) + - [.onDisconnected()](#ondisconnected) + - [.onClose()](#onclose) + - [.onPluginRegistered()](#onpluginregistered) + - [.getDataFromPlugins(name?)](#getdatafrompluginsname) + +### class: [PuppeteerExtraPlugin](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L65-L572) + +- `opts` **PluginOptions?** + +Base class for `puppeteer-extra` plugins. + +Provides convenience methods to avoid boilerplate. + +All common `puppeteer` browser events will be bound to +the plugin instance, if a respectively named class member is found. + +Please refer to the [puppeteer API documentation](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md) as well. + +Example: + +```javascript +// hello-world-plugin.js +const { PuppeteerExtraPlugin } = require('puppeteer-extra-plugin') + +class Plugin extends PuppeteerExtraPlugin { + constructor(opts = {}) { + super(opts) + } + + get name() { + return 'hello-world' + } + + async onPageCreated(page) { + this.debug('page created', page.url()) + const ua = await page.browser().userAgent() + this.debug('user agent', ua) + } +} + +module.exports = function(pluginConfig) { + return new Plugin(pluginConfig) +} + +// foo.js +const puppeteer = require('puppeteer-extra') +puppeteer.use(require('./hello-world-plugin')()) +;(async () => { + const browser = await puppeteer.launch({ headless: false }) + const page = await browser.newPage() + await page.goto('http://example.com', { waitUntil: 'domcontentloaded' }) + await browser.close() +})() +``` + +--- + +#### .[name](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L92-L94) + +Type: **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** + +Plugin name (required). + +Convention: + +- Package: `puppeteer-extra-plugin-anonymize-ua` +- Name: `anonymize-ua` + +Example: + +```javascript +get name () { return 'anonymize-ua' } +``` + +--- + +#### .[defaults](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L117-L119) + +Type: **PluginOptions** + +Plugin defaults (optional). + +If defined will be ([deep-](https://github.com/jonschlinkert/merge-deep))merged with the (optional) user supplied options (supplied during plugin instantiation). + +The result of merging defaults with user supplied options can be accessed through `this.opts`. + +Example: + +```javascript +get defaults () { + return { + stripHeadless: true, + makeWindows: true, + customFn: null + } +} + +// Users can overwrite plugin defaults during instantiation: +puppeteer.use(require('puppeteer-extra-plugin-foobar')({ makeWindows: false })) +``` + +- **See: \[[opts]]** + +--- + +#### .[requirements](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L145-L147) + +Type: **PluginRequirements** + +Plugin requirements (optional). + +Signal certain plugin requirements to the base class and the user. + +Currently supported: + +- `launch` + - If the plugin only supports locally created browser instances (no `puppeteer.connect()`), + will output a warning to the user. +- `headful` + - If the plugin doesn't work in `headless: true` mode, + will output a warning to the user. +- `dataFromPlugins` + - In case the plugin requires data from other plugins. + will enable usage of `this.getDataFromPlugins()`. +- `runLast` + - In case the plugin prefers to run after the others. + Useful when the plugin needs data from others. + +Example: + +```javascript +get requirements () { + return new Set(['runLast', 'dataFromPlugins']) +} +``` + +--- + +#### .[dependencies](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L160-L162) + +Type: **PluginDependencies** + +Plugin dependencies (optional). + +Missing plugins will be required() by puppeteer-extra. + +Example: + +```javascript +get dependencies () { + return new Set(['user-preferences']) +} +// Will ensure the 'puppeteer-extra-plugin-user-preferences' plugin is loaded. +``` + +--- + +#### .[data](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L196-L198) + +Type: **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<PluginData>** + +Plugin data (optional). + +Plugins can expose data (an array of objects), which in turn can be consumed by other plugins, +that list the `dataFromPlugins` requirement (by using `this.getDataFromPlugins()`). + +Convention: `[ {name: 'Any name', value: 'Any value'} ]` + +Example: + +```javascript +// plugin1.js +get data () { + return [ + { + name: 'userPreferences', + value: { foo: 'bar' } + }, + { + name: 'userPreferences', + value: { hello: 'world' } + } + ] + +// plugin2.js +get requirements () { return new Set(['dataFromPlugins']) } + +async beforeLaunch () { + const prefs = this.getDataFromPlugins('userPreferences').map(d => d.value) + this.debug(prefs) // => [ { foo: 'bar' }, { hello: 'world' } ] +} +``` + +- **See: \[[getDataFromPlugins]]** + +--- + +#### .[opts](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L215-L217) + +Type: **PluginOptions** + +Access the plugin options (usually the `defaults` merged with user defined options) + +To skip the auto-merging of defaults with user supplied opts don't define a `defaults` +property and set the `this._opts` Object in your plugin constructor directly. + +Example: + +```javascript +get defaults () { return { foo: "bar" } } + +async onPageCreated (page) { + this.debug(this.opts.foo) // => bar +} +``` + +- **See: \[[defaults]]** + +--- + +#### .[debug](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L235-L237) + +Type: **Debugger** + +Convenience debug logger based on the [debug] module. +Will automatically namespace the logging output to the plugin package name. + +[debug]: https://www.npmjs.com/package/debug + +```bash +# toggle output using environment variables +DEBUG=puppeteer-extra-plugin: node foo.js +# to debug all the things: +DEBUG=puppeteer-extra,puppeteer-extra-plugin:* node foo.js +``` + +Example: + +```javascript +this.debug('hello world') +// will output e.g. 'puppeteer-extra-plugin:anonymize-ua hello world' +``` + +--- + +#### .[beforeLaunch(options)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L256-L258) + +- `options` **any** Puppeteer launch options + +Before a new browser instance is created/launched. + +Can be used to modify the puppeteer launch options by modifying or returning them. + +Plugins using this method will be called in sequence to each +be able to update the launch options. + +Example: + +```javascript +async beforeLaunch (options) { + if (this.opts.flashPluginPath) { + options.args.push(`--ppapi-flash-path=${this.opts.flashPluginPath}`) + } +} +``` + +--- + +#### .[afterLaunch(browser, opts)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L287-L292) + +- `browser` **Puppeteer.Browser** The `puppeteer` browser instance. +- `opts` (optional, default `{options:({}as Puppeteer.LaunchOptions)}`) + +After the browser has launched. + +Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. +It's possible that `pupeeteer.launch` will be called multiple times and more than one browser created. +In order to make the plugins as stateless as possible don't store a reference to the browser instance +in the plugin but rather consider alternatives. + +E.g. when using `onPageCreated` you can get a browser reference by using `page.browser()`. + +Alternatively you could expose a class method that takes a browser instance as a parameter to work with: + +```es6 +const fancyPlugin = require('puppeteer-extra-plugin-fancy')() +puppeteer.use(fancyPlugin) +const browser = await puppeteer.launch() +await fancyPlugin.killBrowser(browser) +``` + +Example: + +```javascript +async afterLaunch (browser, opts) { + this.debug('browser has been launched', opts.options) +} +``` + +--- + +#### .[beforeConnect(options)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L305-L307) + +- `options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Puppeteer connect options + +Before connecting to an existing browser instance. + +Can be used to modify the puppeteer connect options by modifying or returning them. + +Plugins using this method will be called in sequence to each +be able to update the launch options. + +--- + +#### .[afterConnect(browser, opts)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L319-L321) + +- `browser` **Puppeteer.Browser** The `puppeteer` browser instance. +- `opts` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `{}`) + - `opts.options` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** Puppeteer connect options used. + +After connecting to an existing browser instance. + +> Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + +--- + +#### .[onBrowser(browser, opts)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L335-L337) + +- `browser` **Puppeteer.Browser** The `puppeteer` browser instance. +- `opts` **any** + +Returns: **[Promise](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)<void>** + +Called when a browser instance is available. + +This applies to both `puppeteer.launch()` and `puppeteer.connect()`. + +Convenience method created for plugins that need access to a browser instance +and don't mind if it has been created through `launch` or `connect`. + +> Note: Don't assume that there will only be a single browser instance during the lifecycle of a plugin. + +--- + +#### .[onTargetCreated(target)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L348-L350) + +- `target` **Puppeteer.Target** + +Called when a target is created, for example when a new page is opened by window.open or browser.newPage. + +> Note: This includes target creations in incognito browser contexts. +> +> Note: This includes browser instances created through `.launch()` as well as `.connect()`. + +--- + +#### .[onPageCreated(page, target)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L371-L373) + +- `page` **Puppeteer.Page** +- `target` **Puppeteer.Target** + +Same as `onTargetCreated` but prefiltered to only contain Pages, for convenience. + +> Note: This includes page creations in incognito browser contexts. +> +> Note: This includes browser instances created through `.launch()` as well as `.connect()`. + +Example: + +```javascript +async onPageCreated (page) { + let ua = await page.browser().userAgent() + if (this.opts.stripHeadless) { + ua = ua.replace('HeadlessChrome/', 'Chrome/') + } + this.debug('new ua', ua) + await page.setUserAgent(ua) +} +``` + +--- + +#### .[onTargetChanged(target)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L384-L386) + +- `target` **Puppeteer.Target** + +Called when the url of a target changes. + +> Note: This includes target changes in incognito browser contexts. +> +> Note: This includes browser instances created through `.launch()` as well as `.connect()`. + +--- + +#### .[onTargetDestroyed(target)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L397-L399) + +- `target` **Puppeteer.Target** + +Called when a target is destroyed, for example when a page is closed. + +> Note: This includes target destructions in incognito browser contexts. +> +> Note: This includes browser instances created through `.launch()` as well as `.connect()`. + +--- + +#### .[onDisconnected()](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L408-L410) + +Called when Puppeteer gets disconnected from the Chromium instance. + +This might happen because of one of the following: + +- Chromium is closed or crashed +- The `browser.disconnect` method was called + +--- + +#### .[onClose()](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L424-L426) + +**Deprecated:** Since puppeteer v1.6.0 `onDisconnected` has been improved +and should be used instead of `onClose`. + +In puppeteer < v1.6.0 `onDisconnected` was not catching all exit scenarios. +In order for plugins to clean up properly (e.g. deleting temporary files) +the `onClose` method had been introduced. + +> Note: Might be called multiple times on exit. +> +> Note: This only includes browser instances created through `.launch()`. + +--- + +#### .[onPluginRegistered()](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L433-L435) + +After the plugin has been registered in `puppeteer-extra`. + +Normally right after `puppeteer.use(plugin)` is called + +--- + +#### .[getDataFromPlugins(name?)](https://github.com/berstend/puppeteer-extra/blob/dc8b90260a927c0c66c4585c5a56092ea9c35049/packages/puppeteer-extra-plugin/src/index.ts#L448-L450) + +- `name` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?** Filter data by `name` property + +Returns: **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<PluginData>** + +Helper method to retrieve `data` objects from other plugins. + +A plugin needs to state the `dataFromPlugins` requirement +in order to use this method. Will be mapped to `puppeteer.getPluginData`. + +- **See: [data]** +- **See: [requirements]** + +--- diff --git a/projects/org-skill-web-research/node_modules/rimraf/CHANGELOG.md b/projects/org-skill-web-research/node_modules/rimraf/CHANGELOG.md new file mode 100644 index 0000000..f116f14 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/CHANGELOG.md @@ -0,0 +1,65 @@ +# v3.0 + +- Add `--preserve-root` option to executable (default true) +- Drop support for Node.js below version 6 + +# v2.7 + +- Make `glob` an optional dependency + +# 2.6 + +- Retry on EBUSY on non-windows platforms as well +- Make `rimraf.sync` 10000% more reliable on Windows + +# 2.5 + +- Handle Windows EPERM when lstat-ing read-only dirs +- Add glob option to pass options to glob + +# 2.4 + +- Add EPERM to delay/retry loop +- Add `disableGlob` option + +# 2.3 + +- Make maxBusyTries and emfileWait configurable +- Handle weird SunOS unlink-dir issue +- Glob the CLI arg for better Windows support + +# 2.2 + +- Handle ENOENT properly on Windows +- Allow overriding fs methods +- Treat EPERM as indicative of non-empty dir +- Remove optional graceful-fs dep +- Consistently return null error instead of undefined on success +- win32: Treat ENOTEMPTY the same as EBUSY +- Add `rimraf` binary + +# 2.1 + +- Fix SunOS error code for a non-empty directory +- Try rmdir before readdir +- Treat EISDIR like EPERM +- Remove chmod +- Remove lstat polyfill, node 0.7 is not supported + +# 2.0 + +- Fix myGid call to check process.getgid +- Simplify the EBUSY backoff logic. +- Use fs.lstat in node >= 0.7.9 +- Remove gently option +- remove fiber implementation +- Delete files that are marked read-only + +# 1.0 + +- Allow ENOENT in sync method +- Throw when no callback is provided +- Make opts.gently an absolute path +- use 'stat' if 'lstat' is not available +- Consistent error naming, and rethrow non-ENOENT stat errors +- add fiber implementation diff --git a/projects/org-skill-web-research/node_modules/rimraf/LICENSE b/projects/org-skill-web-research/node_modules/rimraf/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/rimraf/README.md b/projects/org-skill-web-research/node_modules/rimraf/README.md new file mode 100644 index 0000000..423b8cf --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/README.md @@ -0,0 +1,101 @@ +[![Build Status](https://travis-ci.org/isaacs/rimraf.svg?branch=master)](https://travis-ci.org/isaacs/rimraf) [![Dependency Status](https://david-dm.org/isaacs/rimraf.svg)](https://david-dm.org/isaacs/rimraf) [![devDependency Status](https://david-dm.org/isaacs/rimraf/dev-status.svg)](https://david-dm.org/isaacs/rimraf#info=devDependencies) + +The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. + +Install with `npm install rimraf`, or just drop rimraf.js somewhere. + +## API + +`rimraf(f, [opts], callback)` + +The first parameter will be interpreted as a globbing pattern for files. If you +want to disable globbing you can do so with `opts.disableGlob` (defaults to +`false`). This might be handy, for instance, if you have filenames that contain +globbing wildcard characters. + +The callback will be called with an error if there is one. Certain +errors are handled for you: + +* Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of + `opts.maxBusyTries` times before giving up, adding 100ms of wait + between each attempt. The default `maxBusyTries` is 3. +* `ENOENT` - If the file doesn't exist, rimraf will return + successfully, since your desired outcome is already the case. +* `EMFILE` - Since `readdir` requires opening a file descriptor, it's + possible to hit `EMFILE` if too many file descriptors are in use. + In the sync case, there's nothing to be done for this. But in the + async case, rimraf will gradually back off with timeouts up to + `opts.emfileWait` ms, which defaults to 1000. + +## options + +* unlink, chmod, stat, lstat, rmdir, readdir, + unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync + + In order to use a custom file system library, you can override + specific fs functions on the options object. + + If any of these functions are present on the options object, then + the supplied function will be used instead of the default fs + method. + + Sync methods are only relevant for `rimraf.sync()`, of course. + + For example: + + ```javascript + var myCustomFS = require('some-custom-fs') + + rimraf('some-thing', myCustomFS, callback) + ``` + +* maxBusyTries + + If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered + on Windows systems, then rimraf will retry with a linear backoff + wait of 100ms longer on each try. The default maxBusyTries is 3. + + Only relevant for async usage. + +* emfileWait + + If an `EMFILE` error is encountered, then rimraf will retry + repeatedly with a linear backoff of 1ms longer on each try, until + the timeout counter hits this max. The default limit is 1000. + + If you repeatedly encounter `EMFILE` errors, then consider using + [graceful-fs](http://npm.im/graceful-fs) in your program. + + Only relevant for async usage. + +* glob + + Set to `false` to disable [glob](http://npm.im/glob) pattern + matching. + + Set to an object to pass options to the glob module. The default + glob options are `{ nosort: true, silent: true }`. + + Glob version 6 is used in this module. + + Relevant for both sync and async usage. + +* disableGlob + + Set to any non-falsey value to disable globbing entirely. + (Equivalent to setting `glob: false`.) + +## rimraf.sync + +It can remove stuff synchronously, too. But that's not so good. Use +the async API. It's better. + +## CLI + +If installed with `npm install rimraf -g` it can be used as a global +command `rimraf [ ...]` which is useful for cross platform support. + +## mkdirp + +If you need to create a directory recursively, check out +[mkdirp](https://github.com/substack/node-mkdirp). diff --git a/projects/org-skill-web-research/node_modules/rimraf/bin.js b/projects/org-skill-web-research/node_modules/rimraf/bin.js new file mode 100755 index 0000000..023814c --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/bin.js @@ -0,0 +1,68 @@ +#!/usr/bin/env node + +const rimraf = require('./') + +const path = require('path') + +const isRoot = arg => /^(\/|[a-zA-Z]:\\)$/.test(path.resolve(arg)) +const filterOutRoot = arg => { + const ok = preserveRoot === false || !isRoot(arg) + if (!ok) { + console.error(`refusing to remove ${arg}`) + console.error('Set --no-preserve-root to allow this') + } + return ok +} + +let help = false +let dashdash = false +let noglob = false +let preserveRoot = true +const args = process.argv.slice(2).filter(arg => { + if (dashdash) + return !!arg + else if (arg === '--') + dashdash = true + else if (arg === '--no-glob' || arg === '-G') + noglob = true + else if (arg === '--glob' || arg === '-g') + noglob = false + else if (arg.match(/^(-+|\/)(h(elp)?|\?)$/)) + help = true + else if (arg === '--preserve-root') + preserveRoot = true + else if (arg === '--no-preserve-root') + preserveRoot = false + else + return !!arg +}).filter(arg => !preserveRoot || filterOutRoot(arg)) + +const go = n => { + if (n >= args.length) + return + const options = noglob ? { glob: false } : {} + rimraf(args[n], options, er => { + if (er) + throw er + go(n+1) + }) +} + +if (help || args.length === 0) { + // If they didn't ask for help, then this is not a "success" + const log = help ? console.log : console.error + log('Usage: rimraf [ ...]') + log('') + log(' Deletes all files and folders at "path" recursively.') + log('') + log('Options:') + log('') + log(' -h, --help Display this usage info') + log(' -G, --no-glob Do not expand glob patterns in arguments') + log(' -g, --glob Expand glob patterns in arguments (default)') + log(' --preserve-root Do not remove \'/\' (default)') + log(' --no-preserve-root Do not treat \'/\' specially') + log(' -- Stop parsing flags') + process.exit(help ? 0 : 1) +} else + go(0) diff --git a/projects/org-skill-web-research/node_modules/rimraf/package.json b/projects/org-skill-web-research/node_modules/rimraf/package.json new file mode 100644 index 0000000..1bf8d5e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/package.json @@ -0,0 +1,32 @@ +{ + "name": "rimraf", + "version": "3.0.2", + "main": "rimraf.js", + "description": "A deep deletion module for node (like `rm -rf`)", + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "repository": "git://github.com/isaacs/rimraf.git", + "scripts": { + "preversion": "npm test", + "postversion": "npm publish", + "postpublish": "git push origin --follow-tags", + "test": "tap test/*.js" + }, + "bin": "./bin.js", + "dependencies": { + "glob": "^7.1.3" + }, + "files": [ + "LICENSE", + "README.md", + "bin.js", + "rimraf.js" + ], + "devDependencies": { + "mkdirp": "^0.5.1", + "tap": "^12.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } +} diff --git a/projects/org-skill-web-research/node_modules/rimraf/rimraf.js b/projects/org-skill-web-research/node_modules/rimraf/rimraf.js new file mode 100644 index 0000000..34da417 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/rimraf/rimraf.js @@ -0,0 +1,360 @@ +const assert = require("assert") +const path = require("path") +const fs = require("fs") +let glob = undefined +try { + glob = require("glob") +} catch (_err) { + // treat glob as optional. +} + +const defaultGlobOpts = { + nosort: true, + silent: true +} + +// for EMFILE handling +let timeout = 0 + +const isWindows = (process.platform === "win32") + +const defaults = options => { + const methods = [ + 'unlink', + 'chmod', + 'stat', + 'lstat', + 'rmdir', + 'readdir' + ] + methods.forEach(m => { + options[m] = options[m] || fs[m] + m = m + 'Sync' + options[m] = options[m] || fs[m] + }) + + options.maxBusyTries = options.maxBusyTries || 3 + options.emfileWait = options.emfileWait || 1000 + if (options.glob === false) { + options.disableGlob = true + } + if (options.disableGlob !== true && glob === undefined) { + throw Error('glob dependency not found, set `options.disableGlob = true` if intentional') + } + options.disableGlob = options.disableGlob || false + options.glob = options.glob || defaultGlobOpts +} + +const rimraf = (p, options, cb) => { + if (typeof options === 'function') { + cb = options + options = {} + } + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert.equal(typeof cb, 'function', 'rimraf: callback function required') + assert(options, 'rimraf: invalid options argument provided') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + defaults(options) + + let busyTries = 0 + let errState = null + let n = 0 + + const next = (er) => { + errState = errState || er + if (--n === 0) + cb(errState) + } + + const afterGlob = (er, results) => { + if (er) + return cb(er) + + n = results.length + if (n === 0) + return cb() + + results.forEach(p => { + const CB = (er) => { + if (er) { + if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && + busyTries < options.maxBusyTries) { + busyTries ++ + // try again, with the same exact callback as this one. + return setTimeout(() => rimraf_(p, options, CB), busyTries * 100) + } + + // this one won't happen if graceful-fs is used. + if (er.code === "EMFILE" && timeout < options.emfileWait) { + return setTimeout(() => rimraf_(p, options, CB), timeout ++) + } + + // already gone + if (er.code === "ENOENT") er = null + } + + timeout = 0 + next(er) + } + rimraf_(p, options, CB) + }) + } + + if (options.disableGlob || !glob.hasMagic(p)) + return afterGlob(null, [p]) + + options.lstat(p, (er, stat) => { + if (!er) + return afterGlob(null, [p]) + + glob(p, options.glob, afterGlob) + }) + +} + +// Two possible strategies. +// 1. Assume it's a file. unlink it, then do the dir stuff on EPERM or EISDIR +// 2. Assume it's a directory. readdir, then do the file stuff on ENOTDIR +// +// Both result in an extra syscall when you guess wrong. However, there +// are likely far more normal files in the world than directories. This +// is based on the assumption that a the average number of files per +// directory is >= 1. +// +// If anyone ever complains about this, then I guess the strategy could +// be made configurable somehow. But until then, YAGNI. +const rimraf_ = (p, options, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // sunos lets the root user unlink directories, which is... weird. + // so we have to lstat here and make sure it's not a dir. + options.lstat(p, (er, st) => { + if (er && er.code === "ENOENT") + return cb(null) + + // Windows can EPERM on stat. Life is suffering. + if (er && er.code === "EPERM" && isWindows) + fixWinEPERM(p, options, er, cb) + + if (st && st.isDirectory()) + return rmdir(p, options, er, cb) + + options.unlink(p, er => { + if (er) { + if (er.code === "ENOENT") + return cb(null) + if (er.code === "EPERM") + return (isWindows) + ? fixWinEPERM(p, options, er, cb) + : rmdir(p, options, er, cb) + if (er.code === "EISDIR") + return rmdir(p, options, er, cb) + } + return cb(er) + }) + }) +} + +const fixWinEPERM = (p, options, er, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.chmod(p, 0o666, er2 => { + if (er2) + cb(er2.code === "ENOENT" ? null : er) + else + options.stat(p, (er3, stats) => { + if (er3) + cb(er3.code === "ENOENT" ? null : er) + else if (stats.isDirectory()) + rmdir(p, options, er, cb) + else + options.unlink(p, cb) + }) + }) +} + +const fixWinEPERMSync = (p, options, er) => { + assert(p) + assert(options) + + try { + options.chmodSync(p, 0o666) + } catch (er2) { + if (er2.code === "ENOENT") + return + else + throw er + } + + let stats + try { + stats = options.statSync(p) + } catch (er3) { + if (er3.code === "ENOENT") + return + else + throw er + } + + if (stats.isDirectory()) + rmdirSync(p, options, er) + else + options.unlinkSync(p) +} + +const rmdir = (p, options, originalEr, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + // try to rmdir first, and only readdir on ENOTEMPTY or EEXIST (SunOS) + // if we guessed wrong, and it's not a directory, then + // raise the original error. + options.rmdir(p, er => { + if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) + rmkids(p, options, cb) + else if (er && er.code === "ENOTDIR") + cb(originalEr) + else + cb(er) + }) +} + +const rmkids = (p, options, cb) => { + assert(p) + assert(options) + assert(typeof cb === 'function') + + options.readdir(p, (er, files) => { + if (er) + return cb(er) + let n = files.length + if (n === 0) + return options.rmdir(p, cb) + let errState + files.forEach(f => { + rimraf(path.join(p, f), options, er => { + if (errState) + return + if (er) + return cb(errState = er) + if (--n === 0) + options.rmdir(p, cb) + }) + }) + }) +} + +// this looks simpler, and is strictly *faster*, but will +// tie up the JavaScript thread and fail on excessively +// deep directory trees. +const rimrafSync = (p, options) => { + options = options || {} + defaults(options) + + assert(p, 'rimraf: missing path') + assert.equal(typeof p, 'string', 'rimraf: path should be a string') + assert(options, 'rimraf: missing options') + assert.equal(typeof options, 'object', 'rimraf: options should be object') + + let results + + if (options.disableGlob || !glob.hasMagic(p)) { + results = [p] + } else { + try { + options.lstatSync(p) + results = [p] + } catch (er) { + results = glob.sync(p, options.glob) + } + } + + if (!results.length) + return + + for (let i = 0; i < results.length; i++) { + const p = results[i] + + let st + try { + st = options.lstatSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + + // Windows can EPERM on stat. Life is suffering. + if (er.code === "EPERM" && isWindows) + fixWinEPERMSync(p, options, er) + } + + try { + // sunos lets the root user unlink directories, which is... weird. + if (st && st.isDirectory()) + rmdirSync(p, options, null) + else + options.unlinkSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "EPERM") + return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er) + if (er.code !== "EISDIR") + throw er + + rmdirSync(p, options, er) + } + } +} + +const rmdirSync = (p, options, originalEr) => { + assert(p) + assert(options) + + try { + options.rmdirSync(p) + } catch (er) { + if (er.code === "ENOENT") + return + if (er.code === "ENOTDIR") + throw originalEr + if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") + rmkidsSync(p, options) + } +} + +const rmkidsSync = (p, options) => { + assert(p) + assert(options) + options.readdirSync(p).forEach(f => rimrafSync(path.join(p, f), options)) + + // We only end up here once we got ENOTEMPTY at least once, and + // at this point, we are guaranteed to have removed all the kids. + // So, we know that it won't be ENOENT or ENOTDIR or anything else. + // try really hard to delete stuff on windows, because it has a + // PROFOUNDLY annoying habit of not closing handles promptly when + // files are deleted, resulting in spurious ENOTEMPTY errors. + const retries = isWindows ? 100 : 1 + let i = 0 + do { + let threw = true + try { + const ret = options.rmdirSync(p, options) + threw = false + return ret + } finally { + if (++i < retries && threw) + continue + } + } while (true) +} + +module.exports = rimraf +rimraf.sync = rimrafSync diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/LICENSE b/projects/org-skill-web-research/node_modules/shallow-clone/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/README.md b/projects/org-skill-web-research/node_modules/shallow-clone/README.md new file mode 100644 index 0000000..6823afc --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/README.md @@ -0,0 +1,94 @@ +# shallow-clone [![NPM version](https://badge.fury.io/js/shallow-clone.svg)](http://badge.fury.io/js/shallow-clone) + +> Make a shallow clone of an object, array or primitive. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i shallow-clone --save +``` + +## Usage + +```js +var clone = require('shallow-clone'); +``` + +## shallow clones arrays + +The array itself is cloned, but not the elements of the array. So any objects in the array will still not be cloned (e.g. they will be the same object as in the orginal array). + +```js +var arr = [{ 'a': 0 }, { 'b': 1 }] +var foo = clone(arr); +// foo => [{ 'a': 0 }, { 'b': 1 }] + +// array is cloned +assert.equal(actual === expected, false); + +// array elements are not +assert.deepEqual(actual[0], expected[0]); // true +``` + +## returns primitives as-is + +```js +clone(0) +//=> 0 + +clone('foo') +//=> 'foo' +``` + +## shallow clone a regex + +```js +clone(/foo/g) +//=> /foo/g +``` + +## shallow clone an object + +```js +clone({a: 1, b: 2, c: 3 }) +//=> {a: 1, b: 2, c: 3 } +``` + +## Related projects + +* [assign-deep](https://github.com/jonschlinkert/assign-deep): Deeply assign the enumerable properties of source objects to a destination object. +* [clone-deep](https://github.com/jonschlinkert/clone-deep): Recursively (deep) clone JavaScript native types, like Object, Array, RegExp, Date as well as primitives. +* [extend-shallow](https://github.com/jonschlinkert/extend-shallow): Extend an object with the properties of additional objects. node.js/javascript util. +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [mixin-object](https://github.com/jonschlinkert/mixin-object): Mixin the own and inherited properties of other objects onto the first object. Pass an… [more](https://github.com/jonschlinkert/mixin-object) +* [mixin-deep](https://github.com/jonschlinkert/mixin-deep): Deeply mix the properties of objects into the first object. Like merge-deep, but doesn't clone. + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/shallow-clone/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 Jon Schlinkert +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 10, 2015._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/index.js b/projects/org-skill-web-research/node_modules/shallow-clone/index.js new file mode 100644 index 0000000..1224c96 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/index.js @@ -0,0 +1,56 @@ +/*! + * shallow-clone + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var utils = require('./utils'); + +/** + * Shallow copy an object, array or primitive. + * + * @param {any} `val` + * @return {any} + */ + +function clone(val) { + var type = utils.typeOf(val); + + if (clone.hasOwnProperty(type)) { + return clone[type](val); + } + return val; +} + +clone.array = function cloneArray(arr) { + return arr.slice(); +}; + +clone.date = function cloneDate(date) { + return new Date(+date); +}; + +clone.object = function cloneObject(obj) { + if (utils.isObject(obj)) { + return utils.mixin({}, obj); + } else { + return obj; + } +}; + +clone.regexp = function cloneRegExp(re) { + var flags = ''; + flags += re.multiline ? 'm' : ''; + flags += re.global ? 'g' : ''; + flags += re.ignorecase ? 'i' : ''; + return new RegExp(re.source, flags); +}; + +/** + * Expose `clone` + */ + +module.exports = clone; diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/LICENSE b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/LICENSE new file mode 100644 index 0000000..cdaf57d --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2014-2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/README.md b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/README.md new file mode 100644 index 0000000..a0af742 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/README.md @@ -0,0 +1,212 @@ +# kind-of [![NPM version](https://badge.fury.io/js/kind-of.svg)](http://badge.fury.io/js/kind-of) [![Build Status](https://travis-ci.org/jonschlinkert/kind-of.svg)](https://travis-ci.org/jonschlinkert/kind-of) + +> Get the native type of a value. + +[](#optimizations)**What makes this so fast?** + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i kind-of --save +``` + +Install with [bower](http://bower.io/) + +```sh +$ bower install kind-of --save +``` + +## Usage + +> es5, browser and es6 ready + +```js +var kindOf = require('kind-of'); + +kindOf(undefined); +//=> 'undefined' + +kindOf(null); +//=> 'null' + +kindOf(true); +//=> 'boolean' + +kindOf(false); +//=> 'boolean' + +kindOf(new Boolean(true)); +//=> 'boolean' + +kindOf(new Buffer('')); +//=> 'buffer' + +kindOf(42); +//=> 'number' + +kindOf(new Number(42)); +//=> 'number' + +kindOf('str'); +//=> 'string' + +kindOf(new String('str')); +//=> 'string' + +kindOf(arguments); +//=> 'arguments' + +kindOf({}); +//=> 'object' + +kindOf(Object.create(null)); +//=> 'object' + +kindOf(new Test()); +//=> 'object' + +kindOf(new Date()); +//=> 'date' + +kindOf([]); +//=> 'array' + +kindOf([1, 2, 3]); +//=> 'array' + +kindOf(new Array()); +//=> 'array' + +kindOf(/[\s\S]+/); +//=> 'regexp' + +kindOf(new RegExp('^' + 'foo$')); +//=> 'regexp' + +kindOf(function () {}); +//=> 'function' + +kindOf(function * () {}); +//=> 'function' + +kindOf(new Function()); +//=> 'function' + +kindOf(new Map()); +//=> 'map' + +kindOf(new WeakMap()); +//=> 'weakmap' + +kindOf(new Set()); +//=> 'set' + +kindOf(new WeakSet()); +//=> 'weakset' + +kindOf(Symbol('str')); +//=> 'symbol' +``` + +## Related projects + +* [is-number](https://github.com/jonschlinkert/is-number): Returns true if the value is a number. comprehensive tests. +* [isobject](https://github.com/jonschlinkert/isobject): Returns true if the value is an object and not an array or null. +* [is-primitive](https://github.com/jonschlinkert/is-primitive): Returns `true` if the value is a primitive. +* [is-plain-object](https://github.com/jonschlinkert/is-plain-object): Returns true if an object was created by the `Object` constructor. +* [is-match](https://github.com/jonschlinkert/is-match): Create a matching function from a glob pattern, regex, string, array or function. + +## Benchmarks + +Benchmarked against [typeof](http://github.com/CodingFu/typeof) and [type-of](https://github.com/ForbesLindesay/type-of). +Note that performaces is slower for es6 features `Map`, `WeakMap`, `Set` and `WeakSet`. + +```bash +#1: array + current x 23,329,397 ops/sec ±0.82% (94 runs sampled) + lib-type-of x 4,170,273 ops/sec ±0.55% (94 runs sampled) + lib-typeof x 9,686,935 ops/sec ±0.59% (98 runs sampled) + +#2: boolean + current x 27,197,115 ops/sec ±0.85% (94 runs sampled) + lib-type-of x 3,145,791 ops/sec ±0.73% (97 runs sampled) + lib-typeof x 9,199,562 ops/sec ±0.44% (99 runs sampled) + +#3: date + current x 20,190,117 ops/sec ±0.86% (92 runs sampled) + lib-type-of x 5,166,970 ops/sec ±0.74% (94 runs sampled) + lib-typeof x 9,610,821 ops/sec ±0.50% (96 runs sampled) + +#4: function + current x 23,855,460 ops/sec ±0.60% (97 runs sampled) + lib-type-of x 5,667,740 ops/sec ±0.54% (100 runs sampled) + lib-typeof x 10,010,644 ops/sec ±0.44% (100 runs sampled) + +#5: null + current x 27,061,047 ops/sec ±0.97% (96 runs sampled) + lib-type-of x 13,965,573 ops/sec ±0.62% (97 runs sampled) + lib-typeof x 8,460,194 ops/sec ±0.61% (97 runs sampled) + +#6: number + current x 25,075,682 ops/sec ±0.53% (99 runs sampled) + lib-type-of x 2,266,405 ops/sec ±0.41% (98 runs sampled) + lib-typeof x 9,821,481 ops/sec ±0.45% (99 runs sampled) + +#7: object + current x 3,348,980 ops/sec ±0.49% (99 runs sampled) + lib-type-of x 3,245,138 ops/sec ±0.60% (94 runs sampled) + lib-typeof x 9,262,952 ops/sec ±0.59% (99 runs sampled) + +#8: regex + current x 21,284,827 ops/sec ±0.72% (96 runs sampled) + lib-type-of x 4,689,241 ops/sec ±0.43% (100 runs sampled) + lib-typeof x 8,957,593 ops/sec ±0.62% (98 runs sampled) + +#9: string + current x 25,379,234 ops/sec ±0.58% (96 runs sampled) + lib-type-of x 3,635,148 ops/sec ±0.76% (93 runs sampled) + lib-typeof x 9,494,134 ops/sec ±0.49% (98 runs sampled) + +#10: undef + current x 27,459,221 ops/sec ±1.01% (93 runs sampled) + lib-type-of x 14,360,433 ops/sec ±0.52% (99 runs sampled) + lib-typeof x 23,202,868 ops/sec ±0.59% (94 runs sampled) +``` + +## Optimizations + +In 7 out of 8 cases, this library is 2x-10x faster than other top libraries included in the benchmarks. There are a few things that lead to this performance advantage, none of them hard and fast rules, but all of them simple and repeatable in almost any code library: + +1. Optimize around the fastest and most common use cases first. Of course, this will change from project-to-project, but I took some time to understand how and why `typeof` checks were being used in my own libraries and other libraries I use a lot. +2. Optimize around bottlenecks - In other words, the order in which conditionals are implemented is significant, because each check is only as fast as the failing checks that came before it. Here, the biggest bottleneck by far is checking for plain objects (an object that was created by the `Object` constructor). I opted to make this check happen by process of elimination rather than brute force up front (e.g. by using something like `val.constructor.name`), so that every other type check would not be penalized it. +3. Don't do uneccessary processing - why do `.slice(8, -1).toLowerCase();` just to get the word `regex`? It's much faster to do `if (type === '[object RegExp]') return 'regex'` + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/kind-of/issues/new) + +## Author + +**Jon Schlinkert** + ++ [github/jonschlinkert](https://github.com/jonschlinkert) ++ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2014-2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on May 31, 2015._ diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/index.js b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/index.js new file mode 100644 index 0000000..6093403 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/index.js @@ -0,0 +1,84 @@ +var isBuffer = require('is-buffer'); +var toString = Object.prototype.toString; + +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ + +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; + } + + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; + } + + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; + } + + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } + + // other objects + var type = toString.call(val); + + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + + // buffer + if (typeof Buffer !== 'undefined' && isBuffer(val)) { + return 'buffer'; + } + + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } + + // must be a plain object + return 'object'; +}; diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/package.json b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/package.json new file mode 100644 index 0000000..399973f --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/kind-of/package.json @@ -0,0 +1,57 @@ +{ + "name": "kind-of", + "description": "Get the native type of a value.", + "version": "2.0.1", + "homepage": "https://github.com/jonschlinkert/kind-of", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/kind-of", + "bugs": { + "url": "https://github.com/jonschlinkert/kind-of/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "prepublish": "browserify -o browser.js -e index.js -s index --bare" + }, + "devDependencies": { + "benchmarked": "^0.1.3", + "chalk": "^0.5.1", + "glob": "^4.3.5", + "mocha": "^2.2.5", + "should": "^4.6.1", + "type-of": "^2.0.1", + "typeof": "^1.0.0" + }, + "keywords": [ + "arguments", + "array", + "boolean", + "check", + "date", + "function", + "is", + "is-type", + "is-type-of", + "kind", + "kind-of", + "number", + "object", + "regexp", + "string", + "test", + "type", + "type-of", + "typeof", + "types" + ], + "dependencies": { + "is-buffer": "^1.0.2" + } +} diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/LICENSE b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/LICENSE new file mode 100644 index 0000000..65f90ac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015, Jon Schlinkert. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/README.md b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/README.md new file mode 100644 index 0000000..7134690 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/README.md @@ -0,0 +1,128 @@ +# lazy-cache [![NPM version](https://img.shields.io/npm/v/lazy-cache.svg)](https://www.npmjs.com/package/lazy-cache) [![Build Status](https://img.shields.io/travis/jonschlinkert/lazy-cache.svg)](https://travis-ci.org/jonschlinkert/lazy-cache) + +> Cache requires to be lazy-loaded when needed. + +## Install + +Install with [npm](https://www.npmjs.com/) + +```sh +$ npm i lazy-cache --save +``` + +## Usage + +```js +var lazy = require('lazy-cache')(require); +``` + +**Use as a property on `lazy`** + +The module is also added as a property to the `lazy` function +so it can be called without having to call a function first. + +```js +var lazy = require('lazy-cache')(require); + +// `npm install glob` +lazy('glob'); + +// glob sync +console.log(lazy.glob.sync('*.js')); + +// glob async +lazy.glob('*.js', function (err, files) { + console.log(files); +}); +``` + +**Use as a function** + +```js +var lazy = require('lazy-cache')(require); +var glob = lazy('glob'); + +// `glob` is a now a function that may be called when needed +glob().sync('foo/*.js'); +``` + +## Aliases + +An alias may be passed as the second argument if you don't want to use the automatically camel-cased variable name. + +**Example** + +```js +var utils = require('lazy-cache')(require); + +utils('ansi-yellow', 'yellow'); +console.log(utils.yellow('foo')); +``` + +## Browserify usage + +**Example** + +```js +var utils = require('lazy-cache')(require); +// temporarily re-assign `require` to trick browserify +var fn = require; +require = utils; +// list module dependencies (here, `require` is actually `lazy-cache`) +require('glob'); +require = fn; // restore the native `require` function + +/** + * Now you can use glob with the `utils.glob` variable + */ + +// sync +console.log(utils.glob.sync('*.js')); + +// async +utils.glob('*.js', function (err, files) { + console.log(files.join('\n')); +}); +``` + +## Kill switch + +In certain rare edge cases, it may be necessary to unlazy all lazy-cached dependencies (two reported cases out of > 9 million downloads). + +To force lazy-cache to immediately invoke all dependencies, do: + +```js +process.env.UNLAZY = true; +``` + +## Related + +[lint-deps](https://www.npmjs.com/package/lint-deps): CLI tool that tells you when dependencies are missing from package.json and offers you a… [more](https://www.npmjs.com/package/lint-deps) | [homepage](https://github.com/jonschlinkert/lint-deps) + +## Running tests + +Install dev dependencies: + +```sh +$ npm i -d && npm test +``` + +## Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/lazy-cache/issues/new). + +## Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +## License + +Copyright © 2015 [Jon Schlinkert](https://github.com/jonschlinkert) +Released under the MIT license. + +*** + +_This file was generated by [verb](https://github.com/verbose/verb) on December 09, 2015._ \ No newline at end of file diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/index.js b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/index.js new file mode 100644 index 0000000..ea7ceb2 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/index.js @@ -0,0 +1,67 @@ +'use strict'; + +/** + * Cache results of the first function call to ensure only calling once. + * + * ```js + * var utils = require('lazy-cache')(require); + * // cache the call to `require('ansi-yellow')` + * utils('ansi-yellow', 'yellow'); + * // use `ansi-yellow` + * console.log(utils.yellow('this is yellow')); + * ``` + * + * @param {Function} `fn` Function that will be called only once. + * @return {Function} Function that can be called to get the cached function + * @api public + */ + +function lazyCache(fn) { + var cache = {}; + var proxy = function(mod, name) { + name = name || camelcase(mod); + + // check both boolean and string in case `process.env` cases to string + if (process.env.UNLAZY === 'true' || process.env.UNLAZY === true) { + cache[name] = fn(mod); + } + + Object.defineProperty(proxy, name, { + enumerable: true, + configurable: true, + get: getter + }); + + function getter() { + if (cache.hasOwnProperty(name)) { + return cache[name]; + } + return (cache[name] = fn(mod)); + } + return getter; + }; + return proxy; +} + +/** + * Used to camelcase the name to be stored on the `lazy` object. + * + * @param {String} `str` String containing `_`, `.`, `-` or whitespace that will be camelcased. + * @return {String} camelcased string. + */ + +function camelcase(str) { + if (str.length === 1) { + return str.toLowerCase(); + } + str = str.replace(/^[\W_]+|[\W_]+$/g, '').toLowerCase(); + return str.replace(/[\W_]+(\w|$)/g, function(_, ch) { + return ch.toUpperCase(); + }); +} + +/** + * Expose `lazyCache` + */ + +module.exports = lazyCache; diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/package.json b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/package.json new file mode 100644 index 0000000..ddf881e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/node_modules/lazy-cache/package.json @@ -0,0 +1,46 @@ +{ + "name": "lazy-cache", + "description": "Cache requires to be lazy-loaded when needed.", + "version": "0.2.7", + "homepage": "https://github.com/jonschlinkert/lazy-cache", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/lazy-cache", + "bugs": { + "url": "https://github.com/jonschlinkert/lazy-cache/issues" + }, + "license": "MIT", + "files": [ + "index.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "devDependencies": { + "ansi-yellow": "^0.1.1", + "glob": "^5.0.14", + "mocha": "*" + }, + "keywords": [ + "cache", + "caching", + "dependencies", + "dependency", + "lazy", + "require", + "requires" + ], + "verb": { + "related": { + "list": [ + "lint-deps" + ] + }, + "plugins": [ + "gulp-format-md" + ] + } +} diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/package.json b/projects/org-skill-web-research/node_modules/shallow-clone/package.json new file mode 100644 index 0000000..a088fd9 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/package.json @@ -0,0 +1,55 @@ +{ + "name": "shallow-clone", + "description": "Make a shallow clone of an object, array or primitive.", + "version": "0.1.2", + "homepage": "https://github.com/jonschlinkert/shallow-clone", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/shallow-clone", + "bugs": { + "url": "https://github.com/jonschlinkert/shallow-clone/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "utils.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "devDependencies": { + "mocha": "*", + "should": "*" + }, + "keywords": [ + "array", + "clone", + "copy", + "extend", + "mixin", + "object", + "primitive", + "shallow" + ], + "verb": { + "related": { + "list": [ + "clone-deep", + "is-plain-object", + "mixin-object", + "mixin-deep", + "extend-shallow", + "assign-deep" + ] + } + } +} diff --git a/projects/org-skill-web-research/node_modules/shallow-clone/utils.js b/projects/org-skill-web-research/node_modules/shallow-clone/utils.js new file mode 100644 index 0000000..f6fb967 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/shallow-clone/utils.js @@ -0,0 +1,10 @@ +'use strict'; + +var utils = require('lazy-cache')(require); +var fn = require; +require = utils; +require('is-extendable', 'isObject'); +require('mixin-object', 'mixin'); +require('kind-of', 'typeOf'); +require = fn; +module.exports = utils; diff --git a/projects/org-skill-web-research/node_modules/universalify/LICENSE b/projects/org-skill-web-research/node_modules/universalify/LICENSE new file mode 100644 index 0000000..514e84e --- /dev/null +++ b/projects/org-skill-web-research/node_modules/universalify/LICENSE @@ -0,0 +1,20 @@ +(The MIT License) + +Copyright (c) 2017, Ryan Zimmerman + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the 'Software'), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/universalify/README.md b/projects/org-skill-web-research/node_modules/universalify/README.md new file mode 100644 index 0000000..1184939 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/universalify/README.md @@ -0,0 +1,76 @@ +# universalify + +![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/RyanZim/universalify/ci.yml?branch=master) +![Coveralls github branch](https://img.shields.io/coveralls/github/RyanZim/universalify/master.svg) +![npm](https://img.shields.io/npm/dm/universalify.svg) +![npm](https://img.shields.io/npm/l/universalify.svg) + +Make a callback- or promise-based function support both promises and callbacks. + +Uses the native promise implementation. + +## Installation + +```bash +npm install universalify +``` + +## API + +### `universalify.fromCallback(fn)` + +Takes a callback-based function to universalify, and returns the universalified function. + +Function must take a callback as the last parameter that will be called with the signature `(error, result)`. `universalify` does not support calling the callback with three or more arguments, and does not ensure that the callback is only called once. + +```js +function callbackFn (n, cb) { + setTimeout(() => cb(null, n), 15) +} + +const fn = universalify.fromCallback(callbackFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +### `universalify.fromPromise(fn)` + +Takes a promise-based function to universalify, and returns the universalified function. + +Function must return a valid JS promise. `universalify` does not ensure that a valid promise is returned. + +```js +function promiseFn (n) { + return new Promise(resolve => { + setTimeout(() => resolve(n), 15) + }) +} + +const fn = universalify.fromPromise(promiseFn) + +// Works with Promises: +fn('Hello World!') +.then(result => console.log(result)) // -> Hello World! +.catch(error => console.error(error)) + +// Works with Callbacks: +fn('Hi!', (error, result) => { + if (error) return console.error(error) + console.log(result) + // -> Hi! +}) +``` + +## License + +MIT diff --git a/projects/org-skill-web-research/node_modules/universalify/index.js b/projects/org-skill-web-research/node_modules/universalify/index.js new file mode 100644 index 0000000..233beac --- /dev/null +++ b/projects/org-skill-web-research/node_modules/universalify/index.js @@ -0,0 +1,24 @@ +'use strict' + +exports.fromCallback = function (fn) { + return Object.defineProperty(function (...args) { + if (typeof args[args.length - 1] === 'function') fn.apply(this, args) + else { + return new Promise((resolve, reject) => { + args.push((err, res) => (err != null) ? reject(err) : resolve(res)) + fn.apply(this, args) + }) + } + }, 'name', { value: fn.name }) +} + +exports.fromPromise = function (fn) { + return Object.defineProperty(function (...args) { + const cb = args[args.length - 1] + if (typeof cb !== 'function') return fn.apply(this, args) + else { + args.pop() + fn.apply(this, args).then(r => cb(null, r), cb) + } + }, 'name', { value: fn.name }) +} diff --git a/projects/org-skill-web-research/node_modules/universalify/package.json b/projects/org-skill-web-research/node_modules/universalify/package.json new file mode 100644 index 0000000..d60fccb --- /dev/null +++ b/projects/org-skill-web-research/node_modules/universalify/package.json @@ -0,0 +1,34 @@ +{ + "name": "universalify", + "version": "2.0.1", + "description": "Make a callback- or promise-based function support both promises and callbacks.", + "keywords": [ + "callback", + "native", + "promise" + ], + "homepage": "https://github.com/RyanZim/universalify#readme", + "bugs": "https://github.com/RyanZim/universalify/issues", + "license": "MIT", + "author": "Ryan Zimmerman ", + "files": [ + "index.js" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/RyanZim/universalify.git" + }, + "scripts": { + "test": "standard && nyc --reporter text --reporter lcovonly tape test/*.js | colortape" + }, + "devDependencies": { + "colortape": "^0.1.2", + "coveralls": "^3.0.1", + "nyc": "^15.0.0", + "standard": "^14.3.1", + "tape": "^5.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } +} diff --git a/projects/org-skill-web-research/node_modules/wrappy/LICENSE b/projects/org-skill-web-research/node_modules/wrappy/LICENSE new file mode 100644 index 0000000..19129e3 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/wrappy/LICENSE @@ -0,0 +1,15 @@ +The ISC License + +Copyright (c) Isaac Z. Schlueter and Contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/projects/org-skill-web-research/node_modules/wrappy/README.md b/projects/org-skill-web-research/node_modules/wrappy/README.md new file mode 100644 index 0000000..98eab25 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/wrappy/README.md @@ -0,0 +1,36 @@ +# wrappy + +Callback wrapping utility + +## USAGE + +```javascript +var wrappy = require("wrappy") + +// var wrapper = wrappy(wrapperFunction) + +// make sure a cb is called only once +// See also: http://npm.im/once for this specific use case +var once = wrappy(function (cb) { + var called = false + return function () { + if (called) return + called = true + return cb.apply(this, arguments) + } +}) + +function printBoo () { + console.log('boo') +} +// has some rando property +printBoo.iAmBooPrinter = true + +var onlyPrintOnce = once(printBoo) + +onlyPrintOnce() // prints 'boo' +onlyPrintOnce() // does nothing + +// random property is retained! +assert.equal(onlyPrintOnce.iAmBooPrinter, true) +``` diff --git a/projects/org-skill-web-research/node_modules/wrappy/package.json b/projects/org-skill-web-research/node_modules/wrappy/package.json new file mode 100644 index 0000000..1307520 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/wrappy/package.json @@ -0,0 +1,29 @@ +{ + "name": "wrappy", + "version": "1.0.2", + "description": "Callback wrapping utility", + "main": "wrappy.js", + "files": [ + "wrappy.js" + ], + "directories": { + "test": "test" + }, + "dependencies": {}, + "devDependencies": { + "tap": "^2.3.1" + }, + "scripts": { + "test": "tap --coverage test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/npm/wrappy" + }, + "author": "Isaac Z. Schlueter (http://blog.izs.me/)", + "license": "ISC", + "bugs": { + "url": "https://github.com/npm/wrappy/issues" + }, + "homepage": "https://github.com/npm/wrappy" +} diff --git a/projects/org-skill-web-research/node_modules/wrappy/wrappy.js b/projects/org-skill-web-research/node_modules/wrappy/wrappy.js new file mode 100644 index 0000000..bb7e7d6 --- /dev/null +++ b/projects/org-skill-web-research/node_modules/wrappy/wrappy.js @@ -0,0 +1,33 @@ +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) + + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') + + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) + + return wrapper + + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) + } + return ret + } +} diff --git a/projects/org-skill-web-research/org-skill-web-research.asd b/projects/org-skill-web-research/org-skill-web-research.asd new file mode 100644 index 0000000..f1abcd9 --- /dev/null +++ b/projects/org-skill-web-research/org-skill-web-research.asd @@ -0,0 +1,9 @@ +(defsystem :org-skill-web-research + :name "org-skill-web-research" + :author "Agent" + :version "0.1.0" + :license "MIT" + :description "Headless browser research bridge" + :depends-on (:uiop) + :components ((:module "src" + :components ((:file "research-logic"))))) diff --git a/projects/org-skill-web-research/package-lock.json b/projects/org-skill-web-research/package-lock.json index 449311d..86c4199 100644 --- a/projects/org-skill-web-research/package-lock.json +++ b/projects/org-skill-web-research/package-lock.json @@ -9,9 +9,127 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "playwright": "^1.58.2" + "playwright": "^1.58.2", + "playwright-extra": "^4.3.6", + "puppeteer-extra-plugin-stealth": "^2.11.2" } }, + "node_modules/@types/debug": { + "version": "4.1.13", + "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.13.tgz", + "integrity": "sha512-KSVgmQmzMwPlmtljOomayoR89W4FynCAi3E8PPs7vmDVPe84hT+vGPKkJfThkmXs0x0jAaa9U8uW8bbfyS2fWw==", + "dependencies": { + "@types/ms": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==" + }, + "node_modules/arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/brace-expansion": { + "version": "1.1.13", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.13.tgz", + "integrity": "sha512-9ZLprWS6EENmhEOpjCYW2c8VkmOvckIJZfkr7rBW6dObmfgJ/L1GpSYW5Hpo9lDz4D1+n0Ckz8rU7FwHDQiG/w==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/clone-deep": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-0.2.4.tgz", + "integrity": "sha512-we+NuQo2DHhSl+DP6jlUiAhyAjBQrYnpOk15rN6c6JSPScjiCLh8IbSU+VTcph6YS3o7mASE8a0+gbZ7ChLpgg==", + "dependencies": { + "for-own": "^0.1.3", + "is-plain-object": "^2.0.1", + "kind-of": "^3.0.2", + "lazy-cache": "^1.0.3", + "shallow-clone": "^0.1.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw==", + "dependencies": { + "for-in": "^1.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -25,6 +143,173 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "node_modules/is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/jsonfile": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.0.tgz", + "integrity": "sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==", + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "dependencies": { + "is-buffer": "^1.1.5" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha512-RE2g0b5VGZsOCFOCgP7omTRYFqydmZkBwl5oNnQ1lDYC57uyO9KqNnNVxT7COSHTxrRCWVcAVOcbjk+tvh/rgQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/merge-deep": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/merge-deep/-/merge-deep-3.0.3.tgz", + "integrity": "sha512-qtmzAS6t6grwEkNrunqTBdn0qKwFgNWvlxUbAV8es9M7Ot1EbyApytCnvE0jALPa46ZpKDUo527kKiaWplmlFA==", + "dependencies": { + "arr-union": "^3.1.0", + "clone-deep": "^0.2.4", + "kind-of": "^3.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/minimatch": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz", + "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/mixin-object": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", + "integrity": "sha512-ALGF1Jt9ouehcaXaHhn6t1yGWRqGaHkPFndtFVHfZXOvkIZ/yoGaSi0AHVTafb3ZBGg4dr/bDwnaEKqCXzchMA==", + "dependencies": { + "for-in": "^0.1.3", + "is-extendable": "^0.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/mixin-object/node_modules/for-in": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-0.1.8.tgz", + "integrity": "sha512-F0to7vbBSHP8E3l6dCjxNOLuSFAACIxFy3UehTUlG7svlXi37HHsDkyVcHo0Pq8QwrE+pXvWSVX3ZT1T9wAZ9g==", + "engines": { + "node": ">=0.10.0" + } + }, + "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==" + }, + "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==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/playwright": { "version": "1.58.2", "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.58.2.tgz", @@ -52,6 +337,192 @@ "engines": { "node": ">=18" } + }, + "node_modules/playwright-extra": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/playwright-extra/-/playwright-extra-4.3.6.tgz", + "integrity": "sha512-q2rVtcE8V8K3vPVF1zny4pvwZveHLH8KBuVU2MoE3Jw4OKVoBWsHI9CH9zPydovHHOCDxjGN2Vg+2m644q3ijA==", + "dependencies": { + "debug": "^4.3.4" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "playwright": "*", + "playwright-core": "*" + }, + "peerDependenciesMeta": { + "playwright": { + "optional": true + }, + "playwright-core": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin/-/puppeteer-extra-plugin-3.2.3.tgz", + "integrity": "sha512-6RNy0e6pH8vaS3akPIKGg28xcryKscczt4wIl0ePciZENGE2yoaQJNd17UiEbdmh5/6WW6dPcfRWT9lxBwCi2Q==", + "dependencies": { + "@types/debug": "^4.1.0", + "debug": "^4.1.1", + "merge-deep": "^3.0.1" + }, + "engines": { + "node": ">=9.11.2" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-stealth": { + "version": "2.11.2", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-stealth/-/puppeteer-extra-plugin-stealth-2.11.2.tgz", + "integrity": "sha512-bUemM5XmTj9i2ZerBzsk2AN5is0wHMNE6K0hXBzBXOzP5m5G3Wl0RHhiqKeHToe/uIH8AoZiGhc1tCkLZQPKTQ==", + "dependencies": { + "debug": "^4.1.1", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-preferences": "^2.4.1" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-user-data-dir": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-user-data-dir/-/puppeteer-extra-plugin-user-data-dir-2.4.1.tgz", + "integrity": "sha512-kH1GnCcqEDoBXO7epAse4TBPJh9tEpVEK/vkedKfjOVOhZAvLkHGc9swMs5ChrJbRnf8Hdpug6TJlEuimXNQ+g==", + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^10.0.0", + "puppeteer-extra-plugin": "^3.2.3", + "rimraf": "^3.0.2" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/puppeteer-extra-plugin-user-preferences": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/puppeteer-extra-plugin-user-preferences/-/puppeteer-extra-plugin-user-preferences-2.4.1.tgz", + "integrity": "sha512-i1oAZxRbc1bk8MZufKCruCEC3CCafO9RKMkkodZltI4OqibLFXF3tj6HZ4LZ9C5vCXZjYcDWazgtY69mnmrQ9A==", + "dependencies": { + "debug": "^4.1.1", + "deepmerge": "^4.2.2", + "puppeteer-extra-plugin": "^3.2.3", + "puppeteer-extra-plugin-user-data-dir": "^2.4.1" + }, + "engines": { + "node": ">=8" + }, + "peerDependencies": { + "playwright-extra": "*", + "puppeteer-extra": "*" + }, + "peerDependenciesMeta": { + "playwright-extra": { + "optional": true + }, + "puppeteer-extra": { + "optional": true + } + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shallow-clone": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-0.1.2.tgz", + "integrity": "sha512-J1zdXCky5GmNnuauESROVu31MQSnLoYvlyEn6j2Ztk6Q5EHFIhxkMhYcv6vuDzl2XEzoRr856QwzMgWM/TmZgw==", + "dependencies": { + "is-extendable": "^0.1.1", + "kind-of": "^2.0.1", + "lazy-cache": "^0.2.3", + "mixin-object": "^2.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/kind-of": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-2.0.1.tgz", + "integrity": "sha512-0u8i1NZ/mg0b+W3MGGw5I7+6Eib2nx72S/QvXa0hYjEkjTknYmEYQJwGu3mLC0BrhtJjtQafTkyRUQ75Kx0LVg==", + "dependencies": { + "is-buffer": "^1.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shallow-clone/node_modules/lazy-cache": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-0.2.7.tgz", + "integrity": "sha512-gkX52wvU/R8DVMMt78ATVPFMJqfW8FPz1GZ1sVHBVQHmu/WvhIWE4cE1GBzhJNFicDeYhnwp6Rl35BcAIM3YOQ==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/universalify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz", + "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==", + "engines": { + "node": ">= 10.0.0" + } + }, + "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==" } } } diff --git a/projects/org-skill-web-research/package.json b/projects/org-skill-web-research/package.json index 3799c46..d858564 100644 --- a/projects/org-skill-web-research/package.json +++ b/projects/org-skill-web-research/package.json @@ -14,6 +14,8 @@ "author": "", "license": "ISC", "dependencies": { - "playwright": "^1.58.2" + "playwright": "^1.58.2", + "playwright-extra": "^4.3.6", + "puppeteer-extra-plugin-stealth": "^2.11.2" } } diff --git a/projects/org-skill-web-research/src/gemini-auth.js b/projects/org-skill-web-research/src/gemini-auth.js new file mode 100644 index 0000000..80bec44 --- /dev/null +++ b/projects/org-skill-web-research/src/gemini-auth.js @@ -0,0 +1,23 @@ +const { chromium } = require('playwright-extra'); +const stealth = require('puppeteer-extra-plugin-stealth')(); +chromium.use(stealth); + +async function loginGemini() { + console.log("Opening browser for manual Google login..."); + console.log("Please log in, pass any captchas, wait for the Gemini chat interface to load, and then close the browser window."); + + const browser = await chromium.launchPersistentContext('/home/user/.local/share/org-agent/browser-profile', { + headless: false, + args: ['--disable-blink-features=AutomationControlled'] + }); + + const page = await browser.newPage(); + await page.goto('https://gemini.google.com/app'); + + // The script keeps running until the user manually closes the window +} + +loginGemini().catch(err => { + console.error(err); + process.exit(1); +}); diff --git a/projects/org-skill-web-research/src/gemini-web.js b/projects/org-skill-web-research/src/gemini-web.js index 8ccd590..61ad9d6 100644 --- a/projects/org-skill-web-research/src/gemini-web.js +++ b/projects/org-skill-web-research/src/gemini-web.js @@ -1,30 +1,44 @@ -const { chromium } = require('playwright'); +const { chromium } = require('playwright-extra'); +const stealth = require('puppeteer-extra-plugin-stealth')(); +chromium.use(stealth); async function askGemini(prompt, cookies) { const browser = await chromium.launch({ headless: true }); - const context = await browser.newContext(); + const context = await browser.newContext({ + userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36' + }); - // Set session cookies await context.addCookies(cookies.map(c => ({ name: c.name, value: c.value, - domain: '.google.com', - path: '/' + url: 'https://gemini.google.com' }))); const page = await context.newPage(); - await page.goto('https://gemini.google.com/app'); + try { + await page.goto('https://gemini.google.com/app', { waitUntil: 'networkidle', timeout: 60000 }); - // Wait for chat box and type prompt - await page.fill('div[role="textbox"]', prompt); - await page.keyboard.press('Enter'); + const inputSelector = 'div[role="textbox"], textarea[aria-label="Prompt"]'; + try { + await page.waitForSelector(inputSelector, { timeout: 15000 }); + } catch (e) { + const bodyText = await page.innerText('body'); + console.error(`VISIBLE TEXT ON PAGE: ${bodyText.substring(0, 500)}`); + throw new Error(`Selector not found. Current URL: ${page.url()}`); + } + + await page.fill(inputSelector, prompt); + await page.keyboard.press('Enter'); - // Wait for response to generate - await page.waitForSelector('message-content:last-child', { state: 'visible' }); - const response = await page.textContent('message-content:last-child'); - - await browser.close(); - console.log(response); + await page.waitForSelector('.model-response-text, message-content', { state: 'visible', timeout: 60000 }); + const response = await page.innerText('.model-response-text:last-child, message-content:last-child'); + process.stdout.write(response); + } catch (err) { + console.error(`ERROR: ${err.message}`); + process.exit(1); + } finally { + await browser.close(); + } } const args = process.argv.slice(2); @@ -32,6 +46,5 @@ const prompt = args[0]; const cookies = JSON.parse(args[1]); askGemini(prompt, cookies).catch(err => { - console.error(err); process.exit(1); }); diff --git a/projects/org-skill-web-research/src/research-logic.lisp b/projects/org-skill-web-research/src/research-logic.lisp index 543a5b5..f911626 100644 --- a/projects/org-skill-web-research/src/research-logic.lisp +++ b/projects/org-skill-web-research/src/research-logic.lisp @@ -1,8 +1,10 @@ (in-package :org-agent) (defun ask-gemini-web (prompt) - "Calls the Playwright bridge to interact with Gemini Web UI." - (let* ((cookie-str (uiop:getenv "GEMINI_COOKIES")) - (script-path (namestring (merge-pathnames "src/gemini-web.js" (asdf:system-source-directory :org-skill-web-research))))) - (unless cookie-str (return-from ask-gemini-web "(:type :LOG :payload (:text \"Gemini Cookies missing\"))")) - (uiop:run-program (list "node" script-path prompt cookie-str) :output :string))) + "Calls the Playwright stealth bridge to interact with Gemini Web UI via a persistent profile." + (let* ((script-path (namestring (merge-pathnames "src/gemini-web.js" (asdf:system-source-directory :org-skill-web-research))))) + (multiple-value-bind (output error-output exit-code) + (uiop:run-program (list "node" script-path prompt) :output :string :error-output :string :ignore-error-status t) + (if (= exit-code 0) + output + (format nil "(:type :LOG :payload (:text \"Node Error (~a): ~a\"))" exit-code error-output))))) diff --git a/system/#fleet-dashboard.org# b/system/#fleet-dashboard.org# new file mode 100644 index 0000000..0762ee7 --- /dev/null +++ b/system/#fleet-dashboard.org# @@ -0,0 +1,355 @@ +#+TITLE: LLM Fleet Dashboard +#+author: Sol (Agent) + +* Model Fleet + +| Provider | Model ID | Context | +|------------+---------------------------------------------------------------+---------| +| OpenRouter | google/gemma-4-26b-a4b-it | 262144 | +| OpenRouter | google/gemma-4-31b-it | 262144 | +| OpenRouter | qwen/qwen3.6-plus:free | 1000000 | +| OpenRouter | z-ai/glm-5v-turbo | 202752 | +| OpenRouter | arcee-ai/trinity-large-thinking | 262144 | +| OpenRouter | x-ai/grok-4.20-multi-agent | 2000000 | +| OpenRouter | x-ai/grok-4.20 | 2000000 | +| OpenRouter | google/lyria-3-pro-preview | 1048576 | +| OpenRouter | google/lyria-3-clip-preview | 1048576 | +| OpenRouter | kwaipilot/kat-coder-pro-v2 | 256000 | +| OpenRouter | rekaai/reka-edge | 16384 | +| OpenRouter | xiaomi/mimo-v2-omni | 262144 | +| OpenRouter | xiaomi/mimo-v2-pro | 1048576 | +| OpenRouter | minimax/minimax-m2.7 | 204800 | +| OpenRouter | openai/gpt-5.4-nano | 400000 | +| OpenRouter | openai/gpt-5.4-mini | 400000 | +| OpenRouter | mistralai/mistral-small-2603 | 262144 | +| OpenRouter | z-ai/glm-5-turbo | 202752 | +| OpenRouter | nvidia/nemotron-3-super-120b-a12b:free | 262144 | +| OpenRouter | nvidia/nemotron-3-super-120b-a12b | 262144 | +| OpenRouter | bytedance-seed/seed-2.0-lite | 262144 | +| OpenRouter | qwen/qwen3.5-9b | 256000 | +| OpenRouter | openai/gpt-5.4-pro | 1050000 | +| OpenRouter | openai/gpt-5.4 | 1050000 | +| OpenRouter | inception/mercury-2 | 128000 | +| OpenRouter | openai/gpt-5.3-chat | 128000 | +| OpenRouter | google/gemini-3.1-flash-lite-preview | 1048576 | +| OpenRouter | bytedance-seed/seed-2.0-mini | 262144 | +| OpenRouter | google/gemini-3.1-flash-image-preview | 65536 | +| OpenRouter | qwen/qwen3.5-35b-a3b | 262144 | +| OpenRouter | qwen/qwen3.5-27b | 262144 | +| OpenRouter | qwen/qwen3.5-122b-a10b | 262144 | +| OpenRouter | qwen/qwen3.5-flash-02-23 | 1000000 | +| OpenRouter | liquid/lfm-2-24b-a2b | 32768 | +| OpenRouter | google/gemini-3.1-pro-preview-customtools | 1048576 | +| OpenRouter | openai/gpt-5.3-codex | 400000 | +| OpenRouter | aion-labs/aion-2.0 | 131072 | +| OpenRouter | google/gemini-3.1-pro-preview | 1048576 | +| OpenRouter | anthropic/claude-sonnet-4.6 | 1000000 | +| OpenRouter | qwen/qwen3.5-plus-02-15 | 1000000 | +| OpenRouter | qwen/qwen3.5-397b-a17b | 262144 | +| OpenRouter | minimax/minimax-m2.5:free | 196608 | +| OpenRouter | minimax/minimax-m2.5 | 196608 | +| OpenRouter | z-ai/glm-5 | 80000 | +| OpenRouter | qwen/qwen3-max-thinking | 262144 | +| OpenRouter | anthropic/claude-opus-4.6 | 1000000 | +| OpenRouter | qwen/qwen3-coder-next | 262144 | +| OpenRouter | openrouter/free | 200000 | +| OpenRouter | stepfun/step-3.5-flash:free | 256000 | +| OpenRouter | stepfun/step-3.5-flash | 262144 | +| OpenRouter | arcee-ai/trinity-large-preview:free | 131000 | +| OpenRouter | moonshotai/kimi-k2.5 | 262144 | +| OpenRouter | upstage/solar-pro-3 | 128000 | +| OpenRouter | minimax/minimax-m2-her | 65536 | +| OpenRouter | writer/palmyra-x5 | 1040000 | +| OpenRouter | liquid/lfm-2.5-1.2b-thinking:free | 32768 | +| OpenRouter | liquid/lfm-2.5-1.2b-instruct:free | 32768 | +| OpenRouter | openai/gpt-audio | 128000 | +| OpenRouter | openai/gpt-audio-mini | 128000 | +| OpenRouter | z-ai/glm-4.7-flash | 202752 | +| OpenRouter | openai/gpt-5.2-codex | 400000 | +| OpenRouter | allenai/olmo-3.1-32b-instruct | 65536 | +| OpenRouter | bytedance-seed/seed-1.6-flash | 262144 | +| OpenRouter | bytedance-seed/seed-1.6 | 262144 | +| OpenRouter | minimax/minimax-m2.1 | 196608 | +| OpenRouter | z-ai/glm-4.7 | 202752 | +| OpenRouter | google/gemini-3-flash-preview | 1048576 | +| OpenRouter | mistralai/mistral-small-creative | 32768 | +| OpenRouter | xiaomi/mimo-v2-flash | 262144 | +| OpenRouter | nvidia/nemotron-3-nano-30b-a3b:free | 256000 | +| OpenRouter | nvidia/nemotron-3-nano-30b-a3b | 262144 | +| OpenRouter | openai/gpt-5.2-chat | 128000 | +| OpenRouter | openai/gpt-5.2-pro | 400000 | +| OpenRouter | openai/gpt-5.2 | 400000 | +| OpenRouter | mistralai/devstral-2512 | 262144 | +| OpenRouter | relace/relace-search | 256000 | +| OpenRouter | z-ai/glm-4.6v | 131072 | +| OpenRouter | nex-agi/deepseek-v3.1-nex-n1 | 131072 | +| OpenRouter | essentialai/rnj-1-instruct | 32768 | +| OpenRouter | openrouter/bodybuilder | 128000 | +| OpenRouter | openai/gpt-5.1-codex-max | 400000 | +| OpenRouter | amazon/nova-2-lite-v1 | 1000000 | +| OpenRouter | mistralai/ministral-14b-2512 | 262144 | +| OpenRouter | mistralai/ministral-8b-2512 | 262144 | +| OpenRouter | mistralai/ministral-3b-2512 | 131072 | +| OpenRouter | mistralai/mistral-large-2512 | 262144 | +| OpenRouter | arcee-ai/trinity-mini:free | 131072 | +| OpenRouter | arcee-ai/trinity-mini | 131072 | +| OpenRouter | deepseek/deepseek-v3.2-speciale | 163840 | +| OpenRouter | deepseek/deepseek-v3.2 | 163840 | +| OpenRouter | prime-intellect/intellect-3 | 131072 | +| OpenRouter | anthropic/claude-opus-4.5 | 200000 | +| OpenRouter | allenai/olmo-3-32b-think | 65536 | +| OpenRouter | google/gemini-3-pro-image-preview | 65536 | +| OpenRouter | x-ai/grok-4.1-fast | 2000000 | +| OpenRouter | deepcogito/cogito-v2.1-671b | 128000 | +| OpenRouter | openai/gpt-5.1 | 400000 | +| OpenRouter | openai/gpt-5.1-chat | 128000 | +| OpenRouter | openai/gpt-5.1-codex | 400000 | +| OpenRouter | openai/gpt-5.1-codex-mini | 400000 | +| OpenRouter | moonshotai/kimi-k2-thinking | 131072 | +| OpenRouter | amazon/nova-premier-v1 | 1000000 | +| OpenRouter | perplexity/sonar-pro-search | 200000 | +| OpenRouter | mistralai/voxtral-small-24b-2507 | 32000 | +| OpenRouter | openai/gpt-oss-safeguard-20b | 131072 | +| OpenRouter | nvidia/nemotron-nano-12b-v2-vl:free | 128000 | +| OpenRouter | nvidia/nemotron-nano-12b-v2-vl | 131072 | +| OpenRouter | minimax/minimax-m2 | 196608 | +| OpenRouter | qwen/qwen3-vl-32b-instruct | 131072 | +| OpenRouter | ibm-granite/granite-4.0-h-micro | 131000 | +| OpenRouter | openai/gpt-5-image-mini | 400000 | +| OpenRouter | anthropic/claude-haiku-4.5 | 200000 | +| OpenRouter | qwen/qwen3-vl-8b-thinking | 131072 | +| OpenRouter | qwen/qwen3-vl-8b-instruct | 131072 | +| OpenRouter | openai/gpt-5-image | 400000 | +| OpenRouter | openai/o3-deep-research | 200000 | +| OpenRouter | openai/o4-mini-deep-research | 200000 | +| OpenRouter | nvidia/llama-3.3-nemotron-super-49b-v1.5 | 131072 | +| OpenRouter | baidu/ernie-4.5-21b-a3b-thinking | 131072 | +| OpenRouter | google/gemini-2.5-flash-image | 32768 | +| OpenRouter | qwen/qwen3-vl-30b-a3b-thinking | 131072 | +| OpenRouter | qwen/qwen3-vl-30b-a3b-instruct | 131072 | +| OpenRouter | openai/gpt-5-pro | 400000 | +| OpenRouter | z-ai/glm-4.6 | 204800 | +| OpenRouter | anthropic/claude-sonnet-4.5 | 1000000 | +| OpenRouter | deepseek/deepseek-v3.2-exp | 163840 | +| OpenRouter | thedrummer/cydonia-24b-v4.1 | 131072 | +| OpenRouter | relace/relace-apply-3 | 256000 | +| OpenRouter | google/gemini-2.5-flash-lite-preview-09-2025 | 1048576 | +| OpenRouter | qwen/qwen3-vl-235b-a22b-thinking | 131072 | +| OpenRouter | qwen/qwen3-vl-235b-a22b-instruct | 262144 | +| OpenRouter | qwen/qwen3-max | 262144 | +| OpenRouter | qwen/qwen3-coder-plus | 1000000 | +| OpenRouter | openai/gpt-5-codex | 400000 | +| OpenRouter | deepseek/deepseek-v3.1-terminus | 163840 | +| OpenRouter | x-ai/grok-4-fast | 2000000 | +| OpenRouter | alibaba/tongyi-deepresearch-30b-a3b | 131072 | +| OpenRouter | qwen/qwen3-coder-flash | 1000000 | +| OpenRouter | qwen/qwen3-next-80b-a3b-thinking | 131072 | +| OpenRouter | qwen/qwen3-next-80b-a3b-instruct:free | 262144 | +| OpenRouter | qwen/qwen3-next-80b-a3b-instruct | 262144 | +| OpenRouter | meituan/longcat-flash-chat | 131072 | +| OpenRouter | qwen/qwen-plus-2025-07-28:thinking | 1000000 | +| OpenRouter | qwen/qwen-plus-2025-07-28 | 1000000 | +| OpenRouter | nvidia/nemotron-nano-9b-v2:free | 128000 | +| OpenRouter | nvidia/nemotron-nano-9b-v2 | 131072 | +| OpenRouter | moonshotai/kimi-k2-0905 | 131072 | +| OpenRouter | qwen/qwen3-30b-a3b-thinking-2507 | 131072 | +| OpenRouter | x-ai/grok-code-fast-1 | 256000 | +| OpenRouter | nousresearch/hermes-4-70b | 131072 | +| OpenRouter | nousresearch/hermes-4-405b | 131072 | +| OpenRouter | deepseek/deepseek-chat-v3.1 | 32768 | +| OpenRouter | openai/gpt-4o-audio-preview | 128000 | +| OpenRouter | mistralai/mistral-medium-3.1 | 131072 | +| OpenRouter | baidu/ernie-4.5-21b-a3b | 120000 | +| OpenRouter | baidu/ernie-4.5-vl-28b-a3b | 30000 | +| OpenRouter | z-ai/glm-4.5v | 65536 | +| OpenRouter | ai21/jamba-large-1.7 | 256000 | +| OpenRouter | openai/gpt-5-chat | 128000 | +| OpenRouter | openai/gpt-5 | 400000 | +| OpenRouter | openai/gpt-5-mini | 400000 | +| OpenRouter | openai/gpt-5-nano | 400000 | +| OpenRouter | openai/gpt-oss-120b:free | 131072 | +| OpenRouter | openai/gpt-oss-120b | 131072 | +| OpenRouter | openai/gpt-oss-20b:free | 131072 | +| OpenRouter | openai/gpt-oss-20b | 131072 | +| OpenRouter | anthropic/claude-opus-4.1 | 200000 | +| OpenRouter | mistralai/codestral-2508 | 256000 | +| OpenRouter | qwen/qwen3-coder-30b-a3b-instruct | 160000 | +| OpenRouter | qwen/qwen3-30b-a3b-instruct-2507 | 262144 | +| OpenRouter | z-ai/glm-4.5 | 131072 | +| OpenRouter | z-ai/glm-4.5-air:free | 131072 | +| OpenRouter | z-ai/glm-4.5-air | 131072 | +| OpenRouter | qwen/qwen3-235b-a22b-thinking-2507 | 131072 | +| OpenRouter | z-ai/glm-4-32b | 128000 | +| OpenRouter | qwen/qwen3-coder:free | 262000 | +| OpenRouter | qwen/qwen3-coder | 262144 | +| OpenRouter | bytedance/ui-tars-1.5-7b | 128000 | +| OpenRouter | google/gemini-2.5-flash-lite | 1048576 | +| OpenRouter | qwen/qwen3-235b-a22b-2507 | 262144 | +| OpenRouter | switchpoint/router | 131072 | +| OpenRouter | moonshotai/kimi-k2 | 131072 | +| OpenRouter | mistralai/devstral-medium | 131072 | +| OpenRouter | mistralai/devstral-small | 131072 | +| OpenRouter | cognitivecomputations/dolphin-mistral-24b-venice-edition:free | 32768 | +| OpenRouter | x-ai/grok-4 | 256000 | +| OpenRouter | google/gemma-3n-e2b-it:free | 8192 | +| OpenRouter | tencent/hunyuan-a13b-instruct | 131072 | +| OpenRouter | tngtech/deepseek-r1t2-chimera | 163840 | +| OpenRouter | morph/morph-v3-large | 262144 | +| OpenRouter | morph/morph-v3-fast | 81920 | +| OpenRouter | baidu/ernie-4.5-vl-424b-a47b | 123000 | +| OpenRouter | baidu/ernie-4.5-300b-a47b | 123000 | +| OpenRouter | inception/mercury | 128000 | +| OpenRouter | mistralai/mistral-small-3.2-24b-instruct | 128000 | +| OpenRouter | minimax/minimax-m1 | 1000000 | +| OpenRouter | google/gemini-2.5-flash | 1048576 | +| OpenRouter | google/gemini-2.5-pro | 1048576 | +| OpenRouter | openai/o3-pro | 200000 | +| OpenRouter | x-ai/grok-3-mini | 131072 | +| OpenRouter | x-ai/grok-3 | 131072 | +| OpenRouter | google/gemini-2.5-pro-preview | 1048576 | +| OpenRouter | deepseek/deepseek-r1-0528 | 163840 | +| OpenRouter | anthropic/claude-opus-4 | 200000 | +| OpenRouter | anthropic/claude-sonnet-4 | 200000 | +| OpenRouter | google/gemma-3n-e4b-it:free | 8192 | +| OpenRouter | google/gemma-3n-e4b-it | 32768 | +| OpenRouter | mistralai/mistral-medium-3 | 131072 | +| OpenRouter | google/gemini-2.5-pro-preview-05-06 | 1048576 | +| OpenRouter | arcee-ai/spotlight | 131072 | +| OpenRouter | arcee-ai/maestro-reasoning | 131072 | +| OpenRouter | arcee-ai/virtuoso-large | 131072 | +| OpenRouter | arcee-ai/coder-large | 32768 | +| OpenRouter | inception/mercury-coder | 128000 | +| OpenRouter | meta-llama/llama-guard-4-12b | 163840 | +| OpenRouter | qwen/qwen3-30b-a3b | 40960 | +| OpenRouter | qwen/qwen3-8b | 40960 | +| OpenRouter | qwen/qwen3-14b | 40960 | +| OpenRouter | qwen/qwen3-32b | 40960 | +| OpenRouter | qwen/qwen3-235b-a22b | 131072 | +| OpenRouter | openai/o4-mini-high | 200000 | +| OpenRouter | openai/o3 | 200000 | +| OpenRouter | openai/o4-mini | 200000 | +| OpenRouter | qwen/qwen2.5-coder-7b-instruct | 32768 | +| OpenRouter | openai/gpt-4.1 | 1047576 | +| OpenRouter | openai/gpt-4.1-mini | 1047576 | +| OpenRouter | openai/gpt-4.1-nano | 1047576 | +| OpenRouter | eleutherai/llemma_7b | 4096 | +| OpenRouter | alfredpros/codellama-7b-instruct-solidity | 4096 | +| OpenRouter | x-ai/grok-3-mini-beta | 131072 | +| OpenRouter | x-ai/grok-3-beta | 131072 | +| OpenRouter | nvidia/llama-3.1-nemotron-ultra-253b-v1 | 131072 | +| OpenRouter | meta-llama/llama-4-maverick | 1048576 | +| OpenRouter | meta-llama/llama-4-scout | 327680 | +| OpenRouter | qwen/qwen2.5-vl-32b-instruct | 128000 | +| OpenRouter | deepseek/deepseek-chat-v3-0324 | 163840 | +| OpenRouter | openai/o1-pro | 200000 | +| OpenRouter | mistralai/mistral-small-3.1-24b-instruct | 131072 | +| OpenRouter | allenai/olmo-2-0325-32b-instruct | 128000 | +| OpenRouter | google/gemma-3-4b-it:free | 32768 | +| OpenRouter | google/gemma-3-4b-it | 131072 | +| OpenRouter | google/gemma-3-12b-it:free | 32768 | +| OpenRouter | google/gemma-3-12b-it | 131072 | +| OpenRouter | cohere/command-a | 256000 | +| OpenRouter | openai/gpt-4o-mini-search-preview | 128000 | +| OpenRouter | openai/gpt-4o-search-preview | 128000 | +| OpenRouter | rekaai/reka-flash-3 | 65536 | +| OpenRouter | google/gemma-3-27b-it:free | 131072 | +| OpenRouter | google/gemma-3-27b-it | 131072 | +| OpenRouter | thedrummer/skyfall-36b-v2 | 32768 | +| OpenRouter | perplexity/sonar-reasoning-pro | 128000 | +| OpenRouter | perplexity/sonar-pro | 200000 | +| OpenRouter | perplexity/sonar-deep-research | 128000 | +| OpenRouter | qwen/qwq-32b | 131072 | +| OpenRouter | google/gemini-2.0-flash-lite-001 | 1048576 | +| OpenRouter | anthropic/claude-3.7-sonnet | 200000 | +| OpenRouter | anthropic/claude-3.7-sonnet:thinking | 200000 | +| OpenRouter | mistralai/mistral-saba | 32768 | +| OpenRouter | meta-llama/llama-guard-3-8b | 131072 | +| OpenRouter | openai/o3-mini-high | 200000 | +| OpenRouter | google/gemini-2.0-flash-001 | 1048576 | +| OpenRouter | qwen/qwen-vl-plus | 131072 | +| OpenRouter | aion-labs/aion-1.0 | 131072 | +| OpenRouter | aion-labs/aion-1.0-mini | 131072 | +| OpenRouter | aion-labs/aion-rp-llama-3.1-8b | 32768 | +| OpenRouter | qwen/qwen-vl-max | 131072 | +| OpenRouter | qwen/qwen-turbo | 131072 | +| OpenRouter | qwen/qwen2.5-vl-72b-instruct | 32768 | +| OpenRouter | qwen/qwen-plus | 1000000 | +| OpenRouter | qwen/qwen-max | 32768 | +| OpenRouter | openai/o3-mini | 200000 | +| OpenRouter | mistralai/mistral-small-24b-instruct-2501 | 32768 | +| OpenRouter | deepseek/deepseek-r1-distill-qwen-32b | 32768 | +| OpenRouter | perplexity/sonar | 127072 | +| OpenRouter | deepseek/deepseek-r1-distill-llama-70b | 131072 | +| OpenRouter | deepseek/deepseek-r1 | 64000 | +| OpenRouter | minimax/minimax-01 | 1000192 | +| OpenRouter | microsoft/phi-4 | 16384 | +| OpenRouter | sao10k/l3.1-70b-hanami-x1 | 16000 | +| OpenRouter | deepseek/deepseek-chat | 163840 | +| OpenRouter | sao10k/l3.3-euryale-70b | 131072 | +| OpenRouter | openai/o1 | 200000 | +| OpenRouter | cohere/command-r7b-12-2024 | 128000 | +| OpenRouter | meta-llama/llama-3.3-70b-instruct:free | 65536 | +| OpenRouter | meta-llama/llama-3.3-70b-instruct | 131072 | +| OpenRouter | amazon/nova-lite-v1 | 300000 | +| OpenRouter | amazon/nova-micro-v1 | 128000 | +| OpenRouter | amazon/nova-pro-v1 | 300000 | +| OpenRouter | openai/gpt-4o-2024-11-20 | 128000 | +| OpenRouter | mistralai/mistral-large-2411 | 131072 | +| OpenRouter | mistralai/mistral-large-2407 | 131072 | +| OpenRouter | mistralai/pixtral-large-2411 | 131072 | +| OpenRouter | qwen/qwen-2.5-coder-32b-instruct | 32768 | +| OpenRouter | thedrummer/unslopnemo-12b | 32768 | +| OpenRouter | anthropic/claude-3.5-haiku | 200000 | +| OpenRouter | anthracite-org/magnum-v4-72b | 16384 | +| OpenRouter | qwen/qwen-2.5-7b-instruct | 32768 | +| OpenRouter | nvidia/llama-3.1-nemotron-70b-instruct | 131072 | +| OpenRouter | inflection/inflection-3-pi | 8000 | +| OpenRouter | inflection/inflection-3-productivity | 8000 | +| OpenRouter | thedrummer/rocinante-12b | 32768 | +| OpenRouter | meta-llama/llama-3.2-3b-instruct:free | 131072 | +| OpenRouter | meta-llama/llama-3.2-3b-instruct | 80000 | +| OpenRouter | meta-llama/llama-3.2-1b-instruct | 60000 | +| OpenRouter | meta-llama/llama-3.2-11b-vision-instruct | 131072 | +| OpenRouter | qwen/qwen-2.5-72b-instruct | 32768 | +| OpenRouter | cohere/command-r-08-2024 | 128000 | +| OpenRouter | cohere/command-r-plus-08-2024 | 128000 | +| OpenRouter | sao10k/l3.1-euryale-70b | 131072 | +| OpenRouter | nousresearch/hermes-3-llama-3.1-70b | 131072 | +| OpenRouter | nousresearch/hermes-3-llama-3.1-405b:free | 131072 | +| OpenRouter | nousresearch/hermes-3-llama-3.1-405b | 131072 | +| OpenRouter | sao10k/l3-lunaris-8b | 8192 | +| OpenRouter | openai/gpt-4o-2024-08-06 | 128000 | +| OpenRouter | meta-llama/llama-3.1-8b-instruct | 16384 | +| OpenRouter | meta-llama/llama-3.1-70b-instruct | 131072 | +| OpenRouter | mistralai/mistral-nemo | 131072 | +| OpenRouter | openai/gpt-4o-mini-2024-07-18 | 128000 | +| OpenRouter | openai/gpt-4o-mini | 128000 | +| OpenRouter | google/gemma-2-27b-it | 8192 | +| OpenRouter | google/gemma-2-9b-it | 8192 | +| OpenRouter | sao10k/l3-euryale-70b | 8192 | +| OpenRouter | nousresearch/hermes-2-pro-llama-3-8b | 8192 | +| OpenRouter | openai/gpt-4o | 128000 | +| OpenRouter | openai/gpt-4o:extended | 128000 | +| OpenRouter | openai/gpt-4o-2024-05-13 | 128000 | +| OpenRouter | meta-llama/llama-3-8b-instruct | 8192 | +| OpenRouter | meta-llama/llama-3-70b-instruct | 8192 | +| OpenRouter | mistralai/mixtral-8x22b-instruct | 65536 | +| OpenRouter | microsoft/wizardlm-2-8x22b | 65535 | +| OpenRouter | openai/gpt-4-turbo | 128000 | +| OpenRouter | anthropic/claude-3-haiku | 200000 | +| OpenRouter | mistralai/mistral-large | 128000 | +| OpenRouter | openai/gpt-3.5-turbo-0613 | 4095 | +| OpenRouter | openai/gpt-4-turbo-preview | 128000 | +| OpenRouter | mistralai/mixtral-8x7b-instruct | 32768 | +| OpenRouter | alpindale/goliath-120b | 6144 | +| OpenRouter | openrouter/auto | 2000000 | +| OpenRouter | openai/gpt-4-1106-preview | 128000 | +| OpenRouter | mistralai/mistral-7b-instruct-v0.1 | 2824 | +| OpenRouter | openai/gpt-3.5-turbo-instruct | 4095 | +| OpenRouter | openai/gpt-3.5-turbo-16k | 16385 | +| OpenRouter | mancer/weaver | 8000 | +| OpenRouter | undi95/remm-slerp-l2-13b | 6144 | +| OpenRouter | gryphe/mythomax-l2-13b | 4096 | +| OpenRouter | openai/gpt-4-0314 | 8191 | +| OpenRouter | openai/gpt-3.5-turbo | 16385 | +| OpenRouter | openai/gpt-4 | 8191 | diff --git a/system/.#fleet-dashboard.org b/system/.#fleet-dashboard.org new file mode 120000 index 0000000..da010b7 --- /dev/null +++ b/system/.#fleet-dashboard.org @@ -0,0 +1 @@ +user@amr.3392:1775060113 \ No newline at end of file diff --git a/system/debug-screenshot.png b/system/debug-screenshot.png new file mode 100644 index 0000000..8d1880f Binary files /dev/null and b/system/debug-screenshot.png differ diff --git a/system/fleet-dashboard.org b/system/fleet-dashboard.org index 5d1b3a9..10262a2 100644 --- a/system/fleet-dashboard.org +++ b/system/fleet-dashboard.org @@ -1,355 +1,359 @@ #+TITLE: LLM Fleet Dashboard #+author: Sol (Agent) +* Instructions +1. Use [X] to select models for your fleet. +2. Save the file to update the kernel. + * Model Fleet -| Provider | Model ID | Context | -|----------+----------+---------| -| OpenRouter | google/gemma-4-26b-a4b-it | 262144 | -| OpenRouter | google/gemma-4-31b-it | 262144 | -| OpenRouter | qwen/qwen3.6-plus:free | 1000000 | -| OpenRouter | z-ai/glm-5v-turbo | 202752 | -| OpenRouter | arcee-ai/trinity-large-thinking | 262144 | -| OpenRouter | x-ai/grok-4.20-multi-agent | 2000000 | -| OpenRouter | x-ai/grok-4.20 | 2000000 | -| OpenRouter | google/lyria-3-pro-preview | 1048576 | -| OpenRouter | google/lyria-3-clip-preview | 1048576 | -| OpenRouter | kwaipilot/kat-coder-pro-v2 | 256000 | -| OpenRouter | rekaai/reka-edge | 16384 | -| OpenRouter | xiaomi/mimo-v2-omni | 262144 | -| OpenRouter | xiaomi/mimo-v2-pro | 1048576 | -| OpenRouter | minimax/minimax-m2.7 | 204800 | -| OpenRouter | openai/gpt-5.4-nano | 400000 | -| OpenRouter | openai/gpt-5.4-mini | 400000 | -| OpenRouter | mistralai/mistral-small-2603 | 262144 | -| OpenRouter | z-ai/glm-5-turbo | 202752 | -| OpenRouter | nvidia/nemotron-3-super-120b-a12b:free | 262144 | -| OpenRouter | nvidia/nemotron-3-super-120b-a12b | 262144 | -| OpenRouter | bytedance-seed/seed-2.0-lite | 262144 | -| OpenRouter | qwen/qwen3.5-9b | 256000 | -| OpenRouter | openai/gpt-5.4-pro | 1050000 | -| OpenRouter | openai/gpt-5.4 | 1050000 | -| OpenRouter | inception/mercury-2 | 128000 | -| OpenRouter | openai/gpt-5.3-chat | 128000 | -| OpenRouter | google/gemini-3.1-flash-lite-preview | 1048576 | -| OpenRouter | bytedance-seed/seed-2.0-mini | 262144 | -| OpenRouter | google/gemini-3.1-flash-image-preview | 65536 | -| OpenRouter | qwen/qwen3.5-35b-a3b | 262144 | -| OpenRouter | qwen/qwen3.5-27b | 262144 | -| OpenRouter | qwen/qwen3.5-122b-a10b | 262144 | -| OpenRouter | qwen/qwen3.5-flash-02-23 | 1000000 | -| OpenRouter | liquid/lfm-2-24b-a2b | 32768 | -| OpenRouter | google/gemini-3.1-pro-preview-customtools | 1048576 | -| OpenRouter | openai/gpt-5.3-codex | 400000 | -| OpenRouter | aion-labs/aion-2.0 | 131072 | -| OpenRouter | google/gemini-3.1-pro-preview | 1048576 | -| OpenRouter | anthropic/claude-sonnet-4.6 | 1000000 | -| OpenRouter | qwen/qwen3.5-plus-02-15 | 1000000 | -| OpenRouter | qwen/qwen3.5-397b-a17b | 262144 | -| OpenRouter | minimax/minimax-m2.5:free | 196608 | -| OpenRouter | minimax/minimax-m2.5 | 196608 | -| OpenRouter | z-ai/glm-5 | 80000 | -| OpenRouter | qwen/qwen3-max-thinking | 262144 | -| OpenRouter | anthropic/claude-opus-4.6 | 1000000 | -| OpenRouter | qwen/qwen3-coder-next | 262144 | -| OpenRouter | openrouter/free | 200000 | -| OpenRouter | stepfun/step-3.5-flash:free | 256000 | -| OpenRouter | stepfun/step-3.5-flash | 262144 | -| OpenRouter | arcee-ai/trinity-large-preview:free | 131000 | -| OpenRouter | moonshotai/kimi-k2.5 | 262144 | -| OpenRouter | upstage/solar-pro-3 | 128000 | -| OpenRouter | minimax/minimax-m2-her | 65536 | -| OpenRouter | writer/palmyra-x5 | 1040000 | -| OpenRouter | liquid/lfm-2.5-1.2b-thinking:free | 32768 | -| OpenRouter | liquid/lfm-2.5-1.2b-instruct:free | 32768 | -| OpenRouter | openai/gpt-audio | 128000 | -| OpenRouter | openai/gpt-audio-mini | 128000 | -| OpenRouter | z-ai/glm-4.7-flash | 202752 | -| OpenRouter | openai/gpt-5.2-codex | 400000 | -| OpenRouter | allenai/olmo-3.1-32b-instruct | 65536 | -| OpenRouter | bytedance-seed/seed-1.6-flash | 262144 | -| OpenRouter | bytedance-seed/seed-1.6 | 262144 | -| OpenRouter | minimax/minimax-m2.1 | 196608 | -| OpenRouter | z-ai/glm-4.7 | 202752 | -| OpenRouter | google/gemini-3-flash-preview | 1048576 | -| OpenRouter | mistralai/mistral-small-creative | 32768 | -| OpenRouter | xiaomi/mimo-v2-flash | 262144 | -| OpenRouter | nvidia/nemotron-3-nano-30b-a3b:free | 256000 | -| OpenRouter | nvidia/nemotron-3-nano-30b-a3b | 262144 | -| OpenRouter | openai/gpt-5.2-chat | 128000 | -| OpenRouter | openai/gpt-5.2-pro | 400000 | -| OpenRouter | openai/gpt-5.2 | 400000 | -| OpenRouter | mistralai/devstral-2512 | 262144 | -| OpenRouter | relace/relace-search | 256000 | -| OpenRouter | z-ai/glm-4.6v | 131072 | -| OpenRouter | nex-agi/deepseek-v3.1-nex-n1 | 131072 | -| OpenRouter | essentialai/rnj-1-instruct | 32768 | -| OpenRouter | openrouter/bodybuilder | 128000 | -| OpenRouter | openai/gpt-5.1-codex-max | 400000 | -| OpenRouter | amazon/nova-2-lite-v1 | 1000000 | -| OpenRouter | mistralai/ministral-14b-2512 | 262144 | -| OpenRouter | mistralai/ministral-8b-2512 | 262144 | -| OpenRouter | mistralai/ministral-3b-2512 | 131072 | -| OpenRouter | mistralai/mistral-large-2512 | 262144 | -| OpenRouter | arcee-ai/trinity-mini:free | 131072 | -| OpenRouter | arcee-ai/trinity-mini | 131072 | -| OpenRouter | deepseek/deepseek-v3.2-speciale | 163840 | -| OpenRouter | deepseek/deepseek-v3.2 | 163840 | -| OpenRouter | prime-intellect/intellect-3 | 131072 | -| OpenRouter | anthropic/claude-opus-4.5 | 200000 | -| OpenRouter | allenai/olmo-3-32b-think | 65536 | -| OpenRouter | google/gemini-3-pro-image-preview | 65536 | -| OpenRouter | x-ai/grok-4.1-fast | 2000000 | -| OpenRouter | deepcogito/cogito-v2.1-671b | 128000 | -| OpenRouter | openai/gpt-5.1 | 400000 | -| OpenRouter | openai/gpt-5.1-chat | 128000 | -| OpenRouter | openai/gpt-5.1-codex | 400000 | -| OpenRouter | openai/gpt-5.1-codex-mini | 400000 | -| OpenRouter | moonshotai/kimi-k2-thinking | 131072 | -| OpenRouter | amazon/nova-premier-v1 | 1000000 | -| OpenRouter | perplexity/sonar-pro-search | 200000 | -| OpenRouter | mistralai/voxtral-small-24b-2507 | 32000 | -| OpenRouter | openai/gpt-oss-safeguard-20b | 131072 | -| OpenRouter | nvidia/nemotron-nano-12b-v2-vl:free | 128000 | -| OpenRouter | nvidia/nemotron-nano-12b-v2-vl | 131072 | -| OpenRouter | minimax/minimax-m2 | 196608 | -| OpenRouter | qwen/qwen3-vl-32b-instruct | 131072 | -| OpenRouter | ibm-granite/granite-4.0-h-micro | 131000 | -| OpenRouter | openai/gpt-5-image-mini | 400000 | -| OpenRouter | anthropic/claude-haiku-4.5 | 200000 | -| OpenRouter | qwen/qwen3-vl-8b-thinking | 131072 | -| OpenRouter | qwen/qwen3-vl-8b-instruct | 131072 | -| OpenRouter | openai/gpt-5-image | 400000 | -| OpenRouter | openai/o3-deep-research | 200000 | -| OpenRouter | openai/o4-mini-deep-research | 200000 | -| OpenRouter | nvidia/llama-3.3-nemotron-super-49b-v1.5 | 131072 | -| OpenRouter | baidu/ernie-4.5-21b-a3b-thinking | 131072 | -| OpenRouter | google/gemini-2.5-flash-image | 32768 | -| OpenRouter | qwen/qwen3-vl-30b-a3b-thinking | 131072 | -| OpenRouter | qwen/qwen3-vl-30b-a3b-instruct | 131072 | -| OpenRouter | openai/gpt-5-pro | 400000 | -| OpenRouter | z-ai/glm-4.6 | 204800 | -| OpenRouter | anthropic/claude-sonnet-4.5 | 1000000 | -| OpenRouter | deepseek/deepseek-v3.2-exp | 163840 | -| OpenRouter | thedrummer/cydonia-24b-v4.1 | 131072 | -| OpenRouter | relace/relace-apply-3 | 256000 | -| OpenRouter | google/gemini-2.5-flash-lite-preview-09-2025 | 1048576 | -| OpenRouter | qwen/qwen3-vl-235b-a22b-thinking | 131072 | -| OpenRouter | qwen/qwen3-vl-235b-a22b-instruct | 262144 | -| OpenRouter | qwen/qwen3-max | 262144 | -| OpenRouter | qwen/qwen3-coder-plus | 1000000 | -| OpenRouter | openai/gpt-5-codex | 400000 | -| OpenRouter | deepseek/deepseek-v3.1-terminus | 163840 | -| OpenRouter | x-ai/grok-4-fast | 2000000 | -| OpenRouter | alibaba/tongyi-deepresearch-30b-a3b | 131072 | -| OpenRouter | qwen/qwen3-coder-flash | 1000000 | -| OpenRouter | qwen/qwen3-next-80b-a3b-thinking | 131072 | -| OpenRouter | qwen/qwen3-next-80b-a3b-instruct:free | 262144 | -| OpenRouter | qwen/qwen3-next-80b-a3b-instruct | 262144 | -| OpenRouter | meituan/longcat-flash-chat | 131072 | -| OpenRouter | qwen/qwen-plus-2025-07-28:thinking | 1000000 | -| OpenRouter | qwen/qwen-plus-2025-07-28 | 1000000 | -| OpenRouter | nvidia/nemotron-nano-9b-v2:free | 128000 | -| OpenRouter | nvidia/nemotron-nano-9b-v2 | 131072 | -| OpenRouter | moonshotai/kimi-k2-0905 | 131072 | -| OpenRouter | qwen/qwen3-30b-a3b-thinking-2507 | 131072 | -| OpenRouter | x-ai/grok-code-fast-1 | 256000 | -| OpenRouter | nousresearch/hermes-4-70b | 131072 | -| OpenRouter | nousresearch/hermes-4-405b | 131072 | -| OpenRouter | deepseek/deepseek-chat-v3.1 | 32768 | -| OpenRouter | openai/gpt-4o-audio-preview | 128000 | -| OpenRouter | mistralai/mistral-medium-3.1 | 131072 | -| OpenRouter | baidu/ernie-4.5-21b-a3b | 120000 | -| OpenRouter | baidu/ernie-4.5-vl-28b-a3b | 30000 | -| OpenRouter | z-ai/glm-4.5v | 65536 | -| OpenRouter | ai21/jamba-large-1.7 | 256000 | -| OpenRouter | openai/gpt-5-chat | 128000 | -| OpenRouter | openai/gpt-5 | 400000 | -| OpenRouter | openai/gpt-5-mini | 400000 | -| OpenRouter | openai/gpt-5-nano | 400000 | -| OpenRouter | openai/gpt-oss-120b:free | 131072 | -| OpenRouter | openai/gpt-oss-120b | 131072 | -| OpenRouter | openai/gpt-oss-20b:free | 131072 | -| OpenRouter | openai/gpt-oss-20b | 131072 | -| OpenRouter | anthropic/claude-opus-4.1 | 200000 | -| OpenRouter | mistralai/codestral-2508 | 256000 | -| OpenRouter | qwen/qwen3-coder-30b-a3b-instruct | 160000 | -| OpenRouter | qwen/qwen3-30b-a3b-instruct-2507 | 262144 | -| OpenRouter | z-ai/glm-4.5 | 131072 | -| OpenRouter | z-ai/glm-4.5-air:free | 131072 | -| OpenRouter | z-ai/glm-4.5-air | 131072 | -| OpenRouter | qwen/qwen3-235b-a22b-thinking-2507 | 131072 | -| OpenRouter | z-ai/glm-4-32b | 128000 | -| OpenRouter | qwen/qwen3-coder:free | 262000 | -| OpenRouter | qwen/qwen3-coder | 262144 | -| OpenRouter | bytedance/ui-tars-1.5-7b | 128000 | -| OpenRouter | google/gemini-2.5-flash-lite | 1048576 | -| OpenRouter | qwen/qwen3-235b-a22b-2507 | 262144 | -| OpenRouter | switchpoint/router | 131072 | -| OpenRouter | moonshotai/kimi-k2 | 131072 | -| OpenRouter | mistralai/devstral-medium | 131072 | -| OpenRouter | mistralai/devstral-small | 131072 | -| OpenRouter | cognitivecomputations/dolphin-mistral-24b-venice-edition:free | 32768 | -| OpenRouter | x-ai/grok-4 | 256000 | -| OpenRouter | google/gemma-3n-e2b-it:free | 8192 | -| OpenRouter | tencent/hunyuan-a13b-instruct | 131072 | -| OpenRouter | tngtech/deepseek-r1t2-chimera | 163840 | -| OpenRouter | morph/morph-v3-large | 262144 | -| OpenRouter | morph/morph-v3-fast | 81920 | -| OpenRouter | baidu/ernie-4.5-vl-424b-a47b | 123000 | -| OpenRouter | baidu/ernie-4.5-300b-a47b | 123000 | -| OpenRouter | inception/mercury | 128000 | -| OpenRouter | mistralai/mistral-small-3.2-24b-instruct | 128000 | -| OpenRouter | minimax/minimax-m1 | 1000000 | -| OpenRouter | google/gemini-2.5-flash | 1048576 | -| OpenRouter | google/gemini-2.5-pro | 1048576 | -| OpenRouter | openai/o3-pro | 200000 | -| OpenRouter | x-ai/grok-3-mini | 131072 | -| OpenRouter | x-ai/grok-3 | 131072 | -| OpenRouter | google/gemini-2.5-pro-preview | 1048576 | -| OpenRouter | deepseek/deepseek-r1-0528 | 163840 | -| OpenRouter | anthropic/claude-opus-4 | 200000 | -| OpenRouter | anthropic/claude-sonnet-4 | 200000 | -| OpenRouter | google/gemma-3n-e4b-it:free | 8192 | -| OpenRouter | google/gemma-3n-e4b-it | 32768 | -| OpenRouter | mistralai/mistral-medium-3 | 131072 | -| OpenRouter | google/gemini-2.5-pro-preview-05-06 | 1048576 | -| OpenRouter | arcee-ai/spotlight | 131072 | -| OpenRouter | arcee-ai/maestro-reasoning | 131072 | -| OpenRouter | arcee-ai/virtuoso-large | 131072 | -| OpenRouter | arcee-ai/coder-large | 32768 | -| OpenRouter | inception/mercury-coder | 128000 | -| OpenRouter | meta-llama/llama-guard-4-12b | 163840 | -| OpenRouter | qwen/qwen3-30b-a3b | 40960 | -| OpenRouter | qwen/qwen3-8b | 40960 | -| OpenRouter | qwen/qwen3-14b | 40960 | -| OpenRouter | qwen/qwen3-32b | 40960 | -| OpenRouter | qwen/qwen3-235b-a22b | 131072 | -| OpenRouter | openai/o4-mini-high | 200000 | -| OpenRouter | openai/o3 | 200000 | -| OpenRouter | openai/o4-mini | 200000 | -| OpenRouter | qwen/qwen2.5-coder-7b-instruct | 32768 | -| OpenRouter | openai/gpt-4.1 | 1047576 | -| OpenRouter | openai/gpt-4.1-mini | 1047576 | -| OpenRouter | openai/gpt-4.1-nano | 1047576 | -| OpenRouter | eleutherai/llemma_7b | 4096 | -| OpenRouter | alfredpros/codellama-7b-instruct-solidity | 4096 | -| OpenRouter | x-ai/grok-3-mini-beta | 131072 | -| OpenRouter | x-ai/grok-3-beta | 131072 | -| OpenRouter | nvidia/llama-3.1-nemotron-ultra-253b-v1 | 131072 | -| OpenRouter | meta-llama/llama-4-maverick | 1048576 | -| OpenRouter | meta-llama/llama-4-scout | 327680 | -| OpenRouter | qwen/qwen2.5-vl-32b-instruct | 128000 | -| OpenRouter | deepseek/deepseek-chat-v3-0324 | 163840 | -| OpenRouter | openai/o1-pro | 200000 | -| OpenRouter | mistralai/mistral-small-3.1-24b-instruct | 131072 | -| OpenRouter | allenai/olmo-2-0325-32b-instruct | 128000 | -| OpenRouter | google/gemma-3-4b-it:free | 32768 | -| OpenRouter | google/gemma-3-4b-it | 131072 | -| OpenRouter | google/gemma-3-12b-it:free | 32768 | -| OpenRouter | google/gemma-3-12b-it | 131072 | -| OpenRouter | cohere/command-a | 256000 | -| OpenRouter | openai/gpt-4o-mini-search-preview | 128000 | -| OpenRouter | openai/gpt-4o-search-preview | 128000 | -| OpenRouter | rekaai/reka-flash-3 | 65536 | -| OpenRouter | google/gemma-3-27b-it:free | 131072 | -| OpenRouter | google/gemma-3-27b-it | 131072 | -| OpenRouter | thedrummer/skyfall-36b-v2 | 32768 | -| OpenRouter | perplexity/sonar-reasoning-pro | 128000 | -| OpenRouter | perplexity/sonar-pro | 200000 | -| OpenRouter | perplexity/sonar-deep-research | 128000 | -| OpenRouter | qwen/qwq-32b | 131072 | -| OpenRouter | google/gemini-2.0-flash-lite-001 | 1048576 | -| OpenRouter | anthropic/claude-3.7-sonnet | 200000 | -| OpenRouter | anthropic/claude-3.7-sonnet:thinking | 200000 | -| OpenRouter | mistralai/mistral-saba | 32768 | -| OpenRouter | meta-llama/llama-guard-3-8b | 131072 | -| OpenRouter | openai/o3-mini-high | 200000 | -| OpenRouter | google/gemini-2.0-flash-001 | 1048576 | -| OpenRouter | qwen/qwen-vl-plus | 131072 | -| OpenRouter | aion-labs/aion-1.0 | 131072 | -| OpenRouter | aion-labs/aion-1.0-mini | 131072 | -| OpenRouter | aion-labs/aion-rp-llama-3.1-8b | 32768 | -| OpenRouter | qwen/qwen-vl-max | 131072 | -| OpenRouter | qwen/qwen-turbo | 131072 | -| OpenRouter | qwen/qwen2.5-vl-72b-instruct | 32768 | -| OpenRouter | qwen/qwen-plus | 1000000 | -| OpenRouter | qwen/qwen-max | 32768 | -| OpenRouter | openai/o3-mini | 200000 | -| OpenRouter | mistralai/mistral-small-24b-instruct-2501 | 32768 | -| OpenRouter | deepseek/deepseek-r1-distill-qwen-32b | 32768 | -| OpenRouter | perplexity/sonar | 127072 | -| OpenRouter | deepseek/deepseek-r1-distill-llama-70b | 131072 | -| OpenRouter | deepseek/deepseek-r1 | 64000 | -| OpenRouter | minimax/minimax-01 | 1000192 | -| OpenRouter | microsoft/phi-4 | 16384 | -| OpenRouter | sao10k/l3.1-70b-hanami-x1 | 16000 | -| OpenRouter | deepseek/deepseek-chat | 163840 | -| OpenRouter | sao10k/l3.3-euryale-70b | 131072 | -| OpenRouter | openai/o1 | 200000 | -| OpenRouter | cohere/command-r7b-12-2024 | 128000 | -| OpenRouter | meta-llama/llama-3.3-70b-instruct:free | 65536 | -| OpenRouter | meta-llama/llama-3.3-70b-instruct | 131072 | -| OpenRouter | amazon/nova-lite-v1 | 300000 | -| OpenRouter | amazon/nova-micro-v1 | 128000 | -| OpenRouter | amazon/nova-pro-v1 | 300000 | -| OpenRouter | openai/gpt-4o-2024-11-20 | 128000 | -| OpenRouter | mistralai/mistral-large-2411 | 131072 | -| OpenRouter | mistralai/mistral-large-2407 | 131072 | -| OpenRouter | mistralai/pixtral-large-2411 | 131072 | -| OpenRouter | qwen/qwen-2.5-coder-32b-instruct | 32768 | -| OpenRouter | thedrummer/unslopnemo-12b | 32768 | -| OpenRouter | anthropic/claude-3.5-haiku | 200000 | -| OpenRouter | anthracite-org/magnum-v4-72b | 16384 | -| OpenRouter | qwen/qwen-2.5-7b-instruct | 32768 | -| OpenRouter | nvidia/llama-3.1-nemotron-70b-instruct | 131072 | -| OpenRouter | inflection/inflection-3-pi | 8000 | -| OpenRouter | inflection/inflection-3-productivity | 8000 | -| OpenRouter | thedrummer/rocinante-12b | 32768 | -| OpenRouter | meta-llama/llama-3.2-3b-instruct:free | 131072 | -| OpenRouter | meta-llama/llama-3.2-3b-instruct | 80000 | -| OpenRouter | meta-llama/llama-3.2-1b-instruct | 60000 | -| OpenRouter | meta-llama/llama-3.2-11b-vision-instruct | 131072 | -| OpenRouter | qwen/qwen-2.5-72b-instruct | 32768 | -| OpenRouter | cohere/command-r-08-2024 | 128000 | -| OpenRouter | cohere/command-r-plus-08-2024 | 128000 | -| OpenRouter | sao10k/l3.1-euryale-70b | 131072 | -| OpenRouter | nousresearch/hermes-3-llama-3.1-70b | 131072 | -| OpenRouter | nousresearch/hermes-3-llama-3.1-405b:free | 131072 | -| OpenRouter | nousresearch/hermes-3-llama-3.1-405b | 131072 | -| OpenRouter | sao10k/l3-lunaris-8b | 8192 | -| OpenRouter | openai/gpt-4o-2024-08-06 | 128000 | -| OpenRouter | meta-llama/llama-3.1-8b-instruct | 16384 | -| OpenRouter | meta-llama/llama-3.1-70b-instruct | 131072 | -| OpenRouter | mistralai/mistral-nemo | 131072 | -| OpenRouter | openai/gpt-4o-mini-2024-07-18 | 128000 | -| OpenRouter | openai/gpt-4o-mini | 128000 | -| OpenRouter | google/gemma-2-27b-it | 8192 | -| OpenRouter | google/gemma-2-9b-it | 8192 | -| OpenRouter | sao10k/l3-euryale-70b | 8192 | -| OpenRouter | nousresearch/hermes-2-pro-llama-3-8b | 8192 | -| OpenRouter | openai/gpt-4o | 128000 | -| OpenRouter | openai/gpt-4o:extended | 128000 | -| OpenRouter | openai/gpt-4o-2024-05-13 | 128000 | -| OpenRouter | meta-llama/llama-3-8b-instruct | 8192 | -| OpenRouter | meta-llama/llama-3-70b-instruct | 8192 | -| OpenRouter | mistralai/mixtral-8x22b-instruct | 65536 | -| OpenRouter | microsoft/wizardlm-2-8x22b | 65535 | -| OpenRouter | openai/gpt-4-turbo | 128000 | -| OpenRouter | anthropic/claude-3-haiku | 200000 | -| OpenRouter | mistralai/mistral-large | 128000 | -| OpenRouter | openai/gpt-3.5-turbo-0613 | 4095 | -| OpenRouter | openai/gpt-4-turbo-preview | 128000 | -| OpenRouter | mistralai/mixtral-8x7b-instruct | 32768 | -| OpenRouter | alpindale/goliath-120b | 6144 | -| OpenRouter | openrouter/auto | 2000000 | -| OpenRouter | openai/gpt-4-1106-preview | 128000 | -| OpenRouter | mistralai/mistral-7b-instruct-v0.1 | 2824 | -| OpenRouter | openai/gpt-3.5-turbo-instruct | 4095 | -| OpenRouter | openai/gpt-3.5-turbo-16k | 16385 | -| OpenRouter | mancer/weaver | 8000 | -| OpenRouter | undi95/remm-slerp-l2-13b | 6144 | -| OpenRouter | gryphe/mythomax-l2-13b | 4096 | -| OpenRouter | openai/gpt-4-0314 | 8191 | -| OpenRouter | openai/gpt-3.5-turbo | 16385 | -| OpenRouter | openai/gpt-4 | 8191 | +| Select | Provider | Model ID | Context | +|--------+------------+----------+---------| +| [ ] | OpenRouter | google/gemma-4-26b-a4b-it | 262144 | +| [ ] | OpenRouter | google/gemma-4-31b-it | 262144 | +| [ ] | OpenRouter | qwen/qwen3.6-plus:free | 1000000 | +| [ ] | OpenRouter | z-ai/glm-5v-turbo | 202752 | +| [ ] | OpenRouter | arcee-ai/trinity-large-thinking | 262144 | +| [ ] | OpenRouter | x-ai/grok-4.20-multi-agent | 2000000 | +| [ ] | OpenRouter | x-ai/grok-4.20 | 2000000 | +| [ ] | OpenRouter | google/lyria-3-pro-preview | 1048576 | +| [ ] | OpenRouter | google/lyria-3-clip-preview | 1048576 | +| [ ] | OpenRouter | kwaipilot/kat-coder-pro-v2 | 256000 | +| [ ] | OpenRouter | rekaai/reka-edge | 16384 | +| [ ] | OpenRouter | xiaomi/mimo-v2-omni | 262144 | +| [ ] | OpenRouter | xiaomi/mimo-v2-pro | 1048576 | +| [ ] | OpenRouter | minimax/minimax-m2.7 | 204800 | +| [ ] | OpenRouter | openai/gpt-5.4-nano | 400000 | +| [ ] | OpenRouter | openai/gpt-5.4-mini | 400000 | +| [ ] | OpenRouter | mistralai/mistral-small-2603 | 262144 | +| [ ] | OpenRouter | z-ai/glm-5-turbo | 202752 | +| [ ] | OpenRouter | nvidia/nemotron-3-super-120b-a12b:free | 262144 | +| [ ] | OpenRouter | nvidia/nemotron-3-super-120b-a12b | 262144 | +| [ ] | OpenRouter | bytedance-seed/seed-2.0-lite | 262144 | +| [ ] | OpenRouter | qwen/qwen3.5-9b | 256000 | +| [ ] | OpenRouter | openai/gpt-5.4-pro | 1050000 | +| [ ] | OpenRouter | openai/gpt-5.4 | 1050000 | +| [ ] | OpenRouter | inception/mercury-2 | 128000 | +| [ ] | OpenRouter | openai/gpt-5.3-chat | 128000 | +| [ ] | OpenRouter | google/gemini-3.1-flash-lite-preview | 1048576 | +| [ ] | OpenRouter | bytedance-seed/seed-2.0-mini | 262144 | +| [ ] | OpenRouter | google/gemini-3.1-flash-image-preview | 65536 | +| [ ] | OpenRouter | qwen/qwen3.5-35b-a3b | 262144 | +| [ ] | OpenRouter | qwen/qwen3.5-27b | 262144 | +| [ ] | OpenRouter | qwen/qwen3.5-122b-a10b | 262144 | +| [ ] | OpenRouter | qwen/qwen3.5-flash-02-23 | 1000000 | +| [ ] | OpenRouter | liquid/lfm-2-24b-a2b | 32768 | +| [ ] | OpenRouter | google/gemini-3.1-pro-preview-customtools | 1048576 | +| [ ] | OpenRouter | openai/gpt-5.3-codex | 400000 | +| [ ] | OpenRouter | aion-labs/aion-2.0 | 131072 | +| [ ] | OpenRouter | google/gemini-3.1-pro-preview | 1048576 | +| [ ] | OpenRouter | anthropic/claude-sonnet-4.6 | 1000000 | +| [ ] | OpenRouter | qwen/qwen3.5-plus-02-15 | 1000000 | +| [ ] | OpenRouter | qwen/qwen3.5-397b-a17b | 262144 | +| [ ] | OpenRouter | minimax/minimax-m2.5:free | 196608 | +| [ ] | OpenRouter | minimax/minimax-m2.5 | 196608 | +| [ ] | OpenRouter | z-ai/glm-5 | 80000 | +| [ ] | OpenRouter | qwen/qwen3-max-thinking | 262144 | +| [ ] | OpenRouter | anthropic/claude-opus-4.6 | 1000000 | +| [ ] | OpenRouter | qwen/qwen3-coder-next | 262144 | +| [ ] | OpenRouter | openrouter/free | 200000 | +| [ ] | OpenRouter | stepfun/step-3.5-flash:free | 256000 | +| [ ] | OpenRouter | stepfun/step-3.5-flash | 262144 | +| [ ] | OpenRouter | arcee-ai/trinity-large-preview:free | 131000 | +| [ ] | OpenRouter | moonshotai/kimi-k2.5 | 262144 | +| [ ] | OpenRouter | upstage/solar-pro-3 | 128000 | +| [ ] | OpenRouter | minimax/minimax-m2-her | 65536 | +| [ ] | OpenRouter | writer/palmyra-x5 | 1040000 | +| [ ] | OpenRouter | liquid/lfm-2.5-1.2b-thinking:free | 32768 | +| [ ] | OpenRouter | liquid/lfm-2.5-1.2b-instruct:free | 32768 | +| [ ] | OpenRouter | openai/gpt-audio | 128000 | +| [ ] | OpenRouter | openai/gpt-audio-mini | 128000 | +| [ ] | OpenRouter | z-ai/glm-4.7-flash | 202752 | +| [ ] | OpenRouter | openai/gpt-5.2-codex | 400000 | +| [ ] | OpenRouter | allenai/olmo-3.1-32b-instruct | 65536 | +| [ ] | OpenRouter | bytedance-seed/seed-1.6-flash | 262144 | +| [ ] | OpenRouter | bytedance-seed/seed-1.6 | 262144 | +| [ ] | OpenRouter | minimax/minimax-m2.1 | 196608 | +| [ ] | OpenRouter | z-ai/glm-4.7 | 202752 | +| [ ] | OpenRouter | google/gemini-3-flash-preview | 1048576 | +| [ ] | OpenRouter | mistralai/mistral-small-creative | 32768 | +| [ ] | OpenRouter | xiaomi/mimo-v2-flash | 262144 | +| [ ] | OpenRouter | nvidia/nemotron-3-nano-30b-a3b:free | 256000 | +| [ ] | OpenRouter | nvidia/nemotron-3-nano-30b-a3b | 262144 | +| [ ] | OpenRouter | openai/gpt-5.2-chat | 128000 | +| [ ] | OpenRouter | openai/gpt-5.2-pro | 400000 | +| [ ] | OpenRouter | openai/gpt-5.2 | 400000 | +| [ ] | OpenRouter | mistralai/devstral-2512 | 262144 | +| [ ] | OpenRouter | relace/relace-search | 256000 | +| [ ] | OpenRouter | z-ai/glm-4.6v | 131072 | +| [ ] | OpenRouter | nex-agi/deepseek-v3.1-nex-n1 | 131072 | +| [ ] | OpenRouter | essentialai/rnj-1-instruct | 32768 | +| [ ] | OpenRouter | openrouter/bodybuilder | 128000 | +| [ ] | OpenRouter | openai/gpt-5.1-codex-max | 400000 | +| [ ] | OpenRouter | amazon/nova-2-lite-v1 | 1000000 | +| [ ] | OpenRouter | mistralai/ministral-14b-2512 | 262144 | +| [ ] | OpenRouter | mistralai/ministral-8b-2512 | 262144 | +| [ ] | OpenRouter | mistralai/ministral-3b-2512 | 131072 | +| [ ] | OpenRouter | mistralai/mistral-large-2512 | 262144 | +| [ ] | OpenRouter | arcee-ai/trinity-mini:free | 131072 | +| [ ] | OpenRouter | arcee-ai/trinity-mini | 131072 | +| [ ] | OpenRouter | deepseek/deepseek-v3.2-speciale | 163840 | +| [ ] | OpenRouter | deepseek/deepseek-v3.2 | 163840 | +| [ ] | OpenRouter | prime-intellect/intellect-3 | 131072 | +| [ ] | OpenRouter | anthropic/claude-opus-4.5 | 200000 | +| [ ] | OpenRouter | allenai/olmo-3-32b-think | 65536 | +| [ ] | OpenRouter | google/gemini-3-pro-image-preview | 65536 | +| [ ] | OpenRouter | x-ai/grok-4.1-fast | 2000000 | +| [ ] | OpenRouter | deepcogito/cogito-v2.1-671b | 128000 | +| [ ] | OpenRouter | openai/gpt-5.1 | 400000 | +| [ ] | OpenRouter | openai/gpt-5.1-chat | 128000 | +| [ ] | OpenRouter | openai/gpt-5.1-codex | 400000 | +| [ ] | OpenRouter | openai/gpt-5.1-codex-mini | 400000 | +| [ ] | OpenRouter | moonshotai/kimi-k2-thinking | 131072 | +| [ ] | OpenRouter | amazon/nova-premier-v1 | 1000000 | +| [ ] | OpenRouter | perplexity/sonar-pro-search | 200000 | +| [ ] | OpenRouter | mistralai/voxtral-small-24b-2507 | 32000 | +| [ ] | OpenRouter | openai/gpt-oss-safeguard-20b | 131072 | +| [ ] | OpenRouter | nvidia/nemotron-nano-12b-v2-vl:free | 128000 | +| [ ] | OpenRouter | nvidia/nemotron-nano-12b-v2-vl | 131072 | +| [ ] | OpenRouter | minimax/minimax-m2 | 196608 | +| [ ] | OpenRouter | qwen/qwen3-vl-32b-instruct | 131072 | +| [ ] | OpenRouter | ibm-granite/granite-4.0-h-micro | 131000 | +| [ ] | OpenRouter | openai/gpt-5-image-mini | 400000 | +| [ ] | OpenRouter | anthropic/claude-haiku-4.5 | 200000 | +| [ ] | OpenRouter | qwen/qwen3-vl-8b-thinking | 131072 | +| [ ] | OpenRouter | qwen/qwen3-vl-8b-instruct | 131072 | +| [ ] | OpenRouter | openai/gpt-5-image | 400000 | +| [ ] | OpenRouter | openai/o3-deep-research | 200000 | +| [ ] | OpenRouter | openai/o4-mini-deep-research | 200000 | +| [ ] | OpenRouter | nvidia/llama-3.3-nemotron-super-49b-v1.5 | 131072 | +| [ ] | OpenRouter | baidu/ernie-4.5-21b-a3b-thinking | 131072 | +| [ ] | OpenRouter | google/gemini-2.5-flash-image | 32768 | +| [ ] | OpenRouter | qwen/qwen3-vl-30b-a3b-thinking | 131072 | +| [ ] | OpenRouter | qwen/qwen3-vl-30b-a3b-instruct | 131072 | +| [ ] | OpenRouter | openai/gpt-5-pro | 400000 | +| [ ] | OpenRouter | z-ai/glm-4.6 | 204800 | +| [ ] | OpenRouter | anthropic/claude-sonnet-4.5 | 1000000 | +| [ ] | OpenRouter | deepseek/deepseek-v3.2-exp | 163840 | +| [ ] | OpenRouter | thedrummer/cydonia-24b-v4.1 | 131072 | +| [ ] | OpenRouter | relace/relace-apply-3 | 256000 | +| [ ] | OpenRouter | google/gemini-2.5-flash-lite-preview-09-2025 | 1048576 | +| [ ] | OpenRouter | qwen/qwen3-vl-235b-a22b-thinking | 131072 | +| [ ] | OpenRouter | qwen/qwen3-vl-235b-a22b-instruct | 262144 | +| [ ] | OpenRouter | qwen/qwen3-max | 262144 | +| [ ] | OpenRouter | qwen/qwen3-coder-plus | 1000000 | +| [ ] | OpenRouter | openai/gpt-5-codex | 400000 | +| [ ] | OpenRouter | deepseek/deepseek-v3.1-terminus | 163840 | +| [ ] | OpenRouter | x-ai/grok-4-fast | 2000000 | +| [ ] | OpenRouter | alibaba/tongyi-deepresearch-30b-a3b | 131072 | +| [ ] | OpenRouter | qwen/qwen3-coder-flash | 1000000 | +| [ ] | OpenRouter | qwen/qwen3-next-80b-a3b-thinking | 131072 | +| [ ] | OpenRouter | qwen/qwen3-next-80b-a3b-instruct:free | 262144 | +| [ ] | OpenRouter | qwen/qwen3-next-80b-a3b-instruct | 262144 | +| [ ] | OpenRouter | meituan/longcat-flash-chat | 131072 | +| [ ] | OpenRouter | qwen/qwen-plus-2025-07-28:thinking | 1000000 | +| [ ] | OpenRouter | qwen/qwen-plus-2025-07-28 | 1000000 | +| [ ] | OpenRouter | nvidia/nemotron-nano-9b-v2:free | 128000 | +| [ ] | OpenRouter | nvidia/nemotron-nano-9b-v2 | 131072 | +| [ ] | OpenRouter | moonshotai/kimi-k2-0905 | 131072 | +| [ ] | OpenRouter | qwen/qwen3-30b-a3b-thinking-2507 | 131072 | +| [ ] | OpenRouter | x-ai/grok-code-fast-1 | 256000 | +| [ ] | OpenRouter | nousresearch/hermes-4-70b | 131072 | +| [ ] | OpenRouter | nousresearch/hermes-4-405b | 131072 | +| [ ] | OpenRouter | deepseek/deepseek-chat-v3.1 | 32768 | +| [ ] | OpenRouter | openai/gpt-4o-audio-preview | 128000 | +| [ ] | OpenRouter | mistralai/mistral-medium-3.1 | 131072 | +| [ ] | OpenRouter | baidu/ernie-4.5-21b-a3b | 120000 | +| [ ] | OpenRouter | baidu/ernie-4.5-vl-28b-a3b | 30000 | +| [ ] | OpenRouter | z-ai/glm-4.5v | 65536 | +| [ ] | OpenRouter | ai21/jamba-large-1.7 | 256000 | +| [ ] | OpenRouter | openai/gpt-5-chat | 128000 | +| [ ] | OpenRouter | openai/gpt-5 | 400000 | +| [ ] | OpenRouter | openai/gpt-5-mini | 400000 | +| [ ] | OpenRouter | openai/gpt-5-nano | 400000 | +| [ ] | OpenRouter | openai/gpt-oss-120b:free | 131072 | +| [ ] | OpenRouter | openai/gpt-oss-120b | 131072 | +| [ ] | OpenRouter | openai/gpt-oss-20b:free | 131072 | +| [ ] | OpenRouter | openai/gpt-oss-20b | 131072 | +| [ ] | OpenRouter | anthropic/claude-opus-4.1 | 200000 | +| [ ] | OpenRouter | mistralai/codestral-2508 | 256000 | +| [ ] | OpenRouter | qwen/qwen3-coder-30b-a3b-instruct | 160000 | +| [ ] | OpenRouter | qwen/qwen3-30b-a3b-instruct-2507 | 262144 | +| [ ] | OpenRouter | z-ai/glm-4.5 | 131072 | +| [ ] | OpenRouter | z-ai/glm-4.5-air:free | 131072 | +| [ ] | OpenRouter | z-ai/glm-4.5-air | 131072 | +| [ ] | OpenRouter | qwen/qwen3-235b-a22b-thinking-2507 | 131072 | +| [ ] | OpenRouter | z-ai/glm-4-32b | 128000 | +| [ ] | OpenRouter | qwen/qwen3-coder:free | 262000 | +| [ ] | OpenRouter | qwen/qwen3-coder | 262144 | +| [ ] | OpenRouter | bytedance/ui-tars-1.5-7b | 128000 | +| [ ] | OpenRouter | google/gemini-2.5-flash-lite | 1048576 | +| [ ] | OpenRouter | qwen/qwen3-235b-a22b-2507 | 262144 | +| [ ] | OpenRouter | switchpoint/router | 131072 | +| [ ] | OpenRouter | moonshotai/kimi-k2 | 131072 | +| [ ] | OpenRouter | mistralai/devstral-medium | 131072 | +| [ ] | OpenRouter | mistralai/devstral-small | 131072 | +| [ ] | OpenRouter | cognitivecomputations/dolphin-mistral-24b-venice-edition:free | 32768 | +| [ ] | OpenRouter | x-ai/grok-4 | 256000 | +| [ ] | OpenRouter | google/gemma-3n-e2b-it:free | 8192 | +| [ ] | OpenRouter | tencent/hunyuan-a13b-instruct | 131072 | +| [ ] | OpenRouter | tngtech/deepseek-r1t2-chimera | 163840 | +| [ ] | OpenRouter | morph/morph-v3-large | 262144 | +| [ ] | OpenRouter | morph/morph-v3-fast | 81920 | +| [ ] | OpenRouter | baidu/ernie-4.5-vl-424b-a47b | 123000 | +| [ ] | OpenRouter | baidu/ernie-4.5-300b-a47b | 123000 | +| [ ] | OpenRouter | inception/mercury | 128000 | +| [ ] | OpenRouter | mistralai/mistral-small-3.2-24b-instruct | 128000 | +| [ ] | OpenRouter | minimax/minimax-m1 | 1000000 | +| [ ] | OpenRouter | google/gemini-2.5-flash | 1048576 | +| [ ] | OpenRouter | google/gemini-2.5-pro | 1048576 | +| [ ] | OpenRouter | openai/o3-pro | 200000 | +| [ ] | OpenRouter | x-ai/grok-3-mini | 131072 | +| [ ] | OpenRouter | x-ai/grok-3 | 131072 | +| [ ] | OpenRouter | google/gemini-2.5-pro-preview | 1048576 | +| [ ] | OpenRouter | deepseek/deepseek-r1-0528 | 163840 | +| [ ] | OpenRouter | anthropic/claude-opus-4 | 200000 | +| [ ] | OpenRouter | anthropic/claude-sonnet-4 | 200000 | +| [ ] | OpenRouter | google/gemma-3n-e4b-it:free | 8192 | +| [ ] | OpenRouter | google/gemma-3n-e4b-it | 32768 | +| [ ] | OpenRouter | mistralai/mistral-medium-3 | 131072 | +| [ ] | OpenRouter | google/gemini-2.5-pro-preview-05-06 | 1048576 | +| [ ] | OpenRouter | arcee-ai/spotlight | 131072 | +| [ ] | OpenRouter | arcee-ai/maestro-reasoning | 131072 | +| [ ] | OpenRouter | arcee-ai/virtuoso-large | 131072 | +| [ ] | OpenRouter | arcee-ai/coder-large | 32768 | +| [ ] | OpenRouter | inception/mercury-coder | 128000 | +| [ ] | OpenRouter | meta-llama/llama-guard-4-12b | 163840 | +| [ ] | OpenRouter | qwen/qwen3-30b-a3b | 40960 | +| [ ] | OpenRouter | qwen/qwen3-8b | 40960 | +| [ ] | OpenRouter | qwen/qwen3-14b | 40960 | +| [ ] | OpenRouter | qwen/qwen3-32b | 40960 | +| [ ] | OpenRouter | qwen/qwen3-235b-a22b | 131072 | +| [ ] | OpenRouter | openai/o4-mini-high | 200000 | +| [ ] | OpenRouter | openai/o3 | 200000 | +| [ ] | OpenRouter | openai/o4-mini | 200000 | +| [ ] | OpenRouter | qwen/qwen2.5-coder-7b-instruct | 32768 | +| [ ] | OpenRouter | openai/gpt-4.1 | 1047576 | +| [ ] | OpenRouter | openai/gpt-4.1-mini | 1047576 | +| [ ] | OpenRouter | openai/gpt-4.1-nano | 1047576 | +| [ ] | OpenRouter | eleutherai/llemma_7b | 4096 | +| [ ] | OpenRouter | alfredpros/codellama-7b-instruct-solidity | 4096 | +| [ ] | OpenRouter | x-ai/grok-3-mini-beta | 131072 | +| [ ] | OpenRouter | x-ai/grok-3-beta | 131072 | +| [ ] | OpenRouter | nvidia/llama-3.1-nemotron-ultra-253b-v1 | 131072 | +| [ ] | OpenRouter | meta-llama/llama-4-maverick | 1048576 | +| [ ] | OpenRouter | meta-llama/llama-4-scout | 327680 | +| [ ] | OpenRouter | qwen/qwen2.5-vl-32b-instruct | 128000 | +| [ ] | OpenRouter | deepseek/deepseek-chat-v3-0324 | 163840 | +| [ ] | OpenRouter | openai/o1-pro | 200000 | +| [ ] | OpenRouter | mistralai/mistral-small-3.1-24b-instruct | 131072 | +| [ ] | OpenRouter | allenai/olmo-2-0325-32b-instruct | 128000 | +| [ ] | OpenRouter | google/gemma-3-4b-it:free | 32768 | +| [ ] | OpenRouter | google/gemma-3-4b-it | 131072 | +| [ ] | OpenRouter | google/gemma-3-12b-it:free | 32768 | +| [ ] | OpenRouter | google/gemma-3-12b-it | 131072 | +| [ ] | OpenRouter | cohere/command-a | 256000 | +| [ ] | OpenRouter | openai/gpt-4o-mini-search-preview | 128000 | +| [ ] | OpenRouter | openai/gpt-4o-search-preview | 128000 | +| [ ] | OpenRouter | rekaai/reka-flash-3 | 65536 | +| [ ] | OpenRouter | google/gemma-3-27b-it:free | 131072 | +| [ ] | OpenRouter | google/gemma-3-27b-it | 131072 | +| [ ] | OpenRouter | thedrummer/skyfall-36b-v2 | 32768 | +| [ ] | OpenRouter | perplexity/sonar-reasoning-pro | 128000 | +| [ ] | OpenRouter | perplexity/sonar-pro | 200000 | +| [ ] | OpenRouter | perplexity/sonar-deep-research | 128000 | +| [ ] | OpenRouter | qwen/qwq-32b | 131072 | +| [ ] | OpenRouter | google/gemini-2.0-flash-lite-001 | 1048576 | +| [ ] | OpenRouter | anthropic/claude-3.7-sonnet | 200000 | +| [ ] | OpenRouter | anthropic/claude-3.7-sonnet:thinking | 200000 | +| [ ] | OpenRouter | mistralai/mistral-saba | 32768 | +| [ ] | OpenRouter | meta-llama/llama-guard-3-8b | 131072 | +| [ ] | OpenRouter | openai/o3-mini-high | 200000 | +| [ ] | OpenRouter | google/gemini-2.0-flash-001 | 1048576 | +| [ ] | OpenRouter | qwen/qwen-vl-plus | 131072 | +| [ ] | OpenRouter | aion-labs/aion-1.0 | 131072 | +| [ ] | OpenRouter | aion-labs/aion-1.0-mini | 131072 | +| [ ] | OpenRouter | aion-labs/aion-rp-llama-3.1-8b | 32768 | +| [ ] | OpenRouter | qwen/qwen-vl-max | 131072 | +| [ ] | OpenRouter | qwen/qwen-turbo | 131072 | +| [ ] | OpenRouter | qwen/qwen2.5-vl-72b-instruct | 32768 | +| [ ] | OpenRouter | qwen/qwen-plus | 1000000 | +| [ ] | OpenRouter | qwen/qwen-max | 32768 | +| [ ] | OpenRouter | openai/o3-mini | 200000 | +| [ ] | OpenRouter | mistralai/mistral-small-24b-instruct-2501 | 32768 | +| [ ] | OpenRouter | deepseek/deepseek-r1-distill-qwen-32b | 32768 | +| [ ] | OpenRouter | perplexity/sonar | 127072 | +| [ ] | OpenRouter | deepseek/deepseek-r1-distill-llama-70b | 131072 | +| [ ] | OpenRouter | deepseek/deepseek-r1 | 64000 | +| [ ] | OpenRouter | minimax/minimax-01 | 1000192 | +| [ ] | OpenRouter | microsoft/phi-4 | 16384 | +| [ ] | OpenRouter | sao10k/l3.1-70b-hanami-x1 | 16000 | +| [ ] | OpenRouter | deepseek/deepseek-chat | 163840 | +| [ ] | OpenRouter | sao10k/l3.3-euryale-70b | 131072 | +| [ ] | OpenRouter | openai/o1 | 200000 | +| [ ] | OpenRouter | cohere/command-r7b-12-2024 | 128000 | +| [ ] | OpenRouter | meta-llama/llama-3.3-70b-instruct:free | 65536 | +| [ ] | OpenRouter | meta-llama/llama-3.3-70b-instruct | 131072 | +| [ ] | OpenRouter | amazon/nova-lite-v1 | 300000 | +| [ ] | OpenRouter | amazon/nova-micro-v1 | 128000 | +| [ ] | OpenRouter | amazon/nova-pro-v1 | 300000 | +| [ ] | OpenRouter | openai/gpt-4o-2024-11-20 | 128000 | +| [ ] | OpenRouter | mistralai/mistral-large-2411 | 131072 | +| [ ] | OpenRouter | mistralai/mistral-large-2407 | 131072 | +| [ ] | OpenRouter | mistralai/pixtral-large-2411 | 131072 | +| [ ] | OpenRouter | qwen/qwen-2.5-coder-32b-instruct | 32768 | +| [ ] | OpenRouter | thedrummer/unslopnemo-12b | 32768 | +| [ ] | OpenRouter | anthropic/claude-3.5-haiku | 200000 | +| [ ] | OpenRouter | anthracite-org/magnum-v4-72b | 16384 | +| [ ] | OpenRouter | qwen/qwen-2.5-7b-instruct | 32768 | +| [ ] | OpenRouter | nvidia/llama-3.1-nemotron-70b-instruct | 131072 | +| [ ] | OpenRouter | inflection/inflection-3-pi | 8000 | +| [ ] | OpenRouter | inflection/inflection-3-productivity | 8000 | +| [ ] | OpenRouter | thedrummer/rocinante-12b | 32768 | +| [ ] | OpenRouter | meta-llama/llama-3.2-3b-instruct:free | 131072 | +| [ ] | OpenRouter | meta-llama/llama-3.2-3b-instruct | 80000 | +| [ ] | OpenRouter | meta-llama/llama-3.2-1b-instruct | 60000 | +| [ ] | OpenRouter | meta-llama/llama-3.2-11b-vision-instruct | 131072 | +| [ ] | OpenRouter | qwen/qwen-2.5-72b-instruct | 32768 | +| [ ] | OpenRouter | cohere/command-r-08-2024 | 128000 | +| [ ] | OpenRouter | cohere/command-r-plus-08-2024 | 128000 | +| [ ] | OpenRouter | sao10k/l3.1-euryale-70b | 131072 | +| [ ] | OpenRouter | nousresearch/hermes-3-llama-3.1-70b | 131072 | +| [ ] | OpenRouter | nousresearch/hermes-3-llama-3.1-405b:free | 131072 | +| [ ] | OpenRouter | nousresearch/hermes-3-llama-3.1-405b | 131072 | +| [ ] | OpenRouter | sao10k/l3-lunaris-8b | 8192 | +| [ ] | OpenRouter | openai/gpt-4o-2024-08-06 | 128000 | +| [ ] | OpenRouter | meta-llama/llama-3.1-8b-instruct | 16384 | +| [ ] | OpenRouter | meta-llama/llama-3.1-70b-instruct | 131072 | +| [ ] | OpenRouter | mistralai/mistral-nemo | 131072 | +| [ ] | OpenRouter | openai/gpt-4o-mini-2024-07-18 | 128000 | +| [ ] | OpenRouter | openai/gpt-4o-mini | 128000 | +| [ ] | OpenRouter | google/gemma-2-27b-it | 8192 | +| [ ] | OpenRouter | google/gemma-2-9b-it | 8192 | +| [ ] | OpenRouter | sao10k/l3-euryale-70b | 8192 | +| [ ] | OpenRouter | nousresearch/hermes-2-pro-llama-3-8b | 8192 | +| [ ] | OpenRouter | openai/gpt-4o | 128000 | +| [ ] | OpenRouter | openai/gpt-4o:extended | 128000 | +| [ ] | OpenRouter | openai/gpt-4o-2024-05-13 | 128000 | +| [ ] | OpenRouter | meta-llama/llama-3-8b-instruct | 8192 | +| [ ] | OpenRouter | meta-llama/llama-3-70b-instruct | 8192 | +| [ ] | OpenRouter | mistralai/mixtral-8x22b-instruct | 65536 | +| [ ] | OpenRouter | microsoft/wizardlm-2-8x22b | 65535 | +| [ ] | OpenRouter | openai/gpt-4-turbo | 128000 | +| [ ] | OpenRouter | anthropic/claude-3-haiku | 200000 | +| [ ] | OpenRouter | mistralai/mistral-large | 128000 | +| [ ] | OpenRouter | openai/gpt-3.5-turbo-0613 | 4095 | +| [ ] | OpenRouter | openai/gpt-4-turbo-preview | 128000 | +| [ ] | OpenRouter | mistralai/mixtral-8x7b-instruct | 32768 | +| [ ] | OpenRouter | alpindale/goliath-120b | 6144 | +| [ ] | OpenRouter | openrouter/auto | 2000000 | +| [ ] | OpenRouter | openai/gpt-4-1106-preview | 128000 | +| [ ] | OpenRouter | mistralai/mistral-7b-instruct-v0.1 | 2824 | +| [ ] | OpenRouter | openai/gpt-3.5-turbo-instruct | 4095 | +| [ ] | OpenRouter | openai/gpt-3.5-turbo-16k | 16385 | +| [ ] | OpenRouter | mancer/weaver | 8000 | +| [ ] | OpenRouter | undi95/remm-slerp-l2-13b | 6144 | +| [ ] | OpenRouter | gryphe/mythomax-l2-13b | 4096 | +| [ ] | OpenRouter | openai/gpt-4-0314 | 8191 | +| [ ] | OpenRouter | openai/gpt-3.5-turbo | 16385 | +| [ ] | OpenRouter | openai/gpt-4 | 8191 | diff --git a/system/lisp-eval.lisp b/system/lisp-eval.lisp new file mode 100644 index 0000000..7d36c3e --- /dev/null +++ b/system/lisp-eval.lisp @@ -0,0 +1,22 @@ +(load "~/quicklisp/setup.lisp") +(ql:quickload :usocket :silent t) + +(defun send-to-swank (form-string) + (let* ((msg (format nil "(:emacs-rex (swank:interactive-eval ~s) :org-agent t 1)" form-string)) + (len (format nil "~6,'0x" (length msg))) + (socket (usocket:socket-connect "127.0.0.1" 4005)) + (stream (usocket:socket-stream socket))) + (write-string len stream) + (write-string msg stream) + (finish-output stream) + (let* ((resp-len-raw (make-string 6))) + (read-sequence resp-len-raw stream) + (let* ((resp-len (parse-integer resp-len-raw :radix 16)) + (resp-payload (make-string resp-len))) + (read-sequence resp-payload stream) + (format t "~a~%" resp-payload))) + (usocket:socket-close socket))) + +(let ((cmd (first (uiop:command-line-arguments)))) + (when cmd + (send-to-swank cmd))) diff --git a/system/skills/org-skill-environment-config.org b/system/skills/org-skill-environment-config.org deleted file mode 120000 index 8dc1eb9..0000000 --- a/system/skills/org-skill-environment-config.org +++ /dev/null @@ -1 +0,0 @@ -/home/user/memex/notes/org-skill-environment-config.org \ No newline at end of file