Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@salesforcedevs/sfdocs-image-transformer

Package Overview
Dependencies
Maintainers
0
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@salesforcedevs/sfdocs-image-transformer - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5-alpha

8

dist/image-cdn-mapper.js

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

function updateImagePath(node, vfile, baseURLConfig) {
const imagePath = node.url;
let imagePath = node.url;
// Check for for non-internal paths

@@ -37,2 +37,8 @@ if (!isInternalPath(imagePath)) {

const contentRepoPath = filePath.substring(0, matchContentLocalePath.index).trim();
// Fix for Included files using images from media folder
// When an included file has images, then the path contains full absolute path of the image.
// The full path is trimmed till media folder for the existing logic to work.
if (imagePath.includes('/media')) {
imagePath = imagePath.substring(imagePath.indexOf('/media'));
}
// Split the repositoryPath by using "/" delimiter and get the last word for repo id

@@ -39,0 +45,0 @@ // Ex: contentRepoPath = /Users/sfdev/doc-framework-monorepo/packages/example-repository

2

package.json
{
"version": "1.0.4",
"version": "1.0.5-alpha",
"name": "@salesforcedevs/sfdocs-image-transformer",

@@ -4,0 +4,0 @@ "description": "Salesforce Docs markdown plugin for image transormation",

@@ -72,2 +72,9 @@ import { updateImagePath, BaseURLConfig } from '../image-cdn-mapper';

});
it('should construct CDN URL for a sub-folder inside images coming from included shared file', () => {
mockNode.url = '/usr/test/dist/repos/media/images/overview/overview.png';
mockVFile.path = '/example-repository/content/ja-jp/subfolder/file.md';
updateImagePath(mockNode, mockVFile, mockBaseURLConfig);
expect(mockNode.url).toBe('https://cdn.example.com/example-repository/media/images/overview/overview.png');
});
});

@@ -25,3 +25,3 @@ import { VFile } from 'vfile';

export function updateImagePath(node: any, vfile: VFile, baseURLConfig: BaseURLConfig): void {
const imagePath = node.url;
let imagePath = node.url;

@@ -50,3 +50,8 @@ // Check for for non-internal paths

const contentRepoPath = filePath.substring(0, matchContentLocalePath.index).trim();
// Fix for Included files using images from media folder
// When an included file has images, then the path contains full absolute path of the image.
// The full path is trimmed till media folder for the existing logic to work.
if (imagePath.includes('/media')) {
imagePath = imagePath.substring(imagePath.indexOf('/media'));
}
// Split the repositoryPath by using "/" delimiter and get the last word for repo id

@@ -53,0 +58,0 @@ // Ex: contentRepoPath = /Users/sfdev/doc-framework-monorepo/packages/example-repository

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