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

@figma-export/output-components-as-es6

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@figma-export/output-components-as-es6 - npm Package Compare versions

Comparing version 1.2.0 to 2.0.0-alpha.0

26

index.js

@@ -5,9 +5,7 @@ const fs = require('fs');

const svgToMiniDataURI = require('mini-svg-data-uri');
const { camelCase } = require('@figma-export/output-components-utils');
const { getVariableName } = require('./utils');
module.exports = ({
output,
variablePrefix = '',
variableSuffix = '',
getVariableName = (options) => camelCase(options.componentName.trim()),
useBase64 = false,

@@ -21,7 +19,16 @@ useDataUrl = false,

components.forEach(({ name: componentName, svg }) => {
const variableName = getVariableName(`${variablePrefix} ${componentName} ${variableSuffix}`);
let variableValue = svg;
components.forEach(({ name: componentName, svg, figmaExport }) => {
const options = {
pageName,
componentName,
...figmaExport,
};
// eslint-disable-next-line default-case
const variableName = getVariableName(options);
let variableValue;
if (/^[\d]+/.test(variableName)) {
throw new Error(`"${componentName.trim()}" thrown an error: component names cannot start with a number.`);
}
switch (true) {

@@ -34,2 +41,5 @@ case useBase64:

break;
default:
variableValue = svg;
break;
}

@@ -36,0 +46,0 @@

@@ -7,2 +7,3 @@ /* eslint-disable no-console */

const fs = require('fs');
const { camelCase } = require('@figma-export/output-components-utils');

@@ -40,4 +41,3 @@ const figmaDocument = require('../core/lib/_config.test');

output: 'output',
variablePrefix: 'i',
variableSuffix: 'my ico',
getVariableName: (options) => camelCase(`i ${options.componentName} my ico`),
})(pages);

@@ -44,0 +44,0 @@

{
"name": "@figma-export/output-components-as-es6",
"version": "1.2.0",
"version": "2.0.0-alpha.0",
"description": "Outputter for @figma-export that exports components in javascript file",

@@ -17,6 +17,7 @@ "main": "index.js",

"dependencies": {
"@figma-export/output-components-utils": "^2.0.0-alpha.0",
"make-dir": "~3.0.0",
"mini-svg-data-uri": "~1.1.3"
},
"gitHead": "b084462214ea7a479208f6ebaffe089798cd5b42"
"gitHead": "5829e7cabc31421abc415a1383bb2721c3e23246"
}
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