Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: atlassian-labs/compiled
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: @compiled/react@0.9.0
Choose a base ref
...
head repository: atlassian-labs/compiled
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: @compiled/react@0.9.1
Choose a head ref
Loading
Showing with 5,302 additions and 4,737 deletions.
  1. +8 −0 .flowconfig
  2. +1 −1 .prettierrc
  3. +2 −0 .storybook/main.js
  4. +7 −0 examples/packages/babel-component/CHANGELOG.md
  5. +5 −5 examples/packages/babel-component/package.json
  6. +1 −3 examples/packages/module-a/index.d.ts
  7. +8 −0 examples/packages/parcel-resolver-alias/CHANGELOG.md
  8. +1 −1 examples/packages/parcel-resolver-alias/package.json
  9. +7 −0 examples/packages/parcel/CHANGELOG.md
  10. +1 −1 examples/packages/parcel/package.json
  11. +7 −0 examples/packages/ssr/CHANGELOG.md
  12. +2 −2 examples/packages/ssr/package.json
  13. +15 −0 examples/packages/webpack/CHANGELOG.md
  14. +5 −5 examples/packages/webpack/package.json
  15. +136 −0 examples/stories/conditional-rules-styled.tsx
  16. +16 −0 examples/stories/css-prop-static-object.tsx
  17. +21 −20 package.json
  18. +3 −3 packages/babel-plugin-strip-runtime/package.json
  19. +32 −30 packages/babel-plugin-strip-runtime/src/__tests__/first-party-strip.test.tsx
  20. +36 −34 packages/babel-plugin-strip-runtime/src/__tests__/third-party-strip.test.tsx
  21. +22 −1 packages/babel-plugin/CHANGELOG.md
  22. +9 −9 packages/babel-plugin/package.json
  23. +41 −40 packages/babel-plugin/src/__tests__/rule-hoisting.test.tsx
  24. +10 −4 packages/babel-plugin/src/__tests__/test-utils.tsx
  25. +29 −84 packages/babel-plugin/src/babel-plugin.tsx
  26. +263 −0 packages/babel-plugin/src/class-names/__tests__/call-expression.test.tsx
  27. +0 −223 packages/babel-plugin/src/class-names/__tests__/object-literal.test.tsx
  28. +0 −280 packages/babel-plugin/src/class-names/__tests__/string-literal.test.tsx
  29. +298 −0 packages/babel-plugin/src/class-names/__tests__/tagged-template-expression.test.tsx
  30. +4 −0 packages/babel-plugin/src/constants.tsx
  31. +28 −0 packages/babel-plugin/src/css-prop/__tests__/behaviour.test.tsx
  32. +35 −4 packages/babel-plugin/src/css-prop/index.tsx
  33. 0 ...l-plugin/src/keyframes/__tests__/{tagged-template.test.tsx → tagged-template-expression.test.tsx}
  34. +117 −25 packages/babel-plugin/src/styled/__tests__/behaviour.test.tsx
  35. +530 −0 packages/babel-plugin/src/styled/__tests__/call-expression.test.tsx
  36. +0 −499 packages/babel-plugin/src/styled/__tests__/object-literal.test.tsx
  37. +0 −777 packages/babel-plugin/src/styled/__tests__/string-literal.test.tsx
  38. +871 −0 packages/babel-plugin/src/styled/__tests__/tagged-template-expression.test.tsx
  39. +53 −0 packages/babel-plugin/src/utils/append-runtime-imports.ts
  40. +73 −36 packages/babel-plugin/src/utils/ast-builders.tsx
  41. +94 −49 packages/babel-plugin/src/utils/ast.tsx
  42. +41 −0 packages/babel-plugin/src/utils/comments.ts
  43. +105 −43 packages/babel-plugin/src/utils/css-builders.tsx
  44. +3 −4 packages/babel-plugin/src/utils/evaluate-expression.tsx
  45. +8 −1 packages/babel-plugin/src/utils/types.tsx
  46. +12 −0 packages/cli/CHANGELOG.md
  47. +3 −5 packages/cli/package.json
  48. +1 −1 packages/cli/src/__tests__/test-utils.tsx
  49. +16 −0 packages/codemods/CHANGELOG.md
  50. +2 −2 packages/codemods/package.json
  51. +4 −0 packages/codemods/src/codemods-helpers.tsx
  52. +35 −21 packages/codemods/src/transforms/emotion-to-compiled/__tests__/emotion-to-compiled.test.tsx
  53. +72 −27 packages/codemods/src/transforms/emotion-to-compiled/emotion-to-compiled.tsx
  54. +17 −8 ...ods/src/transforms/styled-components-to-compiled/__tests__/styled-components-to-compiled.test.tsx
  55. +1 −1 packages/codemods/src/transforms/styled-components-to-compiled/styled-components-to-compiled.tsx
  56. +12 −10 packages/css/src/plugins/__tests__/sort-at-rule-pseudos.test.tsx
  57. +6 −0 packages/eslint-plugin/CHANGELOG.md
  58. +35 −0 packages/eslint-plugin/README.md
  59. +23 −0 packages/eslint-plugin/package.json
  60. +12 −0 packages/eslint-plugin/src/index.tsx
  61. +24 −0 packages/eslint-plugin/src/rules/__tests__/test-utils.tsx
  62. +35 −0 packages/eslint-plugin/src/rules/emotion-to-compiled/README.md
  63. +113 −0 packages/eslint-plugin/src/rules/emotion-to-compiled/__tests__/rule.test.tsx
  64. +142 −0 packages/eslint-plugin/src/rules/emotion-to-compiled/index.tsx
  65. +8 −0 packages/eslint-plugin/tsconfig.json
  66. +1 −1 packages/jest/src/index.js.flow
  67. +1 −1 packages/jest/src/matchers.js.flow
  68. +1 −1 packages/jest/src/types.js.flow
  69. +16 −0 packages/parcel-transformer/CHANGELOG.md
  70. +4 −4 packages/parcel-transformer/package.json
  71. +8 −1 packages/react/CHANGELOG.md
  72. +1 −1 packages/react/package.json
  73. +1 −1 packages/react/src/class-names/index.js.flow
  74. +1 −1 packages/react/src/css/index.js.flow
  75. +1 −1 packages/react/src/index.js.flow
  76. +1 −1 packages/react/src/keyframes/index.js.flow
  77. +1 −1 packages/react/src/runtime.js.flow
  78. +1 −1 packages/react/src/runtime/ax.js.flow
  79. +1 −1 packages/react/src/runtime/css-custom-property.js.flow
  80. +1 −1 packages/react/src/runtime/dev-warnings.js.flow
  81. +1 −1 packages/react/src/runtime/index.js.flow
  82. +1 −1 packages/react/src/runtime/is-node.js.flow
  83. +1 −1 packages/react/src/runtime/sheet.js.flow
  84. +1 −1 packages/react/src/runtime/style-cache.js.flow
  85. +1 −1 packages/react/src/runtime/style.js.flow
  86. +1 −1 packages/react/src/runtime/types.js.flow
  87. +2 −2 packages/react/src/styled/index.js.flow
  88. +1 −1 packages/react/src/types.js.flow
  89. +1 −1 packages/react/src/utils/error.js.flow
  90. +5 −3 packages/utils/src/error.tsx
  91. +16 −0 packages/webpack-loader/CHANGELOG.md
  92. +6 −6 packages/webpack-loader/package.json
  93. +3 −0 scripts/flow-types.sh
  94. +1 −0 security-assistant.yml
  95. +1,700 −2,442 yarn.lock
