@huyooo/file-explorer-bridge-electron 0.4.6 → 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 +3 -0
- package/dist/main/index.js +10 -1
- package/package.json +7 -10
package/dist/main/index.cjs
CHANGED
|
@@ -35,11 +35,14 @@ __export(main_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(main_exports);
|
|
36
36
|
var import_electron = require("electron");
|
|
37
37
|
var import_node_path = __toESM(require("path"), 1);
|
|
38
|
+
var import_node_url = require("url");
|
|
38
39
|
var import_file_explorer_core = require("@huyooo/file-explorer-core");
|
|
39
40
|
var import_node_fs = require("fs");
|
|
40
41
|
var import_path = require("@huyooo/file-explorer-preview/path");
|
|
42
|
+
var import_meta = {};
|
|
41
43
|
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
42
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));
|
|
43
46
|
var clipboardAdapter = null;
|
|
44
47
|
function setClipboardAdapter(adapter) {
|
|
45
48
|
clipboardAdapter = adapter;
|
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,
|
|
@@ -38,6 +40,7 @@ import { promises as fs } from "fs";
|
|
|
38
40
|
import { getPreviewHtmlPath } from "@huyooo/file-explorer-preview/path";
|
|
39
41
|
var DEFAULT_CHANNEL_PREFIX = "file-explorer";
|
|
40
42
|
var DEFAULT_PREVIEW_CHANNEL_PREFIX = "file-explorer-preview";
|
|
43
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
41
44
|
var clipboardAdapter = null;
|
|
42
45
|
function setClipboardAdapter(adapter) {
|
|
43
46
|
clipboardAdapter = adapter;
|
|
@@ -402,6 +405,13 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
402
405
|
const minWidth = minContentWidth;
|
|
403
406
|
const minHeight = minContentHeight + titleBarHeight;
|
|
404
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
|
+
}
|
|
405
415
|
const previewWindow = new BrowserWindow({
|
|
406
416
|
width,
|
|
407
417
|
height,
|
|
@@ -432,7 +442,6 @@ function registerFileExplorerHandlers(options = {}) {
|
|
|
432
442
|
webSecurity: false
|
|
433
443
|
}
|
|
434
444
|
});
|
|
435
|
-
const previewHtmlPath = getPreviewHtmlPath();
|
|
436
445
|
const searchParams = new URLSearchParams({
|
|
437
446
|
type: mediaType,
|
|
438
447
|
url: encodeURIComponent(fileUrl),
|
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"
|