Socket
Socket
Sign inDemoInstall

hexo-util

Package Overview
Dependencies
7
Maintainers
8
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.1 to 3.1.0

0

dist/cache_stream.d.ts

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

2

dist/cache.d.ts

@@ -8,3 +8,3 @@ declare const _default: {

del(id: string): void;
apply(id: string, value: any): any;
apply(id: string, value: any): T;
flush(): void;

@@ -11,0 +11,0 @@ size(): number;

@@ -0,0 +0,0 @@ "use strict";

declare function camelCaseKeys(obj: object): {};
export = camelCaseKeys;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface RGBA {

@@ -0,0 +0,0 @@ "use strict";

declare const decodeURL: (str: string) => string;
export = decodeURL;

@@ -0,0 +0,0 @@ "use strict";

declare function deepMerge<T>(target: Partial<T>, source: Partial<T>): T;
export = deepMerge;

@@ -0,0 +0,0 @@ "use strict";

declare const encodeURL: (str: string) => string;
export = encodeURL;

@@ -0,0 +0,0 @@ "use strict";

declare function escapeDiacritic(str: string): string;
export = escapeDiacritic;

@@ -0,0 +0,0 @@ "use strict";

declare function escapeHTML(str: string): string;
export = escapeHTML;
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
const unescape_html_1 = __importDefault(require("./unescape_html"));
const htmlEntityMap = {
const escapeTestNoEncode = /[<>"'`/=]|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
const escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, 'g');
const escapeReplacements = {
'&': '&amp;',

@@ -16,10 +14,13 @@ '<': '&lt;',

};
const getEscapeReplacement = (ch) => escapeReplacements[ch];
function escapeHTML(str) {
if (typeof str !== 'string')
throw new TypeError('str must be a string!');
str = (0, unescape_html_1.default)(str);
// http://stackoverflow.com/a/12034334
return str.replace(/[&<>"'`/=]/g, a => htmlEntityMap[a]);
// https://github.com/markedjs/marked/blob/master/src/helpers.js
if (escapeTestNoEncode.test(str)) {
return str.replace(escapeReplaceNoEncode, getEscapeReplacement);
}
return str;
}
module.exports = escapeHTML;
//# sourceMappingURL=escape_html.js.map
declare function escapeRegExp(str: string): string;
export = escapeRegExp;

@@ -0,0 +0,0 @@ "use strict";

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

declare function fullUrlForHelper(path?: string): any;
declare function fullUrlForHelper(path?: string): unknown;
export = fullUrlForHelper;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface Options {

@@ -5,6 +5,6 @@ "use strict";

};
const highlight_js_1 = __importDefault(require("highlight.js"));
const strip_indent_1 = __importDefault(require("strip-indent"));
// eslint-disable-next-line @typescript-eslint/no-var-requires
const alias = require('../highlight_alias.json');
let hljs;
function highlightUtil(str, options = {}) {

@@ -17,3 +17,6 @@ if (typeof str !== 'string')

let { wrap = true } = options;
highlight_js_1.default.configure({ classPrefix: useHljs ? 'hljs-' : '' });
if (!hljs) {
hljs = require('highlight.js');
}
hljs.configure({ classPrefix: useHljs ? 'hljs-' : '' });
const data = highlight(str, options);

@@ -75,2 +78,5 @@ const lang = options.lang || data.language || '';

const { autoDetect = false } = options;
if (!hljs) {
hljs = require('highlight.js');
}
if (lang) {

@@ -80,3 +86,3 @@ lang = lang.toLowerCase();

else if (autoDetect) {
const result = highlight_js_1.default.highlightAuto(str);
const result = hljs.highlightAuto(str);
return closeTags(result);

@@ -87,3 +93,3 @@ }

}
const res = highlight_js_1.default.highlight(str, {
const res = hljs.highlight(str, {
language: lang,

@@ -90,0 +96,0 @@ ignoreIllegals: true

declare function htmlTag(tag: string, attrs: {
[key: string]: string | boolean;
[key: string]: string | boolean | null | undefined;
}, text?: string, escape?: boolean): string;
export = htmlTag;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export { default as Cache } from './cache';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /**

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ declare class Pattern {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,1 +1,6 @@

interface Options {
segments?: {
[key: string]: RegExp | string;
};
}
declare class Permalink {

@@ -5,5 +10,3 @@ rule: string;

params: string[];
constructor(rule: string, options: {
segments?: any;
});
constructor(rule: string, options?: Options);
test(str: string): boolean;

@@ -10,0 +13,0 @@ parse(str: string): {};

@@ -8,7 +8,6 @@ "use strict";

class Permalink {
constructor(rule, options) {
constructor(rule, options = {}) {
if (!rule) {
throw new TypeError('rule is required!');
}
options = options || {};
const segments = options.segments || {};

@@ -15,0 +14,0 @@ const params = [];

@@ -0,0 +0,0 @@ interface Options {

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface Options {

@@ -5,5 +5,5 @@ "use strict";

};
const prismjs_1 = __importDefault(require("prismjs"));
const strip_indent_1 = __importDefault(require("strip-indent"));
const components_1 = __importDefault(require("prismjs/components/"));
let Prism;
// https://github.com/PrismJS/prism/issues/2145

@@ -30,8 +30,10 @@ const components_2 = __importDefault(require("prismjs/components"));

function prismHighlight(code, language) {
if (!Prism)
Prism = require('prismjs');
// Prism has not load the language pattern
if (!prismjs_1.default.languages[language] && prismSupportedLanguages.includes(language))
if (!Prism.languages[language] && prismSupportedLanguages.includes(language))
(0, components_1.default)(language);
if (prismjs_1.default.languages[language]) {
if (Prism.languages[language]) {
// Prism escapes output by default
return prismjs_1.default.highlight(code, prismjs_1.default.languages[language], language);
return Prism.highlight(code, Prism.languages[language], language);
}

@@ -38,0 +40,0 @@ // Current language is not supported by Prism, return origin code;

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

declare function relativeUrlHelper(from?: string, to?: string): any;
declare function relativeUrlHelper(from?: string, to?: string): string;
export = relativeUrlHelper;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface Options {

@@ -0,0 +0,0 @@ "use strict";

/// <reference types="node" />
/// <reference types="node" />
import Promise from 'bluebird';
import { SpawnOptions } from 'child_process';

@@ -5,0 +4,0 @@ interface Options extends SpawnOptions {

@@ -6,3 +6,2 @@ "use strict";

const cross_spawn_1 = __importDefault(require("cross-spawn"));
const bluebird_1 = __importDefault(require("bluebird"));
const cache_stream_1 = __importDefault(require("./cache_stream"));

@@ -20,3 +19,3 @@ class StatusError extends Error {

}
return new bluebird_1.default((resolve, reject) => {
return new Promise((resolve, reject) => {
const task = (0, cross_spawn_1.default)(command, args, options);

@@ -23,0 +22,0 @@ const verbose = options.verbose;

declare function striptags(html?: string | String): string;
export = striptags;

@@ -0,0 +0,0 @@ "use strict";

declare const _default: any;
export = _default;
"use strict";
module.exports = require('strip-indent');
//# sourceMappingURL=strip_indent.js.map
declare function tocObj(str: string, options?: {}): any[];
export = tocObj;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface Options {

@@ -0,0 +0,0 @@ "use strict";

declare const unescapeHTML: (str: string) => string;
export = unescapeHTML;

@@ -0,0 +0,0 @@ "use strict";

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

declare function urlForHelper(path: string, options: any): any;
declare function urlForHelper(path: string, options: any): string;
export = urlForHelper;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ interface Options {

@@ -0,0 +0,0 @@ "use strict";

{
"name": "hexo-util",
"version": "3.0.1",
"version": "3.1.0",
"description": "Utilities for Hexo.",
"main": "dist/index",
"types": "./dist/index.d.ts",
"scripts": {

@@ -16,3 +17,3 @@ "prepublishOnly": "npm install && npm run clean && npm run build",

"build:highlight": "node scripts/build_highlight_alias.js",
"prepare": "npm run build:highlight"
"postinstall": "npm run build:highlight"
},

@@ -24,3 +25,2 @@ "files": [

],
"types": "./dist/index.d.ts",
"repository": "hexojs/hexo-util",

@@ -39,3 +39,2 @@ "homepage": "https://hexo.io/",

"devDependencies": {
"@types/bluebird": "^3.5.37",
"@types/cross-spawn": "^6.0.2",

@@ -56,6 +55,5 @@ "@types/node": "^18.11.8",

"ts-node": "^10.9.1",
"typescript": "^4.8.4"
"typescript": "^5.0.3"
},
"dependencies": {
"bluebird": "^3.7.2",
"camel-case": "^4.1.2",

@@ -65,3 +63,3 @@ "cross-spawn": "^7.0.3",

"highlight.js": "^11.6.0",
"htmlparser2": "^8.0.1",
"htmlparser2": "^9.0.0",
"prismjs": "^1.29.0",

@@ -68,0 +66,0 @@ "strip-indent": "^3.0.0"

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

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc