electron-screenshots 0.5.27 → 0.5.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,231 +1,248 @@
1
- # electron-screenshots
2
-
3
- > electron 截图插件
4
-
5
- ## Prerequisites
6
-
7
- - electron >= 11
8
-
9
- ## Install
10
-
11
- [![NPM](https://nodei.co/npm/electron-screenshots.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/electron-screenshots/)
12
-
13
- ## Usage
14
-
15
- ```ts
16
- import debug from "electron-debug";
17
- import { app, globalShortcut } from "electron";
18
- import Screenshots from "./screenshots";
19
-
20
- app.whenReady().then(() => {
21
- const screenshots = new Screenshots();
22
- globalShortcut.register("ctrl+shift+a", () => {
23
- screenshots.startCapture();
24
- screenshots.$view.webContents.openDevTools();
25
- });
26
- // 点击确定按钮回调事件
27
- screenshots.on("ok", (e, buffer, bounds) => {
28
- console.log("capture", buffer, bounds);
29
- });
30
- // 点击取消按钮回调事件
31
- screenshots.on("cancel", () => {
32
- console.log("capture", "cancel1");
33
- });
34
- screenshots.on("cancel", (e) => {
35
- // 执行了preventDefault
36
- // 点击取消不会关闭截图窗口
37
- e.preventDefault();
38
- console.log("capture", "cancel2");
39
- });
40
- // 点击保存按钮回调事件
41
- screenshots.on("save", (e, buffer, bounds) => {
42
- console.log("capture", buffer, bounds);
43
- });
44
- // 保存后的回调事件
45
- screenshots.on("afterSave", (e, buffer, bounds, isSaved) => {
46
- console.log("capture", buffer, bounds);
47
- console.log("isSaved", isSaved) // 是否保存成功
48
- });
49
- debug({ showDevTools: true, devToolsMode: "undocked" });
50
- });
51
-
52
- app.on("window-all-closed", () => {
53
- if (process.platform !== "darwin") {
54
- app.quit();
55
- }
56
- });
57
- ```
58
-
59
- ### 注意
60
-
61
- - 如果使用了 webpack 打包主进程,请在主进程 webpack 配置中修改如下配置,否则可能会出现不能调用截图窗口的情况
62
-
63
- ```js
64
- {
65
- externals: {
66
- 'electron-screenshots': 'require("electron-screenshots")'
67
- }
68
- }
69
- ```
70
-
71
- - `vue-cli-plugin-electron-builder`配置示例[vue-cli-plugin-electron-builder-issue](https://github.com/nashaofu/vue-cli-plugin-electron-builder-issue/blob/0f774a90b09e10b02f86fcb6b50645058fe1a4e8/vue.config.js#L1-L8)
72
-
73
- ```js
74
- // vue.config.js
75
- module.exports = {
76
- publicPath: ".",
77
- pluginOptions: {
78
- electronBuilder: {
79
- // 不打包,使用 require 加载
80
- externals: ["electron-screenshots"],
81
- },
82
- },
83
- };
84
- ```
85
-
86
- - esc 取消截图,可用以下代码实现按 esc 取消截图
87
-
88
- ```js
89
- globalShortcut.register("esc", () => {
90
- if (screenshots.$win?.isFocused()) {
91
- screenshots.endCapture();
92
- }
93
- });
94
- ```
95
-
96
- - 加速截图界面展示,不销毁`BrowserWindow`,减少创建窗口的开销,可用以下代码实现。**需注意,启用该功能,会导致`window-all-closed`事件不触发,因此需要手动关闭截图窗口**
97
-
98
- ```js
99
- // 是否复用截图窗口,加快截图窗口显示,默认值为 false
100
- // 如果设置为 true 则会在第一次调用截图窗口时创建,后续调用时直接使用
101
- // 且由于窗口不会 close,所以不会触发 app 的 `window-all-closed` 事件
102
- const screenshots = new Screenshots({
103
- singleWindow: true,
104
- });
105
- ```
106
-
107
- ## Methods
108
-
109
- - `Debugger`类型产考[debug](https://github.com/debug-js/debug)中的`Debugger`类型
110
-
111
- ```ts
112
- export type LoggerFn = (...args: unknown[]) => void;
113
- export type Logger = Debugger | LoggerFn;
114
-
115
- export interface Lang {
116
- magnifier_position_label?: string;
117
- operation_ok_title?: string;
118
- operation_cancel_title?: string;
119
- operation_save_title?: string;
120
- operation_redo_title?: string;
121
- operation_undo_title?: string;
122
- operation_mosaic_title?: string;
123
- operation_text_title?: string;
124
- operation_brush_title?: string;
125
- operation_arrow_title?: string;
126
- operation_ellipse_title?: string;
127
- operation_rectangle_title?: string;
128
- }
129
-
130
- export interface ScreenshotsOpts {
131
- lang?: Lang;
132
- // 调用日志,默认值为 debug('electron-screenshots')
133
- // debug https://www.npmjs.com/package/debug
134
- logger?: Logger;
135
- // 是否复用截图窗口,加快截图窗口显示,默认值为 false
136
- // 如果设置为 true 则会在第一次调用截图窗口时创建,后续调用时直接使用
137
- // 且由于窗口不会 close,所以不会触发 app 的 `window-all-closed` 事件
138
- singleWindow?: boolean;
139
- }
140
- ```
141
-
142
- | 名称 | 说明 | 返回值 |
143
- | ------------------------------------------------- | ---------------- | ------ |
144
- | `constructor(opts: ScreenshotsOpts): Screenshots` | 调用截图方法截图 | - |
145
- | `startCapture(): Promise<void>` | 调用截图方法截图 | - |
146
- | `endCapture(): Promise<void>` | 手动结束截图 | - |
147
- | `setLang(lang: Lang): Promise<void>` | 修改语言 | - |
148
-
149
- ## Events
150
-
151
- - 数据类型
152
-
153
- ```ts
154
- interface Bounds {
155
- x: number;
156
- y: number;
157
- width: number;
158
- height: number;
159
- }
160
-
161
- export interface Display {
162
- id: number;
163
- x: number;
164
- y: number;
165
- width: number;
166
- height: number;
167
- }
168
-
169
- export interface ScreenshotsData {
170
- bounds: Bounds;
171
- display: Display;
172
- }
173
-
174
- class Event {
175
- public defaultPrevented = false;
176
-
177
- public preventDefault(): void {
178
- this.defaultPrevented = true;
179
- }
180
- }
181
- ```
182
-
183
- | 名称 | 说明 | 回调参数 |
184
- | ------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------- |
185
- | ok | 截图确认事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData) => void` |
186
- | cancel | 截图取消事件 | `(event: Event) => void` |
187
- | save | 截图保存事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData) => void` |
188
- | afterSave | 截图保存(取消保存)后的事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData, isSaved: boolean) => void` |
189
- | windowCreated | 截图窗口被创建后触发 | `($win: BrowserWindow) => void` |
190
- | windowClosed | 截图窗口被关闭后触发,对`BrowserWindow` `closed` 事件的转发 | `($win: BrowserWindow) => void` |
191
-
192
- ### 说明
193
-
194
- - event: 事件对象
195
- - buffer: png 图片 buffer
196
- - bounds: 截图区域信息
197
- - display: 截图的屏幕
198
- - `event`对象可调用`preventDefault`方法来阻止默认事件,例如阻止默认保存事件
199
-
200
- ```ts
201
- const screenshots = new Screenshots({
202
- lang: {
203
- magnifier_position_label: "Position",
204
- operation_ok_title: "Ok",
205
- operation_cancel_title: "Cancel",
206
- operation_save_title: "Save",
207
- operation_redo_title: "Redo",
208
- operation_undo_title: "Undo",
209
- operation_mosaic_title: "Mosaic",
210
- operation_text_title: "Text",
211
- operation_brush_title: "Brush",
212
- operation_arrow_title: "Arrow",
213
- operation_ellipse_title: "Ellipse",
214
- operation_rectangle_title: "Rectangle",
215
- },
216
- });
217
-
218
- screenshots.on("save", (e, buffer, data) => {
219
- // 阻止插件自带的保存功能
220
- // 用户自己控制保存功能
221
- e.preventDefault();
222
- // 用户可在这里自己定义保存功能
223
- console.log("capture", buffer, data);
224
- });
225
-
226
- screenshots.startCapture();
227
- ```
228
-
229
- ## Screenshot
230
-
231
- ![screenshot](../../screenshot.jpg)
1
+ # electron-screenshots
2
+
3
+ > electron 截图插件
4
+
5
+ ## Prerequisites
6
+
7
+ - electron >= 11
8
+
9
+ ## Install
10
+
11
+ [![NPM](https://nodei.co/npm/electron-screenshots.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/electron-screenshots/)
12
+
13
+ ## Usage
14
+
15
+ ```ts
16
+ import debug from "electron-debug";
17
+ import { app, globalShortcut } from "electron";
18
+ import Screenshots from "./screenshots";
19
+
20
+ app.whenReady().then(() => {
21
+ app.setAppUserModelId('com.electron.screenshots')
22
+ const screenshots = new Screenshots();
23
+ globalShortcut.register("ctrl+shift+a", () => {
24
+ screenshots.startCapture();
25
+ screenshots.$view.webContents.openDevTools();
26
+ });
27
+ // 点击确定按钮回调事件
28
+ screenshots.on("ok", (e, buffer, bounds) => {
29
+ console.log("capture", buffer, bounds);
30
+ });
31
+ // 点击取消按钮回调事件
32
+ screenshots.on("cancel", () => {
33
+ console.log("capture", "cancel1");
34
+ });
35
+ screenshots.on("cancel", (e) => {
36
+ // 执行了preventDefault
37
+ // 点击取消不会关闭截图窗口
38
+ e.preventDefault();
39
+ console.log("capture", "cancel2");
40
+ });
41
+ // 点击保存按钮回调事件
42
+ screenshots.on("save", (e, buffer, bounds) => {
43
+ console.log("capture", buffer, bounds);
44
+ });
45
+ // 保存后的回调事件
46
+ screenshots.on("afterSave", (e, buffer, bounds, isSaved) => {
47
+ console.log("capture", buffer, bounds);
48
+ console.log("isSaved", isSaved); // 是否保存成功
49
+ });
50
+ debug({ showDevTools: true, devToolsMode: "undocked" });
51
+ });
52
+
53
+ app.on("window-all-closed", () => {
54
+ if (process.platform !== "darwin") {
55
+ app.quit();
56
+ }
57
+ });
58
+ ```
59
+
60
+ ### 注意
61
+
62
+ - 如果使用了 webpack 打包主进程,请在主进程 webpack 配置中修改如下配置,否则可能会出现不能调用截图窗口的情况
63
+
64
+ ```js
65
+ {
66
+ externals: {
67
+ 'electron-screenshots': 'require("electron-screenshots")'
68
+ }
69
+ }
70
+ ```
71
+
72
+ - `vue-cli-plugin-electron-builder`配置示例[vue-cli-plugin-electron-builder-issue](https://github.com/nashaofu/vue-cli-plugin-electron-builder-issue/blob/0f774a90b09e10b02f86fcb6b50645058fe1a4e8/vue.config.js#L1-L8)
73
+
74
+ ```js
75
+ // vue.config.js
76
+ module.exports = {
77
+ publicPath: ".",
78
+ pluginOptions: {
79
+ electronBuilder: {
80
+ // 不打包,使用 require 加载
81
+ externals: ["electron-screenshots"],
82
+ },
83
+ },
84
+ };
85
+ ```
86
+
87
+ - vite 配置示例:
88
+
89
+ ```js
90
+ // vite.config.js
91
+ import { defineConfig } from "vite";
92
+ import viteExternals from "vite-plugin-externals";
93
+
94
+ export default defineConfig({
95
+ plugins: [
96
+ viteExternals({
97
+ "electron-screenshots": 'require("electron-screenshots")', // 模块名称: 全局变量
98
+ }),
99
+ ],
100
+ });
101
+ ```
102
+
103
+ - esc 取消截图,可用以下代码实现按 esc 取消截图
104
+
105
+ ```js
106
+ globalShortcut.register("esc", () => {
107
+ if (screenshots.$win?.isFocused()) {
108
+ screenshots.endCapture();
109
+ }
110
+ });
111
+ ```
112
+
113
+ - 加速截图界面展示,不销毁`BrowserWindow`,减少创建窗口的开销,可用以下代码实现。**需注意,启用该功能,会导致`window-all-closed`事件不触发,因此需要手动关闭截图窗口**
114
+
115
+ ```js
116
+ // 是否复用截图窗口,加快截图窗口显示,默认值为 false
117
+ // 如果设置为 true 则会在第一次调用截图窗口时创建,后续调用时直接使用
118
+ // 且由于窗口不会 close,所以不会触发 app 的 `window-all-closed` 事件
119
+ const screenshots = new Screenshots({
120
+ singleWindow: true,
121
+ });
122
+ ```
123
+
124
+ ## Methods
125
+
126
+ - `Debugger`类型产考[debug](https://github.com/debug-js/debug)中的`Debugger`类型
127
+
128
+ ```ts
129
+ export type LoggerFn = (...args: unknown[]) => void;
130
+ export type Logger = Debugger | LoggerFn;
131
+
132
+ export interface Lang {
133
+ magnifier_position_label?: string;
134
+ operation_ok_title?: string;
135
+ operation_cancel_title?: string;
136
+ operation_save_title?: string;
137
+ operation_redo_title?: string;
138
+ operation_undo_title?: string;
139
+ operation_mosaic_title?: string;
140
+ operation_text_title?: string;
141
+ operation_brush_title?: string;
142
+ operation_arrow_title?: string;
143
+ operation_ellipse_title?: string;
144
+ operation_rectangle_title?: string;
145
+ }
146
+
147
+ export interface ScreenshotsOpts {
148
+ lang?: Lang;
149
+ // 调用日志,默认值为 debug('electron-screenshots')
150
+ // debug https://www.npmjs.com/package/debug
151
+ logger?: Logger;
152
+ // 是否复用截图窗口,加快截图窗口显示,默认值为 false
153
+ // 如果设置为 true 则会在第一次调用截图窗口时创建,后续调用时直接使用
154
+ // 且由于窗口不会 close,所以不会触发 app 的 `window-all-closed` 事件
155
+ singleWindow?: boolean;
156
+ }
157
+ ```
158
+
159
+ | 名称 | 说明 | 返回值 |
160
+ | ------------------------------------------------- | ---------------- | ------ |
161
+ | `constructor(opts: ScreenshotsOpts): Screenshots` | 调用截图方法截图 | - |
162
+ | `startCapture(): Promise<void>` | 调用截图方法截图 | - |
163
+ | `endCapture(): Promise<void>` | 手动结束截图 | - |
164
+ | `setLang(lang: Lang): Promise<void>` | 修改语言 | - |
165
+
166
+ ## Events
167
+
168
+ - 数据类型
169
+
170
+ ```ts
171
+ interface Bounds {
172
+ x: number;
173
+ y: number;
174
+ width: number;
175
+ height: number;
176
+ }
177
+
178
+ export interface Display {
179
+ id: number;
180
+ x: number;
181
+ y: number;
182
+ width: number;
183
+ height: number;
184
+ }
185
+
186
+ export interface ScreenshotsData {
187
+ bounds: Bounds;
188
+ display: Display;
189
+ }
190
+
191
+ class Event {
192
+ public defaultPrevented = false;
193
+
194
+ public preventDefault(): void {
195
+ this.defaultPrevented = true;
196
+ }
197
+ }
198
+ ```
199
+
200
+ | 名称 | 说明 | 回调参数 |
201
+ | ------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------- |
202
+ | ok | 截图确认事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData) => void` |
203
+ | cancel | 截图取消事件 | `(event: Event) => void` |
204
+ | save | 截图保存事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData) => void` |
205
+ | afterSave | 截图保存(取消保存)后的事件 | `(event: Event, buffer: Buffer, data: ScreenshotsData, isSaved: boolean) => void` |
206
+ | windowCreated | 截图窗口被创建后触发 | `($win: BrowserWindow) => void` |
207
+ | windowClosed | 截图窗口被关闭后触发,对`BrowserWindow` `closed` 事件的转发 | `($win: BrowserWindow) => void` |
208
+
209
+ ### 说明
210
+
211
+ - event: 事件对象
212
+ - buffer: png 图片 buffer
213
+ - bounds: 截图区域信息
214
+ - display: 截图的屏幕
215
+ - `event`对象可调用`preventDefault`方法来阻止默认事件,例如阻止默认保存事件
216
+
217
+ ```ts
218
+ const screenshots = new Screenshots({
219
+ lang: {
220
+ magnifier_position_label: "Position",
221
+ operation_ok_title: "Ok",
222
+ operation_cancel_title: "Cancel",
223
+ operation_save_title: "Save",
224
+ operation_redo_title: "Redo",
225
+ operation_undo_title: "Undo",
226
+ operation_mosaic_title: "Mosaic",
227
+ operation_text_title: "Text",
228
+ operation_brush_title: "Brush",
229
+ operation_arrow_title: "Arrow",
230
+ operation_ellipse_title: "Ellipse",
231
+ operation_rectangle_title: "Rectangle",
232
+ },
233
+ });
234
+
235
+ screenshots.on("save", (e, buffer, data) => {
236
+ // 阻止插件自带的保存功能
237
+ // 用户自己控制保存功能
238
+ e.preventDefault();
239
+ // 用户可在这里自己定义保存功能
240
+ console.log("capture", buffer, data);
241
+ });
242
+
243
+ screenshots.startCapture();
244
+ ```
245
+
246
+ ## Screenshot
247
+
248
+ ![screenshot](../../screenshot.jpg)
package/lib/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Debugger } from 'debug';
3
2
  import { BrowserView, BrowserWindow } from 'electron';
4
3
  import Events from 'events';
package/lib/index.js CHANGED
@@ -30,13 +30,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
30
30
  }) : function(o, v) {
31
31
  o["default"] = v;
32
32
  });
33
- var __importStar = (this && this.__importStar) || function (mod) {
34
- if (mod && mod.__esModule) return mod;
35
- var result = {};
36
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
37
- __setModuleDefault(result, mod);
38
- return result;
39
- };
33
+ var __importStar = (this && this.__importStar) || (function () {
34
+ var ownKeys = function(o) {
35
+ ownKeys = Object.getOwnPropertyNames || function (o) {
36
+ var ar = [];
37
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
38
+ return ar;
39
+ };
40
+ return ownKeys(o);
41
+ };
42
+ return function (mod) {
43
+ if (mod && mod.__esModule) return mod;
44
+ var result = {};
45
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
46
+ __setModuleDefault(result, mod);
47
+ return result;
48
+ };
49
+ })();
40
50
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
41
51
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
42
52
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -47,8 +57,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
47
57
  });
48
58
  };
49
59
  var __generator = (this && this.__generator) || function (thisArg, body) {
50
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
51
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
60
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
61
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
52
62
  function verb(n) { return function (v) { return step([n, v]); }; }
53
63
  function step(op) {
54
64
  if (f) throw new TypeError("Generator is already executing.");
@@ -213,10 +223,10 @@ var Screenshots = /** @class */ (function (_super) {
213
223
  * 初始化窗口
214
224
  */
215
225
  Screenshots.prototype.createWindow = function (display) {
216
- var _a, _b;
217
226
  return __awaiter(this, void 0, void 0, function () {
218
227
  var windowTypes;
219
228
  var _this = this;
229
+ var _a, _b;
220
230
  return __generator(this, function (_c) {
221
231
  switch (_c.label) {
222
232
  case 0:
@@ -310,7 +320,7 @@ var Screenshots = /** @class */ (function (_super) {
310
320
  };
311
321
  Screenshots.prototype.capture = function (display) {
312
322
  return __awaiter(this, void 0, void 0, function () {
313
- var Monitor, monitor, image, buffer, err_1, sources, source;
323
+ var Monitor, point, monitor, image, buffer, err_1, sources, source;
314
324
  return __generator(this, function (_a) {
315
325
  switch (_a.label) {
316
326
  case 0:
@@ -321,7 +331,14 @@ var Screenshots = /** @class */ (function (_super) {
321
331
  return [4 /*yield*/, Promise.resolve().then(function () { return __importStar(require('node-screenshots')); })];
322
332
  case 2:
323
333
  Monitor = (_a.sent()).Monitor;
324
- monitor = Monitor.fromPoint(display.x + display.width / 2, display.y + display.height / 2);
334
+ point = {
335
+ x: display.x + display.width / 2,
336
+ y: display.y + display.height / 2,
337
+ };
338
+ if (process.platform === 'win32') {
339
+ point = electron_1.screen.screenToDipPoint(point);
340
+ }
341
+ monitor = Monitor.fromPoint(point.x, point.y);
325
342
  this.logger('SCREENSHOTS:capture Monitor.fromPoint arguments %o', display);
326
343
  this.logger('SCREENSHOTS:capture Monitor.fromPoint return %o', {
327
344
  id: monitor === null || monitor === void 0 ? void 0 : monitor.id,
package/lib/padStart.js CHANGED
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = padStart;
3
4
  /**
4
5
  * 如果string字符串长度小于 length 则在左侧填充字符
5
6
  * 如果超出length长度则截断超出的部分。
@@ -16,4 +17,3 @@ function padStart(string, length, chars) {
16
17
  }
17
18
  return str;
18
19
  }
19
- exports.default = padStart;
package/package.json CHANGED
@@ -1,63 +1,62 @@
1
- {
2
- "name": "electron-screenshots",
3
- "version": "0.5.27",
4
- "description": "electron 截图插件",
5
- "types": "lib/index.d.ts",
6
- "main": "lib/index.cjs.js",
7
- "module": "lib/index.js",
8
- "files": [
9
- "lib/**"
10
- ],
11
- "scripts": {
12
- "prepublishOnly": "npm run build",
13
- "start": "cross-env DEBUG=electron-screenshots electron lib/demo.js",
14
- "dev": "tsc --sourceMap --watch",
15
- "build": "npm run lint && npm run clean && tsc",
16
- "lint": "eslint . --ext .js,.ts --fix",
17
- "clean": "rimraf lib"
18
- },
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/nashaofu/screenshots.git"
22
- },
23
- "keywords": [
24
- "electron",
25
- "shortcut",
26
- "screenshot",
27
- "cropper"
28
- ],
29
- "author": "nashaofu",
30
- "license": "MIT",
31
- "bugs": {
32
- "url": "https://github.com/nashaofu/screenshots/issues"
33
- },
34
- "homepage": "https://github.com/nashaofu/screenshots/tree/master/packages/electron-screenshots#readme",
35
- "publishConfig": {
36
- "registry": "https://registry.npmjs.org/"
37
- },
38
- "dependencies": {
39
- "debug": "^4.3.4",
40
- "fs-extra": "^11.1.1",
41
- "node-screenshots": "^0.2.1",
42
- "react-screenshots": "^0.5.22"
43
- },
44
- "peerDependencies": {
45
- "electron": ">=14"
46
- },
47
- "devDependencies": {
48
- "@types/debug": "^4.1.7",
49
- "@types/fs-extra": "^11.0.1",
50
- "@types/node": "^18.15.11",
51
- "@typescript-eslint/eslint-plugin": "^5.57.0",
52
- "@typescript-eslint/parser": "^5.57.0",
53
- "cross-env": "^7.0.3",
54
- "electron": "^23.2.0",
55
- "eslint": "^8.37.0",
56
- "eslint-config-airbnb-base": "^15.0.0",
57
- "eslint-config-airbnb-typescript": "^17.0.0",
58
- "eslint-plugin-import": "^2.27.5",
59
- "rimraf": "^4.4.1",
60
- "typescript": "^5.0.2"
61
- },
62
- "gitHead": "bde35a35bc1876098aa5d00c5c1ad088ab4fe9fb"
63
- }
1
+ {
2
+ "name": "electron-screenshots",
3
+ "version": "0.5.28",
4
+ "description": "electron 截图插件",
5
+ "types": "lib/index.d.ts",
6
+ "main": "lib/index.cjs.js",
7
+ "module": "lib/index.js",
8
+ "files": [
9
+ "lib/**"
10
+ ],
11
+ "scripts": {
12
+ "prepublishOnly": "npm run build",
13
+ "start": "cross-env DEBUG=electron-screenshots electron lib/demo.js",
14
+ "dev": "tsc --sourceMap --watch",
15
+ "build": "npm run lint && npm run clean && tsc",
16
+ "lint": "eslint . --ext .js,.ts --fix",
17
+ "clean": "rimraf lib"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/nashaofu/screenshots.git"
22
+ },
23
+ "keywords": [
24
+ "electron",
25
+ "shortcut",
26
+ "screenshot",
27
+ "cropper"
28
+ ],
29
+ "author": "nashaofu",
30
+ "license": "MIT",
31
+ "bugs": {
32
+ "url": "https://github.com/nashaofu/screenshots/issues"
33
+ },
34
+ "homepage": "https://github.com/nashaofu/screenshots/tree/master/packages/electron-screenshots#readme",
35
+ "publishConfig": {
36
+ "registry": "https://registry.npmjs.org/"
37
+ },
38
+ "dependencies": {
39
+ "debug": "^4.3.4",
40
+ "fs-extra": "^11.1.1",
41
+ "node-screenshots": "^0.2.1",
42
+ "react-screenshots": "^0.5.22"
43
+ },
44
+ "peerDependencies": {
45
+ "electron": ">=14"
46
+ },
47
+ "devDependencies": {
48
+ "@types/debug": "^4.1.7",
49
+ "@types/fs-extra": "^11.0.1",
50
+ "@types/node": "^18.15.11",
51
+ "@typescript-eslint/eslint-plugin": "^5.57.0",
52
+ "@typescript-eslint/parser": "^5.57.0",
53
+ "cross-env": "^7.0.3",
54
+ "electron": "^23.2.0",
55
+ "eslint": "^8.37.0",
56
+ "eslint-config-airbnb-base": "^15.0.0",
57
+ "eslint-config-airbnb-typescript": "^17.0.0",
58
+ "eslint-plugin-import": "^2.27.5",
59
+ "rimraf": "^4.4.1",
60
+ "typescript": "^5.0.2"
61
+ }
62
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2019 nashaofu
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.