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