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 */
|
/* global hexo */
|
||||||
'use strict'
|
'use strict'
|
||||||
|
|
||||||
|
/** @typedef {import("@types/hexo")} */
|
||||||
|
|
||||||
hexo.config.minify = {
|
hexo.config.minify = {
|
||||||
enable: true,
|
enable: true,
|
||||||
previewServer: true,
|
previewServer: true,
|
||||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, match, logFn } = require('./tools')
|
||||||
/**
|
/**
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @param {{ path: string }} data
|
* @param {{ path: string }} data
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
*/
|
*/
|
||||||
async function minifyCss(str, data) {
|
async function minifyCss(str, data) {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
|
@ -25,6 +26,9 @@ async function minifyCss(str, data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function minifyCssWithMap() {
|
function minifyCssWithMap() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.css
|
const options = hexo.config.minify.css
|
||||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, logFn } = require('./tools')
|
||||||
/**
|
/**
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @param {{ path: string }} data
|
* @param {{ path: string }} data
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
*/
|
*/
|
||||||
async function minifyHtml(str, data) {
|
async function minifyHtml(str, data) {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
|
|
|
@ -5,6 +5,7 @@ const { isMatch, match, logFn } = require('./tools')
|
||||||
/**
|
/**
|
||||||
* @param {string} str
|
* @param {string} str
|
||||||
* @param {{ path: string }} data
|
* @param {{ path: string }} data
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
*/
|
*/
|
||||||
async function minifyJs(str, data) {
|
async function minifyJs(str, data) {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
|
@ -31,6 +32,9 @@ async function minifyJs(str, data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function minifyJsWithMap() {
|
function minifyJsWithMap() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.js
|
const options = hexo.config.minify.js
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function minifyJson() {
|
function minifyJson() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.json
|
const options = hexo.config.minify.json
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
const { optimize: svgOptimize } = require('svgo')
|
const { optimize: svgOptimize } = require('svgo')
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function minifySvg() {
|
function minifySvg() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.svg
|
const options = hexo.config.minify.svg
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
'use strict'
|
'use strict'
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
async function minifyXml() {
|
async function minifyXml() {
|
||||||
const { minify: compressXml } = await import('minify-xml')
|
const { minify: compressXml } = await import('minify-xml')
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@ const gzip = promisify(zlib.gzip)
|
||||||
const br = promisify(zlib.brotliCompress)
|
const br = promisify(zlib.brotliCompress)
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function gzipFn() {
|
function gzipFn() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.gzip
|
const options = hexo.config.minify.gzip
|
||||||
|
@ -40,6 +43,9 @@ function gzipFn() {
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
function brotliFn() {
|
function brotliFn() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.brotli
|
const options = hexo.config.minify.brotli
|
||||||
|
|
|
@ -25,6 +25,9 @@ function importZstd() {
|
||||||
const { compress: zstd, init = undefined } = importZstd()
|
const { compress: zstd, init = undefined } = importZstd()
|
||||||
const { match, logFn } = require('./tools')
|
const { match, logFn } = require('./tools')
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @this {import('@types/hexo')}
|
||||||
|
*/
|
||||||
async function zstdFn() {
|
async function zstdFn() {
|
||||||
const hexo = this
|
const hexo = this
|
||||||
const options = hexo.config.minify.zstd
|
const options = hexo.config.minify.zstd
|
||||||
|
|
Loading…
Reference in New Issue