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U,KAAO,4BACX,WAAW,QAAQ,UAAU,EAAQ,EAAW,CAClD,OAAQ,GACV,GAIlB,EAEJ,QAAQ,QAAU,IAAI","file":"/npm/electron-forge-template-vite@0.3.5/dist/ViteTemplate.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/electron-forge-template-vite@0.3.5/dist/ViteTemplate.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n    return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __importDefault(require(\"path\"));\nconst template_base_1 = require(\"@electron-forge/template-base\");\nconst fs_extra_1 = __importDefault(require(\"fs-extra\"));\nclass ViteTemplate extends template_base_1.BaseTemplate {\n    constructor() {\n        super(...arguments);\n        this.templateDir = path_1.default.resolve(__dirname, '..', 'tmpl');\n    }\n    async initializeTemplate(directory, options) {\n        const superTasks = await super.initializeTemplate(directory, options);\n        return [\n            ...superTasks,\n            {\n                title: 'Setting up Forge configuration',\n                task: async () => {\n                    await this.copyTemplateFile(directory, 'forge.config.js');\n                },\n            },\n            {\n                title: 'Setting up Vite configuration',\n                task: async () => {\n                    await this.copyTemplateFile(directory, 'vite.renderer.config.mjs');\n                    await this.copyTemplateFile(directory, 'vite.main.config.mjs');\n                    await this.copyTemplateFile(directory, 'vite.preload.config.mjs');\n                    await this.copyTemplateFile(path_1.default.join(directory, 'src'), 'renderer.js');\n                    await this.copyTemplateFile(path_1.default.join(directory, 'src'), 'preload.js');\n                    await this.updateFileByLine(path_1.default.resolve(directory, 'src', 'index.js'), (line) => {\n                        if (line.includes('mainWindow.loadFile'))\n                            return `  if (MAIN_WINDOW_VITE_DEV_SERVER_URL) {\n    mainWindow.loadURL(MAIN_WINDOW_VITE_DEV_SERVER_URL);\n  } else {\n    mainWindow.loadFile(path.join(__dirname, \\`../renderer/\\${MAIN_WINDOW_VITE_NAME}/index.html\\`));\n  }`;\n                        return line;\n                    }, path_1.default.resolve(directory, 'src', 'main.js'));\n                    // TODO: Compatible with any path entry.\n                    // Vite uses index.html under the root path as the entry point.\n                    fs_extra_1.default.moveSync(path_1.default.join(directory, 'src', 'index.html'), path_1.default.join(directory, 'index.html'));\n                    await this.updateFileByLine(path_1.default.join(directory, 'index.html'), (line) => {\n                        if (line.includes('link rel=\"stylesheet\"'))\n                            return '';\n                        if (line.includes('</body>'))\n                            return '    <script type=\"module\" src=\"/src/renderer.js\"></script>\\n  </body>';\n                        return line;\n                    });\n                    // update package.json entry point\n                    const pjPath = path_1.default.resolve(directory, 'package.json');\n                    const currentPJ = await fs_extra_1.default.readJson(pjPath);\n                    currentPJ.main = '.vite/build/main.js';\n                    await fs_extra_1.default.writeJson(pjPath, currentPJ, {\n                        spaces: 2,\n                    });\n                },\n            },\n        ];\n    }\n}\nexports.default = new ViteTemplate();\n"]}