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

@stylable/code-formatter

Package Overview
Dependencies
Maintainers
7
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stylable/code-formatter - npm Package Compare versions

Comparing version 4.9.4 to 4.9.5

18

dist/formatter.js

@@ -18,14 +18,22 @@ "use strict";

function removeFormattingExceptions(ast) {
const changes = [];
const atRuleChanges = [];
const declChanges = [];
// sanitizing @st-imports due to resulting broken formatting
ast.walkAtRules(stImport, (atRule) => {
changes.push(atRule.params);
atRuleChanges.push(atRule.params);
atRule.params = 'temp';
});
return changes;
ast.walkDecls(/^grid/, (decl) => {
declChanges.push(decl.value);
decl.value = `temp`;
});
return { atRuleChanges, declChanges };
}
function restoreFormattingExceptions(ast, changes) {
function restoreFormattingExceptions(ast, { atRuleChanges, declChanges }) {
ast.walkAtRules(stImport, (atRule) => {
atRule.params = changes.shift();
atRule.params = atRuleChanges.shift();
});
ast.walkDecls(/^grid/, (decl) => {
decl.value = declChanges.shift();
});
return ast;

@@ -32,0 +40,0 @@ }

{
"name": "@stylable/code-formatter",
"version": "4.9.4",
"version": "4.9.5",
"description": "A code formatting utility for Stylable stylesheets",

@@ -10,3 +10,3 @@ "main": "dist/index.js",

"dependencies": {
"@stylable/core": "^4.9.4",
"@stylable/core": "^4.9.5",
"js-beautify": "^1.14.0"

@@ -13,0 +13,0 @@ },

@@ -26,18 +26,31 @@ import { safeParse } from '@stylable/core';

function removeFormattingExceptions(ast: Root) {
const changes: string[] = [];
const atRuleChanges: string[] = [];
const declChanges: string[] = [];
// sanitizing @st-imports due to resulting broken formatting
ast.walkAtRules(stImport, (atRule) => {
changes.push(atRule.params);
atRuleChanges.push(atRule.params);
atRule.params = 'temp';
});
return changes;
ast.walkDecls(/^grid/, (decl) => {
declChanges.push(decl.value);
decl.value = `temp`;
});
return { atRuleChanges, declChanges };
}
function restoreFormattingExceptions(ast: Root, changes: string[]) {
function restoreFormattingExceptions(
ast: Root,
{ atRuleChanges, declChanges }: { atRuleChanges: string[]; declChanges: string[] }
) {
ast.walkAtRules(stImport, (atRule) => {
atRule.params = changes.shift()!;
atRule.params = atRuleChanges.shift()!;
});
ast.walkDecls(/^grid/, (decl) => {
decl.value = declChanges.shift()!;
});
return ast;

@@ -44,0 +57,0 @@ }

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