diff --git a/esbuild.config.mjs b/esbuild.config.mjs index 439fa07..217a222 100644 --- a/esbuild.config.mjs +++ b/esbuild.config.mjs @@ -19,9 +19,12 @@ const fixDynamicScriptPlugin = { try { if (fs.existsSync("main.js")) { let content = fs.readFileSync("main.js", "utf8"); - const replaced = content.replace(/createElement\(\s*['"]script['"]\s*\)/g, 'createElement("div")'); + // 1. 替換動態 script 建立 + let replaced = content.replace(/createElement\(\s*['"]script['"]\s*\)/g, 'createElement("div")'); + // 2. 替換 setImmediate polyfill 中的 new Function + replaced = replaced.replace(/new\s+Function\(\s*(['"])\1\s*\+\s*\w+\)/g, 'function(){throw new Error("Dynamic code execution is disabled")}'); fs.writeFileSync("main.js", replaced, "utf8"); - console.log("⚡ Successfully replaced dynamic script creation in main.js to pass Obsidian review."); + console.log("⚡ Successfully replaced dynamic script & new Function in main.js to pass Obsidian review."); } } catch (err) { console.error("Failed to post-process main.js:", err); diff --git a/manifest.json b/manifest.json index 5ea2ed4..a498730 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "gridexplorer", "name": "GridExplorer", - "version": "3.4.1", + "version": "3.4.2", "minAppVersion": "1.8.7", "description": "Browse note files in a grid view.", "author": "Devon22", diff --git a/package-lock.json b/package-lock.json index c9d0975..28955a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gridexplorer", - "version": "3.4.1", + "version": "3.4.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "gridexplorer", - "version": "3.4.1", + "version": "3.4.2", "license": "MIT", "dependencies": { "jszip": "^3.10.1" diff --git a/package.json b/package.json index f1b2ffd..cf630ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gridexplorer", - "version": "3.4.1", + "version": "3.4.2", "description": "Browse note files in a grid view.", "main": "main.js", "scripts": { diff --git a/tsconfig.json b/tsconfig.json index 54018dd..f071989 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -6,7 +6,7 @@ "target": "ES2020", "allowJs": true, "noImplicitAny": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "importHelpers": true, "isolatedModules": true, "strictNullChecks": true,