From 11b145c6c4aacbb69b4c10d49245090dd1db6375 Mon Sep 17 00:00:00 2001 From: Thomas Date: Wed, 24 Nov 2021 14:53:58 +0100 Subject: [PATCH] Switch to picocolors (#4825) nanocolors is deprecated https://github.com/ai/nanocolors --- lib/box/index.js | 2 +- lib/extend/tag.js | 2 +- lib/hexo/index.js | 2 +- lib/hexo/load_config.js | 2 +- lib/hexo/load_plugins.js | 2 +- lib/hexo/load_theme_config.js | 2 +- lib/hexo/post.js | 2 +- lib/plugins/console/deploy.js | 2 +- lib/plugins/console/generate.js | 2 +- lib/plugins/console/list/category.js | 2 +- lib/plugins/console/list/page.js | 2 +- lib/plugins/console/list/post.js | 2 +- lib/plugins/console/list/tag.js | 2 +- lib/plugins/console/migrate.js | 2 +- lib/plugins/console/new.js | 2 +- lib/plugins/console/publish.js | 2 +- lib/plugins/console/render.js | 2 +- lib/plugins/generator/asset.js | 2 +- lib/plugins/processor/asset.js | 2 +- lib/plugins/processor/post.js | 2 +- package.json | 2 +- test/benchmark.js | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/box/index.js b/lib/box/index.js index f248dd58ee..ebea4c3864 100644 --- a/lib/box/index.js +++ b/lib/box/index.js @@ -5,7 +5,7 @@ const Promise = require('bluebird'); const File = require('./file'); const { Pattern, createSha1Hash } = require('hexo-util'); const { createReadStream, readdir, stat, watch } = require('hexo-fs'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const { EventEmitter } = require('events'); const { isMatch, makeRe } = require('micromatch'); diff --git a/lib/extend/tag.js b/lib/extend/tag.js index 71e8676916..4334240278 100644 --- a/lib/extend/tag.js +++ b/lib/extend/tag.js @@ -1,7 +1,7 @@ 'use strict'; const { stripIndent } = require('hexo-util'); -const { cyan, magenta, red, bold } = require('nanocolors'); +const { cyan, magenta, red, bold } = require('picocolors'); const { Environment } = require('nunjucks'); const Promise = require('bluebird'); const rSwigRawFullBlock = /{% *raw *%}/; diff --git a/lib/hexo/index.js b/lib/hexo/index.js index 1f0b4de18c..578cefe914 100644 --- a/lib/hexo/index.js +++ b/lib/hexo/index.js @@ -4,7 +4,7 @@ const Promise = require('bluebird'); const { sep, join, dirname } = require('path'); const tildify = require('tildify'); const Database = require('warehouse'); -const { magenta, underline } = require('nanocolors'); +const { magenta, underline } = require('picocolors'); const { EventEmitter } = require('events'); const { readFile } = require('hexo-fs'); const Module = require('module'); diff --git a/lib/hexo/load_config.js b/lib/hexo/load_config.js index 41faae464d..c8c6f49425 100644 --- a/lib/hexo/load_config.js +++ b/lib/hexo/load_config.js @@ -5,7 +5,7 @@ const tildify = require('tildify'); const Theme = require('../theme'); const Source = require('./source'); const { exists, readdir } = require('hexo-fs'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const { deepMerge } = require('hexo-util'); const validateConfig = require('./validate_config'); const { external_link: externalLinkDefaultCfg } = require('./default_config'); diff --git a/lib/hexo/load_plugins.js b/lib/hexo/load_plugins.js index d2cc4d9cf9..010127c74e 100644 --- a/lib/hexo/load_plugins.js +++ b/lib/hexo/load_plugins.js @@ -3,7 +3,7 @@ const { join } = require('path'); const { exists, readFile, listDir } = require('hexo-fs'); const Promise = require('bluebird'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); module.exports = ctx => { if (!ctx.env.init || ctx.env.safe) return; diff --git a/lib/hexo/load_theme_config.js b/lib/hexo/load_theme_config.js index 697ddfdd31..1abb35d842 100644 --- a/lib/hexo/load_theme_config.js +++ b/lib/hexo/load_theme_config.js @@ -3,7 +3,7 @@ const { join, parse } = require('path'); const tildify = require('tildify'); const { exists, readdir } = require('hexo-fs'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const { deepMerge } = require('hexo-util'); module.exports = ctx => { diff --git a/lib/hexo/post.js b/lib/hexo/post.js index 2251a1592a..7f0db61bbe 100644 --- a/lib/hexo/post.js +++ b/lib/hexo/post.js @@ -4,7 +4,7 @@ const assert = require('assert'); const moment = require('moment'); const Promise = require('bluebird'); const { join, extname, basename } = require('path'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const { load } = require('js-yaml'); const { slugize, escapeRegExp } = require('hexo-util'); const { copyDir, exists, listDir, mkdirs, readFile, rmdir, unlink, writeFile } = require('hexo-fs'); diff --git a/lib/plugins/console/deploy.js b/lib/plugins/console/deploy.js index b48ebf06a1..bd35db8a23 100644 --- a/lib/plugins/console/deploy.js +++ b/lib/plugins/console/deploy.js @@ -1,7 +1,7 @@ 'use strict'; const { exists } = require('hexo-fs'); -const { underline, magenta } = require('nanocolors'); +const { underline, magenta } = require('picocolors'); function deployConsole(args) { let config = this.config.deploy; diff --git a/lib/plugins/console/generate.js b/lib/plugins/console/generate.js index f32042e8ab..a95abb0e15 100644 --- a/lib/plugins/console/generate.js +++ b/lib/plugins/console/generate.js @@ -4,7 +4,7 @@ const { exists, writeFile, unlink, stat, mkdirs } = require('hexo-fs'); const { join } = require('path'); const Promise = require('bluebird'); const prettyHrtime = require('pretty-hrtime'); -const { cyan, magenta } = require('nanocolors'); +const { cyan, magenta } = require('picocolors'); const tildify = require('tildify'); const { PassThrough } = require('stream'); const { createSha1Hash } = require('hexo-util'); diff --git a/lib/plugins/console/list/category.js b/lib/plugins/console/list/category.js index 3691d6900f..8550ec6c1d 100644 --- a/lib/plugins/console/list/category.js +++ b/lib/plugins/console/list/category.js @@ -1,6 +1,6 @@ 'use strict'; -const { underline } = require('nanocolors'); +const { underline } = require('picocolors'); const table = require('text-table'); const { stringLength } = require('./common'); diff --git a/lib/plugins/console/list/page.js b/lib/plugins/console/list/page.js index f6bd970521..7ea880ed54 100644 --- a/lib/plugins/console/list/page.js +++ b/lib/plugins/console/list/page.js @@ -1,6 +1,6 @@ 'use strict'; -const { magenta, underline, gray } = require('nanocolors'); +const { magenta, underline, gray } = require('picocolors'); const table = require('text-table'); const { stringLength } = require('./common'); diff --git a/lib/plugins/console/list/post.js b/lib/plugins/console/list/post.js index a5abc30a60..e09a975b5e 100644 --- a/lib/plugins/console/list/post.js +++ b/lib/plugins/console/list/post.js @@ -1,6 +1,6 @@ 'use strict'; -const { gray, magenta, underline } = require('nanocolors'); +const { gray, magenta, underline } = require('picocolors'); const table = require('text-table'); const { stringLength } = require('./common'); diff --git a/lib/plugins/console/list/tag.js b/lib/plugins/console/list/tag.js index 0c532085bf..6f5dab7c69 100644 --- a/lib/plugins/console/list/tag.js +++ b/lib/plugins/console/list/tag.js @@ -1,6 +1,6 @@ 'use strict'; -const { magenta, underline } = require('nanocolors'); +const { magenta, underline } = require('picocolors'); const table = require('text-table'); const { stringLength } = require('./common'); diff --git a/lib/plugins/console/migrate.js b/lib/plugins/console/migrate.js index a86c4dd42a..707b14ba55 100644 --- a/lib/plugins/console/migrate.js +++ b/lib/plugins/console/migrate.js @@ -1,6 +1,6 @@ 'use strict'; -const { underline, magenta } = require('nanocolors'); +const { underline, magenta } = require('picocolors'); function migrateConsole(args) { // Display help message if user didn't input any arguments diff --git a/lib/plugins/console/new.js b/lib/plugins/console/new.js index 0e471ad918..3b5942c98b 100644 --- a/lib/plugins/console/new.js +++ b/lib/plugins/console/new.js @@ -1,7 +1,7 @@ 'use strict'; const tildify = require('tildify'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const reservedKeys = { _: true, diff --git a/lib/plugins/console/publish.js b/lib/plugins/console/publish.js index 4f535bcf8a..2192e196a1 100644 --- a/lib/plugins/console/publish.js +++ b/lib/plugins/console/publish.js @@ -1,7 +1,7 @@ 'use strict'; const tildify = require('tildify'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); function publishConsole(args) { // Display help message if user didn't input any arguments diff --git a/lib/plugins/console/render.js b/lib/plugins/console/render.js index 44cfb666c2..57028ba0d1 100644 --- a/lib/plugins/console/render.js +++ b/lib/plugins/console/render.js @@ -4,7 +4,7 @@ const { resolve } = require('path'); const tildify = require('tildify'); const prettyHrtime = require('pretty-hrtime'); const fs = require('hexo-fs'); -const { cyan, magenta } = require('nanocolors'); +const { cyan, magenta } = require('picocolors'); function renderConsole(args) { // Display help message if user didn't input any arguments diff --git a/lib/plugins/generator/asset.js b/lib/plugins/generator/asset.js index 7630b16689..3fda4db77d 100644 --- a/lib/plugins/generator/asset.js +++ b/lib/plugins/generator/asset.js @@ -3,7 +3,7 @@ const fs = require('hexo-fs'); const Promise = require('bluebird'); const { extname } = require('path'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const process = (name, ctx) => { return Promise.filter(ctx.model(name).toArray(), asset => fs.exists(asset.source).tap(exist => { diff --git a/lib/plugins/processor/asset.js b/lib/plugins/processor/asset.js index 9595ac6d2f..0dbe442446 100644 --- a/lib/plugins/processor/asset.js +++ b/lib/plugins/processor/asset.js @@ -5,7 +5,7 @@ const Promise = require('bluebird'); const { parse: yfm } = require('hexo-front-matter'); const { extname, relative } = require('path'); const { Pattern } = require('hexo-util'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); module.exports = ctx => { return { diff --git a/lib/plugins/processor/post.js b/lib/plugins/processor/post.js index 3be1422497..c931e61de5 100644 --- a/lib/plugins/processor/post.js +++ b/lib/plugins/processor/post.js @@ -6,7 +6,7 @@ const { parse: yfm } = require('hexo-front-matter'); const { extname, join } = require('path'); const { stat, listDir } = require('hexo-fs'); const { slugize, Pattern, Permalink } = require('hexo-util'); -const { magenta } = require('nanocolors'); +const { magenta } = require('picocolors'); const postDir = '_posts/'; const draftDir = '_drafts/'; diff --git a/package.json b/package.json index 71bc3448dc..6d2056eb0d 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "moize": "^6.1.0", "moment": "^2.22.2", "moment-timezone": "^0.5.21", - "nanocolors": "^0.2.12", + "picocolors": "^1.0.0", "nunjucks": "^3.2.1", "pretty-hrtime": "^1.0.3", "resolve": "^1.8.1", diff --git a/test/benchmark.js b/test/benchmark.js index 83a7ead992..b74c904549 100644 --- a/test/benchmark.js +++ b/test/benchmark.js @@ -6,7 +6,7 @@ const { spawn: spawnAsync } = require('hexo-util'); const { rmdir, exists } = require('hexo-fs'); const { join, resolve } = require('path'); const log = require('hexo-log')(); -const { red } = require('nanocolors'); +const { red } = require('picocolors'); const hooks = [ { regex: /Hexo version/, tag: 'hexo-begin' }, { regex: /Start processing/, tag: 'processing' },