@huyooo/file-explorer-bridge-electron 0.4.5 → 0.4.10
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/dist/main/index.cjs +17 -12
- package/dist/main/index.d.cts +15 -16
- package/dist/main/index.d.ts +15 -16
- package/dist/main/index.js +23 -9
- package/dist/preload/index.cjs +9 -9
- package/dist/preload/index.d.cts +8 -8
- package/dist/preload/index.d.ts +8 -8
- package/dist/preload/index.js +9 -8
- package/dist/renderer/index.cjs +6 -50
- package/dist/renderer/index.d.cts +86 -191
- package/dist/renderer/index.d.ts +86 -191
- package/dist/renderer/index.js +6 -50
- package/package.json +7 -10
package/dist/main/index.cjs
CHANGED
|
@@ -30,21 +30,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/main/index.ts
|
|
31
31
|
var main_exports = {};
|
|
32
32
|
__export(main_exports, {
|
|
33
|
-
|
|
34
|
-
electronUrlEncoder: () => electronUrlEncoder,
|
|
35
|
-
registerFileExplorerHandlers: () => registerFileExplorerHandlers,
|
|
36
|
-
setClipboardAdapter: () => setClipboardAdapter
|
|
33
|
+
registerFileExplorer: () => registerFileExplorer
|
|
37
34
|
});
|
|
38
35
|
module.exports = __toCommonJS(main_exports);
|
|
39
36
|
var import_electron = require("electron");
|
|
40
37
|
var import_node_path = __toESM(require("path"), 1);
|
|
38
|
+
var import_node_url = require("url");
|
|
41
39
|
var import_file_explorer_core = require("@huyooo/file-explorer-core");
|
|
42
40
|
var import_node_fs = require("fs");
|
|
43
41
|
var import_path = require("@huyooo/file-explorer-preview/path");
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
42
|
+
var import_meta = {};
|
|
43
|
+
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
44
|
+
var DEFAULT_PREVIEW_CHANNEL_PREFIX = "file-explorer-preview";
|
|
45
|
+
var __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
48
46
|
var clipboardAdapter = null;
|
|
49
47
|
function setClipboardAdapter(adapter) {
|
|
50
48
|
clipboardAdapter = adapter;
|
|
@@ -64,6 +62,10 @@ var explorerOptions = {};
|
|
|
64
62
|
var mediaPreviewWindows = /* @__PURE__ */ new Map();
|
|
65
63
|
function registerFileExplorerHandlers(options = {}) {
|
|
66
64
|
explorerOptions = options;
|
|
65
|
+
const channelPrefix = options.channelPrefix || DEFAULT_CHANNEL_PREFIX;
|
|
66
|
+
const previewChannelPrefix = options.previewChannelPrefix || DEFAULT_PREVIEW_CHANNEL_PREFIX;
|
|
67
|
+
const channel = (name) => `${channelPrefix}:${name}`;
|
|
68
|
+
const previewChannel = (name) => `${previewChannelPrefix}:${name}`;
|
|
67
69
|
const adapter = createElectronAdapter();
|
|
68
70
|
import_electron.ipcMain.handle(channel("readDirectory"), async (_event, dirPath) => {
|
|
69
71
|
const thumbnailService = (0, import_file_explorer_core.getThumbnailService)();
|
|
@@ -505,10 +507,13 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
505
507
|
});
|
|
506
508
|
console.log("\u2705 File Explorer IPC handlers registered");
|
|
507
509
|
}
|
|
510
|
+
function registerFileExplorer(options = {}) {
|
|
511
|
+
if (options.clipboardAdapter) {
|
|
512
|
+
setClipboardAdapter(options.clipboardAdapter);
|
|
513
|
+
}
|
|
514
|
+
registerFileExplorerHandlers(options);
|
|
515
|
+
}
|
|
508
516
|
// Annotate the CommonJS export names for ESM import in node:
|
|
509
517
|
0 && (module.exports = {
|
|
510
|
-
|
|
511
|
-
electronUrlEncoder,
|
|
512
|
-
registerFileExplorerHandlers,
|
|
513
|
-
setClipboardAdapter
|
|
518
|
+
registerFileExplorer
|
|
514
519
|
});
|
package/dist/main/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClipboardAdapter } from '@huyooo/file-explorer-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* File Explorer Electron Bridge - Main Process
|
|
@@ -6,26 +6,25 @@ import { PlatformAdapter, encodeFileUrl, ClipboardAdapter } from '@huyooo/file-e
|
|
|
6
6
|
* 只负责 IPC 通信,具体实现在 @huyooo/file-explorer-core 中
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* 设置剪贴板适配器
|
|
11
|
-
* 在主进程中调用,注入 clipboard-files 模块
|
|
12
|
-
*/
|
|
13
|
-
declare function setClipboardAdapter(adapter: ClipboardAdapter): void;
|
|
14
|
-
/**
|
|
15
|
-
* 创建 Electron 平台适配器
|
|
16
|
-
*/
|
|
17
|
-
declare function createElectronAdapter(): PlatformAdapter;
|
|
18
|
-
/** URL 编码器(使用 core 中的协议工具) */
|
|
19
|
-
declare const electronUrlEncoder: typeof encodeFileUrl;
|
|
20
9
|
/** 文件管理器配置选项 */
|
|
21
10
|
interface FileExplorerOptions {
|
|
22
11
|
/** 在新窗口中打开文件夹的回调 */
|
|
23
12
|
onOpenInNewWindow?: (folderPath: string) => void;
|
|
13
|
+
/** IPC 通道名称前缀(允许宿主自定义,避免冲突) */
|
|
14
|
+
channelPrefix?: string;
|
|
15
|
+
/** 预览窗口 IPC 通道前缀(一般不需要改) */
|
|
16
|
+
previewChannelPrefix?: string;
|
|
17
|
+
}
|
|
18
|
+
interface RegisterFileExplorerOptions extends FileExplorerOptions {
|
|
19
|
+
/** 注入剪贴板适配器(例如 clipboard-files) */
|
|
20
|
+
clipboardAdapter?: ClipboardAdapter;
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* 高层入口:注册 File Explorer(主进程)
|
|
24
|
+
*
|
|
25
|
+
* - 可选注入 `clipboardAdapter`
|
|
26
|
+
* - 可选自定义 `channelPrefix` 避免多实例冲突
|
|
28
27
|
*/
|
|
29
|
-
declare function
|
|
28
|
+
declare function registerFileExplorer(options?: RegisterFileExplorerOptions): void;
|
|
30
29
|
|
|
31
|
-
export { type FileExplorerOptions,
|
|
30
|
+
export { type FileExplorerOptions, type RegisterFileExplorerOptions, registerFileExplorer };
|
package/dist/main/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ClipboardAdapter } from '@huyooo/file-explorer-core';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* File Explorer Electron Bridge - Main Process
|
|
@@ -6,26 +6,25 @@ import { PlatformAdapter, encodeFileUrl, ClipboardAdapter } from '@huyooo/file-e
|
|
|
6
6
|
* 只负责 IPC 通信,具体实现在 @huyooo/file-explorer-core 中
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* 设置剪贴板适配器
|
|
11
|
-
* 在主进程中调用,注入 clipboard-files 模块
|
|
12
|
-
*/
|
|
13
|
-
declare function setClipboardAdapter(adapter: ClipboardAdapter): void;
|
|
14
|
-
/**
|
|
15
|
-
* 创建 Electron 平台适配器
|
|
16
|
-
*/
|
|
17
|
-
declare function createElectronAdapter(): PlatformAdapter;
|
|
18
|
-
/** URL 编码器(使用 core 中的协议工具) */
|
|
19
|
-
declare const electronUrlEncoder: typeof encodeFileUrl;
|
|
20
9
|
/** 文件管理器配置选项 */
|
|
21
10
|
interface FileExplorerOptions {
|
|
22
11
|
/** 在新窗口中打开文件夹的回调 */
|
|
23
12
|
onOpenInNewWindow?: (folderPath: string) => void;
|
|
13
|
+
/** IPC 通道名称前缀(允许宿主自定义,避免冲突) */
|
|
14
|
+
channelPrefix?: string;
|
|
15
|
+
/** 预览窗口 IPC 通道前缀(一般不需要改) */
|
|
16
|
+
previewChannelPrefix?: string;
|
|
17
|
+
}
|
|
18
|
+
interface RegisterFileExplorerOptions extends FileExplorerOptions {
|
|
19
|
+
/** 注入剪贴板适配器(例如 clipboard-files) */
|
|
20
|
+
clipboardAdapter?: ClipboardAdapter;
|
|
24
21
|
}
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* 高层入口:注册 File Explorer(主进程)
|
|
24
|
+
*
|
|
25
|
+
* - 可选注入 `clipboardAdapter`
|
|
26
|
+
* - 可选自定义 `channelPrefix` 避免多实例冲突
|
|
28
27
|
*/
|
|
29
|
-
declare function
|
|
28
|
+
declare function registerFileExplorer(options?: RegisterFileExplorerOptions): void;
|
|
30
29
|
|
|
31
|
-
export { type FileExplorerOptions,
|
|
30
|
+
export { type FileExplorerOptions, type RegisterFileExplorerOptions, registerFileExplorer };
|
package/dist/main/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// src/main/index.ts
|
|
2
2
|
import { ipcMain, shell, BrowserWindow } from "electron";
|
|
3
3
|
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
import fsSync from "fs";
|
|
4
6
|
import {
|
|
5
7
|
readDirectory,
|
|
6
8
|
readFileContent,
|
|
@@ -36,10 +38,9 @@ import {
|
|
|
36
38
|
} from "@huyooo/file-explorer-core";
|
|
37
39
|
import { promises as fs } from "fs";
|
|
38
40
|
import { getPreviewHtmlPath } from "@huyooo/file-explorer-preview/path";
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var previewChannel = (name) => `${PREVIEW_CHANNEL_PREFIX}:${name}`;
|
|
41
|
+
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
42
|
+
var DEFAULT_PREVIEW_CHANNEL_PREFIX = "file-explorer-preview";
|
|
43
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
43
44
|
var clipboardAdapter = null;
|
|
44
45
|
function setClipboardAdapter(adapter) {
|
|
45
46
|
clipboardAdapter = adapter;
|
|
@@ -59,6 +60,10 @@ var explorerOptions = {};
|
|
|
59
60
|
var mediaPreviewWindows = /* @__PURE__ */ new Map();
|
|
60
61
|
function registerFileExplorerHandlers(options = {}) {
|
|
61
62
|
explorerOptions = options;
|
|
63
|
+
const channelPrefix = options.channelPrefix || DEFAULT_CHANNEL_PREFIX;
|
|
64
|
+
const previewChannelPrefix = options.previewChannelPrefix || DEFAULT_PREVIEW_CHANNEL_PREFIX;
|
|
65
|
+
const channel = (name) => `${channelPrefix}:${name}`;
|
|
66
|
+
const previewChannel = (name) => `${previewChannelPrefix}:${name}`;
|
|
62
67
|
const adapter = createElectronAdapter();
|
|
63
68
|
ipcMain.handle(channel("readDirectory"), async (_event, dirPath) => {
|
|
64
69
|
const thumbnailService = getThumbnailService();
|
|
@@ -400,6 +405,13 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
400
405
|
const minWidth = minContentWidth;
|
|
401
406
|
const minHeight = minContentHeight + titleBarHeight;
|
|
402
407
|
const previewPreloadPath = path.join(__dirname, "../preload/preview.cjs");
|
|
408
|
+
const previewHtmlPath = getPreviewHtmlPath();
|
|
409
|
+
if (!fsSync.existsSync(previewPreloadPath)) {
|
|
410
|
+
return { success: false, error: `Preview preload not found: ${previewPreloadPath}` };
|
|
411
|
+
}
|
|
412
|
+
if (!fsSync.existsSync(previewHtmlPath)) {
|
|
413
|
+
return { success: false, error: `Preview html not found: ${previewHtmlPath}` };
|
|
414
|
+
}
|
|
403
415
|
const previewWindow = new BrowserWindow({
|
|
404
416
|
width,
|
|
405
417
|
height,
|
|
@@ -430,7 +442,6 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
430
442
|
webSecurity: false
|
|
431
443
|
}
|
|
432
444
|
});
|
|
433
|
-
const previewHtmlPath = getPreviewHtmlPath();
|
|
434
445
|
const searchParams = new URLSearchParams({
|
|
435
446
|
type: mediaType,
|
|
436
447
|
url: encodeURIComponent(fileUrl),
|
|
@@ -500,9 +511,12 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
500
511
|
});
|
|
501
512
|
console.log("\u2705 File Explorer IPC handlers registered");
|
|
502
513
|
}
|
|
514
|
+
function registerFileExplorer(options = {}) {
|
|
515
|
+
if (options.clipboardAdapter) {
|
|
516
|
+
setClipboardAdapter(options.clipboardAdapter);
|
|
517
|
+
}
|
|
518
|
+
registerFileExplorerHandlers(options);
|
|
519
|
+
}
|
|
503
520
|
export {
|
|
504
|
-
|
|
505
|
-
electronUrlEncoder,
|
|
506
|
-
registerFileExplorerHandlers,
|
|
507
|
-
setClipboardAdapter
|
|
521
|
+
registerFileExplorer
|
|
508
522
|
};
|
package/dist/preload/index.cjs
CHANGED
|
@@ -20,14 +20,14 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/preload/index.ts
|
|
21
21
|
var preload_exports = {};
|
|
22
22
|
__export(preload_exports, {
|
|
23
|
-
createFileExplorerAPI: () => createFileExplorerAPI,
|
|
24
23
|
exposeFileExplorerAPI: () => exposeFileExplorerAPI
|
|
25
24
|
});
|
|
26
25
|
module.exports = __toCommonJS(preload_exports);
|
|
27
26
|
var import_electron = require("electron");
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
28
|
+
function createFileExplorerAPI(options = {}) {
|
|
29
|
+
const channelPrefix = options.channelPrefix || DEFAULT_CHANNEL_PREFIX;
|
|
30
|
+
const channel = (name) => `${channelPrefix}:${name}`;
|
|
31
31
|
return {
|
|
32
32
|
readDirectory: (dirPath) => import_electron.ipcRenderer.invoke(channel("readDirectory"), dirPath),
|
|
33
33
|
readSystemPath: (pathId) => import_electron.ipcRenderer.invoke(channel("readSystemPath"), pathId),
|
|
@@ -57,8 +57,8 @@ function createFileExplorerAPI() {
|
|
|
57
57
|
import_electron.ipcRenderer.on(channel("searchResults"), handler);
|
|
58
58
|
return () => import_electron.ipcRenderer.removeListener(channel("searchResults"), handler);
|
|
59
59
|
},
|
|
60
|
-
compressFiles: (sources,
|
|
61
|
-
extractArchive: (archivePath,
|
|
60
|
+
compressFiles: (sources, options2) => import_electron.ipcRenderer.invoke(channel("compressFiles"), sources, options2),
|
|
61
|
+
extractArchive: (archivePath, options2) => import_electron.ipcRenderer.invoke(channel("extractArchive"), archivePath, options2),
|
|
62
62
|
isArchiveFile: (filePath) => import_electron.ipcRenderer.invoke(channel("isArchiveFile"), filePath),
|
|
63
63
|
onCompressProgress: (callback) => {
|
|
64
64
|
const handler = (_event, data) => {
|
|
@@ -105,13 +105,13 @@ function createFileExplorerAPI() {
|
|
|
105
105
|
closeMediaPreviewWindow: (filePath) => import_electron.ipcRenderer.invoke(channel("closeMediaPreviewWindow"), filePath)
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
function exposeFileExplorerAPI(
|
|
109
|
-
const
|
|
108
|
+
function exposeFileExplorerAPI(options = {}) {
|
|
109
|
+
const apiName = options.apiName || "fileExplorerAPI";
|
|
110
|
+
const api = createFileExplorerAPI({ channelPrefix: options.channelPrefix });
|
|
110
111
|
import_electron.contextBridge.exposeInMainWorld(apiName, api);
|
|
111
112
|
console.log(`\u2705 File Explorer API exposed as window.${apiName}`);
|
|
112
113
|
}
|
|
113
114
|
// Annotate the CommonJS export names for ESM import in node:
|
|
114
115
|
0 && (module.exports = {
|
|
115
|
-
createFileExplorerAPI,
|
|
116
116
|
exposeFileExplorerAPI
|
|
117
117
|
});
|
package/dist/preload/index.d.cts
CHANGED
|
@@ -260,19 +260,19 @@ interface FileExplorerAPI {
|
|
|
260
260
|
error?: string;
|
|
261
261
|
}>;
|
|
262
262
|
}
|
|
263
|
-
/**
|
|
264
|
-
* 创建文件操作 API
|
|
265
|
-
*/
|
|
266
|
-
declare function createFileExplorerAPI(): FileExplorerAPI;
|
|
267
263
|
/**
|
|
268
264
|
* 暴露文件操作 API 到渲染进程
|
|
269
265
|
*
|
|
270
266
|
* 在 preload.ts 中调用:
|
|
271
267
|
* ```ts
|
|
272
|
-
* import { exposeFileExplorerAPI } from '@
|
|
273
|
-
* exposeFileExplorerAPI();
|
|
268
|
+
* import { exposeFileExplorerAPI } from '@huyooo/file-explorer-bridge-electron/preload';
|
|
269
|
+
* exposeFileExplorerAPI({});
|
|
274
270
|
* ```
|
|
275
271
|
*/
|
|
276
|
-
|
|
272
|
+
interface ExposeFileExplorerAPIOptions {
|
|
273
|
+
apiName?: string;
|
|
274
|
+
channelPrefix?: string;
|
|
275
|
+
}
|
|
276
|
+
declare function exposeFileExplorerAPI(options?: ExposeFileExplorerAPIOptions): void;
|
|
277
277
|
|
|
278
|
-
export { type
|
|
278
|
+
export { type ExposeFileExplorerAPIOptions, type FileExplorerAPI, exposeFileExplorerAPI };
|
package/dist/preload/index.d.ts
CHANGED
|
@@ -260,19 +260,19 @@ interface FileExplorerAPI {
|
|
|
260
260
|
error?: string;
|
|
261
261
|
}>;
|
|
262
262
|
}
|
|
263
|
-
/**
|
|
264
|
-
* 创建文件操作 API
|
|
265
|
-
*/
|
|
266
|
-
declare function createFileExplorerAPI(): FileExplorerAPI;
|
|
267
263
|
/**
|
|
268
264
|
* 暴露文件操作 API 到渲染进程
|
|
269
265
|
*
|
|
270
266
|
* 在 preload.ts 中调用:
|
|
271
267
|
* ```ts
|
|
272
|
-
* import { exposeFileExplorerAPI } from '@
|
|
273
|
-
* exposeFileExplorerAPI();
|
|
268
|
+
* import { exposeFileExplorerAPI } from '@huyooo/file-explorer-bridge-electron/preload';
|
|
269
|
+
* exposeFileExplorerAPI({});
|
|
274
270
|
* ```
|
|
275
271
|
*/
|
|
276
|
-
|
|
272
|
+
interface ExposeFileExplorerAPIOptions {
|
|
273
|
+
apiName?: string;
|
|
274
|
+
channelPrefix?: string;
|
|
275
|
+
}
|
|
276
|
+
declare function exposeFileExplorerAPI(options?: ExposeFileExplorerAPIOptions): void;
|
|
277
277
|
|
|
278
|
-
export { type
|
|
278
|
+
export { type ExposeFileExplorerAPIOptions, type FileExplorerAPI, exposeFileExplorerAPI };
|
package/dist/preload/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// src/preload/index.ts
|
|
2
2
|
import { contextBridge, ipcRenderer } from "electron";
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
4
|
+
function createFileExplorerAPI(options = {}) {
|
|
5
|
+
const channelPrefix = options.channelPrefix || DEFAULT_CHANNEL_PREFIX;
|
|
6
|
+
const channel = (name) => `${channelPrefix}:${name}`;
|
|
6
7
|
return {
|
|
7
8
|
readDirectory: (dirPath) => ipcRenderer.invoke(channel("readDirectory"), dirPath),
|
|
8
9
|
readSystemPath: (pathId) => ipcRenderer.invoke(channel("readSystemPath"), pathId),
|
|
@@ -32,8 +33,8 @@ function createFileExplorerAPI() {
|
|
|
32
33
|
ipcRenderer.on(channel("searchResults"), handler);
|
|
33
34
|
return () => ipcRenderer.removeListener(channel("searchResults"), handler);
|
|
34
35
|
},
|
|
35
|
-
compressFiles: (sources,
|
|
36
|
-
extractArchive: (archivePath,
|
|
36
|
+
compressFiles: (sources, options2) => ipcRenderer.invoke(channel("compressFiles"), sources, options2),
|
|
37
|
+
extractArchive: (archivePath, options2) => ipcRenderer.invoke(channel("extractArchive"), archivePath, options2),
|
|
37
38
|
isArchiveFile: (filePath) => ipcRenderer.invoke(channel("isArchiveFile"), filePath),
|
|
38
39
|
onCompressProgress: (callback) => {
|
|
39
40
|
const handler = (_event, data) => {
|
|
@@ -80,12 +81,12 @@ function createFileExplorerAPI() {
|
|
|
80
81
|
closeMediaPreviewWindow: (filePath) => ipcRenderer.invoke(channel("closeMediaPreviewWindow"), filePath)
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
|
-
function exposeFileExplorerAPI(
|
|
84
|
-
const
|
|
84
|
+
function exposeFileExplorerAPI(options = {}) {
|
|
85
|
+
const apiName = options.apiName || "fileExplorerAPI";
|
|
86
|
+
const api = createFileExplorerAPI({ channelPrefix: options.channelPrefix });
|
|
85
87
|
contextBridge.exposeInMainWorld(apiName, api);
|
|
86
88
|
console.log(`\u2705 File Explorer API exposed as window.${apiName}`);
|
|
87
89
|
}
|
|
88
90
|
export {
|
|
89
|
-
createFileExplorerAPI,
|
|
90
91
|
exposeFileExplorerAPI
|
|
91
92
|
};
|
package/dist/renderer/index.cjs
CHANGED
|
@@ -20,60 +20,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/renderer/index.ts
|
|
21
21
|
var renderer_exports = {};
|
|
22
22
|
__export(renderer_exports, {
|
|
23
|
-
|
|
23
|
+
createFileExplorerClient: () => createFileExplorerClient
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(renderer_exports);
|
|
26
|
-
function
|
|
27
|
-
const api = window.fileExplorerAPI;
|
|
26
|
+
function createFileExplorerClient(apiName = "fileExplorerAPI") {
|
|
27
|
+
const api = apiName === "fileExplorerAPI" ? window.fileExplorerAPI : window[apiName];
|
|
28
28
|
if (!api) {
|
|
29
29
|
throw new Error(
|
|
30
|
-
|
|
30
|
+
`window.${apiName} not found. Make sure to call exposeFileExplorerAPI({ apiName }) in your preload script.`
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
readSystemPath: (pathId) => api.readSystemPath(pathId),
|
|
36
|
-
getSystemPath: (pathId) => api.getSystemPath(pathId),
|
|
37
|
-
readFileContent: (filePath) => api.readFileContent(filePath),
|
|
38
|
-
writeFileContent: (filePath, content) => api.writeFileContent(filePath, content),
|
|
39
|
-
createFolder: (parentDir, folderName) => api.createFolder(parentDir, folderName),
|
|
40
|
-
createFile: (parentDir, fileName, content) => api.createFile(parentDir, fileName, content),
|
|
41
|
-
deleteFiles: (paths) => api.deleteFiles(paths),
|
|
42
|
-
renameFile: (oldPath, newPath) => api.renameFile(oldPath, newPath),
|
|
43
|
-
copyFiles: (sourcePaths, targetDir) => api.copyFiles(sourcePaths, targetDir),
|
|
44
|
-
moveFiles: (sourcePaths, targetDir) => api.moveFiles(sourcePaths, targetDir),
|
|
45
|
-
getFileInfo: (filePath) => api.getFileInfo(filePath),
|
|
46
|
-
readImageAsBase64: (imagePath) => api.readImageAsBase64(imagePath),
|
|
47
|
-
openPath: (filePath) => api.openPath(filePath),
|
|
48
|
-
getApplicationIcon: (appPath) => api.getApplicationIcon(appPath),
|
|
49
|
-
getThumbnailUrl: (filePath) => api.getThumbnailUrl(filePath),
|
|
50
|
-
copyFilesToClipboard: (filePaths) => api.copyFilesToClipboard(filePaths),
|
|
51
|
-
getClipboardFiles: () => api.getClipboardFiles(),
|
|
52
|
-
pasteFiles: (targetDir, sourcePaths) => api.pasteFiles(targetDir, sourcePaths),
|
|
53
|
-
searchFiles: (searchPath, pattern, maxDepth) => api.searchFiles(searchPath, pattern, maxDepth),
|
|
54
|
-
searchFilesStream: (searchPath, pattern, searchId) => api.searchFilesStream(searchPath, pattern, searchId),
|
|
55
|
-
onSearchResults: (callback) => api.onSearchResults(callback),
|
|
56
|
-
compressFiles: (sources, options) => api.compressFiles(sources, options),
|
|
57
|
-
extractArchive: (archivePath, options) => api.extractArchive(archivePath, options),
|
|
58
|
-
isArchiveFile: (filePath) => api.isArchiveFile(filePath),
|
|
59
|
-
onCompressProgress: (callback) => api.onCompressProgress(callback),
|
|
60
|
-
onExtractProgress: (callback) => api.onExtractProgress(callback),
|
|
61
|
-
watchDirectory: (dirPath, watchId) => api.watchDirectory(dirPath, watchId),
|
|
62
|
-
unwatchDirectory: (watchId) => api.unwatchDirectory(watchId),
|
|
63
|
-
onWatchEvent: (callback) => api.onWatchEvent(callback),
|
|
64
|
-
showFileInfo: (filePath) => api.showFileInfo(filePath),
|
|
65
|
-
openInTerminal: (dirPath) => api.openInTerminal(dirPath),
|
|
66
|
-
openInEditor: (targetPath) => api.openInEditor(targetPath),
|
|
67
|
-
openInNewWindow: (folderPath) => api.openInNewWindow(folderPath),
|
|
68
|
-
requestWindowFocus: () => api.requestWindowFocus(),
|
|
69
|
-
// 媒体服务
|
|
70
|
-
mediaNeedsTranscode: (filePath) => api.mediaNeedsTranscode(filePath),
|
|
71
|
-
mediaGetPlayableUrl: (filePath) => api.mediaGetPlayableUrl(filePath),
|
|
72
|
-
mediaGetMetadata: (filePath) => api.mediaGetMetadata(filePath),
|
|
73
|
-
onMediaTranscodeProgress: (callback) => api.onMediaTranscodeProgress(callback),
|
|
74
|
-
mediaCleanupFile: (filePath) => api.mediaCleanupFile(filePath),
|
|
75
|
-
// 媒体预览窗口
|
|
76
|
-
openMediaPreviewWindow: (filePath, mediaType) => api.openMediaPreviewWindow(filePath, mediaType),
|
|
77
|
-
closeMediaPreviewWindow: (filePath) => api.closeMediaPreviewWindow(filePath)
|
|
78
|
-
};
|
|
33
|
+
const typedApi = api;
|
|
34
|
+
return typedApi;
|
|
79
35
|
}
|
|
@@ -1,193 +1,11 @@
|
|
|
1
|
-
import { FileItem, OperationResult, FileInfo,
|
|
2
|
-
export { CompressFormat, CompressLevel, FileInfo, FileItem, OperationResult, SystemPathId } from '@huyooo/file-explorer-core';
|
|
1
|
+
import { FileItem, OperationResult, FileInfo, CompressOptions, CompressResult, ExtractOptions, CompressProgress, WatchEvent, TranscodeInfo, MediaMetadata, TranscodeProgress } from '@huyooo/file-explorer-core';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* File Explorer Electron Bridge - Renderer Process
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* 提供渲染进程使用的 client(仅保留 runtime 入口)
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
/** 压缩选项 */
|
|
11
|
-
interface CompressOptions {
|
|
12
|
-
format: CompressFormat;
|
|
13
|
-
level?: CompressLevel;
|
|
14
|
-
outputName: string;
|
|
15
|
-
outputDir: string;
|
|
16
|
-
deleteSource?: boolean;
|
|
17
|
-
}
|
|
18
|
-
/** 解压选项 */
|
|
19
|
-
interface ExtractOptions {
|
|
20
|
-
targetDir: string;
|
|
21
|
-
deleteArchive?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/** 压缩进度 */
|
|
24
|
-
interface CompressProgress {
|
|
25
|
-
currentFile: string;
|
|
26
|
-
processedCount: number;
|
|
27
|
-
totalCount: number;
|
|
28
|
-
percent: number;
|
|
29
|
-
}
|
|
30
|
-
/** 压缩结果 */
|
|
31
|
-
interface CompressResult {
|
|
32
|
-
success: boolean;
|
|
33
|
-
outputPath?: string;
|
|
34
|
-
error?: string;
|
|
35
|
-
}
|
|
36
|
-
/** 文件变化事件类型 */
|
|
37
|
-
type WatchEventType = 'add' | 'change' | 'remove' | 'rename';
|
|
38
|
-
/** 文件变化事件 */
|
|
39
|
-
interface WatchEvent {
|
|
40
|
-
type: WatchEventType;
|
|
41
|
-
path: string;
|
|
42
|
-
filename: string;
|
|
43
|
-
}
|
|
44
|
-
/** 媒体转码信息 */
|
|
45
|
-
interface TranscodeInfo {
|
|
46
|
-
type: 'video' | 'audio';
|
|
47
|
-
needsTranscode: boolean;
|
|
48
|
-
method: 'direct' | 'remux' | 'transcode';
|
|
49
|
-
estimatedTime?: number;
|
|
50
|
-
targetFormat?: string;
|
|
51
|
-
}
|
|
52
|
-
/** 媒体转码进度 */
|
|
53
|
-
interface MediaTranscodeProgress {
|
|
54
|
-
percent: number;
|
|
55
|
-
time?: number;
|
|
56
|
-
duration?: number;
|
|
57
|
-
speed?: string;
|
|
58
|
-
}
|
|
59
|
-
/** 媒体元数据 */
|
|
60
|
-
interface MediaMetadata {
|
|
61
|
-
filePath: string;
|
|
62
|
-
type: 'video' | 'audio';
|
|
63
|
-
duration: number;
|
|
64
|
-
title?: string;
|
|
65
|
-
artist?: string;
|
|
66
|
-
album?: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 文件操作适配器接口
|
|
70
|
-
*/
|
|
71
|
-
interface FileExplorerAdapter {
|
|
72
|
-
/** 读取目录 */
|
|
73
|
-
readDirectory(dirPath: string): Promise<FileItem[]>;
|
|
74
|
-
/** 读取系统路径目录 */
|
|
75
|
-
readSystemPath(pathId: string): Promise<FileItem[]>;
|
|
76
|
-
/** 获取系统路径 */
|
|
77
|
-
getSystemPath(pathId: string): Promise<string | null>;
|
|
78
|
-
/** 读取文件内容 */
|
|
79
|
-
readFileContent(filePath: string): Promise<string>;
|
|
80
|
-
/** 写入文件内容 */
|
|
81
|
-
writeFileContent(filePath: string, content: string): Promise<OperationResult>;
|
|
82
|
-
/** 创建文件夹 */
|
|
83
|
-
createFolder(parentDir: string, folderName: string): Promise<OperationResult<{
|
|
84
|
-
finalPath: string;
|
|
85
|
-
}>>;
|
|
86
|
-
/** 创建文件 */
|
|
87
|
-
createFile(parentDir: string, fileName: string, content?: string): Promise<OperationResult<{
|
|
88
|
-
finalPath: string;
|
|
89
|
-
}>>;
|
|
90
|
-
/** 删除文件 */
|
|
91
|
-
deleteFiles(paths: string[]): Promise<OperationResult>;
|
|
92
|
-
/** 重命名文件 */
|
|
93
|
-
renameFile(oldPath: string, newPath: string): Promise<OperationResult>;
|
|
94
|
-
/** 复制文件 */
|
|
95
|
-
copyFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
96
|
-
copiedPaths: string[];
|
|
97
|
-
}>>;
|
|
98
|
-
/** 移动文件 */
|
|
99
|
-
moveFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
100
|
-
movedPaths: string[];
|
|
101
|
-
}>>;
|
|
102
|
-
/** 获取文件信息 */
|
|
103
|
-
getFileInfo(filePath: string): Promise<OperationResult<FileInfo>>;
|
|
104
|
-
/** 读取图片为 Base64 */
|
|
105
|
-
readImageAsBase64(imagePath: string): Promise<{
|
|
106
|
-
success: boolean;
|
|
107
|
-
base64?: string;
|
|
108
|
-
mimeType?: string;
|
|
109
|
-
error?: string;
|
|
110
|
-
}>;
|
|
111
|
-
/** 使用系统默认应用打开 */
|
|
112
|
-
openPath(filePath: string): Promise<OperationResult>;
|
|
113
|
-
/** 获取应用程序图标 */
|
|
114
|
-
getApplicationIcon(appPath: string): Promise<string | null>;
|
|
115
|
-
/** 获取缩略图 URL */
|
|
116
|
-
getThumbnailUrl(filePath: string): Promise<string | null>;
|
|
117
|
-
/** 复制文件到剪贴板 */
|
|
118
|
-
copyFilesToClipboard(filePaths: string[]): Promise<OperationResult>;
|
|
119
|
-
/** 从剪贴板获取文件 */
|
|
120
|
-
getClipboardFiles(): Promise<OperationResult<{
|
|
121
|
-
files: string[];
|
|
122
|
-
}>>;
|
|
123
|
-
/** 粘贴文件 */
|
|
124
|
-
pasteFiles(targetDir: string, sourcePaths: string[]): Promise<OperationResult<{
|
|
125
|
-
pastedPaths: string[];
|
|
126
|
-
}>>;
|
|
127
|
-
/** 搜索文件 */
|
|
128
|
-
searchFiles(searchPath: string, pattern: string, maxDepth?: number): Promise<OperationResult<{
|
|
129
|
-
items: FileItem[];
|
|
130
|
-
total: number;
|
|
131
|
-
}>>;
|
|
132
|
-
/** 流式搜索文件 */
|
|
133
|
-
searchFilesStream(searchPath: string, pattern: string, searchId: string): Promise<OperationResult>;
|
|
134
|
-
/** 监听搜索结果 */
|
|
135
|
-
onSearchResults(callback: (data: {
|
|
136
|
-
searchId: string;
|
|
137
|
-
items: FileItem[];
|
|
138
|
-
done: boolean;
|
|
139
|
-
}) => void): () => void;
|
|
140
|
-
/** 压缩文件 */
|
|
141
|
-
compressFiles(sources: string[], options: CompressOptions): Promise<CompressResult>;
|
|
142
|
-
/** 解压文件 */
|
|
143
|
-
extractArchive(archivePath: string, options: ExtractOptions): Promise<CompressResult>;
|
|
144
|
-
/** 判断是否为压缩文件 */
|
|
145
|
-
isArchiveFile(filePath: string): Promise<boolean>;
|
|
146
|
-
/** 监听压缩进度 */
|
|
147
|
-
onCompressProgress(callback: (data: CompressProgress) => void): () => void;
|
|
148
|
-
/** 监听解压进度 */
|
|
149
|
-
onExtractProgress(callback: (data: CompressProgress) => void): () => void;
|
|
150
|
-
/** 监听目录变化 */
|
|
151
|
-
watchDirectory(dirPath: string, watchId: string): Promise<OperationResult>;
|
|
152
|
-
/** 停止监听目录 */
|
|
153
|
-
unwatchDirectory(watchId: string): Promise<OperationResult>;
|
|
154
|
-
/** 监听文件变化事件 */
|
|
155
|
-
onWatchEvent(callback: (data: {
|
|
156
|
-
watchId: string;
|
|
157
|
-
event: WatchEvent;
|
|
158
|
-
}) => void): () => void;
|
|
159
|
-
/** 显示文件/文件夹的系统属性窗口 */
|
|
160
|
-
showFileInfo(filePath: string): Promise<OperationResult>;
|
|
161
|
-
/** 在终端中打开目录 */
|
|
162
|
-
openInTerminal(dirPath: string): Promise<OperationResult>;
|
|
163
|
-
/** 通过 Cursor 打开 */
|
|
164
|
-
openInEditor(targetPath: string): Promise<OperationResult>;
|
|
165
|
-
/** 在新窗口中打开文件夹(使用系统文件管理器) */
|
|
166
|
-
openInNewWindow(folderPath: string): Promise<OperationResult>;
|
|
167
|
-
/** 请求窗口聚焦(用于右键打开菜单前激活窗口) */
|
|
168
|
-
requestWindowFocus(): void;
|
|
169
|
-
/** 检测媒体文件是否需要转码 */
|
|
170
|
-
mediaNeedsTranscode(filePath: string): Promise<OperationResult<TranscodeInfo>>;
|
|
171
|
-
/** 获取可播放的媒体 URL(自动转码) */
|
|
172
|
-
mediaGetPlayableUrl(filePath: string): Promise<{
|
|
173
|
-
success: boolean;
|
|
174
|
-
url?: string;
|
|
175
|
-
error?: string;
|
|
176
|
-
}>;
|
|
177
|
-
/** 获取媒体元数据 */
|
|
178
|
-
mediaGetMetadata(filePath: string): Promise<OperationResult<MediaMetadata>>;
|
|
179
|
-
/** 监听转码进度 */
|
|
180
|
-
onMediaTranscodeProgress(callback: (data: {
|
|
181
|
-
filePath: string;
|
|
182
|
-
progress: MediaTranscodeProgress;
|
|
183
|
-
}) => void): () => void;
|
|
184
|
-
/** 清理指定文件的转码缓存 */
|
|
185
|
-
mediaCleanupFile(filePath: string): Promise<OperationResult>;
|
|
186
|
-
/** 打开媒体预览窗口(原生窗口) */
|
|
187
|
-
openMediaPreviewWindow(filePath: string, mediaType: 'image' | 'video' | 'audio'): Promise<OperationResult>;
|
|
188
|
-
/** 关闭媒体预览窗口 */
|
|
189
|
-
closeMediaPreviewWindow(filePath: string): Promise<OperationResult>;
|
|
190
|
-
}
|
|
191
9
|
/**
|
|
192
10
|
* Window 扩展类型
|
|
193
11
|
*/
|
|
@@ -265,7 +83,7 @@ declare global {
|
|
|
265
83
|
mediaGetMetadata: (filePath: string) => Promise<OperationResult<MediaMetadata>>;
|
|
266
84
|
onMediaTranscodeProgress: (callback: (data: {
|
|
267
85
|
filePath: string;
|
|
268
|
-
progress:
|
|
86
|
+
progress: TranscodeProgress;
|
|
269
87
|
}) => void) => () => void;
|
|
270
88
|
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
271
89
|
openMediaPreviewWindow: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<OperationResult>;
|
|
@@ -274,15 +92,92 @@ declare global {
|
|
|
274
92
|
}
|
|
275
93
|
}
|
|
276
94
|
/**
|
|
277
|
-
* 创建
|
|
95
|
+
* 创建 File Explorer Client(渲染进程唯一入口)
|
|
278
96
|
*
|
|
279
97
|
* 在渲染进程中使用:
|
|
280
98
|
* ```ts
|
|
281
|
-
* import {
|
|
282
|
-
* const
|
|
283
|
-
* const files = await
|
|
99
|
+
* import { createFileExplorerClient } from '@huyooo/file-explorer-bridge-electron/renderer';
|
|
100
|
+
* const client = createFileExplorerClient();
|
|
101
|
+
* const files = await client.readDirectory('/path/to/dir');
|
|
284
102
|
* ```
|
|
285
103
|
*/
|
|
286
|
-
declare function
|
|
104
|
+
declare function createFileExplorerClient(apiName?: string): {
|
|
105
|
+
readDirectory: (dirPath: string) => Promise<FileItem[]>;
|
|
106
|
+
readSystemPath: (pathId: string) => Promise<FileItem[]>;
|
|
107
|
+
getSystemPath: (pathId: string) => Promise<string | null>;
|
|
108
|
+
readFileContent: (filePath: string) => Promise<string>;
|
|
109
|
+
writeFileContent: (filePath: string, content: string) => Promise<OperationResult>;
|
|
110
|
+
createFolder: (parentDir: string, folderName: string) => Promise<OperationResult<{
|
|
111
|
+
finalPath: string;
|
|
112
|
+
}>>;
|
|
113
|
+
createFile: (parentDir: string, fileName: string, content?: string) => Promise<OperationResult<{
|
|
114
|
+
finalPath: string;
|
|
115
|
+
}>>;
|
|
116
|
+
deleteFiles: (paths: string[]) => Promise<OperationResult>;
|
|
117
|
+
renameFile: (oldPath: string, newPath: string) => Promise<OperationResult>;
|
|
118
|
+
copyFiles: (sourcePaths: string[], targetDir: string) => Promise<OperationResult<{
|
|
119
|
+
copiedPaths: string[];
|
|
120
|
+
}>>;
|
|
121
|
+
moveFiles: (sourcePaths: string[], targetDir: string) => Promise<OperationResult<{
|
|
122
|
+
movedPaths: string[];
|
|
123
|
+
}>>;
|
|
124
|
+
getFileInfo: (filePath: string) => Promise<OperationResult<FileInfo>>;
|
|
125
|
+
readImageAsBase64: (imagePath: string) => Promise<{
|
|
126
|
+
success: boolean;
|
|
127
|
+
base64?: string;
|
|
128
|
+
mimeType?: string;
|
|
129
|
+
error?: string;
|
|
130
|
+
}>;
|
|
131
|
+
openPath: (filePath: string) => Promise<OperationResult>;
|
|
132
|
+
getApplicationIcon: (appPath: string) => Promise<string | null>;
|
|
133
|
+
getThumbnailUrl: (filePath: string) => Promise<string | null>;
|
|
134
|
+
copyFilesToClipboard: (filePaths: string[]) => Promise<OperationResult>;
|
|
135
|
+
getClipboardFiles: () => Promise<OperationResult<{
|
|
136
|
+
files: string[];
|
|
137
|
+
}>>;
|
|
138
|
+
pasteFiles: (targetDir: string, sourcePaths: string[]) => Promise<OperationResult<{
|
|
139
|
+
pastedPaths: string[];
|
|
140
|
+
}>>;
|
|
141
|
+
searchFiles: (searchPath: string, pattern: string, maxDepth?: number) => Promise<OperationResult<{
|
|
142
|
+
items: FileItem[];
|
|
143
|
+
total: number;
|
|
144
|
+
}>>;
|
|
145
|
+
searchFilesStream: (searchPath: string, pattern: string, searchId: string) => Promise<OperationResult>;
|
|
146
|
+
onSearchResults: (callback: (data: {
|
|
147
|
+
searchId: string;
|
|
148
|
+
items: FileItem[];
|
|
149
|
+
done: boolean;
|
|
150
|
+
}) => void) => () => void;
|
|
151
|
+
compressFiles: (sources: string[], options: CompressOptions) => Promise<CompressResult>;
|
|
152
|
+
extractArchive: (archivePath: string, options: ExtractOptions) => Promise<CompressResult>;
|
|
153
|
+
isArchiveFile: (filePath: string) => Promise<boolean>;
|
|
154
|
+
onCompressProgress: (callback: (data: CompressProgress) => void) => () => void;
|
|
155
|
+
onExtractProgress: (callback: (data: CompressProgress) => void) => () => void;
|
|
156
|
+
watchDirectory: (dirPath: string, watchId: string) => Promise<OperationResult>;
|
|
157
|
+
unwatchDirectory: (watchId: string) => Promise<OperationResult>;
|
|
158
|
+
onWatchEvent: (callback: (data: {
|
|
159
|
+
watchId: string;
|
|
160
|
+
event: WatchEvent;
|
|
161
|
+
}) => void) => () => void;
|
|
162
|
+
showFileInfo: (filePath: string) => Promise<OperationResult>;
|
|
163
|
+
openInTerminal: (dirPath: string) => Promise<OperationResult>;
|
|
164
|
+
openInEditor: (targetPath: string) => Promise<OperationResult>;
|
|
165
|
+
openInNewWindow: (folderPath: string) => Promise<OperationResult>;
|
|
166
|
+
requestWindowFocus: () => void;
|
|
167
|
+
mediaNeedsTranscode: (filePath: string) => Promise<OperationResult<TranscodeInfo>>;
|
|
168
|
+
mediaGetPlayableUrl: (filePath: string) => Promise<{
|
|
169
|
+
success: boolean;
|
|
170
|
+
url?: string;
|
|
171
|
+
error?: string;
|
|
172
|
+
}>;
|
|
173
|
+
mediaGetMetadata: (filePath: string) => Promise<OperationResult<MediaMetadata>>;
|
|
174
|
+
onMediaTranscodeProgress: (callback: (data: {
|
|
175
|
+
filePath: string;
|
|
176
|
+
progress: TranscodeProgress;
|
|
177
|
+
}) => void) => () => void;
|
|
178
|
+
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
179
|
+
openMediaPreviewWindow: (filePath: string, mediaType: "image" | "video" | "audio") => Promise<OperationResult>;
|
|
180
|
+
closeMediaPreviewWindow: (filePath: string) => Promise<OperationResult>;
|
|
181
|
+
};
|
|
287
182
|
|
|
288
|
-
export {
|
|
183
|
+
export { createFileExplorerClient };
|
package/dist/renderer/index.d.ts
CHANGED
|
@@ -1,193 +1,11 @@
|
|
|
1
|
-
import { FileItem, OperationResult, FileInfo,
|
|
2
|
-
export { CompressFormat, CompressLevel, FileInfo, FileItem, OperationResult, SystemPathId } from '@huyooo/file-explorer-core';
|
|
1
|
+
import { FileItem, OperationResult, FileInfo, CompressOptions, CompressResult, ExtractOptions, CompressProgress, WatchEvent, TranscodeInfo, MediaMetadata, TranscodeProgress } from '@huyooo/file-explorer-core';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* File Explorer Electron Bridge - Renderer Process
|
|
6
5
|
*
|
|
7
|
-
*
|
|
6
|
+
* 提供渲染进程使用的 client(仅保留 runtime 入口)
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
/** 压缩选项 */
|
|
11
|
-
interface CompressOptions {
|
|
12
|
-
format: CompressFormat;
|
|
13
|
-
level?: CompressLevel;
|
|
14
|
-
outputName: string;
|
|
15
|
-
outputDir: string;
|
|
16
|
-
deleteSource?: boolean;
|
|
17
|
-
}
|
|
18
|
-
/** 解压选项 */
|
|
19
|
-
interface ExtractOptions {
|
|
20
|
-
targetDir: string;
|
|
21
|
-
deleteArchive?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/** 压缩进度 */
|
|
24
|
-
interface CompressProgress {
|
|
25
|
-
currentFile: string;
|
|
26
|
-
processedCount: number;
|
|
27
|
-
totalCount: number;
|
|
28
|
-
percent: number;
|
|
29
|
-
}
|
|
30
|
-
/** 压缩结果 */
|
|
31
|
-
interface CompressResult {
|
|
32
|
-
success: boolean;
|
|
33
|
-
outputPath?: string;
|
|
34
|
-
error?: string;
|
|
35
|
-
}
|
|
36
|
-
/** 文件变化事件类型 */
|
|
37
|
-
type WatchEventType = 'add' | 'change' | 'remove' | 'rename';
|
|
38
|
-
/** 文件变化事件 */
|
|
39
|
-
interface WatchEvent {
|
|
40
|
-
type: WatchEventType;
|
|
41
|
-
path: string;
|
|
42
|
-
filename: string;
|
|
43
|
-
}
|
|
44
|
-
/** 媒体转码信息 */
|
|
45
|
-
interface TranscodeInfo {
|
|
46
|
-
type: 'video' | 'audio';
|
|
47
|
-
needsTranscode: boolean;
|
|
48
|
-
method: 'direct' | 'remux' | 'transcode';
|
|
49
|
-
estimatedTime?: number;
|
|
50
|
-
targetFormat?: string;
|
|
51
|
-
}
|
|
52
|
-
/** 媒体转码进度 */
|
|
53
|
-
interface MediaTranscodeProgress {
|
|
54
|
-
percent: number;
|
|
55
|
-
time?: number;
|
|
56
|
-
duration?: number;
|
|
57
|
-
speed?: string;
|
|
58
|
-
}
|
|
59
|
-
/** 媒体元数据 */
|
|
60
|
-
interface MediaMetadata {
|
|
61
|
-
filePath: string;
|
|
62
|
-
type: 'video' | 'audio';
|
|
63
|
-
duration: number;
|
|
64
|
-
title?: string;
|
|
65
|
-
artist?: string;
|
|
66
|
-
album?: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* 文件操作适配器接口
|
|
70
|
-
*/
|
|
71
|
-
interface FileExplorerAdapter {
|
|
72
|
-
/** 读取目录 */
|
|
73
|
-
readDirectory(dirPath: string): Promise<FileItem[]>;
|
|
74
|
-
/** 读取系统路径目录 */
|
|
75
|
-
readSystemPath(pathId: string): Promise<FileItem[]>;
|
|
76
|
-
/** 获取系统路径 */
|
|
77
|
-
getSystemPath(pathId: string): Promise<string | null>;
|
|
78
|
-
/** 读取文件内容 */
|
|
79
|
-
readFileContent(filePath: string): Promise<string>;
|
|
80
|
-
/** 写入文件内容 */
|
|
81
|
-
writeFileContent(filePath: string, content: string): Promise<OperationResult>;
|
|
82
|
-
/** 创建文件夹 */
|
|
83
|
-
createFolder(parentDir: string, folderName: string): Promise<OperationResult<{
|
|
84
|
-
finalPath: string;
|
|
85
|
-
}>>;
|
|
86
|
-
/** 创建文件 */
|
|
87
|
-
createFile(parentDir: string, fileName: string, content?: string): Promise<OperationResult<{
|
|
88
|
-
finalPath: string;
|
|
89
|
-
}>>;
|
|
90
|
-
/** 删除文件 */
|
|
91
|
-
deleteFiles(paths: string[]): Promise<OperationResult>;
|
|
92
|
-
/** 重命名文件 */
|
|
93
|
-
renameFile(oldPath: string, newPath: string): Promise<OperationResult>;
|
|
94
|
-
/** 复制文件 */
|
|
95
|
-
copyFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
96
|
-
copiedPaths: string[];
|
|
97
|
-
}>>;
|
|
98
|
-
/** 移动文件 */
|
|
99
|
-
moveFiles(sourcePaths: string[], targetDir: string): Promise<OperationResult<{
|
|
100
|
-
movedPaths: string[];
|
|
101
|
-
}>>;
|
|
102
|
-
/** 获取文件信息 */
|
|
103
|
-
getFileInfo(filePath: string): Promise<OperationResult<FileInfo>>;
|
|
104
|
-
/** 读取图片为 Base64 */
|
|
105
|
-
readImageAsBase64(imagePath: string): Promise<{
|
|
106
|
-
success: boolean;
|
|
107
|
-
base64?: string;
|
|
108
|
-
mimeType?: string;
|
|
109
|
-
error?: string;
|
|
110
|
-
}>;
|
|
111
|
-
/** 使用系统默认应用打开 */
|
|
112
|
-
openPath(filePath: string): Promise<OperationResult>;
|
|
113
|
-
/** 获取应用程序图标 */
|
|
114
|
-
getApplicationIcon(appPath: string): Promise<string | null>;
|
|
115
|
-
/** 获取缩略图 URL */
|
|
116
|
-
getThumbnailUrl(filePath: string): Promise<string | null>;
|
|
117
|
-
/** 复制文件到剪贴板 */
|
|
118
|
-
copyFilesToClipboard(filePaths: string[]): Promise<OperationResult>;
|
|
119
|
-
/** 从剪贴板获取文件 */
|
|
120
|
-
getClipboardFiles(): Promise<OperationResult<{
|
|
121
|
-
files: string[];
|
|
122
|
-
}>>;
|
|
123
|
-
/** 粘贴文件 */
|
|
124
|
-
pasteFiles(targetDir: string, sourcePaths: string[]): Promise<OperationResult<{
|
|
125
|
-
pastedPaths: string[];
|
|
126
|
-
}>>;
|
|
127
|
-
/** 搜索文件 */
|
|
128
|
-
searchFiles(searchPath: string, pattern: string, maxDepth?: number): Promise<OperationResult<{
|
|
129
|
-
items: FileItem[];
|
|
130
|
-
total: number;
|
|
131
|
-
}>>;
|
|
132
|
-
/** 流式搜索文件 */
|
|
133
|
-
searchFilesStream(searchPath: string, pattern: string, searchId: string): Promise<OperationResult>;
|
|
134
|
-
/** 监听搜索结果 */
|
|
135
|
-
onSearchResults(callback: (data: {
|
|
136
|
-
searchId: string;
|
|
137
|
-
items: FileItem[];
|
|
138
|
-
done: boolean;
|
|
139
|
-
}) => void): () => void;
|
|
140
|
-
/** 压缩文件 */
|
|
141
|
-
compressFiles(sources: string[], options: CompressOptions): Promise<CompressResult>;
|
|
142
|
-
/** 解压文件 */
|
|
143
|
-
extractArchive(archivePath: string, options: ExtractOptions): Promise<CompressResult>;
|
|
144
|
-
/** 判断是否为压缩文件 */
|
|
145
|
-
isArchiveFile(filePath: string): Promise<boolean>;
|
|
146
|
-
/** 监听压缩进度 */
|
|
147
|
-
onCompressProgress(callback: (data: CompressProgress) => void): () => void;
|
|
148
|
-
/** 监听解压进度 */
|
|
149
|
-
onExtractProgress(callback: (data: CompressProgress) => void): () => void;
|
|
150
|
-
/** 监听目录变化 */
|
|
151
|
-
watchDirectory(dirPath: string, watchId: string): Promise<OperationResult>;
|
|
152
|
-
/** 停止监听目录 */
|
|
153
|
-
unwatchDirectory(watchId: string): Promise<OperationResult>;
|
|
154
|
-
/** 监听文件变化事件 */
|
|
155
|
-
onWatchEvent(callback: (data: {
|
|
156
|
-
watchId: string;
|
|
157
|
-
event: WatchEvent;
|
|
158
|
-
}) => void): () => void;
|
|
159
|
-
/** 显示文件/文件夹的系统属性窗口 */
|
|
160
|
-
showFileInfo(filePath: string): Promise<OperationResult>;
|
|
161
|
-
/** 在终端中打开目录 */
|
|
162
|
-
openInTerminal(dirPath: string): Promise<OperationResult>;
|
|
163
|
-
/** 通过 Cursor 打开 */
|
|
164
|
-
openInEditor(targetPath: string): Promise<OperationResult>;
|
|
165
|
-
/** 在新窗口中打开文件夹(使用系统文件管理器) */
|
|
166
|
-
openInNewWindow(folderPath: string): Promise<OperationResult>;
|
|
167
|
-
/** 请求窗口聚焦(用于右键打开菜单前激活窗口) */
|
|
168
|
-
requestWindowFocus(): void;
|
|
169
|
-
/** 检测媒体文件是否需要转码 */
|
|
170
|
-
mediaNeedsTranscode(filePath: string): Promise<OperationResult<TranscodeInfo>>;
|
|
171
|
-
/** 获取可播放的媒体 URL(自动转码) */
|
|
172
|
-
mediaGetPlayableUrl(filePath: string): Promise<{
|
|
173
|
-
success: boolean;
|
|
174
|
-
url?: string;
|
|
175
|
-
error?: string;
|
|
176
|
-
}>;
|
|
177
|
-
/** 获取媒体元数据 */
|
|
178
|
-
mediaGetMetadata(filePath: string): Promise<OperationResult<MediaMetadata>>;
|
|
179
|
-
/** 监听转码进度 */
|
|
180
|
-
onMediaTranscodeProgress(callback: (data: {
|
|
181
|
-
filePath: string;
|
|
182
|
-
progress: MediaTranscodeProgress;
|
|
183
|
-
}) => void): () => void;
|
|
184
|
-
/** 清理指定文件的转码缓存 */
|
|
185
|
-
mediaCleanupFile(filePath: string): Promise<OperationResult>;
|
|
186
|
-
/** 打开媒体预览窗口(原生窗口) */
|
|
187
|
-
openMediaPreviewWindow(filePath: string, mediaType: 'image' | 'video' | 'audio'): Promise<OperationResult>;
|
|
188
|
-
/** 关闭媒体预览窗口 */
|
|
189
|
-
closeMediaPreviewWindow(filePath: string): Promise<OperationResult>;
|
|
190
|
-
}
|
|
191
9
|
/**
|
|
192
10
|
* Window 扩展类型
|
|
193
11
|
*/
|
|
@@ -265,7 +83,7 @@ declare global {
|
|
|
265
83
|
mediaGetMetadata: (filePath: string) => Promise<OperationResult<MediaMetadata>>;
|
|
266
84
|
onMediaTranscodeProgress: (callback: (data: {
|
|
267
85
|
filePath: string;
|
|
268
|
-
progress:
|
|
86
|
+
progress: TranscodeProgress;
|
|
269
87
|
}) => void) => () => void;
|
|
270
88
|
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
271
89
|
openMediaPreviewWindow: (filePath: string, mediaType: 'image' | 'video' | 'audio') => Promise<OperationResult>;
|
|
@@ -274,15 +92,92 @@ declare global {
|
|
|
274
92
|
}
|
|
275
93
|
}
|
|
276
94
|
/**
|
|
277
|
-
* 创建
|
|
95
|
+
* 创建 File Explorer Client(渲染进程唯一入口)
|
|
278
96
|
*
|
|
279
97
|
* 在渲染进程中使用:
|
|
280
98
|
* ```ts
|
|
281
|
-
* import {
|
|
282
|
-
* const
|
|
283
|
-
* const files = await
|
|
99
|
+
* import { createFileExplorerClient } from '@huyooo/file-explorer-bridge-electron/renderer';
|
|
100
|
+
* const client = createFileExplorerClient();
|
|
101
|
+
* const files = await client.readDirectory('/path/to/dir');
|
|
284
102
|
* ```
|
|
285
103
|
*/
|
|
286
|
-
declare function
|
|
104
|
+
declare function createFileExplorerClient(apiName?: string): {
|
|
105
|
+
readDirectory: (dirPath: string) => Promise<FileItem[]>;
|
|
106
|
+
readSystemPath: (pathId: string) => Promise<FileItem[]>;
|
|
107
|
+
getSystemPath: (pathId: string) => Promise<string | null>;
|
|
108
|
+
readFileContent: (filePath: string) => Promise<string>;
|
|
109
|
+
writeFileContent: (filePath: string, content: string) => Promise<OperationResult>;
|
|
110
|
+
createFolder: (parentDir: string, folderName: string) => Promise<OperationResult<{
|
|
111
|
+
finalPath: string;
|
|
112
|
+
}>>;
|
|
113
|
+
createFile: (parentDir: string, fileName: string, content?: string) => Promise<OperationResult<{
|
|
114
|
+
finalPath: string;
|
|
115
|
+
}>>;
|
|
116
|
+
deleteFiles: (paths: string[]) => Promise<OperationResult>;
|
|
117
|
+
renameFile: (oldPath: string, newPath: string) => Promise<OperationResult>;
|
|
118
|
+
copyFiles: (sourcePaths: string[], targetDir: string) => Promise<OperationResult<{
|
|
119
|
+
copiedPaths: string[];
|
|
120
|
+
}>>;
|
|
121
|
+
moveFiles: (sourcePaths: string[], targetDir: string) => Promise<OperationResult<{
|
|
122
|
+
movedPaths: string[];
|
|
123
|
+
}>>;
|
|
124
|
+
getFileInfo: (filePath: string) => Promise<OperationResult<FileInfo>>;
|
|
125
|
+
readImageAsBase64: (imagePath: string) => Promise<{
|
|
126
|
+
success: boolean;
|
|
127
|
+
base64?: string;
|
|
128
|
+
mimeType?: string;
|
|
129
|
+
error?: string;
|
|
130
|
+
}>;
|
|
131
|
+
openPath: (filePath: string) => Promise<OperationResult>;
|
|
132
|
+
getApplicationIcon: (appPath: string) => Promise<string | null>;
|
|
133
|
+
getThumbnailUrl: (filePath: string) => Promise<string | null>;
|
|
134
|
+
copyFilesToClipboard: (filePaths: string[]) => Promise<OperationResult>;
|
|
135
|
+
getClipboardFiles: () => Promise<OperationResult<{
|
|
136
|
+
files: string[];
|
|
137
|
+
}>>;
|
|
138
|
+
pasteFiles: (targetDir: string, sourcePaths: string[]) => Promise<OperationResult<{
|
|
139
|
+
pastedPaths: string[];
|
|
140
|
+
}>>;
|
|
141
|
+
searchFiles: (searchPath: string, pattern: string, maxDepth?: number) => Promise<OperationResult<{
|
|
142
|
+
items: FileItem[];
|
|
143
|
+
total: number;
|
|
144
|
+
}>>;
|
|
145
|
+
searchFilesStream: (searchPath: string, pattern: string, searchId: string) => Promise<OperationResult>;
|
|
146
|
+
onSearchResults: (callback: (data: {
|
|
147
|
+
searchId: string;
|
|
148
|
+
items: FileItem[];
|
|
149
|
+
done: boolean;
|
|
150
|
+
}) => void) => () => void;
|
|
151
|
+
compressFiles: (sources: string[], options: CompressOptions) => Promise<CompressResult>;
|
|
152
|
+
extractArchive: (archivePath: string, options: ExtractOptions) => Promise<CompressResult>;
|
|
153
|
+
isArchiveFile: (filePath: string) => Promise<boolean>;
|
|
154
|
+
onCompressProgress: (callback: (data: CompressProgress) => void) => () => void;
|
|
155
|
+
onExtractProgress: (callback: (data: CompressProgress) => void) => () => void;
|
|
156
|
+
watchDirectory: (dirPath: string, watchId: string) => Promise<OperationResult>;
|
|
157
|
+
unwatchDirectory: (watchId: string) => Promise<OperationResult>;
|
|
158
|
+
onWatchEvent: (callback: (data: {
|
|
159
|
+
watchId: string;
|
|
160
|
+
event: WatchEvent;
|
|
161
|
+
}) => void) => () => void;
|
|
162
|
+
showFileInfo: (filePath: string) => Promise<OperationResult>;
|
|
163
|
+
openInTerminal: (dirPath: string) => Promise<OperationResult>;
|
|
164
|
+
openInEditor: (targetPath: string) => Promise<OperationResult>;
|
|
165
|
+
openInNewWindow: (folderPath: string) => Promise<OperationResult>;
|
|
166
|
+
requestWindowFocus: () => void;
|
|
167
|
+
mediaNeedsTranscode: (filePath: string) => Promise<OperationResult<TranscodeInfo>>;
|
|
168
|
+
mediaGetPlayableUrl: (filePath: string) => Promise<{
|
|
169
|
+
success: boolean;
|
|
170
|
+
url?: string;
|
|
171
|
+
error?: string;
|
|
172
|
+
}>;
|
|
173
|
+
mediaGetMetadata: (filePath: string) => Promise<OperationResult<MediaMetadata>>;
|
|
174
|
+
onMediaTranscodeProgress: (callback: (data: {
|
|
175
|
+
filePath: string;
|
|
176
|
+
progress: TranscodeProgress;
|
|
177
|
+
}) => void) => () => void;
|
|
178
|
+
mediaCleanupFile: (filePath: string) => Promise<OperationResult>;
|
|
179
|
+
openMediaPreviewWindow: (filePath: string, mediaType: "image" | "video" | "audio") => Promise<OperationResult>;
|
|
180
|
+
closeMediaPreviewWindow: (filePath: string) => Promise<OperationResult>;
|
|
181
|
+
};
|
|
287
182
|
|
|
288
|
-
export {
|
|
183
|
+
export { createFileExplorerClient };
|
package/dist/renderer/index.js
CHANGED
|
@@ -1,58 +1,14 @@
|
|
|
1
1
|
// src/renderer/index.ts
|
|
2
|
-
function
|
|
3
|
-
const api = window.fileExplorerAPI;
|
|
2
|
+
function createFileExplorerClient(apiName = "fileExplorerAPI") {
|
|
3
|
+
const api = apiName === "fileExplorerAPI" ? window.fileExplorerAPI : window[apiName];
|
|
4
4
|
if (!api) {
|
|
5
5
|
throw new Error(
|
|
6
|
-
|
|
6
|
+
`window.${apiName} not found. Make sure to call exposeFileExplorerAPI({ apiName }) in your preload script.`
|
|
7
7
|
);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
readSystemPath: (pathId) => api.readSystemPath(pathId),
|
|
12
|
-
getSystemPath: (pathId) => api.getSystemPath(pathId),
|
|
13
|
-
readFileContent: (filePath) => api.readFileContent(filePath),
|
|
14
|
-
writeFileContent: (filePath, content) => api.writeFileContent(filePath, content),
|
|
15
|
-
createFolder: (parentDir, folderName) => api.createFolder(parentDir, folderName),
|
|
16
|
-
createFile: (parentDir, fileName, content) => api.createFile(parentDir, fileName, content),
|
|
17
|
-
deleteFiles: (paths) => api.deleteFiles(paths),
|
|
18
|
-
renameFile: (oldPath, newPath) => api.renameFile(oldPath, newPath),
|
|
19
|
-
copyFiles: (sourcePaths, targetDir) => api.copyFiles(sourcePaths, targetDir),
|
|
20
|
-
moveFiles: (sourcePaths, targetDir) => api.moveFiles(sourcePaths, targetDir),
|
|
21
|
-
getFileInfo: (filePath) => api.getFileInfo(filePath),
|
|
22
|
-
readImageAsBase64: (imagePath) => api.readImageAsBase64(imagePath),
|
|
23
|
-
openPath: (filePath) => api.openPath(filePath),
|
|
24
|
-
getApplicationIcon: (appPath) => api.getApplicationIcon(appPath),
|
|
25
|
-
getThumbnailUrl: (filePath) => api.getThumbnailUrl(filePath),
|
|
26
|
-
copyFilesToClipboard: (filePaths) => api.copyFilesToClipboard(filePaths),
|
|
27
|
-
getClipboardFiles: () => api.getClipboardFiles(),
|
|
28
|
-
pasteFiles: (targetDir, sourcePaths) => api.pasteFiles(targetDir, sourcePaths),
|
|
29
|
-
searchFiles: (searchPath, pattern, maxDepth) => api.searchFiles(searchPath, pattern, maxDepth),
|
|
30
|
-
searchFilesStream: (searchPath, pattern, searchId) => api.searchFilesStream(searchPath, pattern, searchId),
|
|
31
|
-
onSearchResults: (callback) => api.onSearchResults(callback),
|
|
32
|
-
compressFiles: (sources, options) => api.compressFiles(sources, options),
|
|
33
|
-
extractArchive: (archivePath, options) => api.extractArchive(archivePath, options),
|
|
34
|
-
isArchiveFile: (filePath) => api.isArchiveFile(filePath),
|
|
35
|
-
onCompressProgress: (callback) => api.onCompressProgress(callback),
|
|
36
|
-
onExtractProgress: (callback) => api.onExtractProgress(callback),
|
|
37
|
-
watchDirectory: (dirPath, watchId) => api.watchDirectory(dirPath, watchId),
|
|
38
|
-
unwatchDirectory: (watchId) => api.unwatchDirectory(watchId),
|
|
39
|
-
onWatchEvent: (callback) => api.onWatchEvent(callback),
|
|
40
|
-
showFileInfo: (filePath) => api.showFileInfo(filePath),
|
|
41
|
-
openInTerminal: (dirPath) => api.openInTerminal(dirPath),
|
|
42
|
-
openInEditor: (targetPath) => api.openInEditor(targetPath),
|
|
43
|
-
openInNewWindow: (folderPath) => api.openInNewWindow(folderPath),
|
|
44
|
-
requestWindowFocus: () => api.requestWindowFocus(),
|
|
45
|
-
// 媒体服务
|
|
46
|
-
mediaNeedsTranscode: (filePath) => api.mediaNeedsTranscode(filePath),
|
|
47
|
-
mediaGetPlayableUrl: (filePath) => api.mediaGetPlayableUrl(filePath),
|
|
48
|
-
mediaGetMetadata: (filePath) => api.mediaGetMetadata(filePath),
|
|
49
|
-
onMediaTranscodeProgress: (callback) => api.onMediaTranscodeProgress(callback),
|
|
50
|
-
mediaCleanupFile: (filePath) => api.mediaCleanupFile(filePath),
|
|
51
|
-
// 媒体预览窗口
|
|
52
|
-
openMediaPreviewWindow: (filePath, mediaType) => api.openMediaPreviewWindow(filePath, mediaType),
|
|
53
|
-
closeMediaPreviewWindow: (filePath) => api.closeMediaPreviewWindow(filePath)
|
|
54
|
-
};
|
|
9
|
+
const typedApi = api;
|
|
10
|
+
return typedApi;
|
|
55
11
|
}
|
|
56
12
|
export {
|
|
57
|
-
|
|
13
|
+
createFileExplorerClient
|
|
58
14
|
};
|
package/package.json
CHANGED
|
@@ -1,29 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huyooo/file-explorer-bridge-electron",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.10",
|
|
4
4
|
"description": "File Explorer Electron Bridge - IPC integration for Electron apps",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/main/index.
|
|
6
|
+
"main": "./dist/main/index.js",
|
|
7
7
|
"module": "./dist/main/index.js",
|
|
8
8
|
"types": "./dist/main/index.d.ts",
|
|
9
9
|
"exports": {
|
|
10
10
|
"./main": {
|
|
11
11
|
"types": "./dist/main/index.d.ts",
|
|
12
12
|
"development": "./src/main/index.ts",
|
|
13
|
-
"import": "./dist/main/index.js"
|
|
14
|
-
"require": "./dist/main/index.cjs"
|
|
13
|
+
"import": "./dist/main/index.js"
|
|
15
14
|
},
|
|
16
15
|
"./preload": {
|
|
17
16
|
"types": "./dist/preload/index.d.ts",
|
|
18
17
|
"development": "./src/preload/index.ts",
|
|
19
|
-
"import": "./dist/preload/index.js"
|
|
20
|
-
"require": "./dist/preload/index.cjs"
|
|
18
|
+
"import": "./dist/preload/index.js"
|
|
21
19
|
},
|
|
22
20
|
"./renderer": {
|
|
23
21
|
"types": "./dist/renderer/index.d.ts",
|
|
24
22
|
"development": "./src/renderer/index.ts",
|
|
25
|
-
"import": "./dist/renderer/index.js"
|
|
26
|
-
"require": "./dist/renderer/index.cjs"
|
|
23
|
+
"import": "./dist/renderer/index.js"
|
|
27
24
|
}
|
|
28
25
|
},
|
|
29
26
|
"files": [
|
|
@@ -36,8 +33,8 @@
|
|
|
36
33
|
"clean": "rm -rf dist"
|
|
37
34
|
},
|
|
38
35
|
"dependencies": {
|
|
39
|
-
"@huyooo/file-explorer-core": "^0.4.
|
|
40
|
-
"@huyooo/file-explorer-preview": "^0.4.
|
|
36
|
+
"@huyooo/file-explorer-core": "^0.4.10",
|
|
37
|
+
"@huyooo/file-explorer-preview": "^0.4.10"
|
|
41
38
|
},
|
|
42
39
|
"peerDependencies": {
|
|
43
40
|
"electron": ">=20.0.0"
|