mirror of https://github.com/curbengh/hexo-yam
feat: add hexo type define
This commit is contained in:
parent
a36d5ef2df
commit
9fa79f78d1
2
index.js
2
index.js
|
@ -1,6 +1,8 @@
|
|||
/* global hexo */
|
||||
'use strict'
|
||||
|
||||
/** @typedef {import("@types/hexo")} */
|
||||
|
||||
hexo.config.minify = {
|
||||
enable: true,
|
||||
previewServer: true,
|
||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, match, logFn } = require('./tools')
|
|||
/**
|
||||
* @param {string} str
|
||||
* @param {{ path: string }} data
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
async function minifyCss(str, data) {
|
||||
const hexo = this
|
||||
|
@ -25,6 +26,9 @@ async function minifyCss(str, data) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function minifyCssWithMap() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.css
|
||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, logFn } = require('./tools')
|
|||
/**
|
||||
* @param {string} str
|
||||
* @param {{ path: string }} data
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
async function minifyHtml(str, data) {
|
||||
const hexo = this
|
||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, match, logFn } = require('./tools')
|
|||
/**
|
||||
* @param {string} str
|
||||
* @param {{ path: string }} data
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
async function minifyJs(str, data) {
|
||||
const hexo = this
|
||||
|
@ -31,6 +32,9 @@ async function minifyJs(str, data) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function minifyJsWithMap() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.js
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
'use strict'
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function minifyJson() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.json
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
const { optimize: svgOptimize } = require('svgo')
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function minifySvg() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.svg
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
'use strict'
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
async function minifyXml() {
|
||||
const { minify: compressXml } = await import('minify-xml')
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@ const gzip = promisify(zlib.gzip)
|
|||
const br = promisify(zlib.brotliCompress)
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function gzipFn() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.gzip
|
||||
|
@ -40,6 +43,9 @@ function gzipFn() {
|
|||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
function brotliFn() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.brotli
|
||||
|
|
|
@ -25,6 +25,9 @@ function importZstd() {
|
|||
const { compress: zstd, init = undefined } = importZstd()
|
||||
const { match, logFn } = require('./tools')
|
||||
|
||||
/**
|
||||
* @this {import('@types/hexo')}
|
||||
*/
|
||||
async function zstdFn() {
|
||||
const hexo = this
|
||||
const options = hexo.config.minify.zstd
|
||||
|
|
Loading…
Reference in New Issue