UNPKG

4.69 kBTypeScriptView Raw
1import { Session } from 'electron';
2
3/**
4 * Download extension options
5 */
6interface DownloadOptions {
7 /**
8 * Force to download the extension even if it's already installed. Default is `false`
9 * @default false
10 */
11 force?: boolean;
12 /**
13 * Whether to unzip the downloaded file. Default is `true`
14 * @default true
15 */
16 unzip?: boolean;
17 /**
18 * Number of attempts to download the extension. Default is `5`
19 * @default 5
20 */
21 attempts?: number;
22 /**
23 * The path to save the extension. Default is `path.join(app.getPath('userData'), 'extensions')`
24 * @default path.join(app.getPath('userData'), 'extensions')
25 */
26 outPath?: string;
27 /**
28 * Download source. When the OS language is `zh_CN` , the default value is `npmmirror`, otherwise it is `chrome`.
29 * @see https://www.npmjs.com/package/@tomjs/electron-devtools-files
30 * @default "chrome"
31 */
32 source?: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror';
33}
34/**
35 * download file from network
36 * @param url url address to download
37 * @param filePath file path to save
38 * @returns
39 */
40declare const downloadFile: (url: string, filePath: string) => Promise<void>;
41/**
42 * download chrome extension
43 * @param extensionId extension id
44 * @param options download extension options
45 */
46declare function downloadExtension(extensionId: string, options?: DownloadOptions): Promise<{
47 filePath: string;
48 unzipPath?: string;
49}>;
50
51/**
52 * Angular DevTools
53 * @see https://chromewebstore.google.com/detail/ienfalfjdbdpebioblfackkekamfmbnh
54 */
55declare const ANGULAR_DEVTOOLS = "ienfalfjdbdpebioblfackkekamfmbnh";
56/**
57 * Apollo Client Devtools
58 * @see https://chromewebstore.google.com/detail/jdkknkkbebbapilgoeccciglkfbmbnfm
59 */
60declare const APOLLO_CLIENT_TOOLS = "jdkknkkbebbapilgoeccciglkfbmbnfm";
61/**
62 * Backbone Debugger
63 * @see https://chromewebstore.google.com/detail/bhljhndlimiafopmmhjlgfpnnchjjbhd
64 */
65declare const BACKBONE_DEBUGGER = "bhljhndlimiafopmmhjlgfpnnchjjbhd";
66/**
67 * Ember Inspector
68 * @see https://chromewebstore.google.com/detail/bmdblncegkenkacieihfhpjfppoconhi
69 */
70declare const EMBER_INSPECTOR = "bmdblncegkenkacieihfhpjfppoconhi";
71/**
72 * jQuery Debugger
73 * @see https://chromewebstore.google.com/detail/dbhhnnnpaeobfddmlalhnehgclcmjimi
74 */
75declare const JQUERY_DEBUGGER = "dbhhnnnpaeobfddmlalhnehgclcmjimi";
76/**
77 * MobX Developer Tools
78 * @see https://chromewebstore.google.com/detail/pfgnfdagidkfgccljigdamigbcnndkod
79 */
80declare const MOBX_DEVTOOLS = "pfgnfdagidkfgccljigdamigbcnndkod";
81/**
82 * React Developer Tools
83 * @see https://chromewebstore.google.com/detail/fmkadmapgofadopljbjfkapdkoienihi
84 */
85declare const REACT_DEVELOPER_TOOLS = "fmkadmapgofadopljbjfkapdkoienihi";
86/**
87 * Redux Devtools
88 * @see https://chromewebstore.google.com/detail/lmhkpmbekcpmknklioeibfkpmmfibljd
89 */
90declare const REDUX_DEVTOOLS = "lmhkpmbekcpmknklioeibfkpmmfibljd";
91/**
92 * Vue.js devtools
93 * @see https://chromewebstore.google.com/detail/nhdogjmejiglipccpnnnanhbledajbpd
94 */
95declare const VUEJS_DEVTOOLS = "nhdogjmejiglipccpnnnanhbledajbpd";
96/**
97 * All supported extensions
98 */
99declare const EXTENSIONS: string[];
100
101/**
102 * Install extension options.
103 */
104interface InstallOptions {
105 /**
106 * Force to download the extension even if it's already installed. Default is `false`.
107 * @default false
108 */
109 forceDownload?: boolean;
110 /**
111 * Options for loading an unpacked extension.
112 * @see https://www.electronjs.org/docs/latest/api/session#sesloadextensionpath-options
113 */
114 loadExtensionOptions?: Electron.LoadExtensionOptions;
115 /**
116 * Download url source. When the OS language is `zh_CN` , the default value is `npmmirror`, otherwise it is `chrome`.
117 * @see https://www.npmjs.com/package/@tomjs/electron-devtools-files
118 * @default "chrome"
119 */
120 source?: 'chrome' | 'unpkg' | 'jsdelivr' | 'npmmirror';
121 /**
122 * The target session on which the extension shall be installed, default is `session.defaultSession`.
123 */
124 session?: string | Session;
125}
126/**
127 * Install Chrome extension for Electron
128 * @param extensionIds Extension id or ids
129 * @param options Install options
130 */
131declare function installExtension(extensionIds: string, options?: InstallOptions): Promise<Electron.Extension>;
132declare function installExtension(extensionIds: string[], options?: InstallOptions): Promise<Electron.Extension[]>;
133
134export { ANGULAR_DEVTOOLS, APOLLO_CLIENT_TOOLS, BACKBONE_DEBUGGER, EMBER_INSPECTOR, EXTENSIONS, type InstallOptions, JQUERY_DEBUGGER, MOBX_DEVTOOLS, REACT_DEVELOPER_TOOLS, REDUX_DEVTOOLS, VUEJS_DEVTOOLS, installExtension as default, downloadExtension, downloadFile, installExtension };