Socket
Socket
Sign inDemoInstall

@atlaskit/icon

Package Overview
Dependencies
Maintainers
1
Versions
261
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@atlaskit/icon - npm Package Compare versions

Comparing version 21.2.1 to 21.2.2

9

CHANGELOG.md
# @atlaskit/icon
## 21.2.2
### Patch Changes
- [`c65f28c058`](https://bitbucket.org/atlassian/atlassian-frontend/commits/c65f28c058) - Change codemod to return raw source if it is not transforming a file.
Otherwise it would run prettier which can lead to some invalid syntax outputted
in edge cases. This is likely due to an issue in either `codemod-cli` or `jscodeshift`.
## 21.2.1

@@ -4,0 +13,0 @@

78

codemods/21.2.0-metadata-entry.ts

@@ -7,2 +7,3 @@ import core, {

ImportDefaultSpecifier,
Options,
} from 'jscodeshift';

@@ -13,36 +14,53 @@ import { Collection } from 'jscodeshift/src/Collection';

export default function transformer(file: FileInfo, api: API) {
export default function transformer(
file: FileInfo,
api: API,
options: Options,
) {
const j = api.jscodeshift;
const root = j(file.source, { quote: 'auto' });
const imports = root.find(j.ImportSpecifier, {
imported: { name: 'metadata' },
});
imports.forEach((p: ASTPath<ImportSpecifier | ImportDefaultSpecifier>) => {
if (p.parentPath.parentPath.node.source.value !== packageName) {
return;
}
if (p.parentPath.node.specifiers.length === 1) {
p.node.type = 'ImportDefaultSpecifier';
p.parentPath.node.source.value = `${packageName}/metadata`;
} else if (p.node.local) {
tryCreateImport({
j,
base: root,
packageName: `${packageName}/metadata`,
relativeToPackage: packageName,
});
addToImport({
j,
base: root,
packageName: `${packageName}/metadata`,
importSpecifier: j.importDefaultSpecifier(
j.identifier(p.node.local.name),
),
});
p.replace();
}
});
return root.toSource({ quote: 'single' });
if (hasImportDeclaration(j, root, packageName)) {
const imports = root.find(j.ImportSpecifier, {
imported: { name: 'metadata' },
});
imports.forEach((p: ASTPath<ImportSpecifier | ImportDefaultSpecifier>) => {
if (p.parentPath.parentPath.node.source.value !== packageName) {
return;
}
if (p.parentPath.node.specifiers.length === 1) {
p.node.type = 'ImportDefaultSpecifier';
p.parentPath.node.source.value = `${packageName}/metadata`;
} else if (p.node.local) {
tryCreateImport({
j,
base: root,
packageName: `${packageName}/metadata`,
relativeToPackage: packageName,
});
addToImport({
j,
base: root,
packageName: `${packageName}/metadata`,
importSpecifier: j.importDefaultSpecifier(
j.identifier(p.node.local.name),
),
});
p.replace();
}
});
return root.toSource(options.printOptions || { quote: 'single' });
}
return file.source;
}
function hasImportDeclaration(
j: core.JSCodeshift,
source: ReturnType<typeof j>,
importPath: string,
) {
return !!source
.find(j.ImportDeclaration)
.filter(path => path.node.source.value === importPath).length;
}
function tryCreateImport({

@@ -49,0 +67,0 @@ j,

{
"name": "@atlaskit/icon",
"version": "21.2.1",
"version": "21.2.2",
"sideEffects": false
}
{
"name": "@atlaskit/icon",
"version": "21.2.1",
"version": "21.2.2",
"sideEffects": false
}
{
"name": "@atlaskit/icon",
"version": "21.2.1",
"version": "21.2.2",
"sideEffects": false
}
{
"name": "@atlaskit/icon",
"version": "21.2.1",
"version": "21.2.2",
"description": "A React package that contains icons",

@@ -5,0 +5,0 @@ "publishConfig": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc