fix: 兼容V3的目录/
This commit is contained in:
parent
109e7fc907
commit
0bc9112bdb
|
@ -0,0 +1,2 @@
|
|||
import handler from "../../src/core/plugins/handler.js";
|
||||
export default handler
|
|
@ -0,0 +1,2 @@
|
|||
import pluginsLoader from "../../src/core/plugins.loader";
|
||||
export default pluginsLoader
|
|
@ -9,9 +9,9 @@ import Puppeteer from './lib/puppeteer.js'
|
|||
* @returns renderer.render 渲染入口
|
||||
*/
|
||||
export default function (config?: PuppeteerLaunchOptions & {
|
||||
chromiumPath: string;
|
||||
puppeteerWS: any;
|
||||
puppeteerTimeout: any;
|
||||
chromiumPath?: string;
|
||||
puppeteerWS?: any;
|
||||
puppeteerTimeout?: any;
|
||||
}) {
|
||||
// TODO Puppeteer待简化重构
|
||||
return new Puppeteer(config)
|
||||
|
|
61
src/miao.ts
61
src/miao.ts
|
@ -1,2 +1,63 @@
|
|||
export { Common, Data } from '#miao'
|
||||
export { Character, Weapon } from '#miao.models'
|
||||
// import lodash from 'lodash'
|
||||
// import { existsSync, mkdirSync } from 'node:fs'
|
||||
// import util from 'node:util'
|
||||
|
||||
// const rootPath = process.cwd()
|
||||
// const _path = rootPath
|
||||
|
||||
// const getRoot = (root = '') => {
|
||||
// if (!root) {
|
||||
// root = `${_path}/`
|
||||
// } else if (root === 'root' || root === 'yunzai') {
|
||||
// root = `${_path}/`
|
||||
// } else if (root === 'miao') {
|
||||
// root = `${_path}/plugins/miao-plugin/`
|
||||
// } else {
|
||||
// root = `${_path}/plugins/${root}/`
|
||||
// }
|
||||
// return root
|
||||
// }
|
||||
|
||||
// export const Data = {
|
||||
// //
|
||||
// createDir(path = '', root = '', includeFile = false) {
|
||||
// root = getRoot(root)
|
||||
// let pathList = path.split('/')
|
||||
// let nowPath = root
|
||||
// pathList.forEach((name, idx) => {
|
||||
// name = name.trim()
|
||||
// if (!includeFile && idx <= pathList.length - 1) {
|
||||
// nowPath += name + '/'
|
||||
// if (name) {
|
||||
// if (!existsSync(nowPath)) {
|
||||
// mkdirSync(nowPath)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// },
|
||||
// isPromise(data) {
|
||||
// return util.types.isPromise(data)
|
||||
// },
|
||||
// async forEach(data, fn) {
|
||||
// if (lodash.isArray(data)) {
|
||||
// for (let idx = 0; idx < data.length; idx++) {
|
||||
// let ret = fn(data[idx], idx)
|
||||
// ret = Data.isPromise(ret) ? await ret : ret
|
||||
// if (ret === false) {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// } else if (lodash.isPlainObject(data)) {
|
||||
// for (const idx in data) {
|
||||
// let ret = fn(data[idx], idx)
|
||||
// ret = Data.isPromise(ret) ? await ret : ret
|
||||
// if (ret === false) {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
|
|
@ -121,10 +121,7 @@ export class Puppeteer {
|
|||
* @param timeout 响应检查
|
||||
* @returns buffer
|
||||
*/
|
||||
async render(
|
||||
htmlPath: string | Buffer | URL,
|
||||
Options?: ScreenshotFileOptions
|
||||
) {
|
||||
async render(htmlPath: string, Options?: ScreenshotFileOptions) {
|
||||
if (!(await this.isStart())) return false
|
||||
try {
|
||||
const page = await this.#browser?.newPage().catch(err => {
|
||||
|
|
|
@ -10,9 +10,9 @@ import Puppeteer from './puppeteer.js'
|
|||
* @returns renderer.render 渲染入口
|
||||
*/
|
||||
export default function (config?: PuppeteerLaunchOptions & {
|
||||
chromiumPath: string;
|
||||
puppeteerWS: any;
|
||||
puppeteerTimeout: any;
|
||||
chromiumPath?: string;
|
||||
puppeteerWS?: any;
|
||||
puppeteerTimeout?: any;
|
||||
}) {
|
||||
// TODO Puppeteer待简化重构
|
||||
return new Puppeteer(config)
|
||||
|
|
|
@ -43,9 +43,9 @@ export default class Puppeteer extends Renderer {
|
|||
* @param config
|
||||
*/
|
||||
constructor(config?: PuppeteerLaunchOptions & {
|
||||
chromiumPath: string
|
||||
puppeteerWS: any
|
||||
puppeteerTimeout: any
|
||||
chromiumPath?: string
|
||||
puppeteerWS?: any
|
||||
puppeteerTimeout?: any
|
||||
}) {
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
// import { type ScreenshotOptions, type PuppeteerLifeCycleEvent } from 'puppeteer'
|
||||
// import queryString from 'querystring'
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -12,17 +9,3 @@ export interface ScreenshotFileOptions {
|
|||
tab?: string
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
// export interface ScreenshotUrlOptions {
|
||||
// url: string
|
||||
// time?: number
|
||||
// rand?: ScreenshotOptions
|
||||
// params?: queryString.ParsedUrlQueryInput
|
||||
// tab?: string
|
||||
// timeout?: number
|
||||
// cache?: boolean
|
||||
// waitUntil?: PuppeteerLifeCycleEvent | PuppeteerLifeCycleEvent[]
|
||||
// }
|
||||
|
|
Loading…
Reference in New Issue