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

@teleporthq/teleport-plugin-react-styled-components

Package Overview
Dependencies
Maintainers
5
Versions
136
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleporthq/teleport-plugin-react-styled-components - npm Package Compare versions

Comparing version

to
0.17.6

1

dist/cjs/constants.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.projectVariantPropKey = exports.projectVariantPropPrefix = exports.componentVariantPropKey = exports.componentVariantPropPrefix = exports.VARIANT_DEPENDENCY = void 0;
exports.VARIANT_DEPENDENCY = {

@@ -4,0 +5,0 @@ type: 'package',

42

dist/cjs/index.js

@@ -13,2 +13,21 @@ "use strict";

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -50,10 +69,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStyleSheetPlugin = exports.createReactStyledComponentsPlugin = void 0;
var types = __importStar(require("@babel/types"));

@@ -65,5 +78,5 @@ var teleport_types_1 = require("@teleporthq/teleport-types");

var style_sheet_1 = require("./style-sheet");
exports.createStyleSheetPlugin = style_sheet_1.createStyleSheetPlugin;
Object.defineProperty(exports, "createStyleSheetPlugin", { enumerable: true, get: function () { return style_sheet_1.createStyleSheetPlugin; } });
var constants_1 = require("./constants");
exports.createReactStyledComponentsPlugin = function (config) {
var createReactStyledComponentsPlugin = function (config) {
var _a = config || {}, _b = _a.componentChunkName, componentChunkName = _b === void 0 ? 'jsx-component' : _b, _c = _a.importChunkName, importChunkName = _c === void 0 ? 'import-local' : _c, _d = _a.componentLibrary, componentLibrary = _d === void 0 ? 'react' : _d, _e = _a.illegalComponentNames, illegalComponentNames = _e === void 0 ? [] : _e, _f = _a.classAttributeName, classAttributeName = _f === void 0 ? 'className' : _f;

@@ -138,3 +151,3 @@ var reactStyledComponentsPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () {

Object.values(referencedStyles).forEach(function (styleRef) {
var _a, _b, _c;
var _a;
switch ((_a = styleRef.content) === null || _a === void 0 ? void 0 : _a.mapType) {

@@ -153,3 +166,3 @@ case 'inlined': {

}));
if (((_b = nodeStyle) === null || _b === void 0 ? void 0 : _b.type) === 'ObjectExpression') {
if ((nodeStyle === null || nodeStyle === void 0 ? void 0 : nodeStyle.type) === 'ObjectExpression') {
nodeStyle.properties.push(mediaStyles);

@@ -170,3 +183,3 @@ }

}));
if (((_c = nodeStyle) === null || _c === void 0 ? void 0 : _c.type) === 'ObjectExpression') {
if ((nodeStyle === null || nodeStyle === void 0 ? void 0 : nodeStyle.type) === 'ObjectExpression') {
nodeStyle.properties.push(mediaStyles);

@@ -210,3 +223,3 @@ }

type: 'local',
path: projectStyleSet.path + "/" + projectStyleSet.fileName,
path: "" + projectStyleSet.path + projectStyleSet.fileName,
meta: {

@@ -255,3 +268,3 @@ namedImport: true,

type: 'local',
path: projectStyleSet.path + "/" + projectStyleSet.fileName,
path: "" + projectStyleSet.path + projectStyleSet.fileName,
meta: {

@@ -277,3 +290,4 @@ namedImport: true,

};
exports.createReactStyledComponentsPlugin = createReactStyledComponentsPlugin;
exports.default = exports.createReactStyledComponentsPlugin();
//# sourceMappingURL=index.js.map
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -38,10 +57,4 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStyleSheetPlugin = void 0;
var types = __importStar(require("@babel/types"));

@@ -52,9 +65,9 @@ var teleport_types_1 = require("@teleporthq/teleport-types");

var constants_1 = require("./constants");
exports.createStyleSheetPlugin = function (config) {
var createStyleSheetPlugin = function (config) {
var _a = (config || {}).fileName, fileName = _a === void 0 ? 'style' : _a;
var styleSheetPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () {
var uidl, chunks, dependencies, _a, styleSetDefinitions, _b, _c, tokens, tokensMap, variants;
return __generator(this, function (_d) {
var uidl, chunks, dependencies, _a, styleSetDefinitions, _b, _c, _d, tokens, tokensMap, variants;
return __generator(this, function (_e) {
uidl = structure.uidl, chunks = structure.chunks, dependencies = structure.dependencies;
_a = uidl.styleSetDefinitions, styleSetDefinitions = _a === void 0 ? {} : _a, _b = uidl.designLanguage, _c = (_b === void 0 ? {} : _b).tokens, tokens = _c === void 0 ? {} : _c;
_a = uidl.styleSetDefinitions, styleSetDefinitions = _a === void 0 ? {} : _a, _b = uidl.designLanguage, _c = _b === void 0 ? {} : _b, _d = _c.tokens, tokens = _d === void 0 ? {} : _d;
if (Object.keys(styleSetDefinitions).length === 0 && Object.keys(tokens).length === 0) {

@@ -104,2 +117,3 @@ return [2 /*return*/, structure];

};
exports.createStyleSheetPlugin = createStyleSheetPlugin;
//# sourceMappingURL=style-sheet.js.map

@@ -13,14 +13,27 @@ "use strict";

};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.generateVariantsfromStyleSet = exports.generateStyledComponentStyles = exports.removeUnusedDependencies = exports.generateStyledComponent = void 0;
var types = __importStar(require("@babel/types"));
var teleport_shared_1 = require("@teleporthq/teleport-shared");
var teleport_types_1 = require("@teleporthq/teleport-types");
exports.generateStyledComponent = function (params) {
var generateStyledComponent = function (params) {
var name = params.name, elementType = params.elementType, styles = params.styles, propsReferred = params.propsReferred, componentStyleReferences = params.componentStyleReferences, projectStyleReferences = params.projectStyleReferences;

@@ -45,3 +58,4 @@ var styleExpressions = styles;

};
exports.removeUnusedDependencies = function (dependencies, jsxNodesLookup) {
exports.generateStyledComponent = generateStyledComponent;
var removeUnusedDependencies = function (dependencies, jsxNodesLookup) {
Object.keys(dependencies).forEach(function (depKey) {

@@ -60,6 +74,6 @@ var dependency = dependencies[depKey];

};
exports.generateStyledComponentStyles = function (params) {
exports.removeUnusedDependencies = removeUnusedDependencies;
var generateStyledComponentStyles = function (params) {
var styles = params.styles, tokensReferred = params.tokensReferred, propsReferred = params.propsReferred, _a = params.propsPrefix, propsPrefix = _a === void 0 ? 'props' : _a, _b = params.tokensPrefix, tokensPrefix = _b === void 0 ? 'TOKENS' : _b;
var properties = Object.keys(styles).reduce(function (acc, styleId) {
var _a, _b;
var style = styles[styleId];

@@ -81,3 +95,3 @@ var styleKey = types.stringLiteral(teleport_shared_1.StringUtils.camelCaseToDashCase(styleId));

: types.identifier("'" + style.content.id + "'"), !isNestedProp)));
(_a = propsReferred) === null || _a === void 0 ? void 0 : _a.add(style.content.id);
propsReferred === null || propsReferred === void 0 ? void 0 : propsReferred.add(style.content.id);
}

@@ -87,3 +101,3 @@ if (style.type === 'dynamic' && style.content.referenceType === 'token') {

acc.push(types.objectProperty(styleKey, types.memberExpression(types.identifier(tokensPrefix), types.identifier(usedToken))));
(_b = tokensReferred) === null || _b === void 0 ? void 0 : _b.add(usedToken);
tokensReferred === null || tokensReferred === void 0 ? void 0 : tokensReferred.add(usedToken);
}

@@ -94,3 +108,4 @@ return acc;

};
exports.generateVariantsfromStyleSet = function (styleSets, variantPropPrefix, variantPropKey, tokensReferred) {
exports.generateStyledComponentStyles = generateStyledComponentStyles;
var generateVariantsfromStyleSet = function (styleSets, variantPropPrefix, variantPropKey, tokensReferred) {
var variantExpressions = types.objectExpression(Object.keys(styleSets).reduce(function (acc, styleId) {

@@ -120,2 +135,3 @@ var style = styleSets[styleId];

};
exports.generateVariantsfromStyleSet = generateVariantsfromStyleSet;
//# sourceMappingURL=utils.js.map

@@ -125,3 +125,3 @@ var __assign = (this && this.__assign) || function () {

Object.values(referencedStyles).forEach(function (styleRef) {
var _a, _b, _c;
var _a;
switch ((_a = styleRef.content) === null || _a === void 0 ? void 0 : _a.mapType) {

@@ -140,3 +140,3 @@ case 'inlined': {

}));
if (((_b = nodeStyle) === null || _b === void 0 ? void 0 : _b.type) === 'ObjectExpression') {
if ((nodeStyle === null || nodeStyle === void 0 ? void 0 : nodeStyle.type) === 'ObjectExpression') {
nodeStyle.properties.push(mediaStyles);

@@ -157,3 +157,3 @@ }

}));
if (((_c = nodeStyle) === null || _c === void 0 ? void 0 : _c.type) === 'ObjectExpression') {
if ((nodeStyle === null || nodeStyle === void 0 ? void 0 : nodeStyle.type) === 'ObjectExpression') {
nodeStyle.properties.push(mediaStyles);

@@ -197,3 +197,3 @@ }

type: 'local',
path: projectStyleSet.path + "/" + projectStyleSet.fileName,
path: "" + projectStyleSet.path + projectStyleSet.fileName,
meta: {

@@ -242,3 +242,3 @@ namedImport: true,

type: 'local',
path: projectStyleSet.path + "/" + projectStyleSet.fileName,
path: "" + projectStyleSet.path + projectStyleSet.fileName,
meta: {

@@ -245,0 +245,0 @@ namedImport: true,

@@ -45,6 +45,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

var styleSheetPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () {
var uidl, chunks, dependencies, _a, styleSetDefinitions, _b, _c, tokens, tokensMap, variants;
return __generator(this, function (_d) {
var uidl, chunks, dependencies, _a, styleSetDefinitions, _b, _c, _d, tokens, tokensMap, variants;
return __generator(this, function (_e) {
uidl = structure.uidl, chunks = structure.chunks, dependencies = structure.dependencies;
_a = uidl.styleSetDefinitions, styleSetDefinitions = _a === void 0 ? {} : _a, _b = uidl.designLanguage, _c = (_b === void 0 ? {} : _b).tokens, tokens = _c === void 0 ? {} : _c;
_a = uidl.styleSetDefinitions, styleSetDefinitions = _a === void 0 ? {} : _a, _b = uidl.designLanguage, _c = _b === void 0 ? {} : _b, _d = _c.tokens, tokens = _d === void 0 ? {} : _d;
if (Object.keys(styleSetDefinitions).length === 0 && Object.keys(tokens).length === 0) {

@@ -51,0 +51,0 @@ return [2 /*return*/, structure];

@@ -52,3 +52,2 @@ var __assign = (this && this.__assign) || function () {

var properties = Object.keys(styles).reduce(function (acc, styleId) {
var _a, _b;
var style = styles[styleId];

@@ -70,3 +69,3 @@ var styleKey = types.stringLiteral(StringUtils.camelCaseToDashCase(styleId));

: types.identifier("'" + style.content.id + "'"), !isNestedProp)));
(_a = propsReferred) === null || _a === void 0 ? void 0 : _a.add(style.content.id);
propsReferred === null || propsReferred === void 0 ? void 0 : propsReferred.add(style.content.id);
}

@@ -76,3 +75,3 @@ if (style.type === 'dynamic' && style.content.referenceType === 'token') {

acc.push(types.objectProperty(styleKey, types.memberExpression(types.identifier(tokensPrefix), types.identifier(usedToken))));
(_b = tokensReferred) === null || _b === void 0 ? void 0 : _b.add(usedToken);
tokensReferred === null || tokensReferred === void 0 ? void 0 : tokensReferred.add(usedToken);
}

@@ -79,0 +78,0 @@ return acc;

{
"name": "@teleporthq/teleport-plugin-react-styled-components",
"version": "0.17.3",
"version": "0.17.6",
"description": "A plugin for injecting the styles through styled-components inside React components",

@@ -32,3 +32,3 @@ "author": "teleportHQ",

},
"gitHead": "1a673d148f2626c5488092f3e88b3a9d7c9725b4"
"gitHead": "24b885a8fbc39cc12ba9bf4be5e85a7f9b24cf94"
}

@@ -232,3 +232,3 @@ import * as types from '@babel/types'

type: 'local',
path: `${projectStyleSet.path}/${projectStyleSet.fileName}`,
path: `${projectStyleSet.path}${projectStyleSet.fileName}`,
meta: {

@@ -294,3 +294,3 @@ namedImport: true,

type: 'local',
path: `${projectStyleSet.path}/${projectStyleSet.fileName}`,
path: `${projectStyleSet.path}${projectStyleSet.fileName}`,
meta: {

@@ -297,0 +297,0 @@ namedImport: true,

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet