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

@compiled/codemods

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compiled/codemods - npm Package Compare versions

Comparing version 0.7.0 to 0.7.1

24

dist/utils/convert-to-named-import.js

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

importDeclarationCollection.forEach(function (importDeclarationPath) {
var _a, _b;
var _a;
var newSpecifiers = (importDeclarationPath.node.specifiers || [])

@@ -98,9 +98,4 @@ .map(function (specifier) {

});
var newImport = applyBuildImport({
plugins: plugins,
originalNode: importDeclarationPath.node,
specifiers: newSpecifiers,
});
// Remove all moved import specifiers from the original import
importDeclarationPath.node.specifiers = (_a = importDeclarationPath.node.specifiers) === null || _a === void 0 ? void 0 : _a.filter(function (specifier) {
var originalNode = importDeclarationPath.node;
var unresolvedSpecifiers = (_a = originalNode.specifiers) === null || _a === void 0 ? void 0 : _a.filter(function (specifier) {
var _a;

@@ -111,5 +106,12 @@ return specifier.type !== 'ImportDefaultSpecifier' &&

});
j(importDeclarationPath).insertAfter(newImport);
if (((_b = importDeclarationPath.node.specifiers) === null || _b === void 0 ? void 0 : _b.length) === 0)
j(importDeclarationPath).remove();
if ((unresolvedSpecifiers === null || unresolvedSpecifiers === void 0 ? void 0 : unresolvedSpecifiers.length) && unresolvedSpecifiers.length > 0) {
// Create a new declaration with the unresolved imports
j(importDeclarationPath).insertAfter(j.importDeclaration(unresolvedSpecifiers, originalNode.source));
}
var newImport = applyBuildImport({
plugins: plugins,
originalNode: originalNode,
specifiers: newSpecifiers,
});
j(importDeclarationPath).replaceWith(newImport);
});

@@ -116,0 +118,0 @@ };

{
"name": "@compiled/codemods",
"version": "0.7.0",
"version": "0.7.1",
"description": "A familiar and performant compile time CSS-in-JS library for React.",

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

@@ -399,6 +399,5 @@ import type { API, FileInfo } from 'jscodeshift';

import * as React from 'react';
import { ClassNames, css as c } from '@compiled/react';
import { CSSObject } from '@emotion/core';
import { ClassNames, css as c } from '@compiled/react';
let cssObject: CSSObject = {};

@@ -446,8 +445,5 @@

import { CSSObject } from '@emotion/core';
// @top-level comment
import { ClassNames, css as c } from '@compiled/react';
import { CSSObject } from '@emotion/core';
// comment 1

@@ -474,7 +470,7 @@ import * as React from 'react';

import * as React from 'react';
// comment 1
import { CSSObject } from '@emotion/core';
// comment 1
import { ClassNames, css as c } from '@compiled/react';
import { CSSObject } from '@emotion/core';
`,

@@ -481,0 +477,0 @@ 'it should not remove comments before transformed statement when not on top'

@@ -142,4 +142,4 @@ import type { API, FileInfo } from 'jscodeshift';

`
import { css, keyframes, styled } from '@compiled/react';
import { createGlobalStyle, ThemeProvider, withTheme } from 'styled-components';
import { css, keyframes, styled } from '@compiled/react';
import * as React from 'react';

@@ -146,0 +146,0 @@ `,

@@ -158,10 +158,4 @@ import type {

const newImport = applyBuildImport({
plugins,
originalNode: importDeclarationPath.node,
specifiers: newSpecifiers,
});
// Remove all moved import specifiers from the original import
importDeclarationPath.node.specifiers = importDeclarationPath.node.specifiers?.filter(
const originalNode = importDeclarationPath.node;
const unresolvedSpecifiers = originalNode.specifiers?.filter(
(specifier) =>

@@ -174,7 +168,17 @@ specifier.type !== 'ImportDefaultSpecifier' &&

);
if (unresolvedSpecifiers?.length && unresolvedSpecifiers.length > 0) {
// Create a new declaration with the unresolved imports
j(importDeclarationPath).insertAfter(
j.importDeclaration(unresolvedSpecifiers, originalNode.source)
);
}
j(importDeclarationPath).insertAfter(newImport);
const newImport = applyBuildImport({
plugins,
originalNode: originalNode,
specifiers: newSpecifiers,
});
if (importDeclarationPath.node.specifiers?.length === 0) j(importDeclarationPath).remove();
j(importDeclarationPath).replaceWith(newImport);
});
};

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