export declare enum EXTENSION_TARGET { CHROME = "chrome", MOZILLA = "mozilla" } export declare const CONFIG_FILE_NAMES: string[]; interface ManifestIconMap { 16: string; 48: string; 128: string; } export declare type ManifestIcons = ManifestIconMap | string; export interface ManifestBrowserAction { default_icon?: ManifestIcons; default_title?: string; default_popup?: string; } interface ManifestBackgroundOptions { scripts: string[]; } interface ManifestSettingsOptions { page: string; open_in_tab: boolean; } declare type ManifestContentScriptRunAtOption = "document_idle" | "document_start" | "document_end"; export interface ManifestContentScriptOptions { matches: string[]; css?: string[]; js?: string[]; match_about_blank?: boolean; exclude_matches?: string[]; include_globs?: string[]; exclude_globs?: string[]; run_at?: ManifestContentScriptRunAtOption; all_frames?: boolean; } export interface ManifestBrowserSpecificSettings { gecko?: { id?: string; strict_min_version?: string; strict_max_version?: string; update_url?: string; }; } export interface IDictionary { [key: string]: v; } export interface ManifestOptions { version: string; name: string; short_name?: string; description?: string; /** * The extension's author, intended for display in the browser's user interface * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/author */ author?: string; icons?: ManifestIcons; browser_action?: ManifestBrowserAction; page_action?: ManifestBrowserAction; /** * Use required permissions when they are needed for your extension’s basic functionality * https://developer.chrome.com/extensions/permissions */ permissions?: string[]; /** * Use optional permissions when they are needed for optional features in your extension * https://developer.chrome.com/extensions/permissions */ optional_permissions?: string[]; /** * specify the CSP for the extension * https://developer.chrome.com/extensions/contentSecurityPolicy */ content_security_policy?: string; background?: ManifestBackgroundOptions; options_ui?: ManifestSettingsOptions; /** * whether the app or extension is expected to work offline * https://developer.chrome.com/extensions/manifest/offline_enabled */ offline_enabled?: boolean; /** * override selected Chrome settings */ chrome_settings_overrides?: IDictionary; /** * override selected Chrome user interface properties */ chrome_ui_overrides?: IDictionary; /** * substitute an HTML file from your extension for a page that Google Chrome normally provides */ chrome_url_overrides?: IDictionary; /** * add keyboard shortcuts that trigger actions in your extension */ commands?: IDictionary; /** * content scripts are files that run in the context of web pages. * https://developer.chrome.com/extensions/content_scripts */ content_scripts?: IDictionary; /** * Create a devtools extension */ devtools_page?: string; /** * The URL of the homepage for this extension * https://developer.chrome.com/extensions/manifest/homepage_url */ homepage_url?: string; /** * specify how this extension will behave if allowed to run in incognito mode * https://developer.chrome.com/extensions/manifest/incognito */ incognito?: "spanning" | "split" | "not_allowed"; /** * the version of chrome that your extension requires * https://developer.chrome.com/extensions/manifest/minimum_chrome_version */ minimum_chrome_version?: string; /** * allows you to register a keyword with Google Chrome's address bar * https://developer.chrome.com/extensions/omnibox */ omnibox?: IDictionary; /** * https://developer.chrome.com/extensions/manifest/storage */ storage?: IDictionary; /** * array of strings specifying the paths of packaged resources * that are expected to be usable in the context of a web page * https://developer.chrome.com/extensions/manifest/web_accessible_resources */ web_accessible_resources?: IDictionary; /** * contains keys that are specific to a particular host application * https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings */ browser_specific_settings?: ManifestBrowserSpecificSettings; } export interface CwexConfig { /** array of glob matching patterns of files and directories */ include: string[]; /** array of regular expressions matching files and directories to be excluded */ exclude: string[]; /** target browser extensions */ targets: string[]; /** root directory to find files and directories */ rootDir: string; /** directory where the build would be compiled to */ outDir: string; /** name of the file for the compiled extension */ outFile?: string; /** path to script to execute before compiling extension */ beforeCompile?: string; /** Manifest file options */ manifestOptions?: ManifestOptions; /** Config options specific to a target e.g. chrome: { include, exclude, etc } */ targetOptions?: { [key: string]: CwexConfig; }; } export interface ExtensionInfo { content: string; fileName: string; fileType: string; } export declare type ExtensionInfoGenerator = (config: CwexConfig) => Promise; export interface ExtensionCompilerOption { extensionFilesDir: string; extensionBuildOutputDir: string; config: CwexConfig; } export declare type ExtensionCompiler = (opts: ExtensionCompilerOption) => Promise; export declare const defaultConfig: CwexConfig; export declare const getConfigFile: () => Promise; export declare const getConfig: (configPath?: string) => Promise<{ /** array of glob matching patterns of files and directories */ include: string[]; /** array of regular expressions matching files and directories to be excluded */ exclude: string[]; /** target browser extensions */ targets: string[]; /** root directory to find files and directories */ rootDir: string; /** directory where the build would be compiled to */ outDir: string; /** name of the file for the compiled extension */ outFile?: string | undefined; /** path to script to execute before compiling extension */ beforeCompile?: string | undefined; /** Manifest file options */ manifestOptions?: ManifestOptions | undefined; /** Config options specific to a target e.g. chrome: { include, exclude, etc } */ targetOptions?: { [key: string]: CwexConfig; } | undefined; }>; export {};