From cd8f993593e852760361741a9f182ad4eb91c778 Mon Sep 17 00:00:00 2001 From: PRO-2684 <54608551+PRO-2684@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:02:48 +0800 Subject: [PATCH 1/2] fix: LiteLoaderQQNT fix --- README.md | 5 +++++ main.cjs | 3 +++ manifest.json | 3 +-- modules/loaders/unified.js | 9 +++++---- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 main.cjs diff --git a/README.md b/README.md index 926cc78..3105530 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,11 @@ [![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/PRO-2684/Scriptio/total?logo=github)](https://github.com/PRO-2684/Scriptio/releases) [![GitHub Downloads (all assets, latest release)](https://img.shields.io/github/downloads/PRO-2684/Scriptio/latest/total?logo=github)](https://github.com/PRO-2684/Scriptio/releases/latest) +> [!NOTE] +> 若需在 LiteLoaderQQNT 中使用此插件,需要修改 [框架的白名单代码](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/blob/9628031664e9d3df35834f373cd5456f92ea250a/src/main/api.js#L45-L51),使得 Scriptio 能够读取 LiteLoader 对象。 +> +> 具体来说,对于 CJS `require`,error stack 会使用正常的平台路径,例如 `D:\LiteLoader\plugins\plugininstaller\dist\main.js:16:362331`;但是此插件使用了 ESM `import`,因此 error stack 中的路径会被转换为 `file:///D:/LiteLoader/plugins/Scriptio/modules/loaders/unified.js:3:38`,从而导致框架的白名单代码无法正确识别路径。 + [LiteLoaderQQNT](https://github.com/mo-jinran/LiteLoaderQQNT) / QwQNT 插件,用于为 QQNT 加载任意 **渲染层** 的用户脚本。 你可能也感兴趣:[Transitio](https://github.com/PRO-2684/transitio),自定义用户样式加载器。 diff --git a/main.cjs b/main.cjs new file mode 100644 index 0000000..7cb9397 --- /dev/null +++ b/main.cjs @@ -0,0 +1,3 @@ +(async () => { + await import("./main.js"); +})(); diff --git a/manifest.json b/manifest.json index 7bb28f7..6e2b646 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,6 @@ "$schema": "./manifest.schema.json", "manifest_version": 4, "type": "extension", - "esm": true, "name": "Scriptio", "slug": "scriptio", "description": "📄 自定义用户脚本加载器", @@ -31,7 +30,7 @@ "platform": ["win32", "linux", "darwin"], "injects": { "renderer": "./renderer.js", - "main": "./main.js", + "main": "./main.cjs", "preload": "./preload.js" } } diff --git a/modules/loaders/unified.js b/modules/loaders/unified.js index 58d83a2..6bb4a5f 100644 --- a/modules/loaders/unified.js +++ b/modules/loaders/unified.js @@ -1,8 +1,9 @@ // Unified API for LiteLoader & QwQNT, main & renderer -const { dataPathOrig, pluginPathOrig, scriptioVersion, configApi } = globalThis.LiteLoader ? - await import("./liteloader.js") : - await import("./qwqnt.js"); +const { dataPathOrig, pluginPathOrig, scriptioVersion, configApi } = + globalThis.LiteLoader + ? await import("./liteloader.js") + : await import("./qwqnt.js"); /** Scriptio data path, normalized to use `/`, ending with `/` */ const dataPath = normalize(dataPathOrig) + "/"; /** Scriptio script path, normalized to use `/`, ending with `/` */ @@ -27,4 +28,4 @@ export { /** Should only be used in main */ configApi, normalize, -} +}; From d77355830f319955787812d9b9737b533a0151de Mon Sep 17 00:00:00 2001 From: PRO-2684 <54608551+PRO-2684@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:09:21 +0800 Subject: [PATCH 2/2] doc: Add helpful PR link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3105530..dc1b7e8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ > 若需在 LiteLoaderQQNT 中使用此插件,需要修改 [框架的白名单代码](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/blob/9628031664e9d3df35834f373cd5456f92ea250a/src/main/api.js#L45-L51),使得 Scriptio 能够读取 LiteLoader 对象。 > > 具体来说,对于 CJS `require`,error stack 会使用正常的平台路径,例如 `D:\LiteLoader\plugins\plugininstaller\dist\main.js:16:362331`;但是此插件使用了 ESM `import`,因此 error stack 中的路径会被转换为 `file:///D:/LiteLoader/plugins/Scriptio/modules/loaders/unified.js:3:38`,从而导致框架的白名单代码无法正确识别路径。 +> +> [此 PR 中对 `whitelist` 的修改](https://github.com/LiteLoaderQQNT/LiteLoaderQQNT/commit/7575d7b3b0576d4a5f08c425e67b89fa6846944c#diff-1baf6e1c82a8708570aa947887a99298911bec4554ae8acae3aa92eae21aafcd) 可能对您有所帮助。 [LiteLoaderQQNT](https://github.com/mo-jinran/LiteLoaderQQNT) / QwQNT 插件,用于为 QQNT 加载任意 **渲染层** 的用户脚本。