Socket
Socket
Sign inDemoInstall

hexo-util

Package Overview
Dependencies
Maintainers
8
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hexo-util - npm Package Compare versions

Comparing version 3.1.0 to 3.2.0

2

dist/html_tag.js

@@ -8,3 +8,3 @@ "use strict";

const regexUrl = /(cite|download|href|src|url)$/i;
const regexMeta = /^(og:|twitter:)(audio|image|url|video)(:secure_url)?$/i;
const regexMeta = /^(og:|twitter:)(audio|image|url|video|player)(:secure_url)?$/i;
function encSrcset(str) {

@@ -11,0 +11,0 @@ str.split(' ')

@@ -8,3 +8,3 @@ /**

*/
declare function isExternalLink(input: string, sitehost: string, exclude: string[]): boolean;
declare function isExternalLink(input: string, sitehost: string, exclude?: string | string[]): boolean;
export = isExternalLink;

@@ -46,3 +46,9 @@ "use strict";

stringify(data) {
return this.rule.replace(rParam, (match, name) => data[name]);
return this.rule.replace(rParam, (match, name) => {
const descriptor = Object.getOwnPropertyDescriptor(data, name);
if (descriptor && typeof descriptor.get === 'function') {
throw new Error('Invalid permalink setting!');
}
return data[name];
});
}

@@ -49,0 +55,0 @@ }

@@ -1,2 +0,21 @@

declare function urlForHelper(path: string, options: any): string;
/**
* url_for options type
* @example
* // to call this type
* type urlOpt = Parameters<typeof import('hexo-util')['url_for']>[1];
*/
interface UrlForOptions {
relative?: boolean;
}
/**
* get url relative to base URL (config_yml.url)
* @param path relative path inside `source` folder (config_yml.source_dir)
* @param options
* @returns
* @example
* // global `hexo` must be exist when used this function inside plugin
* const Hutil = require('hexo-util')
* console.log(Hutil.url_for.bind(hexo)('path/to/file/inside/source.css')); // https://example.com/path/to/file/inside/source.css
*/
declare function urlForHelper(path?: string, options?: UrlForOptions | null): string;
export = urlForHelper;

@@ -11,3 +11,13 @@ "use strict";

const cache = new cache_1.default();
function urlForHelper(path = '/', options) {
/**
* get url relative to base URL (config_yml.url)
* @param path relative path inside `source` folder (config_yml.source_dir)
* @param options
* @returns
* @example
* // global `hexo` must be exist when used this function inside plugin
* const Hutil = require('hexo-util')
* console.log(Hutil.url_for.bind(hexo)('path/to/file/inside/source.css')); // https://example.com/path/to/file/inside/source.css
*/
function urlForHelper(path = '/', options = {}) {
if (/^(#|\/\/|http(s)?:)/.test(path))

@@ -18,3 +28,5 @@ return path;

relative: config.relative_link
}, options);
},
// fallback empty object when options filled with NULL
options || {});
// Resolve relative url

@@ -21,0 +33,0 @@ if (options.relative) {

{
"name": "hexo-util",
"version": "3.1.0",
"version": "3.2.0",
"description": "Utilities for Hexo.",

@@ -15,3 +15,3 @@ "main": "dist/index",

"test": "mocha --require ts-node/register",
"test-cov": "nyc --reporter=lcovonly npm run test",
"test-cov": "c8 --reporter=lcovonly npm run test",
"build:highlight": "node scripts/build_highlight_alias.js",

@@ -41,4 +41,3 @@ "postinstall": "npm run build:highlight"

"@types/prismjs": "^1.26.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.41.0",
"c8": "^8.0.1",
"chai": "^4.3.6",

@@ -51,3 +50,2 @@ "chai-as-promised": "^7.1.1",

"mocha": "^10.0.0",
"nyc": "^15.1.0",
"rewire": "^6.0.0",

@@ -54,0 +52,0 @@ "ts-node": "^10.9.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc