format code
This commit is contained in:
parent
2fed75baf0
commit
3ca324376e
|
@ -44,7 +44,7 @@ export default defineConfig({
|
||||||
* For usage of Electron and NodeJS APIs in the Renderer process
|
* For usage of Electron and NodeJS APIs in the Renderer process
|
||||||
* @see https://github.com/caoxiemeihao/electron-vue-vite/issues/52
|
* @see https://github.com/caoxiemeihao/electron-vue-vite/issues/52
|
||||||
*/
|
*/
|
||||||
export function resolveElectron(
|
export function resolveElectron(
|
||||||
resolves: Parameters<typeof resolve>[0] = {}
|
resolves: Parameters<typeof resolve>[0] = {}
|
||||||
): Plugin {
|
): Plugin {
|
||||||
const builtins = builtinModules.filter((t) => !t.startsWith('_'))
|
const builtins = builtinModules.filter((t) => !t.startsWith('_'))
|
||||||
|
@ -60,11 +60,11 @@ export function resolveElectron(
|
||||||
|
|
||||||
function electronExport() {
|
function electronExport() {
|
||||||
return `
|
return `
|
||||||
/**
|
/**
|
||||||
* For all exported modules see https://www.electronjs.org/docs/latest/api/clipboard -> Renderer Process Modules
|
* For all exported modules see https://www.electronjs.org/docs/latest/api/clipboard -> Renderer Process Modules
|
||||||
*/
|
*/
|
||||||
const electron = require("electron");
|
const electron = require("electron");
|
||||||
const {
|
const {
|
||||||
clipboard,
|
clipboard,
|
||||||
nativeImage,
|
nativeImage,
|
||||||
shell,
|
shell,
|
||||||
|
@ -74,9 +74,9 @@ export function resolveElectron(
|
||||||
webFrame,
|
webFrame,
|
||||||
desktopCapturer,
|
desktopCapturer,
|
||||||
deprecate,
|
deprecate,
|
||||||
} = electron;
|
} = electron;
|
||||||
|
|
||||||
export {
|
export {
|
||||||
electron as default,
|
electron as default,
|
||||||
clipboard,
|
clipboard,
|
||||||
nativeImage,
|
nativeImage,
|
||||||
|
@ -87,8 +87,8 @@ export function resolveElectron(
|
||||||
webFrame,
|
webFrame,
|
||||||
desktopCapturer,
|
desktopCapturer,
|
||||||
deprecate,
|
deprecate,
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
function builtinModulesExport(modules: string[]) {
|
function builtinModulesExport(modules: string[]) {
|
||||||
|
@ -102,12 +102,12 @@ export function resolveElectron(
|
||||||
.map((attr) => `export const ${attr} = M.${attr}`)
|
.map((attr) => `export const ${attr} = M.${attr}`)
|
||||||
.join(';\n') + ';'
|
.join(';\n') + ';'
|
||||||
const nodeModuleCode = `
|
const nodeModuleCode = `
|
||||||
${requireModule}
|
${requireModule}
|
||||||
|
|
||||||
${exportDefault}
|
${exportDefault}
|
||||||
|
|
||||||
${exportMembers}
|
${exportMembers}
|
||||||
`
|
`
|
||||||
|
|
||||||
return { [moduleId]: nodeModuleCode }
|
return { [moduleId]: nodeModuleCode }
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue