From f3ae9b3c2a4eb38e8107d88f7e29d79e884fc63e Mon Sep 17 00:00:00 2001 From: the1812 Date: Fri, 6 May 2022 23:40:16 +0800 Subject: [PATCH] Refactor cli options --- dist/cli/batch.js | 23 +- dist/cli/index.js | 25 +- dist/cli/options.js | 117 +++++++-- dist/cli/tagger.js | 35 ++- dist/core/exists.js | 23 +- dist/core/metadata/local-json/local-json.js | 5 +- dist/core/metadata/local-mp3/local-mp3.js | 23 +- .../thb-wiki/lyrics/thb-wiki-lyrics.js | 5 +- dist/core/metadata/thb-wiki/thb-wiki.js | 26 +- dist/core/readline.js | 21 +- dist/core/writer/flac/flac-writer.js | 21 +- dist/core/writer/mp3/mp3-writer.js | 21 +- package.json | 9 +- src/cli/batch.ts | 2 +- src/cli/index.ts | 2 +- src/cli/options.ts | 131 +++++++--- src/cli/tagger.ts | 2 +- tsconfig.json | 3 + yarn.lock | 242 ++++++++---------- 19 files changed, 505 insertions(+), 231 deletions(-) diff --git a/dist/cli/batch.js b/dist/cli/batch.js index 093575b..8d5dee0 100644 --- a/dist/cli/batch.js +++ b/dist/cli/batch.js @@ -1,4 +1,23 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.runBatchTagger = void 0; const fs_1 = require("fs"); @@ -11,8 +30,8 @@ const runBatchTagger = async (folder) => { .filter(dir => dir.isDirectory()) .map(dir => dir.name); const albumCount = albums.length; - const { CliTagger } = await Promise.resolve().then(() => require('./tagger')); - const ora = await Promise.resolve().then(() => require('ora')); + const { CliTagger } = await Promise.resolve().then(() => __importStar(require('./tagger'))); + const { default: ora } = await Promise.resolve().then(() => __importStar(require('ora'))); for (let index = 0; index < albumCount; index++) { try { const album = (0, default_album_name_1.getDefaultAlbumName)(albums[index]); diff --git a/dist/cli/index.js b/dist/cli/index.js index d2e49a1..a70556a 100644 --- a/dist/cli/index.js +++ b/dist/cli/index.js @@ -1,12 +1,31 @@ #!/usr/bin/env node "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); const options_1 = require("./options"); const readline_1 = require("../core/readline"); const default_album_name_1 = require("./default-album-name"); let spinner; const runTagger = async (album) => { - const ora = await Promise.resolve().then(() => require('ora')); + const { default: ora } = await Promise.resolve().then(() => __importStar(require('ora'))); if (!spinner) { spinner = ora({ text: '搜索中', @@ -16,14 +35,14 @@ const runTagger = async (album) => { } }).start(); } - const { CliTagger } = await Promise.resolve().then(() => require('./tagger')); + const { CliTagger } = await Promise.resolve().then(() => __importStar(require('./tagger'))); const tagger = new CliTagger(options_1.cliOptions, options_1.metadataConfig, spinner); await tagger.run(album); process.exit(); }; const defaultAlbumName = (0, default_album_name_1.getDefaultAlbumName)(); if (options_1.cliOptions.batch) { - Promise.resolve().then(() => require('./batch')).then(({ runBatchTagger }) => { + Promise.resolve().then(() => __importStar(require('./batch'))).then(({ runBatchTagger }) => { runBatchTagger(options_1.cliOptions.batch); }); } diff --git a/dist/cli/options.js b/dist/cli/options.js index 5c11da5..6d26ba7 100644 --- a/dist/cli/options.js +++ b/dist/cli/options.js @@ -1,45 +1,114 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.metadataConfig = exports.lyricConfig = exports.cliOptions = void 0; -const commandLineArgs = require("command-line-args"); +const yargs_1 = __importDefault(require("yargs")); +const helpers_1 = require("yargs/helpers"); const core_config_1 = require("../core/core-config"); const debug_1 = require("../core/debug"); const config_file_1 = require("./config-file"); -const options = commandLineArgs([ - { name: 'cover', alias: 'c', type: Boolean, defaultValue: false }, - { name: 'debug', alias: 'd', type: Boolean, defaultValue: false }, - { name: 'source', alias: 's', type: String, defaultValue: 'thb-wiki' }, - { name: 'lyric', alias: 'l', type: Boolean, defaultValue: false }, - { name: 'batch', alias: 'b', type: String, defaultValue: '' }, - { name: 'separator', type: String, defaultValue: core_config_1.DefaultMetadataSeparator }, - { name: 'timeout', type: Number, defaultValue: 30 }, - { name: 'retry', type: Number, defaultValue: 3 }, - { name: 'lyric-type', alias: 't', type: String }, - { name: 'lyric-output', alias: 'o', type: String }, - { name: 'no-lyric-time', alias: 'T', type: Boolean, defaultValue: false }, - { name: 'no-interactive', alias: 'I', type: Boolean, defaultValue: false }, -]); +const options = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)) + .option('cover', { + alias: 'c', + type: 'boolean', + default: false, + description: '是否将封面保存为独立文件', +}) + .option('debug', { + alias: 'd', + type: 'boolean', + default: false, + description: '是否启用调试模式, 输出更杂碎的日志', +}) + .option('source', { + alias: 's', + type: 'string', + default: 'thb-wiki', + choices: ['thb-wiki', 'local-mp3', 'local-json'], + description: '设置数据源', +}) + .option('lyric', { + alias: 'l', + type: 'boolean', + default: false, + description: '是否启用歌词写入 (会增加运行时间)', +}) + .option('lyric-type', { + alias: 'lt', + type: 'string', + default: 'original', + choices: ['original', 'translated', 'mixed'], + description: '歌词类型, 可以选择原文/译文/混合模式', +}) + .option('lyric-output', { + alias: 'lo', + type: 'string', + default: 'metadata', + choices: ['metadata', 'lrc'], + description: '歌词输出方式, 可以选择写入歌曲元数据或者保存为 lrc 文件', +}) + .option('translation-separator', { + alias: 'ts', + type: 'string', + default: ' // ', + description: '指定混合歌词模式下, 使用的分隔符', +}) + .option('lyric-time', { + alias: 'lt', + type: 'boolean', + default: true, + description: '是否启用歌词时轴', +}) + .option('batch', { + alias: 'b', + type: 'string', + description: '是否使用批量模式, 参数为开始批量运行的路径', +}) + .option('separator', { + type: 'string', + default: core_config_1.DefaultMetadataSeparator, + description: '指定 mp3 元数据的分隔符', +}) + .option('timeout', { + type: 'number', + default: 30, + description: '指定一次运行的超时时间', +}) + .option('retry', { + type: 'number', + default: 3, + description: '指定超时后自动重试的最大次数', +}) + .option('interactive', { + alias: 'i', + type: 'boolean', + default: true, + description: '是否允许交互', +}) + .parseSync(); (0, debug_1.setDebug)(options.debug); const configFile = (0, config_file_1.loadConfigFile)(); if (configFile !== null) { (0, debug_1.log)('config file: ', configFile); const { lyric, ...restConfig } = configFile; if (lyric !== undefined) { - if (options['lyric-output'] === undefined) { - options['lyric-output'] = lyric.output; + if (options.lyricOutput === undefined) { + options.lyricOutput = lyric.output; } - if (options['lyric-type'] === undefined) { - options['lyric-type'] = lyric.type; + if (options.lyricType === undefined) { + options.lyricType = lyric.type; } - options['translation-separator'] = lyric.translationSeparator; + options.translationSeparator = lyric.translationSeparator; } Object.assign(options, restConfig); } const lyric = { - type: options['lyric-type'] || 'original', - output: options['lyric-output'] || 'metadata', - time: !options['no-lyric-time'], - translationSeparator: options['translation-separator'] || ' // ' + type: options.lyricType, + output: options.lyricOutput, + time: options.lyricTime, + translationSeparator: options.translationSeparator, }; const metadata = { lyric: options.lyric ? lyric : undefined, diff --git a/dist/cli/tagger.js b/dist/cli/tagger.js index c089d43..e241653 100644 --- a/dist/cli/tagger.js +++ b/dist/cli/tagger.js @@ -1,4 +1,23 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.CliTagger = void 0; const fs_1 = require("fs"); @@ -55,20 +74,20 @@ class CliTagger { const json = (0, fs_1.readFileSync)((0, path_1.resolve)(this.workingDir, localMetadata), { encoding: 'utf8' }); (0, debug_1.log)('localJson get'); (0, debug_1.log)(json); - const { localJson } = await Promise.resolve().then(() => require('../core/metadata/local-json/local-json')); + const { localJson } = await Promise.resolve().then(() => __importStar(require('../core/metadata/local-json/local-json'))); return localJson.normalize(JSON.parse(json), await this.getLocalCover()); } async downloadMetadata(album, cover) { - const { sourceMappings } = await Promise.resolve().then(() => require(`../core/metadata/source-mappings`)); + const { sourceMappings } = await Promise.resolve().then(() => __importStar(require(`../core/metadata/source-mappings`))); const metadataSource = sourceMappings[this.cliOptions.source]; metadataSource.config = this.metadataConfig; this.metadataSource = metadataSource; return await this.metadataSource.getMetadata(album, cover); } async createFiles(metadata) { - const { readdirSync, renameSync } = await Promise.resolve().then(() => require('fs')); - const { dirname } = await Promise.resolve().then(() => require('path')); - const { writerMappings } = await Promise.resolve().then(() => require('../core/writer/writer-mappings')); + const { readdirSync, renameSync } = await Promise.resolve().then(() => __importStar(require('fs'))); + const { dirname } = await Promise.resolve().then(() => __importStar(require('path'))); + const { writerMappings } = await Promise.resolve().then(() => __importStar(require('../core/writer/writer-mappings'))); const fileTypes = Object.keys(writerMappings); const fileTypeFilter = (file) => fileTypes.some(type => file.endsWith(type)); const dir = readdirSync(this.workingDir).sort(leadingNumberSort); @@ -100,7 +119,7 @@ class CliTagger { return targetFiles; } async writeMetadataToFile(metadata, targetFiles) { - const { writerMappings } = await Promise.resolve().then(() => require('../core/writer/writer-mappings')); + const { writerMappings } = await Promise.resolve().then(() => __importStar(require('../core/writer/writer-mappings'))); for (let i = 0; i < targetFiles.length; i++) { const file = targetFiles[i]; (0, debug_1.log)(file); @@ -120,7 +139,7 @@ class CliTagger { // })) const coverBuffer = metadata[0].coverImage; if (this.cliOptions.cover && coverBuffer) { - const imageType = await Promise.resolve().then(() => require('image-type')); + const { default: imageType } = await Promise.resolve().then(() => __importStar(require('image-type'))); const type = imageType(coverBuffer); if (type !== null) { const coverFilename = (0, path_1.resolve)(this.workingDir, `cover.${type.ext}`); @@ -183,7 +202,7 @@ class CliTagger { }); } async run(album) { - const { sourceMappings } = await Promise.resolve().then(() => require(`../core/metadata/source-mappings`)); + const { sourceMappings } = await Promise.resolve().then(() => __importStar(require(`../core/metadata/source-mappings`))); const metadataSource = sourceMappings[this.cliOptions.source]; const noInteractive = this.cliOptions['no-interactive']; if (!metadataSource) { diff --git a/dist/core/exists.js b/dist/core/exists.js index c1b94ca..a058aeb 100644 --- a/dist/core/exists.js +++ b/dist/core/exists.js @@ -1,9 +1,28 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolvePath = void 0; const resolvePath = async (path) => { - const { resolve } = await Promise.resolve().then(() => require('path')); - const { existsSync } = await Promise.resolve().then(() => require('fs')); + const { resolve } = await Promise.resolve().then(() => __importStar(require('path'))); + const { existsSync } = await Promise.resolve().then(() => __importStar(require('fs'))); const localSourcePath = resolve(path).replace(/\\/g, '/'); if (!existsSync(localSourcePath)) { throw new Error('路径不存在'); diff --git a/dist/core/metadata/local-json/local-json.js b/dist/core/metadata/local-json/local-json.js index 3f9df5a..0bd0763 100644 --- a/dist/core/metadata/local-json/local-json.js +++ b/dist/core/metadata/local-json/local-json.js @@ -1,10 +1,13 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.localJson = exports.LocalJson = void 0; const metadata_source_1 = require("../metadata-source"); const fs_1 = require("fs"); const exists_1 = require("../../exists"); -const axios_1 = require("axios"); +const axios_1 = __importDefault(require("axios")); class LocalJson extends metadata_source_1.MetadataSource { /** * Normalize JSON data from file: diff --git a/dist/core/metadata/local-mp3/local-mp3.js b/dist/core/metadata/local-mp3/local-mp3.js index 78ff508..90cbcef 100644 --- a/dist/core/metadata/local-mp3/local-mp3.js +++ b/dist/core/metadata/local-mp3/local-mp3.js @@ -1,11 +1,30 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.localMp3 = exports.LocalMp3 = void 0; const metadata_source_1 = require("../metadata-source"); const fs_1 = require("fs"); const exists_1 = require("../../exists"); const proxy_1 = require("../../proxy"); -const id3 = require("../../node-id3"); +const id3 = __importStar(require("../../node-id3")); const dirFilter = (path, predicate) => { return (0, fs_1.readdirSync)(path, { withFileTypes: true }) .filter(predicate) @@ -16,7 +35,7 @@ class LocalMp3 extends metadata_source_1.MetadataSource { return (0, exists_1.resolvePath)(localSource); } async getMultipleDiscFiles(path) { - const { join } = await Promise.resolve().then(() => require('path')); + const { join } = await Promise.resolve().then(() => __importStar(require('path'))); const subFolders = dirFilter(path, it => it.isDirectory() && /^Disc (\d+)/.test(it.name)); const mp3Filter = (it) => it.isFile() && it.name.endsWith('.mp3'); if (subFolders.length > 0) { diff --git a/dist/core/metadata/thb-wiki/lyrics/thb-wiki-lyrics.js b/dist/core/metadata/thb-wiki/lyrics/thb-wiki-lyrics.js index 4d649a7..9f21d1a 100644 --- a/dist/core/metadata/thb-wiki/lyrics/thb-wiki-lyrics.js +++ b/dist/core/metadata/thb-wiki/lyrics/thb-wiki-lyrics.js @@ -1,7 +1,10 @@ "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.downloadLyrics = void 0; -const axios_1 = require("axios"); +const axios_1 = __importDefault(require("axios")); const jsdom_1 = require("jsdom"); const debug_1 = require("../../../debug"); const lyric_parser_1 = require("./lyric-parser"); diff --git a/dist/core/metadata/thb-wiki/thb-wiki.js b/dist/core/metadata/thb-wiki/thb-wiki.js index 81b257f..bcdda36 100644 --- a/dist/core/metadata/thb-wiki/thb-wiki.js +++ b/dist/core/metadata/thb-wiki/thb-wiki.js @@ -1,8 +1,30 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.thbWiki = exports.THBWiki = void 0; const metadata_source_1 = require("../metadata-source"); -const axios_1 = require("axios"); +const axios_1 = __importDefault(require("axios")); const jsdom_1 = require("jsdom"); const debug_1 = require("../../debug"); const alt_names_1 = require("./alt-names"); @@ -227,7 +249,7 @@ class THBWiki extends metadata_source_1.MetadataSource { const { lyricLanguage, lyric } = await (async () => { const lyricLink = trackNumberRow.querySelector(':not(.new) > a:not(.external)'); if (this.config.lyric && lyricLink) { - const { downloadLyrics } = await Promise.resolve().then(() => require('./lyrics/thb-wiki-lyrics')); + const { downloadLyrics } = await Promise.resolve().then(() => __importStar(require('./lyrics/thb-wiki-lyrics'))); return await downloadLyrics('https://thwiki.cc' + lyricLink.href, title, this.config); } else { diff --git a/dist/core/readline.js b/dist/core/readline.js index 5fea6df..cb8daea 100644 --- a/dist/core/readline.js +++ b/dist/core/readline.js @@ -1,7 +1,26 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.readline = void 0; -const rl = require("readline"); +const rl = __importStar(require("readline")); const reader = rl.createInterface({ input: process.stdin, output: process.stdout, diff --git a/dist/core/writer/flac/flac-writer.js b/dist/core/writer/flac/flac-writer.js index 75a1b80..0a7ae7e 100644 --- a/dist/core/writer/flac/flac-writer.js +++ b/dist/core/writer/flac/flac-writer.js @@ -1,8 +1,27 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.flacWriter = exports.FlacWriter = void 0; const metadata_writer_1 = require("../metadata-writer"); -const flac = require("flac-metadata"); +const flac = __importStar(require("flac-metadata")); const imageinfo = require("imageinfo"); const fs_1 = require("fs"); const stream_1 = require("stream"); diff --git a/dist/core/writer/mp3/mp3-writer.js b/dist/core/writer/mp3/mp3-writer.js index b9e3ed6..43aff27 100644 --- a/dist/core/writer/mp3/mp3-writer.js +++ b/dist/core/writer/mp3/mp3-writer.js @@ -1,8 +1,27 @@ "use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); exports.mp3Writer = exports.Mp3Writer = void 0; const metadata_writer_1 = require("../metadata-writer"); -const id3 = require("../../node-id3"); +const id3 = __importStar(require("../../node-id3")); const languageCodeConvert = (code) => { const mapping = { ja: 'jpn', diff --git a/package.json b/package.json index 8ff55ea..8b02690 100644 --- a/package.json +++ b/package.json @@ -33,18 +33,17 @@ "homepage": "https://github.com/the1812/Touhou-Tagger#readme", "dependencies": { "axios": "^0.19.0", - "command-line-args": "^5.1.1", "flac-metadata": "^0.1.1", "image-type": "^4.1.0", "imageinfo": "^1.0.4", "jsdom": "^19.0.0", - "linkedom": "^0.13.0", "musicgenres-json": "^1.0.2", - "ora": "^4.0.3" + "ora": "^4.0.3", + "yargs": "^17.4.1" }, "devDependencies": { - "@types/command-line-args": "^5.0.0", "@types/jsdom": "^16.2.13", - "@types/node": "^12.7.5" + "@types/node": "^12.7.5", + "@types/yargs": "^17.0.10" } } diff --git a/src/cli/batch.ts b/src/cli/batch.ts index c80b037..cc1a168 100644 --- a/src/cli/batch.ts +++ b/src/cli/batch.ts @@ -10,7 +10,7 @@ export const runBatchTagger = async (folder: string) => { .map(dir => dir.name) const albumCount = albums.length const { CliTagger } = await import('./tagger') - const ora = await import('ora') + const { default: ora } = await import('ora') for (let index = 0; index < albumCount; index++) { try { const album = getDefaultAlbumName(albums[index]) diff --git a/src/cli/index.ts b/src/cli/index.ts index e460eb4..f532438 100644 --- a/src/cli/index.ts +++ b/src/cli/index.ts @@ -6,7 +6,7 @@ import { getDefaultAlbumName } from './default-album-name' let spinner: Ora const runTagger = async (album: string) => { - const ora = await import('ora') + const { default: ora } = await import('ora') if (!spinner) { spinner = ora({ text: '搜索中', diff --git a/src/cli/options.ts b/src/cli/options.ts index 02f7e1a..ad5ee3b 100644 --- a/src/cli/options.ts +++ b/src/cli/options.ts @@ -1,37 +1,89 @@ -import * as commandLineArgs from 'command-line-args' +import yargs from 'yargs' +import { hideBin } from 'yargs/helpers' import { DefaultMetadataSeparator, LyricConfig, MetadataConfig } from '../core/core-config' import { log, setDebug } from '../core/debug' import { loadConfigFile, saveConfigFile } from './config-file' -export interface CliOptions { - cover: boolean - debug: boolean - source: string - lyric: boolean - batch: string - timeout: number - retry: number - separator: string - 'lyric-type': string - 'lyric-output': string - 'no-lyric-time': boolean - 'no-interactive': boolean - [key: string]: any -} -const options = commandLineArgs([ - { name: 'cover', alias: 'c', type: Boolean, defaultValue: false }, - { name: 'debug', alias: 'd', type: Boolean, defaultValue: false }, - { name: 'source', alias: 's', type: String, defaultValue: 'thb-wiki' }, - { name: 'lyric', alias: 'l', type: Boolean, defaultValue: false }, - { name: 'batch', alias: 'b', type: String, defaultValue: '' }, - { name: 'separator', type: String, defaultValue: DefaultMetadataSeparator }, - { name: 'timeout', type: Number, defaultValue: 30 }, - { name: 'retry', type: Number, defaultValue: 3 }, - { name: 'lyric-type', alias: 't', type: String }, - { name: 'lyric-output', alias: 'o', type: String }, - { name: 'no-lyric-time', alias: 'T', type: Boolean, defaultValue: false }, - { name: 'no-interactive', alias: 'I', type: Boolean, defaultValue: false }, -]) as CliOptions +const options = yargs(hideBin(process.argv)) + .option('cover', { + alias: 'c', + type: 'boolean', + default: false, + description: '是否将封面保存为独立文件', + }) + .option('debug', { + alias: 'd', + type: 'boolean', + default: false, + description: '是否启用调试模式, 输出更杂碎的日志', + }) + .option('source', { + alias: 's', + type: 'string', + default: 'thb-wiki', + choices: ['thb-wiki', 'local-mp3', 'local-json'], + description: '设置数据源', + }) + .option('lyric', { + alias: 'l', + type: 'boolean', + default: false, + description: '是否启用歌词写入 (会增加运行时间)', + }) + .option('lyric-type', { + alias: 'lt', + type: 'string', + default: 'original', + choices: ['original', 'translated', 'mixed'], + description: '歌词类型, 可以选择原文/译文/混合模式', + }) + .option('lyric-output', { + alias: 'lo', + type: 'string', + default: 'metadata', + choices: ['metadata', 'lrc'], + description: '歌词输出方式, 可以选择写入歌曲元数据或者保存为 lrc 文件', + }) + .option('translation-separator', { + alias: 'ts', + type: 'string', + default: ' // ', + description: '指定混合歌词模式下, 使用的分隔符', + }) + .option('lyric-time', { + alias: 'lt', + type: 'boolean', + default: true, + description: '是否启用歌词时轴', + }) + .option('batch', { + alias: 'b', + type: 'string', + description: '是否使用批量模式, 参数为开始批量运行的路径', + }) + .option('separator', { + type: 'string', + default: DefaultMetadataSeparator, + description: '指定 mp3 元数据的分隔符', + }) + .option('timeout', { + type: 'number', + default: 30, + description: '指定一次运行的超时时间', + }) + .option('retry', { + type: 'number', + default: 3, + description: '指定超时后自动重试的最大次数', + }) + .option('interactive', { + alias: 'i', + type: 'boolean', + default: true, + description: '是否允许交互', + }) + .parseSync() + setDebug(options.debug) const configFile = loadConfigFile() @@ -39,21 +91,21 @@ if (configFile !== null) { log('config file: ', configFile) const { lyric, ...restConfig } = configFile if (lyric !== undefined) { - if (options['lyric-output'] === undefined) { - options['lyric-output'] = lyric.output + if (options.lyricOutput === undefined) { + options.lyricOutput = lyric.output } - if (options['lyric-type'] === undefined) { - options['lyric-type'] = lyric.type + if (options.lyricType === undefined) { + options.lyricType = lyric.type } - options['translation-separator'] = lyric.translationSeparator + options.translationSeparator = lyric.translationSeparator } Object.assign(options, restConfig) } const lyric = { - type: options['lyric-type'] || 'original', - output: options['lyric-output'] || 'metadata', - time: !options['no-lyric-time'], - translationSeparator: options['translation-separator'] || ' // ' + type: options.lyricType, + output: options.lyricOutput, + time: options.lyricTime, + translationSeparator: options.translationSeparator, } as LyricConfig const metadata: MetadataConfig = { lyric: options.lyric ? lyric : undefined, @@ -66,5 +118,6 @@ log(metadata) saveConfigFile({ ...metadata, lyric }) export const cliOptions = options +export type CliOptions = typeof options export const lyricConfig = lyric export const metadataConfig = metadata diff --git a/src/cli/tagger.ts b/src/cli/tagger.ts index 40d8cea..fd23def 100644 --- a/src/cli/tagger.ts +++ b/src/cli/tagger.ts @@ -120,7 +120,7 @@ export class CliTagger { // })) const coverBuffer = metadata[0].coverImage if (this.cliOptions.cover && coverBuffer) { - const imageType = await import('image-type') + const { default: imageType } = await import('image-type') const type = imageType(coverBuffer) if (type !== null) { const coverFilename = resolve(this.workingDir, `cover.${type.ext}`) diff --git a/tsconfig.json b/tsconfig.json index 367411e..3117f3d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,8 +3,11 @@ "target": "ESNext", "module": "commonjs", "moduleResolution": "node", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, "noImplicitAny": false, "strictNullChecks": false, + "skipLibCheck": true, "sourceMap": false, "allowJs": true, "outDir": "dist/" diff --git a/yarn.lock b/yarn.lock index d646d52..e7476e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,11 +12,6 @@ resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz?cache=0&sync_timestamp=1588200580715&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40types%2Fcolor-name%2Fdownload%2F%40types%2Fcolor-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" integrity sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA= -"@types/command-line-args@^5.0.0": - version "5.0.0" - resolved "https://registry.npm.taobao.org/@types/command-line-args/download/@types/command-line-args-5.0.0.tgz#484e704d20dbb8754a8f091eee45cdd22bcff28c" - integrity sha1-SE5wTSDbuHVKjwke7kXN0ivP8ow= - "@types/jsdom@^16.2.13": version "16.2.13" resolved "https://registry.npmmirror.com/@types/jsdom/download/@types/jsdom-16.2.13.tgz?cache=0&sync_timestamp=1637266038243&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2F%40types%2Fjsdom%2Fdownload%2F%40types%2Fjsdom-16.2.13.tgz#126c8b7441b159d6234610a48de77b6066f1823f" @@ -46,6 +41,18 @@ resolved "https://registry.npmmirror.com/@types/tough-cookie/download/@types/tough-cookie-4.0.1.tgz#8f80dd965ad81f3e1bc26d6f5c727e132721ff40" integrity sha1-j4DdllrYHz4bwm1vXHJ+Eych/0A= +"@types/yargs-parser@*": + version "21.0.0" + resolved "https://registry.npmmirror.com/@types/yargs-parser/-/yargs-parser-21.0.0.tgz#0c60e537fa790f5f9472ed2776c2b71ec117351b" + integrity sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA== + +"@types/yargs@^17.0.10": + version "17.0.10" + resolved "https://registry.npmmirror.com/@types/yargs/-/yargs-17.0.10.tgz#591522fce85d8739bca7b8bb90d048e4478d186a" + integrity sha512-gmEaFwpj/7f/ROdtIlci1R1VYU1J4j95m8T+Tj3iBgiBFKg1foE/PSl93bBd5T9LDXNPo8UlNN6W0qwD8O5OaA== + dependencies: + "@types/yargs-parser" "*" + "@webassemblyjs/ast@1.9.0": version "1.9.0" resolved "https://registry.nlark.com/@webassemblyjs/ast/download/@webassemblyjs/ast-1.9.0.tgz?cache=0&sync_timestamp=1625473466238&other_urls=https%3A%2F%2Fregistry.nlark.com%2F%40webassemblyjs%2Fast%2Fdownload%2F%40webassemblyjs%2Fast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964" @@ -266,6 +273,11 @@ ansi-regex@^5.0.0: resolved "https://registry.npm.taobao.org/ansi-regex/download/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" integrity sha1-OIU59VF5vzkznIGvMKZU1p+Hy3U= +ansi-regex@^5.0.1: + version "5.0.1" + resolved "https://registry.npmmirror.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304" + integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ== + ansi-styles@^3.2.1: version "3.2.1" resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d" @@ -273,6 +285,13 @@ ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0: + version "4.3.0" + resolved "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937" + integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg== + dependencies: + color-convert "^2.0.1" + ansi-styles@^4.1.0: version "4.2.1" resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" @@ -317,11 +336,6 @@ arr-union@^3.1.0: resolved "https://registry.npm.taobao.org/arr-union/download/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= -array-back@^3.0.1: - version "3.1.0" - resolved "https://registry.npm.taobao.org/array-back/download/array-back-3.1.0.tgz#b8859d7a508871c9a7b2cf42f99428f65e96bfb0" - integrity sha1-uIWdelCIccmnss9C+ZQo9l6Wv7A= - array-unique@^0.3.2: version "0.3.2" resolved "https://registry.npm.taobao.org/array-unique/download/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" @@ -432,11 +446,6 @@ bn.js@^5.0.0, bn.js@^5.1.1: resolved "https://registry.npm.taobao.org/bn.js/download/bn.js-5.2.0.tgz#358860674396c6997771a9d051fcc1b57d4ae002" integrity sha1-NYhgZ0OWxpl3canQUfzBtX1K4AI= -boolbase@^1.0.0: - version "1.0.0" - resolved "https://registry.npm.taobao.org/boolbase/download/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" - integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= - brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.npm.taobao.org/brace-expansion/download/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -690,6 +699,15 @@ cli-spinners@^2.2.0: resolved "https://registry.npm.taobao.org/cli-spinners/download/cli-spinners-2.3.0.tgz#0632239a4b5aa4c958610142c34bb7a651fc8df5" integrity sha1-BjIjmktapMlYYQFCw0u3plH8jfU= +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.npmmirror.com/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + clone@^1.0.2: version "1.0.4" resolved "https://registry.npm.taobao.org/clone/download/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" @@ -734,16 +752,6 @@ combined-stream@^1.0.8: dependencies: delayed-stream "~1.0.0" -command-line-args@^5.1.1: - version "5.1.1" - resolved "https://registry.npm.taobao.org/command-line-args/download/command-line-args-5.1.1.tgz#88e793e5bb3ceb30754a86863f0401ac92fd369a" - integrity sha1-iOeT5bs86zB1SoaGPwQBrJL9Npo= - dependencies: - array-back "^3.0.1" - find-replace "^3.0.0" - lodash.camelcase "^4.3.0" - typical "^4.0.0" - commander@^2.20.0: version "2.20.3" resolved "https://registry.npmmirror.com/commander/download/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -854,22 +862,6 @@ crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -css-select@^4.1.3: - version "4.1.3" - resolved "https://registry.nlark.com/css-select/download/css-select-4.1.3.tgz?cache=0&sync_timestamp=1622994276976&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcss-select%2Fdownload%2Fcss-select-4.1.3.tgz#a70440f70317f2669118ad74ff105e65849c7067" - integrity sha1-pwRA9wMX8maRGK10/xBeZYSccGc= - dependencies: - boolbase "^1.0.0" - css-what "^5.0.0" - domhandler "^4.2.0" - domutils "^2.6.0" - nth-check "^2.0.0" - -css-what@^5.0.0: - version "5.1.0" - resolved "https://registry.npmmirror.com/css-what/download/css-what-5.1.0.tgz#3f7b707aadf633baf62c2ceb8579b545bb40f7fe" - integrity sha1-P3tweq32M7r2LCzrhXm1RbtA9/4= - cssom@^0.5.0: version "0.5.0" resolved "https://registry.nlark.com/cssom/download/cssom-0.5.0.tgz?cache=0&sync_timestamp=1624218957158&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fcssom%2Fdownload%2Fcssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" @@ -988,25 +980,11 @@ diffie-hellman@^5.0.0: miller-rabin "^4.0.0" randombytes "^2.0.0" -dom-serializer@^1.0.1: - version "1.3.2" - resolved "https://registry.nlark.com/dom-serializer/download/dom-serializer-1.3.2.tgz?cache=0&sync_timestamp=1621256918158&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdom-serializer%2Fdownload%2Fdom-serializer-1.3.2.tgz#6206437d32ceefaec7161803230c7a20bc1b4d91" - integrity sha1-YgZDfTLO767HFhgDIwx6ILwbTZE= - dependencies: - domelementtype "^2.0.1" - domhandler "^4.2.0" - entities "^2.0.0" - domain-browser@^1.1.1: version "1.2.0" resolved "https://registry.nlark.com/domain-browser/download/domain-browser-1.2.0.tgz?cache=0&sync_timestamp=1627591557212&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdomain-browser%2Fdownload%2Fdomain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" integrity sha1-PTH1AZGmdJ3RN1p/Ui6CPULlTto= -domelementtype@^2.0.1, domelementtype@^2.2.0: - version "2.2.0" - resolved "https://registry.npm.taobao.org/domelementtype/download/domelementtype-2.2.0.tgz?cache=0&sync_timestamp=1617298545989&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fdomelementtype%2Fdownload%2Fdomelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" - integrity sha1-mgtsJ4LtahxzI9QiZxg9+b2LHVc= - domexception@^4.0.0: version "4.0.0" resolved "https://registry.npmmirror.com/domexception/download/domexception-4.0.0.tgz?cache=0&sync_timestamp=1633538737274&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fdomexception%2Fdownload%2Fdomexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" @@ -1014,22 +992,6 @@ domexception@^4.0.0: dependencies: webidl-conversions "^7.0.0" -domhandler@^4.2.0, domhandler@^4.2.2: - version "4.3.0" - resolved "https://registry.npmmirror.com/domhandler/download/domhandler-4.3.0.tgz#16c658c626cf966967e306f966b431f77d4a5626" - integrity sha512-fC0aXNQXqKSFTr2wDNZDhsEYjCiYsDWl3D01kwt25hm1YIPyDGHvvi3rw+PLqHAl/m71MaiF7d5zvBr0p5UB2g== - dependencies: - domelementtype "^2.2.0" - -domutils@^2.6.0, domutils@^2.8.0: - version "2.8.0" - resolved "https://registry.nlark.com/domutils/download/domutils-2.8.0.tgz?cache=0&sync_timestamp=1630106606599&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fdomutils%2Fdownload%2Fdomutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" - integrity sha1-RDfe9dtuLR9dbuhZvZXKfQIEgTU= - dependencies: - dom-serializer "^1.0.1" - domelementtype "^2.2.0" - domhandler "^4.2.0" - duplexify@^3.4.2, duplexify@^3.6.0: version "3.7.1" resolved "https://registry.nlark.com/duplexify/download/duplexify-3.7.1.tgz?cache=0&sync_timestamp=1626860645267&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fduplexify%2Fdownload%2Fduplexify-3.7.1.tgz#2a4df5317f6ccfd91f86d6fd25d8d8a103b88309" @@ -1053,6 +1015,11 @@ elliptic@^6.5.3: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +emoji-regex@^8.0.0: + version "8.0.0" + resolved "https://registry.npmmirror.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" + integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== + emojis-list@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/emojis-list/download/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" @@ -1074,16 +1041,6 @@ enhanced-resolve@^4.5.0: memory-fs "^0.5.0" tapable "^1.0.0" -entities@^2.0.0: - version "2.2.0" - resolved "https://registry.nlark.com/entities/download/entities-2.2.0.tgz#098dc90ebb83d8dffa089d55256b351d34c4da55" - integrity sha1-CY3JDruD2N/6CJ1VJWs1HTTE2lU= - -entities@^3.0.1: - version "3.0.1" - resolved "https://registry.nlark.com/entities/download/entities-3.0.1.tgz#2b887ca62585e96db3903482d336c1006c3001d4" - integrity sha1-K4h8piWF6W2zkDSC0zbBAGwwAdQ= - errno@^0.1.3, errno@~0.1.7: version "0.1.8" resolved "https://registry.npm.taobao.org/errno/download/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" @@ -1091,6 +1048,11 @@ errno@^0.1.3, errno@~0.1.7: dependencies: prr "~1.0.1" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.npmmirror.com/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz?cache=0&sync_timestamp=1587627154980&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fescape-string-regexp%2Fdownload%2Fescape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1254,13 +1216,6 @@ find-cache-dir@^2.1.0: make-dir "^2.0.0" pkg-dir "^3.0.0" -find-replace@^3.0.0: - version "3.0.0" - resolved "https://registry.npm.taobao.org/find-replace/download/find-replace-3.0.0.tgz#3e7e23d3b05167a76f770c9fbd5258b0def68c38" - integrity sha1-Pn4j07BRZ6dvdwyfvVJYsN72jDg= - dependencies: - array-back "^3.0.1" - find-up@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/find-up/download/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -1345,6 +1300,11 @@ fsevents@~2.3.2: resolved "https://registry.npmmirror.com/fsevents/download/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a" integrity sha1-ilJveLj99GI7cJ4Ll1xSwkwC/Ro= +get-caller-file@^2.0.5: + version "2.0.5" + resolved "https://registry.npmmirror.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.npm.taobao.org/get-value/download/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -1468,21 +1428,6 @@ html-encoding-sniffer@^3.0.0: dependencies: whatwg-encoding "^2.0.0" -html-escaper@^3.0.3: - version "3.0.3" - resolved "https://registry.npm.taobao.org/html-escaper/download/html-escaper-3.0.3.tgz#4d336674652beb1dcbc29ef6b6ba7f6be6fdfed6" - integrity sha1-TTNmdGUr6x3Lwp72trp/a+b9/tY= - -htmlparser2@^7.1.2: - version "7.2.0" - resolved "https://registry.npmmirror.com/htmlparser2/download/htmlparser2-7.2.0.tgz?cache=0&sync_timestamp=1636641539121&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fhtmlparser2%2Fdownload%2Fhtmlparser2-7.2.0.tgz#8817cdea38bbc324392a90b1990908e81a65f5a5" - integrity sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog== - dependencies: - domelementtype "^2.0.1" - domhandler "^4.2.2" - domutils "^2.8.0" - entities "^3.0.1" - http-proxy-agent@^5.0.0: version "5.0.0" resolved "https://registry.npmmirror.com/http-proxy-agent/download/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43" @@ -1649,6 +1594,11 @@ is-extglob@^2.1.0, is-extglob@^2.1.1: resolved "https://registry.nlark.com/is-extglob/download/is-extglob-2.1.1.tgz#a88c02535791f02ed37c76a1b9ea9773c833f8c2" integrity sha1-qIwCU1eR8C7TfHahueqXc8gz+MI= +is-fullwidth-code-point@^3.0.0: + version "3.0.0" + resolved "https://registry.npmmirror.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d" + integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg== + is-glob@^3.1.0: version "3.1.0" resolved "https://registry.npmmirror.com/is-glob/download/is-glob-3.1.0.tgz?cache=0&sync_timestamp=1632934512076&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fis-glob%2Fdownload%2Fis-glob-3.1.0.tgz#7ba5ae24217804ac70707b96922567486cc3e84a" @@ -1801,17 +1751,6 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -linkedom@^0.13.0: - version "0.13.0" - resolved "https://registry.npmmirror.com/linkedom/download/linkedom-0.13.0.tgz#15ef2751ee8610a653ee9bb550907ed133bed0a5" - integrity sha1-Fe8nUe6GEKZT7pu1UJB+0TO+0KU= - dependencies: - css-select "^4.1.3" - cssom "^0.5.0" - html-escaper "^3.0.3" - htmlparser2 "^7.1.2" - uhyphen "^0.1.0" - loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.npm.taobao.org/loader-runner/download/loader-runner-2.4.0.tgz?cache=0&sync_timestamp=1610027852811&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Floader-runner%2Fdownload%2Floader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" @@ -1834,11 +1773,6 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" -lodash.camelcase@^4.3.0: - version "4.3.0" - resolved "https://registry.npm.taobao.org/lodash.camelcase/download/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6" - integrity sha1-soqmKIorn8ZRA1x3EfZathkDMaY= - log-symbols@^3.0.0: version "3.0.0" resolved "https://registry.npm.taobao.org/log-symbols/download/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4" @@ -2097,13 +2031,6 @@ normalize-path@^3.0.0, normalize-path@~3.0.0: resolved "https://registry.nlark.com/normalize-path/download/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha1-Dc1p/yOhybEf0JeDFmRKA4ghamU= -nth-check@^2.0.0: - version "2.0.1" - resolved "https://registry.nlark.com/nth-check/download/nth-check-2.0.1.tgz?cache=0&sync_timestamp=1631793807802&other_urls=https%3A%2F%2Fregistry.nlark.com%2Fnth-check%2Fdownload%2Fnth-check-2.0.1.tgz#2efe162f5c3da06a28959fbd3db75dbeea9f0fc2" - integrity sha1-Lv4WL1w9oGoolZ+9PbddvuqfD8I= - dependencies: - boolbase "^1.0.0" - nwsapi@^2.2.0: version "2.2.0" resolved "https://registry.npm.taobao.org/nwsapi/download/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" @@ -2457,6 +2384,11 @@ repeat-string@^1.6.1: resolved "https://registry.npm.taobao.org/repeat-string/download/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= +require-directory@^2.1.1: + version "2.1.1" + resolved "https://registry.npmmirror.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" + integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.npm.taobao.org/resolve-url/download/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -2698,6 +2630,15 @@ stream-shift@^1.0.0: resolved "https://registry.npm.taobao.org/stream-shift/download/stream-shift-1.0.1.tgz#d7088281559ab2778424279b0877da3c392d5a3d" integrity sha1-1wiCgVWasneEJCebCHfaPDktWj0= +string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.npmmirror.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npm.taobao.org/string_decoder/download/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -2719,6 +2660,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.0.0" +strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.npmmirror.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + supports-color@^5.3.0: version "5.5.0" resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f" @@ -2852,16 +2800,6 @@ typedarray@^0.0.6: resolved "https://registry.npm.taobao.org/typedarray/download/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" integrity sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c= -typical@^4.0.0: - version "4.0.0" - resolved "https://registry.npm.taobao.org/typical/download/typical-4.0.0.tgz#cbeaff3b9d7ae1e2bbfaf5a4e6f11eccfde94fc4" - integrity sha1-y+r/O5164eK7+vWk5vEezP3pT8Q= - -uhyphen@^0.1.0: - version "0.1.0" - resolved "https://registry.npmmirror.com/uhyphen/download/uhyphen-0.1.0.tgz#3cc22afa790daa802b9f6789f3583108d5b4a08c" - integrity sha1-PMIq+nkNqoArn2eJ81gxCNW0oIw= - union-value@^1.0.0: version "1.0.1" resolved "https://registry.npm.taobao.org/union-value/download/union-value-1.0.1.tgz#0b6fe7b835aecda61c6ea4d4f02c14221e109847" @@ -3066,6 +3004,15 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmmirror.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.npm.taobao.org/wrappy/download/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -3096,7 +3043,30 @@ y18n@^4.0.0: resolved "https://registry.npm.taobao.org/y18n/download/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha1-le+U+F7MgdAHwmThkKEg8KPIVms= +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.npmmirror.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + yallist@^3.0.2: version "3.1.1" resolved "https://registry.nlark.com/yallist/download/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha1-27fa+b/YusmrRev2ArjLrQ1dCP0= + +yargs-parser@^21.0.0: + version "21.0.1" + resolved "https://registry.npmmirror.com/yargs-parser/-/yargs-parser-21.0.1.tgz#0267f286c877a4f0f728fceb6f8a3e4cb95c6e35" + integrity sha512-9BK1jFpLzJROCI5TzwZL/TU4gqjK5xiHV/RfWLOahrjAko/e4DJkRDZQXfvqAsiZzzYhgAzbgz6lg48jcm4GLg== + +yargs@^17.4.1: + version "17.4.1" + resolved "https://registry.npmmirror.com/yargs/-/yargs-17.4.1.tgz#ebe23284207bb75cee7c408c33e722bfb27b5284" + integrity sha512-WSZD9jgobAg3ZKuCQZSa3g9QOJeCCqLoLAykiWgmXnDo9EPnn4RPf5qVTtzgOx66o6/oqhcA5tHtJXpG8pMt3g== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.3" + y18n "^5.0.5" + yargs-parser "^21.0.0"