mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-04-07 20:20:12 +08:00
chore: remove useless code
This commit is contained in:
parent
a96991ac38
commit
fc9abe80bc
@ -1,9 +1,10 @@
|
||||
import { builtinModules } from 'module'
|
||||
import { get } from 'http'
|
||||
import { green } from 'chalk'
|
||||
import { Plugin } from 'rollup'
|
||||
import chalk from 'chalk'
|
||||
|
||||
/** 轮询监听 vite 启动 */
|
||||
const TAG = '[waitOn]'
|
||||
|
||||
/** Listen http server startup */
|
||||
export function waitOn(arg0: { port: string | number; interval?: number; }) {
|
||||
return new Promise<number | undefined>(resolve => {
|
||||
const { port, interval = 149 } = arg0
|
||||
@ -12,10 +13,10 @@ export function waitOn(arg0: { port: string | number; interval?: number; }) {
|
||||
const timer: NodeJS.Timer = setInterval(() => {
|
||||
get(url, res => {
|
||||
clearInterval(timer)
|
||||
console.log('[waitOn]', green(`"${url}" are already responsive.`), `(${res.statusCode}: ${res.statusMessage})`)
|
||||
console.log(TAG, chalk.green(`"${url}" are already responsive.`), `(${res.statusCode}: ${res.statusMessage})`)
|
||||
resolve(res.statusCode)
|
||||
}).on('error', err => {
|
||||
console.log('[waitOn]', `counter: ${counter++}`)
|
||||
console.log(TAG, `counter: ${counter++}`)
|
||||
})
|
||||
}, interval)
|
||||
})
|
||||
@ -23,13 +24,3 @@ export function waitOn(arg0: { port: string | number; interval?: number; }) {
|
||||
|
||||
/** node.js builtins module */
|
||||
export const builtins = () => builtinModules.filter(x => !/^_|^(internal|v8|node-inspect)\/|\//.test(x))
|
||||
|
||||
/**
|
||||
* @todo
|
||||
* typescript with esbuild
|
||||
*/
|
||||
export function typescript(): Plugin {
|
||||
return {
|
||||
name: 'cxmh:rollup-typescript-esbuild',
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import path from 'path'
|
||||
import { app, BrowserWindow, ipcMain } from 'electron'
|
||||
import { app, BrowserWindow } from 'electron'
|
||||
|
||||
app.disableHardwareAcceleration()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user