New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

webext-content-scripts

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webext-content-scripts - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

2

index.d.ts

@@ -26,5 +26,5 @@ import type { ExtensionTypes } from 'webextension-polyfill';

export declare function executeScript({ tabId, frameId, files, allFrames, matchAboutBlank, runAt, }: InjectionDetails, { ignoreTargetErrors }?: InjectionOptions): Promise<void>;
export declare function getTabsByUrl(patterns: string[]): Promise<number[]>;
export declare function getTabsByUrl(matches: string[], excludeMatches?: string[]): Promise<number[]>;
export declare function injectContentScript(where: MaybeArray<number | Target>, scripts: MaybeArray<ContentScript>, options?: InjectionOptions): Promise<void>;
export declare function isScriptableUrl(url: string): boolean;
export {};
import chromeP from 'webext-polyfill-kinda';
import { patternToRegex } from 'webext-patterns';
const gotScripting = typeof chrome === 'object' && 'scripting' in chrome;

@@ -117,8 +118,11 @@ function castTarget(target) {

}
export async function getTabsByUrl(patterns) {
if (patterns.length === 0) {
export async function getTabsByUrl(matches, excludeMatches) {
if (matches.length === 0) {
return [];
}
const tabs = await chromeP.tabs.query({ url: patterns });
return tabs.map(tab => tab.id).filter((id) => typeof id === 'number');
const exclude = excludeMatches ? patternToRegex(...excludeMatches) : undefined;
const tabs = await chromeP.tabs.query({ url: matches });
return tabs
.filter(tab => tab.id && tab.url && (exclude ? !exclude.test(tab.url) : true))
.map(tab => tab.id);
}

@@ -125,0 +129,0 @@ export async function injectContentScript(where, scripts, options = {}) {

{
"name": "webext-content-scripts",
"version": "2.3.0",
"version": "2.4.0",
"description": "Utility functions to inject content scripts in WebExtensions, for Manifest v2 and v3",

@@ -40,2 +40,3 @@ "keywords": [

"unicorn/prefer-ternary": "off",
"n/file-extension-in-import": "off",
"@typescript-eslint/no-implicit-any-catch": "off",

@@ -46,2 +47,3 @@ "@typescript-eslint/consistent-type-definitions": "off"

"dependencies": {
"webext-patterns": "^1.2.0",
"webext-polyfill-kinda": "^0.10.0"

@@ -52,6 +54,9 @@ },

"@types/chrome": "^0.0.206",
"@types/jest": "^29.2.5",
"@types/webextension-polyfill": "^0.9.2",
"jest-chrome": "^0.8.0",
"typescript": "^4.9.4",
"vitest": "^0.27.1",
"xo": "^0.53.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc