From 488c5953df4acd411e6c221f79a12c88a7ff5c8f Mon Sep 17 00:00:00 2001 From: D-Sketon <2055272094@qq.com> Date: Sun, 14 Apr 2024 11:46:26 +0800 Subject: [PATCH] chore(deps): bump hexo-fs from ^4.1.1 to ^4.1.3 --- lib/hexo/load_plugins.ts | 2 +- lib/hexo/multi_config_path.ts | 2 +- lib/hexo/post.ts | 2 +- lib/hexo/render.ts | 4 ++-- lib/hexo/update_package.ts | 2 +- lib/plugins/helper/number_format.ts | 2 +- lib/plugins/renderer/nunjucks.ts | 2 +- lib/plugins/tag/include_code.ts | 2 +- package.json | 2 +- test/scripts/console/config.ts | 4 ++-- test/scripts/console/render.ts | 8 ++++---- test/scripts/hexo/update_package.ts | 6 +++--- 12 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lib/hexo/load_plugins.ts b/lib/hexo/load_plugins.ts index 49802f9292..3c21df4ea5 100644 --- a/lib/hexo/load_plugins.ts +++ b/lib/hexo/load_plugins.ts @@ -19,7 +19,7 @@ function loadModuleList(ctx: Hexo, basedir: string): Promise { // Read package.json and find dependencies return readFile(packagePath).then(content => { - const json = JSON.parse(content as string); + const json = JSON.parse(content); const deps = Object.keys(json.dependencies || {}); const devDeps = Object.keys(json.devDependencies || {}); diff --git a/lib/hexo/multi_config_path.ts b/lib/hexo/multi_config_path.ts index 6c0ad0b88f..cb81a9539a 100644 --- a/lib/hexo/multi_config_path.ts +++ b/lib/hexo/multi_config_path.ts @@ -43,7 +43,7 @@ export = (ctx: Hexo) => function multiConfigPath(base: string, configPaths?: str } // files read synchronously to ensure proper overwrite order - const file = readFileSync(configPath) as string; + const file = readFileSync(configPath); const ext = extname(paths[i]).toLowerCase(); if (ext === '.yml') { diff --git a/lib/hexo/post.ts b/lib/hexo/post.ts index fed51ae5bd..8e443b0283 100644 --- a/lib/hexo/post.ts +++ b/lib/hexo/post.ts @@ -363,7 +363,7 @@ class Post { // Read the content src = join(draftDir, item); return readFile(src); - }).then((content: string) => { + }).then(content => { // Create post Object.assign(data, yfmParse(content)); data.content = data._content; diff --git a/lib/hexo/render.ts b/lib/hexo/render.ts index ce54a18a6b..788201c6e1 100644 --- a/lib/hexo/render.ts +++ b/lib/hexo/render.ts @@ -76,7 +76,7 @@ class Render { } else if (!data.path) { return Promise.reject(new TypeError('No input file or string!')); } else { - promise = readFile(data.path) as Promise; + promise = readFile(data.path); } return promise.then(text => { @@ -109,7 +109,7 @@ class Render { if (data.text == null) { if (!data.path) throw new TypeError('No input file or string!'); - data.text = readFileSync(data.path) as string; + data.text = readFileSync(data.path); } if (data.text == null) throw new TypeError('No input file or string!'); diff --git a/lib/hexo/update_package.ts b/lib/hexo/update_package.ts index 7913a67f67..ba95086e16 100644 --- a/lib/hexo/update_package.ts +++ b/lib/hexo/update_package.ts @@ -25,7 +25,7 @@ function readPkg(path: string): Promise { if (!exist) return; return readFile(path).then(content => { - const pkg = JSON.parse(content as string); + const pkg = JSON.parse(content); if (typeof pkg.hexo !== 'object') return; return pkg; diff --git a/lib/plugins/helper/number_format.ts b/lib/plugins/helper/number_format.ts index 477e50e892..5d92575bd8 100644 --- a/lib/plugins/helper/number_format.ts +++ b/lib/plugins/helper/number_format.ts @@ -6,7 +6,7 @@ interface Options { function numberFormatHelper(num: number, options: Options = {}) { const split = num.toString().split('.'); - let before = split.shift() as string; + let before = split.shift(); let after = split.length ? split[0] : ''; const delimiter = options.delimiter || ','; const separator = options.separator || '.'; diff --git a/lib/plugins/renderer/nunjucks.ts b/lib/plugins/renderer/nunjucks.ts index b8a82bea43..660026999b 100644 --- a/lib/plugins/renderer/nunjucks.ts +++ b/lib/plugins/renderer/nunjucks.ts @@ -53,7 +53,7 @@ function njkCompile(data: StoreFunctionData): nunjucks.Template { const text = 'text' in data ? data.text : readFileSync(data.path); - return nunjucks.compile(text as string, env, data.path); + return nunjucks.compile(text, env, data.path); } function njkRenderer(data: StoreFunctionData, locals?: any): string { diff --git a/lib/plugins/tag/include_code.ts b/lib/plugins/tag/include_code.ts index 78edbe1bdb..c3d56d2fca 100644 --- a/lib/plugins/tag/include_code.ts +++ b/lib/plugins/tag/include_code.ts @@ -55,7 +55,7 @@ export = (ctx: Hexo) => function includeCodeTag(args: string[]) { return exists(src).then(exist => { if (exist) return readFile(src); - }).then((code: string) => { + }).then(code => { if (!code) return; const lines = code.split('\n'); diff --git a/package.json b/package.json index 2255dd4cc7..b489563829 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "bluebird": "^3.7.2", "hexo-cli": "^4.3.0", "hexo-front-matter": "^4.2.1", - "hexo-fs": "^4.1.1", + "hexo-fs": "^4.1.3", "hexo-i18n": "^2.0.0", "hexo-log": "^4.0.1", "hexo-util": "^3.3.0", diff --git a/test/scripts/console/config.ts b/test/scripts/console/config.ts index 3395e12756..0a70da3c73 100644 --- a/test/scripts/console/config.ts +++ b/test/scripts/console/config.ts @@ -65,7 +65,7 @@ describe('config', () => { async function writeConfig(...args) { await config({_: args}); - const content = await readFile(hexo.config_path) as string; + const content = await readFile(hexo.config_path); return load(content) as any; } @@ -107,7 +107,7 @@ describe('config', () => { await config({_: ['title', 'My Blog']}); return readFile(configPath).then(content => { - const json = JSON.parse(content as string); + const json = JSON.parse(content); json.title.should.eql('My Blog'); diff --git a/test/scripts/console/render.ts b/test/scripts/console/render.ts index d79ef572e1..784c5d397e 100644 --- a/test/scripts/console/render.ts +++ b/test/scripts/console/render.ts @@ -43,7 +43,7 @@ describe('render', () => { await writeFile(src, body); await render({_: ['test.yml'], output: 'result.json'}); - const result = await readFile(dest) as string; + const result = await readFile(dest); JSON.parse(result).should.eql({ foo: 1, bar: { @@ -64,7 +64,7 @@ describe('render', () => { await writeFile(src, body); await render({_: [src], output: 'result.json'}); - const result = await readFile(dest) as string; + const result = await readFile(dest); JSON.parse(result).should.eql({ foo: 1, bar: { @@ -85,7 +85,7 @@ describe('render', () => { await writeFile(src, body); await render({_: ['test.yml'], output: dest}); - const result = await readFile(dest) as string; + const result = await readFile(dest); JSON.parse(result).should.eql({ foo: 1, bar: { @@ -108,7 +108,7 @@ describe('render', () => { await writeFile(src, body); await render({_: ['test'], output: 'result.json', engine: 'yaml'}); - const result = await readFile(dest) as string; + const result = await readFile(dest); JSON.parse(result).should.eql({ foo: 1, bar: { diff --git a/test/scripts/hexo/update_package.ts b/test/scripts/hexo/update_package.ts index b2b440bcd9..eaa7876091 100644 --- a/test/scripts/hexo/update_package.ts +++ b/test/scripts/hexo/update_package.ts @@ -25,7 +25,7 @@ describe('Update package.json', () => { await writeFile(packagePath, JSON.stringify(pkg)); await updatePkg(hexo); - const content = await readFile(packagePath) as string; + const content = await readFile(packagePath); JSON.parse(content).hexo.version.should.eql(hexo.version); hexo.env.init.should.be.true; @@ -40,7 +40,7 @@ describe('Update package.json', () => { await writeFile(packagePath, JSON.stringify(pkg)); await updatePkg(hexo); - const content = await readFile(packagePath) as string; + const content = await readFile(packagePath); // Don't change the original package.json JSON.parse(content).should.eql(pkg); hexo.env.init.should.be.false; @@ -57,7 +57,7 @@ describe('Update package.json', () => { await writeFile(packagePath, JSON.stringify(pkg)); await updatePkg(hexo); - const content = await readFile(packagePath) as string; + const content = await readFile(packagePath); JSON.parse(content).should.eql(pkg); hexo.env.init.should.be.true;