New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@docusaurus/utils

Package Overview
Dependencies
Maintainers
3
Versions
1892
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@docusaurus/utils - npm Package Compare versions

Comparing version 2.0.0-alpha.31 to 2.0.0-alpha.32

2

lib/index.d.ts

@@ -28,3 +28,3 @@ /**

*/
export declare function genChunkName(modulePath: string, prefix?: string, preferredName?: string): string;
export declare function genChunkName(modulePath: string, prefix?: string, preferredName?: string, shortId?: boolean): string;
export declare function idx(target: any, keyPaths?: string | (string | number)[]): any;

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

@@ -104,15 +104,23 @@ "use strict";

*/
function genChunkName(modulePath, prefix, preferredName) {
function genChunkName(modulePath, prefix, preferredName, shortId) {
let chunkName = chunkNameCache.get(modulePath);
if (!chunkName) {
let str = modulePath;
if (preferredName) {
const shortHash = crypto_1.createHash('md5')
if (shortId) {
chunkName = crypto_1.createHash('md5')
.update(modulePath)
.digest('hex')
.substr(0, 3);
str = `${preferredName}${shortHash}`;
.substr(0, 8);
}
const name = str === '/' ? 'index' : docuHash(str);
chunkName = prefix ? `${prefix}---${name}` : name;
else {
let str = modulePath;
if (preferredName) {
const shortHash = crypto_1.createHash('md5')
.update(modulePath)
.digest('hex')
.substr(0, 3);
str = `${preferredName}${shortHash}`;
}
const name = str === '/' ? 'index' : docuHash(str);
chunkName = prefix ? `${prefix}---${name}` : name;
}
chunkNameCache.set(modulePath, chunkName);

@@ -119,0 +127,0 @@ }

{
"name": "@docusaurus/utils",
"version": "2.0.0-alpha.31",
"version": "2.0.0-alpha.32",
"description": "Node utility functions for Docusaurus packages",

@@ -20,3 +20,3 @@ "main": "./lib/index.js",

},
"gitHead": "d4342dcbf32836e62eca2271115ac05ecd06fe26"
"gitHead": "cd9e2f23464a468ad50973c795f3052f4f7852bd"
}

@@ -111,2 +111,16 @@ /**

});
// Only generate short unique id
const thirdAssert = {
a: '0cc175b9',
b: '92eb5ffe',
c: '4a8a08f0',
d: '8277e091',
};
Object.keys(thirdAssert).forEach(str => {
expect(genChunkName(str, undefined, undefined, true)).toBe(
thirdAssert[str],
);
});
expect(genChunkName('d', undefined, undefined, true)).toBe('8277e091');
});

@@ -113,0 +127,0 @@

@@ -104,15 +104,23 @@ /**

preferredName?: string,
shortId?: boolean,
): string {
let chunkName: string | undefined = chunkNameCache.get(modulePath);
if (!chunkName) {
let str = modulePath;
if (preferredName) {
const shortHash = createHash('md5')
if (shortId) {
chunkName = createHash('md5')
.update(modulePath)
.digest('hex')
.substr(0, 3);
str = `${preferredName}${shortHash}`;
.substr(0, 8);
} else {
let str = modulePath;
if (preferredName) {
const shortHash = createHash('md5')
.update(modulePath)
.digest('hex')
.substr(0, 3);
str = `${preferredName}${shortHash}`;
}
const name = str === '/' ? 'index' : docuHash(str);
chunkName = prefix ? `${prefix}---${name}` : name;
}
const name = str === '/' ? 'index' : docuHash(str);
chunkName = prefix ? `${prefix}---${name}` : name;
chunkNameCache.set(modulePath, chunkName);

@@ -119,0 +127,0 @@ }

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