@huyooo/file-explorer-preview 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/path.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 获取预览页面 HTML 文件的绝对路径
3
- * 使用 __dirname 在运行时解析(tsup 会正确处理)
3
+ * 使用 import.meta.url 在运行时解析(避免 ESM 环境下 __dirname 不存在)
4
4
  */
5
5
  declare function getPreviewHtmlPath(): string;
6
6
  /** 构建预览页面的 URL(带参数) */
package/dist/path.js CHANGED
@@ -1,13 +1,8 @@
1
- // ../../node_modules/tsup/assets/esm_shims.js
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
- var getFilename = () => fileURLToPath(import.meta.url);
5
- var getDirname = () => path.dirname(getFilename());
6
- var __dirname = /* @__PURE__ */ getDirname();
7
-
8
1
  // src/path.ts
9
- import { join } from "path";
2
+ import { dirname, join } from "path";
3
+ import { fileURLToPath } from "url";
10
4
  function getPreviewHtmlPath() {
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
11
6
  return join(__dirname, "index.html");
12
7
  }
13
8
  function buildPreviewUrl(params) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huyooo/file-explorer-preview",
3
- "version": "0.4.6",
3
+ "version": "0.4.10",
4
4
  "description": "Media preview window for File Explorer - supports image, video, and audio",
5
5
  "type": "module",
6
6
  "main": "./dist/index.html",
@@ -8,8 +8,7 @@
8
8
  ".": "./dist/index.html",
9
9
  "./path": {
10
10
  "types": "./dist/path.d.ts",
11
- "import": "./dist/path.js",
12
- "require": "./dist/path.cjs"
11
+ "import": "./dist/path.js"
13
12
  }
14
13
  },
15
14
  "files": [
package/dist/path.cjs DELETED
@@ -1,43 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/path.ts
21
- var path_exports = {};
22
- __export(path_exports, {
23
- buildPreviewUrl: () => buildPreviewUrl,
24
- getPreviewHtmlPath: () => getPreviewHtmlPath
25
- });
26
- module.exports = __toCommonJS(path_exports);
27
- var import_path = require("path");
28
- function getPreviewHtmlPath() {
29
- return (0, import_path.join)(__dirname, "index.html");
30
- }
31
- function buildPreviewUrl(params) {
32
- const searchParams = new URLSearchParams({
33
- type: params.type,
34
- url: encodeURIComponent(params.url),
35
- name: encodeURIComponent(params.name)
36
- });
37
- return `file://${getPreviewHtmlPath()}?${searchParams.toString()}`;
38
- }
39
- // Annotate the CommonJS export names for ESM import in node:
40
- 0 && (module.exports = {
41
- buildPreviewUrl,
42
- getPreviewHtmlPath
43
- });
package/dist/path.d.cts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * 获取预览页面 HTML 文件的绝对路径
3
- * 使用 __dirname 在运行时解析(tsup 会正确处理)
4
- */
5
- declare function getPreviewHtmlPath(): string;
6
- /** 构建预览页面的 URL(带参数) */
7
- declare function buildPreviewUrl(params: {
8
- type: 'image' | 'video' | 'audio';
9
- url: string;
10
- name: string;
11
- }): string;
12
-
13
- export { buildPreviewUrl, getPreviewHtmlPath };