8 changes: 8 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -10,11 +10,19 @@ packages/.*/*.js.flow
.*/node_modules/.*

[lints]
deprecated-utility=warn
unnecessary-optional-chain=warn
implicit-inexact-object=error
untyped-type-import=error

[options]
exact_by_default=true

[strict]
deprecated-type
deprecated-utility
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"jsxBracketSameLine": true,
"bracketSameLine": true,
"bracketSpacing": true,
"semi": true,
"tabWidth": 2,
2 changes: 2 additions & 0 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -4,4 +4,6 @@ module.exports = {
builder: 'webpack5',
},
stories: ['../examples/stories/*.tsx'],
// Workaround for https://github.com/storybookjs/storybook/issues/15336
typescript: { reactDocgen: false },
};
7 changes: 7 additions & 0 deletions examples/packages/babel-component/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @private/babel-component

## 0.0.8

### Patch Changes

- Updated dependencies [4309aaa]
- @compiled/react@0.9.1

## 0.0.7

### Patch Changes
10 changes: 5 additions & 5 deletions examples/packages/babel-component/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@private/babel-component",
"private": true,
"version": "0.0.7",
"version": "0.0.8",
"main": "./dist/index.js",
"scripts": {
"build": "babel ./src --out-dir=./dist"
@@ -11,10 +11,10 @@
},
"devDependencies": {
"@compiled/babel-plugin": "*",
"@babel/core": "^7.15.8",
"@babel/cli": "^7.15.7",
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5"
"@babel/core": "^7.16.0",
"@babel/cli": "^7.16.0",
"@babel/preset-env": "^7.16.0",
"@babel/preset-react": "^7.16.0"
},
"peerDependencies": {
"react": "^17.0.1"
4 changes: 1 addition & 3 deletions examples/packages/module-a/index.d.ts
Original file line number Diff line number Diff line change
@@ -9,9 +9,7 @@ export const objectStyles: {
backgroundColor: (bgColor?: string) => string | undefined;
};

export const colorMixin: (
radius: number
) => {
export const colorMixin: (radius: number) => {
color: string;
backgroundColor: string;
borderRadius: number;
8 changes: 8 additions & 0 deletions examples/packages/parcel-resolver-alias/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# @compiled/parcel-resolver-alias

## 0.0.2

### Patch Changes

- Updated dependencies [4309aaa]
- @compiled/react@0.9.1

## 0.0.1

### Patch Changes

- 0b60ae1: Add placeholder resolver example
2 changes: 1 addition & 1 deletion examples/packages/parcel-resolver-alias/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compiled/parcel-resolver-alias",
"version": "0.0.1",
"version": "0.0.2",
"private": true,
"main": "dist/index.js",
"dependencies": {
7 changes: 7 additions & 0 deletions examples/packages/parcel/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @compiled/parcel-app

## 1.0.7

### Patch Changes

- Updated dependencies [4309aaa]
- @compiled/react@0.9.1

## 1.0.6

### Patch Changes
2 changes: 1 addition & 1 deletion examples/packages/parcel/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compiled/parcel-app",
"version": "1.0.6",
"version": "1.0.7",
"private": true,
"scripts": {
"start": "parcel serve ./src/index.html --open --no-cache",
7 changes: 7 additions & 0 deletions examples/packages/ssr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @private/ssr

## 1.0.7

### Patch Changes

- Updated dependencies [4309aaa]
- @compiled/react@0.9.1

## 1.0.6

### Patch Changes
4 changes: 2 additions & 2 deletions examples/packages/ssr/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@private/ssr",
"version": "1.0.6",
"version": "1.0.7",
"private": true,
"scripts": {
"start": "razzle start",
"build": "razzle build",
"start:prod": "NODE_ENV=production node build/server.js"
},
"dependencies": {
"@babel/helper-builder-react-jsx": "^7.15.4",
"@babel/helper-builder-react-jsx": "^7.16.0",
"@babel/helper-builder-react-jsx-experimental": "^7.12.11",
"@compiled/react": "*",
"express": "4.17.1",
15 changes: 15 additions & 0 deletions examples/packages/webpack/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# @compiled/webpack-app

## 1.0.8

### Patch Changes

- Updated dependencies [4309aaa]
- @compiled/react@0.9.1
- @private/babel-component@0.0.8
- @compiled/webpack-loader@0.7.2

## 1.0.7

### Patch Changes

- @compiled/webpack-loader@0.7.1

## 1.0.6

### Patch Changes
10 changes: 5 additions & 5 deletions examples/packages/webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compiled/webpack-app",
"version": "1.0.6",
"version": "1.0.8",
"private": true,
"scripts": {
"start": "webpack serve --hot",
@@ -10,15 +10,15 @@
"@compiled/react": "*",
"@compiled/webpack-loader": "*",
"@private/babel-component": "*",
"babel-loader": "^8.2.2",
"babel-loader": "^8.2.3",
"css-loader": "^5.2.7",
"css-minimizer-webpack-plugin": "^1.3.0",
"html-webpack-plugin": "^5.3.2",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^1.5.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"style-loader": "^2.0.0",
"webpack": "^5.58.1",
"webpack-cli": "^4.9.0"
"webpack": "^5.61.0",
"webpack-cli": "^4.9.1"
}
}
136 changes: 136 additions & 0 deletions examples/stories/conditional-rules-styled.tsx
Original file line number Diff line number Diff line change
@@ -28,6 +28,15 @@ const TextWithTernaryOperatorTemplateLiteral = styled.span<TextProps>`
props.isPrimary && props.isMaybe ? (props.isBolded && 'bold') || 'normal' : 'light'};
`;

const TextWithNestedTernaryOperatorTemplateLiteralCssVariable = styled.span<TextProps>`
color: ${(props) => (props.isPrimary ? (props.isMaybe ? 'orange' : 'blue') : 'red')};
`;

const TextWithNestedTernaryOperatorTemplateLiteral = styled.span<TextProps>`
${(props) =>
props.isPrimary ? (props.isMaybe ? 'color: orange' : 'color: blue') : 'color: red'};
`;

const TextWithObjectStyles = styled.span<TextProps>(
{ color: 'red' },
(props) => props.isPrimary && { color: 'blue' },
@@ -41,6 +50,16 @@ const TextWithTernaryAndBooleanObjectStyle = styled.span<TextProps>({ fontSize:
props.isPrimary && props.isBolded ? { color: 'blue', fontWeight: 'bold' } : { color: 'red' }
);

const TextWithNestedTernaryAndBooleanObjectStyle = styled.span<TextProps>(
{ fontSize: '20px' },
(props) =>
props.isPrimary
? props.isBolded
? { color: 'blue', fontWeight: 'bold' }
: { color: 'blue' }
: { color: 'red' }
);

const TextWithMixins = styled.span<TextProps>`
${(props) =>
props.isPrimary ? primaryTaggedTemplateExpression : secondaryTaggedTemplateExpression};
@@ -72,6 +91,10 @@ const KeyValueString = styled.div<TextProps>`
${(props) => (props.isPrimary ? 'color: green' : `color: red`)};
`;

const NoValuePath = styled.div<TextProps>`
${(props) => (props.isPrimary ? undefined : 'color: red')}
`;

export const PrimaryTextWithTemplateLiteral = (): JSX.Element => {
return <TextWithTemplateLiteral isPrimary>Hello primary</TextWithTemplateLiteral>;
};
@@ -102,6 +125,73 @@ export const NotPrimaryTextWithTernaryOperatorTemplateLiteral = (): JSX.Element
);
};

export const PrimaryTextWithNestedTernaryOperatorTemplateLiteralCssVariable = (): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteralCssVariable isPrimary>
Hello primary (blue)
</TextWithNestedTernaryOperatorTemplateLiteralCssVariable>
);
};

export const PrimaryMaybeTextWithNestedTernaryOperatorTemplateLiteralCssVariable =
(): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteralCssVariable isPrimary isMaybe>
Hello primary maybe (orange)
</TextWithNestedTernaryOperatorTemplateLiteralCssVariable>
);
};

export const NotPrimaryTextWithNestedTernaryOperatorTemplateLiteralCssVariable =
(): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteralCssVariable>
Hello secondary (red)
</TextWithNestedTernaryOperatorTemplateLiteralCssVariable>
);
};

export const NotPrimaryMaybeTextWithNestedTernaryOperatorTemplateLiteralCssVariable =
(): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteralCssVariable isMaybe>
Hello secondary (red)
</TextWithNestedTernaryOperatorTemplateLiteralCssVariable>
);
};

export const PrimaryTextWithNestedTernaryOperatorTemplateLiteral = (): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteral isPrimary>
Hello primary (blue)
</TextWithNestedTernaryOperatorTemplateLiteral>
);
};

export const PrimaryMaybeTextWithNestedTernaryOperatorTemplateLiteral = (): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteral isPrimary isMaybe>
Hello primary maybe (orange)
</TextWithNestedTernaryOperatorTemplateLiteral>
);
};

export const NotPrimaryTextWithNestedTernaryOperatorTemplateLiteral = (): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteral>
Hello secondary (red)
</TextWithNestedTernaryOperatorTemplateLiteral>
);
};

export const NotPrimaryMaybeTextWithNestedTernaryOperatorTemplateLiteral = (): JSX.Element => {
return (
<TextWithNestedTernaryOperatorTemplateLiteral isMaybe>
Hello secondary (red)
</TextWithNestedTernaryOperatorTemplateLiteral>
);
};

export const PrimaryTextWithObjectStyles = (): JSX.Element => {
return <TextWithObjectStyles isPrimary>Hello primary</TextWithObjectStyles>;
};
@@ -142,6 +232,43 @@ export const NotPrimaryTextWithTernaryAndBooleanObjectStyle = (): JSX.Element =>
);
};

export const PrimaryTextWithNestedTernaryAndBooleanObjectStyle = (): JSX.Element => {
return (
<TextWithNestedTernaryAndBooleanObjectStyle isPrimary>
{' '}
Hello primary but not bolded. This should be blue.
</TextWithNestedTernaryAndBooleanObjectStyle>
);
};

export const BoldedPrimaryNestedTextWithTernaryAndBooleanObjectStyle = (): JSX.Element => {
return (
<TextWithNestedTernaryAndBooleanObjectStyle isPrimary isBolded>
{' '}
Hello bolded primary. This should be blue.
</TextWithNestedTernaryAndBooleanObjectStyle>
);
};

export const NotPrimaryTextWithNestedTernaryAndBooleanObjectStyle = (): JSX.Element => {
return (
// should not render bold since it is not also primary
<TextWithNestedTernaryAndBooleanObjectStyle isBolded>
{' '}
Hello secondary
</TextWithNestedTernaryAndBooleanObjectStyle>
);
};

export const NotPrimaryNotBoldedTextWithNestedTernaryAndBooleanObjectStyle = (): JSX.Element => {
return (
<TextWithNestedTernaryAndBooleanObjectStyle>
{' '}
Hello secondary
</TextWithNestedTernaryAndBooleanObjectStyle>
);
};

export const PrimaryTextWithMixins = (): JSX.Element => {
return <TextWithMixins isPrimary>Hello primary</TextWithMixins>;
};
@@ -175,3 +302,12 @@ export const TextWithKeyValueString = (): JSX.Element => (
<KeyValueString isPrimary={false}>color: red</KeyValueString>
</div>
);

export const ConditionWithNoValuePath = (): JSX.Element => {
return (
<div>
<NoValuePath isPrimary>Primary path with no given CSS</NoValuePath>
<NoValuePath>Secondary path with CSS</NoValuePath>
</div>
);
};
16 changes: 16 additions & 0 deletions examples/stories/css-prop-static-object.tsx
Original file line number Diff line number Diff line change
@@ -82,3 +82,19 @@ export const ObjectLiteralMapWithKeys = (): JSX.Element => (
))}
</div>
);

export const ObjectExpressionDisabledSameLine = (): JSX.Element => (
<h1
css={{ color: 'red' }} // @compiled-disable-line transform-css-prop
>
Black text
</h1>
);

export const ObjectExpressionDisabledNextLine = (): JSX.Element => (
<h1
// @compiled-disable-next-line transform-css-prop
css={{ color: 'red' }}>
Black text
</h1>
);
Loading