diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..f6b9638 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules/ +coverage/ +tmp/ \ No newline at end of file diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 0000000..4ab2c05 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,4 @@ +{ + "extends": "hexo", + "root": true +} diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..93385d9 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 20 diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 0000000..2ddfe8e --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,27 @@ +name: Linter + +on: [push, pull_request] + +jobs: + linter: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Use Node.js 14.x + uses: actions/setup-node@v2 + with: + node-version: '14.x' + - name: Cache NPM dependencies + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.OS }}-npm-cache + restore-keys: | + ${{ runner.OS }}-npm-cache + - name: Install Dependencies + run: npm install + - name: Lint + run: | + npm run eslint + env: + CI: true diff --git a/index.js b/index.js index 0e97097..43241cf 100644 --- a/index.js +++ b/index.js @@ -1,50 +1,54 @@ +/* global hexo */ + 'use strict'; -var renderer = require('./lib/renderer'); -var assign = require('object-assign'); -var read_info = require('./lib/read-info'); -var emacs = require('./lib/emacs'); -var fs = require('fs'); -var path = require('path'); +const renderer = require('./lib/renderer'); +const assign = require('object-assign'); +const read_info = require('./lib/read-info'); +const emacs = require('./lib/emacs'); + +const fs = require('fs'); +const path = require('path'); // for detect if we use `hexo s' -var server_mode = false; -var emacs_server_start = false; +let server_mode = false; +let emacs_server_start = false; // Init option hexo.config.org = assign({ emacs: 'emacs', - emacsclient: 'emacsclient', // user should not setup this if renderer work correctly + emacsclient: 'emacsclient', // user should not setup this if renderer work correctly common: '#+OPTIONS: toc:nil num:nil\n#+BIND: org-html-postamble nil', - export_cfg: "(progn (package-initialize)(require 'org) (require 'org-clock) (require 'ox))", // FIXME: why not remove this ? + export_cfg: '(progn (package-initialize)(require \'org) (require \'org-clock) (require \'ox))', // FIXME: why not remove this ? cachedir: './hexo-org-cache/', - clean_cache: false, // enable this to make 'hexo clean' also clean the cache + clean_cache: false, // enable this to make 'hexo clean' also clean the cache theme: '', user_config: '', htmlize: false, line_number: false, - daemonize: true, // set false to disable use emacs server + daemonize: true, // set false to disable use emacs server debug: false }, hexo.config.org); -hexo.on('ready', function() { +hexo.on('ready', () => { // detect if current is execute for server, we have different method to handle emacs server exit. // some people may use 'hexo generate --watch' or 'hexo generate -w', which we also need to keep emacs server exist server_mode = process.argv.indexOf('server') > 0 || process.argv.indexOf('s') > 0 || process.argv.indexOf('--watch') > 0 || process.argv.indexOf('-w') > 0; // detect if we are going to clear all cache file (the 'cachedir/emacs.d' will not remove ) - if(process.argv.indexOf('clean') > 0 ) { - var dir = hexo.config.org.cachedir; + if (process.argv.indexOf('clean') > 0) { + const dir = hexo.config.org.cachedir; if (fs.existsSync(dir) && hexo.config.org.clean_cache) { - var files = fs.readdirSync(dir); - files.forEach(function (filename) { - var fullname = path.join(dir, filename); - var stats = fs.statSync(fullname); - if (!stats.isDirectory()) - fs.unlink(fullname, (err) => { + const files = fs.readdirSync(dir); + files.forEach(filename => { + const fullname = path.join(dir, filename); + const stats = fs.statSync(fullname); + if (!stats.isDirectory()) { + fs.unlink(fullname, err => { if (err) throw err; - console.log(fullname + " was deleted"); + console.log(fullname + ' was deleted'); }); + } }); } } @@ -64,15 +68,16 @@ hexo.on('ready', function() { }); // When time to exit hexo, kill emacs process -hexo.on('exit', function(err) { +hexo.on('exit', err => { // If use `hexo server`, the hexo will first enter `.on(exit)` event then start the server. // that's why we skip emacs.server.stop() when first etner here with server mode. if (server_mode) { server_mode = false; return; } - if (emacs_server_start) + if (emacs_server_start) { emacs.server.stop(hexo); + } }); hexo.extend.renderer.register('org', 'html', renderer.bind(hexo), false); diff --git a/lib/emacs.js b/lib/emacs.js index 57bb1ef..c6c44e3 100644 --- a/lib/emacs.js +++ b/lib/emacs.js @@ -1,256 +1,239 @@ +/* global hexo */ + 'use strict'; -var child_process = require('child_process'); -var slash = require('slash'); -var fs = require('fs-extra'); -var tmp = require('tmp'); -var path = require('path'); -var retry = require('retry'); -var md5 = require('md5'); +const child_process = require('child_process'); +const slash = require('slash'); +const fs = require('fs-extra'); +const tmp = require('tmp'); +const path = require('path'); +const retry = require('retry'); +const md5 = require('md5'); // A variable to save current config.org.emacsclient info -var emacsclient = "emacsclient"; +let emacsclient = 'emacsclient'; // A variable to save current emacs server status -var emacs_server_is_dead = false; +let emacs_server_is_dead = false; // Set false to disable emacs server -var use_emacs_server = true; +let use_emacs_server = true; // NOTE: Maybe make this variable configurable ? // emacs daemon server-name -var server_name = "hexo-renderer-org"; +const server_name = 'hexo-renderer-org'; // NOTE: Maybe make this variable configurable ? // Directory to place server socket file -var server_dir = "./emacs.d/server"; +const server_dir = './emacs.d/server'; // Emacs daemon server-file (full path) -var server_file = undefined; - -function fix_filepath(s) -{ - // unix way of filepath - s = slash(s); - // convert " -> \" - s = s.replace(/[\""]/g, '\\"'); - return s; +let server_file; + +function fix_filepath(s) { + // unix way of filepath + s = slash(s); + // convert " -> \" + s = s.replace(/[\""]/g, '\\"'); + return s; } -function fix_elisp(s) -{ - // remove lisp's comments - s = s.replace(/^[\s\t]*;.*$/gm, ""); +function fix_elisp(s) { + // remove lisp's comments + s = s.replace(/^[\s\t]*;.*$/gm, ''); - // remove trailing garbage to prevent emacs eval fail - s = s.replace(/\r?\n|\r/g, ""); + // remove trailing garbage to prevent emacs eval fail + s = s.replace(/\r?\n|\r/g, ''); - return s; + return s; } // convert true, false => t, nil -function elisp_bool(b) -{ - return (b == true) ? "t" : "nil"; +function elisp_bool(b) { + return b == true ? 't' : 'nil'; } function update_server_file(hexo) { - var config = hexo.config; - var cachedir = config.org.cachedir; - server_file = path.join(process.cwd(), cachedir, server_dir, server_name); - server_file = fix_filepath(server_file); - if (config.org.debug) - console.log("Update server_file =", server_file); - return server_file; + const config = hexo.config; + const cachedir = config.org.cachedir; + server_file = path.join(process.cwd(), cachedir, server_dir, server_name); + server_file = fix_filepath(server_file); + if (config.org.debug) { console.log('Update server_file =', server_file); } + return server_file; } // The file path of hexo-renderer-org may be too long for emacs --daemon, short it with md5 function get_server_name(hexo) { - return md5(get_server_file(hexo)) + return md5(get_server_file(hexo)); } function get_server_file(hexo) { - return server_file || update_server_file(hexo); + return server_file || update_server_file(hexo); } function ensure_server_dir(hexo) { - // NOTE: Ensure server-dir exist - // It seems that emacs doesn't prepare the directory for the server-file, - // and if the dir doesn't exist, emacs cannot create the server file properly, - // though the server daemon is running, but emacsclient could never get the - // connection done, because the inaccessibility to the server-file, this - // behavior is confirmed on Windows MSYS2 MinGW64 Shell, with GNU Emacs 25.2.1, - // installed using command pacman -S mingw-w64-x86_64-emacs. - var dir = path.dirname(get_server_file(hexo)); - fs.mkdirsSync(dir); - return fs.existsSync(dir); + // NOTE: Ensure server-dir exist + // It seems that emacs doesn't prepare the directory for the server-file, + // and if the dir doesn't exist, emacs cannot create the server file properly, + // though the server daemon is running, but emacsclient could never get the + // connection done, because the inaccessibility to the server-file, this + // behavior is confirmed on Windows MSYS2 MinGW64 Shell, with GNU Emacs 25.2.1, + // installed using command pacman -S mingw-w64-x86_64-emacs. + const dir = path.dirname(get_server_file(hexo)); + fs.mkdirsSync(dir); + return fs.existsSync(dir); } // pass hexo.config to this function -function emacs_server_start(hexo) -{ - var config = hexo.config; - config.highlight = config.highlight || {}; +function emacs_server_start(hexo) { + const config = hexo.config; + config.highlight = config.highlight || {}; - if (!config.org.daemonize) { - use_emacs_server = false; - return; - } + if (!config.org.daemonize) { + use_emacs_server = false; + return; + } - // save config.org.emacsclient info - emacsclient = config.org.emacsclient; + // save config.org.emacsclient info + emacsclient = config.org.emacsclient; - // Find emacs entry point hexo-renderer-org.el - var init_el = path.join(process.cwd(), "emacs", "hexo-renderer-org.el" ); - if (!fs.existsSync(init_el)) - init_el = path.join(process.cwd(), "node_modules", "hexo-renderer-org", "emacs", "hexo-renderer-org.el" ); + // Find emacs entry point hexo-renderer-org.el + let init_el = path.join(process.cwd(), 'emacs', 'hexo-renderer-org.el'); + if (!fs.existsSync(init_el)) { init_el = path.join(process.cwd(), 'node_modules', 'hexo-renderer-org', 'emacs', 'hexo-renderer-org.el'); } - init_el = fix_filepath(init_el); + init_el = fix_filepath(init_el); - var debug_file = tmp.fileSync(); + const debug_file = tmp.fileSync(); - // convert user_config to absolute path - var user_config = ""; - if (config.org.user_config) - user_config = path.join(process.cwd(), path.normalize(config.org.user_config)); + // convert user_config to absolute path + let user_config = ''; + if (config.org.user_config) { user_config = path.join(process.cwd(), path.normalize(config.org.user_config)); } - // Ensure server-dir exist - if (!ensure_server_dir(hexo)) { - if (config.org.debug) - console.log("Warning, directory to emacs server-file doesn't exist."); - // FIXME: Maybe add some code here to avoid inaccessible emacs daemon. - } + // Ensure server-dir exist + if (!ensure_server_dir(hexo)) { + if (config.org.debug) { console.log('Warning, directory to emacs server-file doesn\'t exist.'); } + // FIXME: Maybe add some code here to avoid inaccessible emacs daemon. + } - var emacs_lisp = ` + let emacs_lisp = ` (progn ;; Setup user's config - ${config.org.preloadScript === undefined? "": '(load "' + config.org.preloadScript + '")'} - (setq hexo-renderer-org-cachedir "${fix_filepath(config.org.cachedir) || ""}") - (setq hexo-renderer-org-user-config "${fix_filepath(user_config) || ""}") - (setq hexo-renderer-org-theme "${config.org.theme || ""}") - (setq hexo-renderer-org-common-block "${config.org.common.replace(/\n/g, "\\n")}") + ${config.org.preloadScript === undefined ? '' : '(load "' + config.org.preloadScript + '")'} + (setq hexo-renderer-org-cachedir "${fix_filepath(config.org.cachedir) || ''}") + (setq hexo-renderer-org-user-config "${fix_filepath(user_config) || ''}") + (setq hexo-renderer-org-theme "${config.org.theme || ''}") + (setq hexo-renderer-org-common-block "${config.org.common.replace(/\n/g, '\\n')}") (setq hexo-renderer-org--debug-file "${fix_filepath(debug_file.name)}") - (setq hexo-renderer-org--use-htmlize ${elisp_bool((config.org.htmlize))}) - (setq org-hexo-use-htmlize ${elisp_bool((config.org.htmlize))}) + (setq hexo-renderer-org--use-htmlize ${elisp_bool(config.org.htmlize)}) + (setq org-hexo-use-htmlize ${elisp_bool(config.org.htmlize)}) (setq org-hexo-use-line-number ${elisp_bool(config.org.line_number)}) ;; load init.el (load "${init_el}")) `; - if (config.org.debug) { - console.log("\n------------------------------"); - console.log("emacs: ", config.org.emacs); - console.log("emacs_lisp: \n", emacs_lisp); - console.log("\n------------------------------"); + if (config.org.debug) { + console.log('\n------------------------------'); + console.log('emacs: ', config.org.emacs); + console.log('emacs_lisp: \n', emacs_lisp); + console.log('\n------------------------------'); + } + + // Remove triling garbages + emacs_lisp = fix_elisp(emacs_lisp); + + const exec_args = ['-Q', '--daemon=' + get_server_name(hexo), '--eval', emacs_lisp]; + + const proc = child_process.spawn(config.org.emacs, exec_args, { + stdio: 'inherit' // emacs's htmlize package need tty + }); + + proc.on('exit', code => { + try { + const oops = JSON.parse(fs.readFileSync(debug_file.name, 'utf8')); + console.error(oops.message); + emacs_server_is_dead = true; + hexo.exit(-1); // FIXME: why this can't really make 'hexo s' stop ? + } catch (e) { + // forget about it :) } + }); - // Remove triling garbages - emacs_lisp = fix_elisp(emacs_lisp); + return proc; +} - var exec_args = ['-Q','--daemon=' + get_server_name(hexo), '--eval', emacs_lisp]; +function emacs_server_stop(hexo) { + return new Promise((resolve, reject) => { + const config = hexo.config; - var proc = child_process.spawn(config.org.emacs, exec_args, { - stdio: 'inherit' // emacs's htmlize package need tty - }); + if (emacs_server_is_dead) { return resolve(); } - proc.on('exit', function(code) { - try { - var oops = JSON.parse(fs.readFileSync(debug_file.name, "utf8")); - console.error(oops.message); - emacs_server_is_dead = true; - hexo.exit(-1); // FIXME: why this can't really make 'hexo s' stop ? - } - catch(e) { - // forget about it :) - } + if (!use_emacs_server) { return resolve(); } + + const proc = child_process.spawn(emacsclient, ['-s', get_server_name(hexo), '-e', '(kill-emacs)'], { + // detached: true }); - return proc; + proc.on('exit', code => { + if (code != 0) { + // FIXME: + // What timeout interval is better, or spinning with no timeout ? + setTimeout(() => { + if (config.org.debug) { console.log('Wait for emacs daemon exit!!'); } + resolve(emacs_server_stop(hexo)); + }, 100); + return; + } + // FIXME: + // What if emacsclient doesn't successfully connect to emacs daemon (wrong server file name), + // or emacs daemon doesn't successfully initialize, the emacs daemon becomes a zombie process + // without actually serving as a server. In these situation the command '(kill-emacs)' will + // never reach to emacs daemon, thus causing endless wait. + resolve(); + }); + }); } -function emacs_server_stop(hexo) -{ - return new Promise((resolve,reject) => { - var config = hexo.config; - - if (emacs_server_is_dead) - return resolve(); - - if (!use_emacs_server) - return resolve(); - - var proc = child_process.spawn(emacsclient, ['-s', get_server_name(hexo), '-e', '(kill-emacs)'], { - // detached: true - }); - - proc.on('exit', function(code) { - if (code != 0) { - // FIXME: - // What timeout interval is better, or spinning with no timeout ? - setTimeout(() => { - if (config.org.debug) - console.log("Wait for emacs daemon exit!!"); - resolve(emacs_server_stop(hexo)); - }, 100); - return; - } - // FIXME: - // What if emacsclient doesn't successfully connect to emacs daemon (wrong server file name), - // or emacs daemon doesn't successfully initialize, the emacs daemon becomes a zombie process - // without actually serving as a server. In these situation the command '(kill-emacs)' will - // never reach to emacs daemon, thus causing endless wait. - resolve(); - }); +function emacs_server_wait(hexo) { + return new Promise((resolve, reject) => { + const config = hexo.config; + if (emacs_server_is_dead) { return resolve(); } + + if (!use_emacs_server) { return resolve(); } + + const proc = child_process.spawn(emacsclient, ['-s', get_server_name(hexo), '-e', '(message "ping")'], { }); -} -function emacs_server_wait(hexo) -{ - return new Promise((resolve,reject) => { - var config = hexo.config; - if (emacs_server_is_dead) - return resolve(); - - if (!use_emacs_server) - return resolve(); - - var proc = child_process.spawn(emacsclient, ['-s', get_server_name(hexo), '-e', '(message "ping")'], { - }); - - proc.on('exit', function(code) { - if (code != 0) { - // FIXME: - // What timeout interval is better, or spinning with no timeout ? - setTimeout(() => { - if (config.org.debug) - console.log("Wait for emacs daemon startup!!"); - resolve(emacs_server_wait(hexo)); - }, 100); - return; - } - // FIXME: - // What if emacsclient doesn't successfully connect to emacs daemon (wrong server file name), - // or emacs daemon doesn't successfully initialize, the emacs daemon becomes a zombie process - // without actually serving as a server. In these situation the command '(kill-emacs)' will - // never reach to emacs daemon, thus causing endless wait. - resolve(); - }); + proc.on('exit', code => { + if (code != 0) { + // FIXME: + // What timeout interval is better, or spinning with no timeout ? + setTimeout(() => { + if (config.org.debug) { console.log('Wait for emacs daemon startup!!'); } + resolve(emacs_server_wait(hexo)); + }, 100); + return; + } + // FIXME: + // What if emacsclient doesn't successfully connect to emacs daemon (wrong server file name), + // or emacs daemon doesn't successfully initialize, the emacs daemon becomes a zombie process + // without actually serving as a server. In these situation the command '(kill-emacs)' will + // never reach to emacs daemon, thus causing endless wait. + resolve(); }); + }); } -function emacs_client(hexo, data, callback) -{ - var config = hexo.config; - if (emacs_server_is_dead) - return; +function emacs_client(hexo, data, callback) { + const config = hexo.config; + if (emacs_server_is_dead) { return; } - config.highlight = config.highlight || {}; + config.highlight = config.highlight || {}; - var emacs_path = config.org.emacs; + const emacs_path = config.org.emacs; - var output_file = tmp.fileSync(); + const output_file = tmp.fileSync(); - var emacs_lisp = ` + let emacs_lisp = ` (progn ;; render file according to args (hexo-renderer-org '(:file "${fix_filepath(data.path)}" @@ -258,62 +241,59 @@ function emacs_client(hexo, data, callback) ))) `; - // Enable this for debugging - if (config.org.debug) { - console.log("\n------------------------------"); - console.log("emacsclient: ", config.org.emacsclient); - console.log("emacs_lisp: \n", emacs_lisp); - console.log("\n------------------------------"); - } + // Enable this for debugging + if (config.org.debug) { + console.log('\n------------------------------'); + console.log('emacsclient: ', config.org.emacsclient); + console.log('emacs_lisp: \n', emacs_lisp); + console.log('\n------------------------------'); + } - // Remove triling garbages - emacs_lisp = fix_elisp(emacs_lisp); + // Remove triling garbages + emacs_lisp = fix_elisp(emacs_lisp); - var exec_args = ['-s', get_server_name(hexo), '-e', emacs_lisp]; + const exec_args = ['-s', get_server_name(hexo), '-e', emacs_lisp]; - // if (config.org.export_cfg != '') - // exec_args.splice(1,0,'--execute', config.org.export_cfg); + // if (config.org.export_cfg != '') + // exec_args.splice(1,0,'--execute', config.org.export_cfg); - var operation = retry.operation( { - retries: 100, - factor: 2, - minTimeout: 100, - maxTimeout: 1000, - randomize: true - }); + const operation = retry.operation({ + retries: 100, + factor: 2, + minTimeout: 100, + maxTimeout: 1000, + randomize: true + }); - operation.attempt(function (currentAttempt) { + operation.attempt(currentAttempt => { - var proc = child_process.spawn(config.org.emacsclient, exec_args, { - stdio: 'inherit' - }); + const proc = child_process.spawn(config.org.emacsclient, exec_args, { + stdio: 'inherit' + }); - function retryOrExit(err) { - if (config.org.debug) - console.log("RETRY: ", data.path); + function retryOrExit(err) { + if (config.org.debug) { console.log('RETRY: ', data.path); } - if (emacs_server_is_dead) - callback(""); + if (emacs_server_is_dead) { callback(''); } - const retrying = operation.retry(err); - if (!retrying) { + const retrying = operation.retry(err); + if (!retrying) { - if (config.org.debug) - console.log("DONE: ", data.path); + if (config.org.debug) { console.log('DONE: ', data.path); } - var result = fs.readFileSync(output_file.name, 'utf8'); - callback(result); // return callback - } - } + const result = fs.readFileSync(output_file.name, 'utf8'); + callback(result); // return callback + } + } - proc.on('exit', (code, signal) => { - retryOrExit(code !== 0); - }); + proc.on('exit', (code, signal) => { + retryOrExit(code !== 0); + }); - proc.on('error', (err) => { - retryOrExit(err); - }); + proc.on('error', err => { + retryOrExit(err); }); + }); } @@ -323,36 +303,33 @@ function emacs_client(hexo, data, callback) // 3. does not support htmlize syntax higlight // 4. maybe more slow // 5. just for some system can't use emacs daemon method -function emacs_process(hexo, data, callback) -{ - var config = hexo.config; - config.highlight = config.highlight || {}; +function emacs_process(hexo, data, callback) { + const config = hexo.config; + config.highlight = config.highlight || {}; - var emacs_path = config.org.emacs; + const emacs_path = config.org.emacs; - // Find emacs entry point hexo-renderer-org.el - var init_el = path.join(process.cwd(), "emacs", "hexo-renderer-org.el" ); - if (!fs.existsSync(init_el)) - init_el = path.join(process.cwd(), "node_modules", "hexo-renderer-org", "emacs", "hexo-renderer-org.el" ); + // Find emacs entry point hexo-renderer-org.el + let init_el = path.join(process.cwd(), 'emacs', 'hexo-renderer-org.el'); + if (!fs.existsSync(init_el)) { init_el = path.join(process.cwd(), 'node_modules', 'hexo-renderer-org', 'emacs', 'hexo-renderer-org.el'); } - init_el = fix_filepath(init_el); + init_el = fix_filepath(init_el); - var debug_file = tmp.fileSync(); - var output_file = tmp.fileSync(); + const debug_file = tmp.fileSync(); + const output_file = tmp.fileSync(); - // convert user_config to absolute path - var user_config = ""; - if (config.org.user_config) - user_config = path.join(process.cwd(), path.normalize(config.org.user_config)); + // convert user_config to absolute path + let user_config = ''; + if (config.org.user_config) { user_config = path.join(process.cwd(), path.normalize(config.org.user_config)); } - var emacs_lisp = ` + let emacs_lisp = ` (progn ;; Setup user's config (setq hexo-renderer-org-daemonize nil) - (setq hexo-renderer-org-cachedir "${fix_filepath(config.org.cachedir) || ""}") + (setq hexo-renderer-org-cachedir "${fix_filepath(config.org.cachedir) || ''}") (setq hexo-renderer-org-user-config "") (setq hexo-renderer-org-theme "") - (setq hexo-renderer-org-common-block "${config.org.common.replace(/\n/g, "\\n")}") + (setq hexo-renderer-org-common-block "${config.org.common.replace(/\n/g, '\\n')}") (setq hexo-renderer-org--debug-file "${fix_filepath(debug_file.name)}") (setq hexo-renderer-org--use-htmlize nil) (setq org-hexo-use-htmlize nil) @@ -366,53 +343,52 @@ function emacs_process(hexo, data, callback) (kill-emacs)) `; - // Enable this for debugging - if (config.org.debug) { - console.log("\n------------------------------"); - console.log("emacs: ", config.org.emacs); - console.log("type: emacs process"); - console.log("emacs_lisp: \n", emacs_lisp); - console.log("\n------------------------------"); - } + // Enable this for debugging + if (config.org.debug) { + console.log('\n------------------------------'); + console.log('emacs: ', config.org.emacs); + console.log('type: emacs process'); + console.log('emacs_lisp: \n', emacs_lisp); + console.log('\n------------------------------'); + } - // Remove triling garbages - emacs_lisp = fix_elisp(emacs_lisp); + // Remove triling garbages + emacs_lisp = fix_elisp(emacs_lisp); - var exec_args = ['--batch', '--eval', emacs_lisp]; + const exec_args = ['--batch', '--eval', emacs_lisp]; - // if (config.org.export_cfg != '') - // exec_args.splice(1,0,'--execute', config.org.export_cfg); + // if (config.org.export_cfg != '') + // exec_args.splice(1,0,'--execute', config.org.export_cfg); - var proc = child_process.spawn(config.org.emacs, exec_args); + const proc = child_process.spawn(config.org.emacs, exec_args); - proc.on('exit', (code, signal) => { - if (config.org.debug) - console.log("DONE: ", data.path); + proc.on('exit', (code, signal) => { + if (config.org.debug) { console.log('DONE: ', data.path); } - var result = fs.readFileSync(output_file.name, 'utf8'); - callback(result); // return callback - }); + const result = fs.readFileSync(output_file.name, 'utf8'); + callback(result); // return callback + }); } module.exports = { - server: { - start: function(hexo) { - return emacs_server_start(hexo); - }, - stop: function(hexo) { - return emacs_server_stop(hexo); - }, - wait: function(hexo) { - return emacs_server_wait(hexo); - } + server: { + start: function(hexo) { + return emacs_server_start(hexo); }, - - client: function(hexo, data, callback) { - return emacs_client(hexo, data, callback); + stop: function(hexo) { + return emacs_server_stop(hexo); }, - - process: function(hexo, data, callback) { - return emacs_process(hexo, data, callback); + wait: function(hexo) { + return emacs_server_wait(hexo); } + }, + + client: function(hexo, data, callback) { + return emacs_client(hexo, data, callback); + }, + + process: function(hexo, data, callback) { + return emacs_process(hexo, data, callback); + } }; diff --git a/lib/read-info.js b/lib/read-info.js index d57ab12..92a1ff2 100644 --- a/lib/read-info.js +++ b/lib/read-info.js @@ -1,26 +1,25 @@ 'use strict'; -var moment = require('moment'); +const moment = require('moment'); function read_info(data) { - var _items = {}; + const _items = {}; read_in(); read_all(); return data; function split2(str, delim) { - var parts = str.split(delim); + const parts = str.split(delim); return [parts[0], parts.splice(1, parts.length).join(delim)]; } function read_in() { - var r = data.content.match(/#\+[a-zA-Z]*:.*\n/g); + const r = data.content.match(/#\+[a-zA-Z]*:.*\n/g); if (r) { - for (var i = 0; i < r.length; i++) { - var parts = split2(r[i], ':'); - var key = parts[0].substring(2).trim(); - if(!_items[key]) - _items[key] = parts[1].trim(); + for (let i = 0; i < r.length; i++) { + const parts = split2(r[i], ':'); + const key = parts[0].substring(2).trim(); + if (!_items[key]) { _items[key] = parts[1].trim(); } } } } @@ -48,46 +47,46 @@ function read_info(data) { } // #+TAGS: can split with comma or space - function read_tags(){ - if(_items.TAGS){ - data.setTags(_items.TAGS.split(',').map((item) => item.trim())); + function read_tags() { + if (_items.TAGS) { + data.setTags(_items.TAGS.split(',').map(item => item.trim())); } } - function read_categories(){ - if(_items.CATEGORIES){ - data.setCategories(_items.CATEGORIES.split(',').map((item) => item.trim())); + function read_categories() { + if (_items.CATEGORIES) { + data.setCategories(_items.CATEGORIES.split(',').map(item => item.trim())); } } - function read_layout(){ - if(_items.LAYOUT){ + function read_layout() { + if (_items.LAYOUT) { data.layout = _items.LAYOUT; } } - function read_comments(){ - if(_items.COMMENTS == "no"){ + function read_comments() { + if (_items.COMMENTS == 'no') { data.comments = false; } } function read_permalink() { - if(_items.PERMALINK){ + if (_items.PERMALINK) { data.slug = _items.PERMALINK; } } function read_alias() { // support array, re-read again - if(_items.ALIAS){ - var r = data.content.match(/#\+ALIAS:.*\n/g); + if (_items.ALIAS) { + const r = data.content.match(/#\+ALIAS:.*\n/g); if (r) { data.alias = []; - for (var i = 0; i < r.length; i++) { - var parts = split2(r[i], ':'); - var key = parts[0].substring(2).trim(); - data.alias.push( parts[1].trim()); + for (const i = 0; i < r.length; i++) { + const parts = split2(r[i], ':'); + const key = parts[0].substring(2).trim(); + data.alias.push(parts[1].trim()); } } } diff --git a/lib/renderer.js b/lib/renderer.js index 5ce8a34..b5154ed 100644 --- a/lib/renderer.js +++ b/lib/renderer.js @@ -1,151 +1,147 @@ 'use strict'; -var cheerio = require('cheerio'); -var util = require('hexo-util'); -var os = require('os'); -var iconv = require('iconv-lite'); -var jsonfile = require('jsonfile'); -var md5 = require('md5'); -var fs = require('fs-extra'); -var tmp = require('tmp'); -var path = require('path'); -var highlight = util.highlight; - -var emacs = require('./emacs'); - -function get_content(elem){ - elem('h1.title').remove(); - var r = ""; - var to_export = ['div#preamble', 'div#content', 'div#postamble']; - for(var i=0;i { - - // for use 'htmlize' to syntax highlight code block - if (config.org.htmlize) - reslove(html); - - // for use 'highlight.js' to syntax highlight code block (default) - config.highlight = config.highlight || {}; - var $ = cheerio.load(html, { - ignoreWhitespace: false, - xmlMode: false, - lowerCaseTags: false, - decodeEntities: true - }); - + return new Promise((reslove, reject) => { + + // for use 'htmlize' to syntax highlight code block + if (config.org.htmlize) { reslove(html); } + + // for use 'highlight.js' to syntax highlight code block (default) + config.highlight = config.highlight || {}; + const $ = cheerio.load(html, { + ignoreWhitespace: false, + xmlMode: false, + lowerCaseTags: false, + decodeEntities: true + }); - $('pre.src').each(function() { - var text; // await highlight code text - var lang = 'unknown'; - var code = $(this); - var class_str = code.attr('class'); - if (class_str.startsWith('src src-')) { - lang = class_str.substring('src src-'.length); - } - // In ox-hexml.el, I return the line-number with code text, we need to remove first-line to - // get line-number info - - // remove first line - var lines = code.text().split('\n'); - - var firstLine = parseInt(lines[0]) + 1; - - var gutter;// = config.org.line_number; - if (config.org.line_number) - gutter = true; - else { - gutter = (firstLine == 0) ? false : true; - } - - // remove first line - lines.splice(0,1); - // remove newline - text = lines.join('\n').replace(/\n$/g,''); - - // USE hexo.utils to render highlight.js code block - $(this).replaceWith( highlight(text, { - gutter: gutter, - autoDetect: config.highlight.auto_detect, - firstLine: firstLine, - lang: lang - })); - }); - //reslove(get_content($)); - reslove($.html()); + $('pre.src').each(function() { + let text; // await highlight code text + let lang = 'unknown'; + const code = $(this); + const class_str = code.attr('class'); + if (class_str.startsWith('src src-')) { + lang = class_str.substring('src src-'.length); + } + // In ox-hexml.el, I return the line-number with code text, we need to remove first-line to + // get line-number info + + // remove first line + const lines = code.text().split('\n'); + + const firstLine = parseInt(lines[0]) + 1; + + let gutter;// = config.org.line_number; + if (config.org.line_number) { gutter = true; } else { + gutter = firstLine != 0; + } + + // remove first line + lines.splice(0, 1); + // remove newline + text = lines.join('\n').replace(/\n$/g, ''); + + // USE hexo.utils to render highlight.js code block + $(this).replaceWith(highlight(text, { + gutter: gutter, + autoDetect: config.highlight.auto_detect, + firstLine: firstLine, + lang: lang + })); }); + + // reslove(get_content($)); + reslove($.html()); + }); } function renderer(data) { - return emacs.server.wait(this).then(()=> { - return new Promise((resolve, reject) => { - var config = this.config; - // wait for emacs server ready - this.log.info("render data.path", data.path); - // check cache - var cachefile = null; - if(config.org.cachedir){ - fs.mkdirsSync(config.org.cachedir); - cachefile = config.org.cachedir + md5(data.path); - } - var cache = null; - var content_md5 = null; - if(cachefile){ - if(!fs.existsSync(cachefile)){ - cache = {}; - }else{ - cache = jsonfile.readFileSync(cachefile); - } - var content = fs.readFileSync(data.path); - - content_md5 = md5(content + return emacs.server.wait(this).then(() => { + return new Promise((resolve, reject) => { + const config = this.config; + // wait for emacs server ready + this.log.info('render data.path', data.path); + // check cache + let cachefile = null; + if (config.org.cachedir) { + fs.mkdirsSync(config.org.cachedir); + cachefile = config.org.cachedir + md5(data.path); + } + let cache = null; + let content_md5 = null; + if (cachefile) { + if (!fs.existsSync(cachefile)) { + cache = {}; + } else { + cache = jsonfile.readFileSync(cachefile); + } + const content = fs.readFileSync(data.path); + + content_md5 = md5(content + JSON.stringify(config.org) + JSON.stringify(config.highlight)); - if(cache.md5 == content_md5){ // hit cache - console.log(`${data.path} completed with cache`); - resolve(cache.content); - return; - } - } - convert(data, this) - .then((html) => { - return render_html(html, config); - }) - .then((result) => { - console.log(`${data.path} completed`); - if(cache !== null){ - cache.md5 = content_md5; - cache.content = result; - jsonfile.writeFileSync(cachefile, cache); - } - resolve(result); - }); + if (cache.md5 == content_md5) { // hit cache + console.log(`${data.path} completed with cache`); + resolve(cache.content); + return; + } + } + convert(data, this) + .then(html => { + return render_html(html, config); + }) + .then(result => { + console.log(`${data.path} completed`); + if (cache !== null) { + cache.md5 = content_md5; + cache.content = result; + jsonfile.writeFileSync(cachefile, cache); + } + resolve(result); }); - }); + }); + } function convert(data, hexo) { - return new Promise((resolve, reject) => { - var config = hexo.config; - if (config.org.daemonize) { - emacs.client(hexo, data, resolve); - } - else { - emacs.process(hexo, data, resolve); - } - }); + return new Promise((resolve, reject) => { + const config = hexo.config; + if (config.org.daemonize) { + emacs.client(hexo, data, resolve); + } else { + emacs.process(hexo, data, resolve); + } + }); } module.exports = renderer; diff --git a/package-lock.json b/package-lock.json index b9a1977..fefbf3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,56 @@ { "name": "hexo-renderer-org", - "version": "0.2.5", + "version": "0.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { + "@eslint/eslintrc": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.2.1.tgz", + "integrity": "sha512-bxvbYnBPN1Gibwyp6NrpnFzA3YtRL3BBAyEAFVIpNTm2Rn4Vy87GA5M4aSn3InRrlsbX5N0GW7XIx+U4SAEKdQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.3.1", + "globals": "^13.9.0", + "ignore": "^5.2.0", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + } + } + }, "@gar/promisify": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==" }, + "@humanwhocodes/config-array": { + "version": "0.9.5", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", + "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -124,17 +166,164 @@ "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==" }, + "@types/json-schema": { + "version": "7.0.10", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.10.tgz", + "integrity": "sha512-BLO9bBq59vW3fxCpD4o0N4U+DXsvwvIcl+jofw0frQo/GrBFC+/jRZj1E7kgp6dvTyNmA4y6JCV5Id/r3mNP5A==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.15.0.tgz", + "integrity": "sha512-u6Db5JfF0Esn3tiAKELvoU5TpXVSkOpZ78cEGn/wXtT2RVqs2vkt4ge6N8cRCyw7YVKhmmLDbwI2pg92mlv7cA==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/type-utils": "5.15.0", + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.15.0.tgz", + "integrity": "sha512-NGAYP/+RDM2sVfmKiKOCgJYPstAO40vPAgACoWPO/+yoYKSgAXIFaBKsV8P0Cc7fwKgvj27SjRNX4L7f4/jCKQ==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "debug": "^4.3.2" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.15.0.tgz", + "integrity": "sha512-EFiZcSKrHh4kWk0pZaa+YNJosvKE50EnmN4IfgjkA3bTHElPtYcd2U37QQkNTqwMCS7LXeDeZzEqnsOH8chjSg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0" + } + }, + "@typescript-eslint/type-utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.15.0.tgz", + "integrity": "sha512-KGeDoEQ7gHieLydujGEFLyLofipe9PIzfvA/41urz4hv+xVxPEbmMQonKSynZ0Ks2xDhJQ4VYjB3DnRiywvKDA==", + "dev": true, + "requires": { + "@typescript-eslint/utils": "5.15.0", + "debug": "^4.3.2", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/types": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.15.0.tgz", + "integrity": "sha512-yEiTN4MDy23vvsIksrShjNwQl2vl6kJeG9YkVJXjXZnkJElzVK8nfPsWKYxcsGWG8GhurYXP4/KGj3aZAxbeOA==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.15.0.tgz", + "integrity": "sha512-Hb0e3dGc35b75xLzixM3cSbG1sSbrTBQDfIScqdyvrfJZVEi4XWAT+UL/HMxEdrJNB8Yk28SKxPLtAhfCbBInA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/visitor-keys": "5.15.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + } + }, + "@typescript-eslint/utils": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.15.0.tgz", + "integrity": "sha512-081rWu2IPKOgTOhHUk/QfxuFog8m4wxW43sXNOMSCdh578tGJ1PAaWPsj42LOa7pguh173tNlMigsbrHvh/mtA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.15.0", + "@typescript-eslint/types": "5.15.0", + "@typescript-eslint/typescript-estree": "5.15.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.15.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.15.0.tgz", + "integrity": "sha512-+vX5FKtgvyHbmIJdxMJ2jKm9z2BIlXJiuewI8dsDYMp5LzPUcuTT78Ya5iwvQg3VqSVdmxyM8Anj1Jeq7733ZQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.15.0", + "eslint-visitor-keys": "^3.0.0" + } + }, "@ungap/promise-all-settled": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "a-sync-waterfall": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/a-sync-waterfall/-/a-sync-waterfall-1.0.1.tgz", + "integrity": "sha512-RYTOHHdWipFUliRFMCS4X2Yn2X8M87V/OpSqWzKKOGhzqyUxzyVmhHDH9sAvG+ZuQf/TAOFsLCpMw09I1ufUnA==", + "dev": true + }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==" }, + "acorn": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", + "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true + }, "agent-base": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", @@ -162,6 +351,18 @@ "indent-string": "^4.0.0" } }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, "ansi-align": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz", @@ -204,6 +405,12 @@ "resolved": "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz", "integrity": "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ==" }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, "are-we-there-yet": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-3.0.0.tgz", @@ -223,6 +430,12 @@ "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" }, + "asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", + "dev": true + }, "assertion-error": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", @@ -377,6 +590,12 @@ } } }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, "camel-case": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/camel-case/-/camel-case-4.1.2.tgz", @@ -577,6 +796,12 @@ "resolved": "https://registry.npmjs.org/colors/-/colors-1.0.3.tgz", "integrity": "sha1-BDP0TYCWgP3rYO0mDxsMJi6CpAs=" }, + "command-exists": { + "version": "1.2.9", + "resolved": "https://registry.npmjs.org/command-exists/-/command-exists-1.2.9.tgz", + "integrity": "sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w==", + "dev": true + }, "commander": { "version": "9.1.0", "resolved": "https://registry.npmjs.org/commander/-/commander-9.1.0.tgz", @@ -642,6 +867,12 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz", "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw==" }, + "cuid": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/cuid/-/cuid-2.1.8.tgz", + "integrity": "sha512-xiEMER6E7TlTPnDxrM4eRiC6TRgjNX9xzEZ5U/Se2YJKr7Mq4pJn/2XEHjl3STcSh96GmkHPcBXLES8M29wyyg==", + "dev": true + }, "debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -678,6 +909,12 @@ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==" }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, "deepmerge": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.2.2.tgz", @@ -712,6 +949,15 @@ "path-type": "^4.0.0" } }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "dom-serializer": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz", @@ -812,6 +1058,233 @@ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true }, + "eslint": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", + "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.2.1", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.1", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.3.0", + "espree": "^9.3.1", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^5.2.0", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "regexpp": "^3.2.0", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + } + } + }, + "eslint-config-hexo": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/eslint-config-hexo/-/eslint-config-hexo-5.0.0.tgz", + "integrity": "sha512-fSfgurmn11lNUtaw+Bbr5LgfFP5rS4BtDYWGWgkhAbWKORIwKM+kMxNxa+iy/fY3LJICM3T3i9Jrhjl7qgcCLg==", + "dev": true, + "requires": { + "@typescript-eslint/eslint-plugin": "^5.7.0", + "@typescript-eslint/parser": "^5.7.0", + "eslint-plugin-node": "^11.1.0" + } + }, + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, + "eslint-scope": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.1.tgz", + "integrity": "sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.3.0.tgz", + "integrity": "sha512-mQ+suqKJVyeuwGYHAdjMFqjCyfl8+Ldnxuyp3ldiMBFKkvytrXUZWaiPCEav8qDHKty44bD+qV1IP4T+w+xXRA==", + "dev": true + }, + "espree": { + "version": "9.3.1", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.3.1.tgz", + "integrity": "sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==", + "dev": true, + "requires": { + "acorn": "^8.7.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.3.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-equals": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-2.0.4.tgz", + "integrity": "sha512-caj/ZmjHljPrZtbzJ3kfH5ia/k4mTJe/qSiXAGzxZWRZgsgDV0cvNaQULqUX8t0/JVlzzEdYOwCN5DmzTxoD4w==", + "dev": true + }, "fast-glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", @@ -824,6 +1297,18 @@ "micromatch": "^4.0.4" } }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "fast-memoize": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/fast-memoize/-/fast-memoize-2.5.2.tgz", @@ -842,6 +1327,15 @@ "resolved": "https://registry.npmjs.org/figgy-pudding/-/figgy-pudding-3.5.2.tgz", "integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==" }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -865,6 +1359,22 @@ "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", "dev": true }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz", + "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==", + "dev": true + }, "fp-and-or": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/fp-and-or/-/fp-and-or-0.1.3.tgz", @@ -905,6 +1415,12 @@ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "gauge": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/gauge/-/gauge-4.0.3.tgz", @@ -981,6 +1497,15 @@ } } }, + "globals": { + "version": "13.13.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.13.0.tgz", + "integrity": "sha512-EQ7Q18AJlPwp3vUDL4mKA0KXrXyNIQyWon6T6XQiBQF0XHvRsiCSrWmmeATpUzdJN2HhWZU6Pdl0a9zdep5p6A==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, "globby": { "version": "11.1.0", "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", @@ -1059,6 +1584,108 @@ "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", "dev": true }, + "hexo": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/hexo/-/hexo-6.1.0.tgz", + "integrity": "sha512-TeV2cN61CD2C1GKczJRR3tdZhR3JUQi8wtS4eIgkDOeDYWTmovPoSCcc8jvh42D3fehOPp6E81fTeyjh39QWtA==", + "dev": true, + "requires": { + "abbrev": "^1.1.1", + "archy": "^1.0.0", + "bluebird": "^3.7.2", + "hexo-cli": "^4.3.0", + "hexo-front-matter": "^3.0.0", + "hexo-fs": "^3.1.0", + "hexo-i18n": "^1.0.0", + "hexo-log": "^3.0.0", + "hexo-util": "^2.6.0", + "js-yaml": "^4.1.0", + "js-yaml-js-types": "^1.0.0", + "micromatch": "^4.0.4", + "moize": "^6.1.0", + "moment": "^2.29.1", + "moment-timezone": "^0.5.34", + "nunjucks": "^3.2.3", + "picocolors": "^1.0.0", + "pretty-hrtime": "^1.0.3", + "resolve": "^1.22.0", + "strip-ansi": "^6.0.0", + "text-table": "^0.2.0", + "tildify": "^2.0.0", + "titlecase": "^1.1.3", + "warehouse": "^4.0.0" + }, + "dependencies": { + "hexo-cli": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/hexo-cli/-/hexo-cli-4.3.0.tgz", + "integrity": "sha512-lr46h1tK1RNQJAQZbzKYAWGsmqF5DLrW6xKEakqv/o9JqgdeempBjIm7HqjcZEUBpWij4EO65X6YJiDmT9LR7g==", + "dev": true, + "requires": { + "abbrev": "^1.1.1", + "bluebird": "^3.5.5", + "chalk": "^4.0.0", + "command-exists": "^1.2.8", + "hexo-fs": "^3.0.1", + "hexo-log": "^2.0.0", + "hexo-util": "^2.0.0", + "minimist": "^1.2.5", + "resolve": "^1.11.0", + "tildify": "^2.0.0" + }, + "dependencies": { + "hexo-log": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hexo-log/-/hexo-log-2.0.0.tgz", + "integrity": "sha512-U7zdDae74pXcyhQEyNmpJdq3UI6zWKxQ7/zLoMr/d3CBRdIfB5yO8DWqKUnewfibYv0gODyTWUIhxQDWuwloow==", + "dev": true, + "requires": { + "chalk": "^4.0.0" + } + } + } + } + } + }, + "hexo-front-matter": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hexo-front-matter/-/hexo-front-matter-3.0.0.tgz", + "integrity": "sha512-hSQTPUmB/BCe1BFYmXRkPyLk8rqbBqHCQq+rjwwOJuEfOADrFaVK2VPZb90tJzPyXE1xSxpgCxE/AZq0CyTVwg==", + "dev": true, + "requires": { + "js-yaml": "^4.1.0" + } + }, + "hexo-fs": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hexo-fs/-/hexo-fs-3.1.0.tgz", + "integrity": "sha512-SfoDH7zlU9Iop+bAfEONXezbNIkpVX1QqjNCBYpapilZR+xVOCfTEdlNixanrKBbLGPb2fXqrdDBFgrKuiVGQQ==", + "dev": true, + "requires": { + "bluebird": "^3.5.1", + "chokidar": "^3.0.0", + "graceful-fs": "^4.1.11", + "hexo-util": "^2.0.0" + } + }, + "hexo-i18n": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hexo-i18n/-/hexo-i18n-1.0.0.tgz", + "integrity": "sha512-yw90JHr7ybUHN/QOkpHmlWJj1luVk5/v8CUU5NRA0n4TFp6av8NT7ujZ10GDawgnQEdMHnN5PUfAbNIVGR6axg==", + "dev": true, + "requires": { + "sprintf-js": "^1.0.3" + } + }, + "hexo-log": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/hexo-log/-/hexo-log-3.0.0.tgz", + "integrity": "sha512-fd87qXYznpNTa8SLov+wjDsrPssk4yKSgdIQg1wJPcuthy8ngvbXYdqaJ4vWMSADZ+D257EmKXTJHJyaxJQhVw==", + "dev": true, + "requires": { + "nanocolors": "^0.2.12" + } + }, "hexo-util": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/hexo-util/-/hexo-util-2.6.0.tgz", @@ -1209,6 +1836,16 @@ "minimatch": "^3.0.4" } }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, "import-lazy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", @@ -1341,6 +1978,12 @@ "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", "dev": true }, + "is-plain-object": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-3.0.1.tgz", + "integrity": "sha512-Xnpx182SBMrr/aBik8y+GuR4U1L9FqMSojwDQwPMmxyC6bvEqly9UBCxhauBF5vNh2gwWJNX6oDV7O+OM4z34g==", + "dev": true + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -1375,6 +2018,15 @@ "argparse": "^2.0.1" } }, + "js-yaml-js-types": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/js-yaml-js-types/-/js-yaml-js-types-1.0.0.tgz", + "integrity": "sha512-UNjPwuoaj4mcHkJCJSF6l4MgkzoFjG+JJkBXMYNvjgO3yE9gTeRt+E6PN022vduz/daZZ7HmlEiSEE36NrGE4w==", + "dev": true, + "requires": { + "esprima": "^4.0.1" + } + }, "json-buffer": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", @@ -1393,6 +2045,18 @@ "jju": "^1.1.0" } }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json5": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", @@ -1441,6 +2105,16 @@ "package-json": "^6.3.0" } }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, "libnpmconfig": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/libnpmconfig/-/libnpmconfig-1.2.1.tgz", @@ -1504,6 +2178,12 @@ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, "log-symbols": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", @@ -1604,6 +2284,12 @@ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" }, + "micro-memoize": { + "version": "4.0.9", + "resolved": "https://registry.npmjs.org/micro-memoize/-/micro-memoize-4.0.9.tgz", + "integrity": "sha512-Z2uZi/IUMGQDCXASdujXRqrXXEwSY0XffUrAOllhqzQI3wpUyZbiZTiE2JuYC0HSG2G7DbCS5jZmsEKEGZuemg==", + "dev": true + }, "micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -1868,22 +2554,53 @@ } } }, + "moize": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/moize/-/moize-6.1.0.tgz", + "integrity": "sha512-WrMcM+C2Jy+qyOC/UMhA3BCHGowxV34dhDZnDNfxsREW/8N+33SFjmc23Q61Xv1WUthUA1vYopTitP1sZ5jkeg==", + "dev": true, + "requires": { + "fast-equals": "^2.0.1", + "micro-memoize": "^4.0.9" + } + }, "moment": { "version": "2.29.1", "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz", "integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==" }, + "moment-timezone": { + "version": "0.5.34", + "resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.34.tgz", + "integrity": "sha512-3zAEHh2hKUs3EXLESx/wsgw6IQdusOT8Bxm3D9UrHPQR7zlMmzwybC8zHEM1tQ4LJwP7fcxrWr8tuBg05fFCbg==", + "dev": true, + "requires": { + "moment": ">= 2.9.0" + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "nanocolors": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/nanocolors/-/nanocolors-0.2.13.tgz", + "integrity": "sha512-0n3mSAQLPpGLV9ORXT5+C/D4mwew7Ebws69Hx4E2sgz2ZA5+32Q80B9tL8PbL7XHnRDiAxH/pnrUJ9a4fkTNTA==", + "dev": true + }, "nanoid": { "version": "3.3.1", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.1.tgz", "integrity": "sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==", "dev": true }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "negotiator": { "version": "0.6.3", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", @@ -2130,6 +2847,25 @@ "boolbase": "^1.0.0" } }, + "nunjucks": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/nunjucks/-/nunjucks-3.2.3.tgz", + "integrity": "sha512-psb6xjLj47+fE76JdZwskvwG4MYsQKXUtMsPh6U0YMvmyjRtKRFcxnlXGWglNybtNTNVmGdp94K62/+NjF5FDQ==", + "dev": true, + "requires": { + "a-sync-waterfall": "^1.0.0", + "asap": "^2.0.3", + "commander": "^5.1.0" + }, + "dependencies": { + "commander": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", + "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", + "dev": true + } + } + }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -2143,6 +2879,20 @@ "wrappy": "1" } }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, "p-cancelable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", @@ -2223,6 +2973,15 @@ "tar": "^6.1.11" } }, + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, "parse-github-url": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/parse-github-url/-/parse-github-url-1.0.2.tgz", @@ -2265,6 +3024,12 @@ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, "path-type": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", @@ -2276,16 +3041,34 @@ "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", "dev": true }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, "picomatch": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, "prepend-http": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" }, + "pretty-hrtime": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", + "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", + "dev": true + }, "prismjs": { "version": "1.27.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.27.0.tgz", @@ -2340,6 +3123,12 @@ "once": "^1.3.1" } }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, "pupa": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", @@ -2438,6 +3227,12 @@ "picomatch": "^2.2.1" } }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, "registry-auth-token": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", @@ -2470,6 +3265,23 @@ "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==" }, + "resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "requires": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, "responselike": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", @@ -2488,6 +3300,12 @@ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" }, + "rfdc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", + "integrity": "sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==", + "dev": true + }, "rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", @@ -2655,6 +3473,12 @@ "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==" }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true + }, "ssri": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/ssri/-/ssri-8.0.1.tgz", @@ -2710,6 +3534,12 @@ "has-flag": "^4.0.0" } }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true + }, "tar": { "version": "6.1.11", "resolved": "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz", @@ -2723,6 +3553,30 @@ "yallist": "^4.0.0" } }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "tildify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tildify/-/tildify-2.0.0.tgz", + "integrity": "sha512-Cc+OraorugtXNfs50hU9KS369rFXCfgGLpfCfvlc+Ud5u6VWmUQsOAa9HbTvheQdYnrdJqqv1e5oIqXppMYnSw==", + "dev": true + }, + "titlecase": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/titlecase/-/titlecase-1.1.3.tgz", + "integrity": "sha512-pQX4oiemzjBEELPqgK4WE+q0yhAqjp/yzusGtlSJsOuiDys0RQxggepYmo0BuegIDppYS3b3cpdegRwkpyN3hw==", + "dev": true + }, "tmp": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", @@ -2749,6 +3603,32 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + } + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -2818,6 +3698,15 @@ "xdg-basedir": "^4.0.0" } }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "url-parse-lax": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", @@ -2831,6 +3720,12 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -2848,6 +3743,20 @@ "builtins": "^1.0.3" } }, + "warehouse": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/warehouse/-/warehouse-4.0.0.tgz", + "integrity": "sha512-9i6/JiHzjnyene5Pvvl2D2Pd18no129YGy0C0P7x18iTz/SeO9nOBioR64XoCy5xKwBKQtl3MU361qpr0V9uXw==", + "dev": true, + "requires": { + "JSONStream": "^1.0.7", + "bluebird": "^3.2.2", + "cuid": "^2.1.4", + "graceful-fs": "^4.1.3", + "is-plain-object": "^3.0.0", + "rfdc": "^1.1.4" + } + }, "which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -2872,6 +3781,12 @@ "string-width": "^4.0.0" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "workerpool": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", diff --git a/package.json b/package.json index c88c54b..6e93d2d 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,10 @@ { "name": "hexo-renderer-org", - "version": "0.2.5", + "version": "0.3.0", "description": "Emacs org-mode render plugin for hexo (fork)", "main": "index", "scripts": { + "eslint": "eslint .", "test": "node_modules/.bin/mocha test/index.js" }, "repository": { @@ -20,6 +21,13 @@ "url": "https://github.com/coldnew/hexo-render-org/issues" }, "homepage": "https://github.com/coldnew/hexo-render-org#readme", + "directories": { + "lib": "./lib" + }, + "files": [ + "lib", + "index.js" + ], "dependencies": { "bufferhelper": "^0.2.1", "cheerio": "^1.0.0-rc.10", @@ -37,6 +45,12 @@ }, "devDependencies": { "chai": "^4.3.6", + "eslint": "^8.0.0", + "eslint-config-hexo": "^5.0.0", + "hexo": "^6.0.0", "mocha": "^9.2.2" + }, + "engines": { + "node": ">=12" } } diff --git a/test/index.js b/test/index.js index 4be2c24..c85f170 100644 --- a/test/index.js +++ b/test/index.js @@ -1,12 +1,12 @@ 'use strict'; -var should = require('chai').should(); +const should = require('chai').should(); describe('Org renderer', function() { this.timeout(100000); // in index.js - var assign = require('object-assign'); - var ctx = { + const assign = require('object-assign'); + const ctx = { config: { org: { emacs: 'emacs', @@ -20,16 +20,16 @@ describe('Org renderer', function() { } }; - var r = require('../lib/renderer').bind(ctx); + const r = require('../lib/renderer').bind(ctx); // org-html-postamble contains time and version info which is not easy to test - it('rendering simple-test.org with org-html-postamble', function(){ - var data = { + it('rendering simple-test.org with org-html-postamble', () => { + const data = { path: `${process.cwd()}/test/org/simple-test.org`, text: 'test' // did nothing }; // FIXME: this test can pass on org-mode 8.x, failed on 9.x :-S - return r(data).then((result) => { + return r(data).then(result => { console.log(result); result.should.eql( `