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

@chakra-ui/cli

Package Overview
Dependencies
Maintainers
3
Versions
364
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@chakra-ui/cli - npm Package Compare versions

Comparing version 0.0.0-pr-20211120215645 to 0.0.0-pr-20211126151058

7

dist/command/tokens/create-theme-typings-interface.js

@@ -30,3 +30,4 @@ "use strict";

_createThemeTypingsInterface = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(theme, _ref) {
var config, unions, textStyles, layerStyles, colorSchemes, componentTypes, template;
var config, _ref$strictComponentT, strictComponentTypes, unions, textStyles, layerStyles, colorSchemes, componentTypes, template;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -36,3 +37,3 @@ while (1) {

case 0:
config = _ref.config;
config = _ref.config, _ref$strictComponentT = _ref.strictComponentTypes, strictComponentTypes = _ref$strictComponentT === void 0 ? false : _ref$strictComponentT;
unions = config.reduce(function (allUnions, _ref2) {

@@ -68,3 +69,3 @@ var key = _ref2.key,

colorSchemes: colorSchemes
})) + "\n " + (0, _extractComponentTypes.printComponentTypes)(componentTypes) + "\n}\n\n";
})) + "\n " + (0, _extractComponentTypes.printComponentTypes)(componentTypes, strictComponentTypes) + "\n}\n\n";
return _context.abrupt("return", (0, _formatWithPrettier.formatWithPrettierIfAvailable)(template));

@@ -71,0 +72,0 @@

@@ -39,7 +39,11 @@ "use strict";

function printComponentTypes(componentTypes) {
function printComponentTypes(componentTypes, strict) {
if (strict === void 0) {
strict = false;
}
var types = Object.entries(componentTypes).map(function (_ref2) {
var componentName = _ref2[0],
unions = _ref2[1];
return escapeComponentName(componentName) + ": {\n " + (0, _extractPropertyPaths.printUnionMap)(unions) + "\n}";
return escapeComponentName(componentName) + ": {\n " + (0, _extractPropertyPaths.printUnionMap)(unions, strict) + "\n}";
}).join("\n");

@@ -46,0 +50,0 @@ return "components: {\n " + types + " \n}\n";

@@ -9,2 +9,4 @@ "use strict";

var AutoCompleteStringType = "(string & {})";
function wrapWithQuotes(value) {

@@ -14,8 +16,12 @@ return "\"" + value + "\"";

function printUnionType(values) {
function printUnionType(values, strict) {
if (strict === void 0) {
strict = false;
}
if (!values.length) {
return "never";
return strict ? "never" : AutoCompleteStringType;
}
return values.map(wrapWithQuotes).join(" | ");
return values.map(wrapWithQuotes).concat(strict ? [] : [AutoCompleteStringType]).join(" | ");
}

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

function printUnionMap(unions) {
function printUnionMap(unions, strict) {
if (strict === void 0) {
strict = false;
}
return Object.entries(unions).sort(function (_ref, _ref2) {

@@ -37,3 +47,3 @@ var a = _ref[0];

union = _ref3[1];
return targetKey + ": " + printUnionType(union) + ";";
return targetKey + ": " + printUnionType(union, strict) + ";";
}).join("\n");

@@ -40,0 +50,0 @@ }

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

_runTemplateWorker = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(_ref) {
var themeFile, worker;
var themeFile, strictComponentTypes, worker;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -40,4 +40,4 @@ while (1) {

case 0:
themeFile = _ref.themeFile;
worker = (0, _child_process.fork)(_path["default"].join(__dirname, "..", "..", "scripts", "read-theme-file.worker.js"), [themeFile], {
themeFile = _ref.themeFile, strictComponentTypes = _ref.strictComponentTypes;
worker = (0, _child_process.fork)(_path["default"].join(__dirname, "..", "..", "scripts", "read-theme-file.worker.js"), [themeFile].concat(strictComponentTypes ? "--strict-component-types" : []), {
stdio: ["pipe", "pipe", "pipe", "ipc"],

@@ -75,3 +75,3 @@ cwd: process.cwd()

_generateThemeTypings = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(_ref2) {
var themeFile, out, spinner, template, outPath;
var themeFile, out, strictComponentTypes, spinner, template, outPath;
return regeneratorRuntime.wrap(function _callee2$(_context2) {

@@ -81,3 +81,3 @@ while (1) {

case 0:
themeFile = _ref2.themeFile, out = _ref2.out;
themeFile = _ref2.themeFile, out = _ref2.out, strictComponentTypes = _ref2.strictComponentTypes;
spinner = (0, _ora["default"])("Generating chakra theme typings").start();

@@ -87,3 +87,4 @@ _context2.prev = 2;

return runTemplateWorker({
themeFile: themeFile
themeFile: themeFile,
strictComponentTypes: strictComponentTypes
});

@@ -90,0 +91,0 @@

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

case 2:
_commander.program.command("tokens <source>").option("--out <path>", "output file e.g. " + path.join.apply(path, _tokens.themeInterfaceDestination)).action( /*#__PURE__*/function () {
_commander.program.command("tokens <source>").option("--out <path>", "output file e.g. " + path.join.apply(path, _tokens.themeInterfaceDestination)).option("--strict-component-types", "Generate strict types for props variant and size").action( /*#__PURE__*/function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(themeFile, command) {
var _command$opts, out;
var _command$opts, out, strictComponentTypes;

@@ -47,7 +47,8 @@ return regeneratorRuntime.wrap(function _callee$(_context) {

case 0:
_command$opts = command.opts(), out = _command$opts.out;
_command$opts = command.opts(), out = _command$opts.out, strictComponentTypes = _command$opts.strictComponentTypes;
_context.next = 3;
return (0, _tokens.generateThemeTypings)({
themeFile: themeFile,
out: out
out: out,
strictComponentTypes: strictComponentTypes
});

@@ -54,0 +55,0 @@

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

_run = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
var themeFile, theme, template;
var themeFile, strictComponentTypes, theme, template;
return regeneratorRuntime.wrap(function _callee3$(_context3) {

@@ -181,5 +181,6 @@ while (1) {

themeFile = process.argv[2];
strictComponentTypes = process.argv.includes("--strict-component-types");
if (themeFile) {
_context3.next = 3;
_context3.next = 4;
break;

@@ -190,11 +191,11 @@ }

case 3:
_context3.next = 5;
case 4:
_context3.next = 6;
return readTheme(themeFile);
case 5:
case 6:
theme = _context3.sent;
if ((0, _utils.isObject)(theme)) {
_context3.next = 8;
_context3.next = 9;
break;

@@ -205,9 +206,10 @@ }

case 8:
_context3.next = 10;
case 9:
_context3.next = 11;
return (0, _createThemeTypingsInterface.createThemeTypingsInterface)(theme, {
config: _config.themeKeyConfiguration
config: _config.themeKeyConfiguration,
strictComponentTypes: strictComponentTypes
});
case 10:
case 11:
template = _context3.sent;

@@ -221,3 +223,3 @@

case 12:
case 13:
case "end":

@@ -224,0 +226,0 @@ return _context3.stop();

{
"name": "@chakra-ui/cli",
"version": "0.0.0-pr-20211120215645",
"version": "0.0.0-pr-20211126151058",
"description": "Generate theme typings for autocomplete",

@@ -5,0 +5,0 @@ "keywords": [

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc