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.11.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.11.1
Choose a head ref
Loading
Showing with 2,487 additions and 1,626 deletions.
  1. BIN .loki/reference/chrome_laptop_css_prop_variable_clash_Using_Component_With_Props.png
  2. BIN .loki/reference/chrome_laptop_css_prop_variable_clash_Using_Component_Without_Props.png
  3. BIN .loki/reference/chrome_laptop_edge_cases_shadow_variables_Clashing_Internal_Names.png
  4. BIN .loki/reference/chrome_laptop_edge_cases_shadow_variables_Clashing_Variable_Names.png
  5. +1 −0 .storybook/.babelrc.json
  6. +15 −1 babel.config.json
  7. +4 −2 examples/parcel/.compiledcssrc
  8. +10 −2 examples/parcel/.parcelrc
  9. +8 −1 examples/ssr/.babelrc
  10. +2 −2 examples/ssr/package.json
  11. +2 −1 examples/webpack/webpack.config.js
  12. +1 −1 fixtures/babel-component/.babelrc
  13. +1 −1 fixtures/babel-component/src/index.jsx
  14. +2 −1 fixtures/parcel-transformer-test-app/.compiledcssrc
  15. +10 −0 fixtures/parcel-transformer-test-custom-resolver-app/.compiledcssrc
  16. +6 −0 fixtures/parcel-transformer-test-custom-resolver-app/.parcelrc
  17. +11 −0 fixtures/parcel-transformer-test-custom-resolver-app/CHANGELOG.md
  18. +1 −0 fixtures/parcel-transformer-test-custom-resolver-app/package-lock.json
  19. +14 −0 fixtures/parcel-transformer-test-custom-resolver-app/package.json
  20. +1 −0 fixtures/parcel-transformer-test-custom-resolver-app/src/foo.js
  21. +11 −0 fixtures/parcel-transformer-test-custom-resolver-app/src/index.html
  22. +8 −0 fixtures/parcel-transformer-test-custom-resolver-app/src/index.jsx
  23. +2 −1 fixtures/parcel-transformer-test-extract-app/.compiledcssrc
  24. +10 −10 package.json
  25. +3 −1 packages/babel-plugin-strip-runtime/src/__tests__/strip-runtime-source-code.test.ts
  26. +1 −1 packages/babel-plugin-strip-runtime/src/__tests__/strip-runtime-transpiled-code.test.ts
  27. +40 −0 packages/babel-plugin/CHANGELOG.md
  28. +4 −4 packages/babel-plugin/package.json
  29. +41 −0 packages/babel-plugin/src/__tests__/expression-evaluation.test.ts
  30. +15 −11 packages/babel-plugin/src/__tests__/index.test.ts
  31. +8 −8 packages/babel-plugin/src/__tests__/jsx-automatic.test.ts
  32. +15 −11 packages/babel-plugin/src/__tests__/module-imports.test.ts
  33. +5 −2 packages/babel-plugin/src/__tests__/module-traversal.test.ts
  34. +24 −16 packages/babel-plugin/src/babel-plugin.ts
  35. +4 −1 packages/babel-plugin/src/class-names/index.ts
  36. +4 −1 packages/babel-plugin/src/constants.ts
  37. +4 −4 packages/babel-plugin/src/keyframes/__tests__/behaviour.test.ts
  38. +156 −132 packages/babel-plugin/src/keyframes/__tests__/call-expression.test.ts
  39. +78 −66 packages/babel-plugin/src/keyframes/__tests__/tagged-template-expression.test.ts
  40. +305 −275 packages/babel-plugin/src/styled/__tests__/behaviour.test.ts
  41. +22 −36 packages/babel-plugin/src/styled/__tests__/call-expression.test.ts
  42. +49 −60 packages/babel-plugin/src/styled/__tests__/tagged-template-expression.test.ts
  43. +6 −2 packages/babel-plugin/src/test-utils.ts
  44. +7 −0 packages/babel-plugin/src/types.ts
  45. +86 −0 packages/babel-plugin/src/utils/__tests__/normalize-props.usage.test.ts
  46. +217 −0 packages/babel-plugin/src/utils/__tests__/object-property-to-string.test.ts
  47. +0 −45 packages/babel-plugin/src/utils/ast.ts
  48. +1 −1 packages/babel-plugin/src/utils/build-compiled-component.ts
  49. +69 −170 packages/babel-plugin/src/utils/build-styled-component.ts
  50. +13 −131 packages/babel-plugin/src/utils/css-builders.ts
  51. +21 −14 packages/babel-plugin/src/utils/evaluate-expression.ts
  52. +6 −0 packages/babel-plugin/src/utils/is-empty.ts
  53. +4 −1 packages/babel-plugin/src/utils/manipulate-template-literal.ts
  54. +86 −0 packages/babel-plugin/src/utils/normalize-props-usage.ts
  55. +88 −0 packages/babel-plugin/src/utils/object-property-to-string.ts
  56. +33 −7 packages/babel-plugin/src/utils/transform-css-items.ts
  57. +0 −5 packages/babel-plugin/src/utils/types.ts
  58. +1 −1 packages/cli/package.json
  59. +12 −0 packages/css/CHANGELOG.md
  60. +4 −4 packages/css/package.json
  61. +67 −58 packages/css/src/__tests__/transform.test.ts
  62. +72 −0 packages/css/src/plugins/__tests__/discard-empty-rules.test.ts
  63. +25 −0 packages/css/src/plugins/discard-empty-rules.ts
  64. +13 −5 packages/css/src/plugins/normalize-css.ts
  65. +11 −2 packages/css/src/transform.ts
  66. +1 −1 packages/eslint-plugin/package.json
  67. +7 −0 packages/parcel-config/CHANGELOG.md
  68. +2 −2 packages/parcel-config/package.json
  69. +1 −1 packages/parcel-optimizer/package.json
  70. +19 −0 packages/parcel-transformer/CHANGELOG.md
  71. +4 −3 packages/parcel-transformer/package.json
  72. +28 −11 packages/parcel-transformer/src/__tests__/transformer.parceltest.ts
  73. +25 −1 packages/parcel-transformer/src/index.ts
  74. +14 −1 packages/parcel-transformer/src/types.ts
  75. +7 −0 packages/react/CHANGELOG.md
  76. +2 −2 packages/react/package.json
  77. +2 −2 packages/react/src/runtime/__tests__/css-custom-property.test.ts
  78. +1 −1 packages/react/src/runtime/css-custom-property.ts
  79. +28 −0 packages/webpack-loader/CHANGELOG.md
  80. +7 −7 packages/webpack-loader/package.json
  81. +22 −13 packages/webpack-loader/src/__tests__/extract-plugin.test.ts
  82. +2 −1 packages/webpack-loader/src/__tests__/test-utils.ts
  83. +11 −0 packages/webpack-loader/src/compiled-loader.ts
  84. +1 −1 packages/webpack-loader/src/extract-plugin.ts
  85. +6 −0 packages/webpack-loader/src/types.ts
  86. +0 −19 stories/css-shadow-variable-clash.tsx
  87. +66 −0 stories/edge-cases-shadow-variables.tsx
  88. +491 −462 yarn.lock
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions .storybook/.babelrc.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,7 @@
"@compiled/babel-plugin",
{
"importReact": false,
"optimizeCss": false,
"transformerBabelPlugins": [
[
"@babel/plugin-proposal-decorators",
16 changes: 15 additions & 1 deletion babel.config.json
Original file line number Diff line number Diff line change
@@ -10,5 +10,19 @@
["@babel/preset-env", { "targets": { "node": "current" } }],
"@babel/preset-typescript",
["@babel/preset-react", { "runtime": "automatic" }]
]
],
"env": {
"test": {
"plugins": [
[
"@compiled/babel-plugin",
{
"nonce": "\"k0Mp1lEd\"",
"importReact": false,
"optimizeCss": false
}
]
]
}
}
}
6 changes: 4 additions & 2 deletions examples/parcel/.compiledcssrc
Original file line number Diff line number Diff line change
@@ -8,7 +8,8 @@
".customjsx"
],
"parserBabelPlugins": [
"typescript"
"typescript",
"jsx"
],
"transformerBabelPlugins": [
[
@@ -18,5 +19,6 @@
}
]
],
"extract": true
"extract": true,
"optimizeCss": false
}
12 changes: 10 additions & 2 deletions examples/parcel/.parcelrc
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
{
"extends": ["@parcel/config-default", "@compiled/parcel-config"],
"extends": [
"@parcel/config-default",
"@compiled/parcel-config"
],
"transformers": {
"*.{js,mjs,jsx,cjs,ts,tsx}": [
// Manually remove the babel transformer so we don't use the root babel config
"@compiled/parcel-transformer",
"@parcel/transformer-js",
"@parcel/transformer-react-refresh-wrap"
],
"*.customjsx": [
"@compiled/parcel-transformer",
"@parcel/transformer-babel",
"@parcel/transformer-js",
"@parcel/transformer-react-refresh-wrap",
"..."
9 changes: 8 additions & 1 deletion examples/ssr/.babelrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"presets": ["razzle/babel"],
"plugins": ["@compiled/babel-plugin"]
"plugins": [
[
"@compiled/babel-plugin",
{
"optimizeCss": false
}
]
]
}
4 changes: 2 additions & 2 deletions examples/ssr/package.json
Original file line number Diff line number Diff line change
@@ -15,15 +15,15 @@
"@babel/helper-builder-react-jsx": "^7.16.7",
"@babel/helper-builder-react-jsx-experimental": "^7.12.11",
"@compiled/react": "*",
"express": "4.17.3",
"express": "4.18.1",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"babel-preset-razzle": "^4.2.17",
"html-webpack-plugin": "^5.5.0",
"mini-css-extract-plugin": "^0.9.0",
"postcss": "^8.4.13",
"postcss": "^8.4.14",
"razzle": "^4.2.17",
"razzle-dev-utils": "^4.2.17",
"webpack": "^5.71.0",
3 changes: 2 additions & 1 deletion examples/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -37,8 +37,9 @@ module.exports = {
extract: extractCSS,
importReact: false,
extensions: ['.js', '.jsx', '.ts', '.tsx', '.customjsx'],
parserBabelPlugins: ['typescript'],
parserBabelPlugins: ['typescript', 'jsx'],
transformerBabelPlugins: [['@babel/plugin-proposal-decorators', { legacy: true }]],
optimizeCss: false,
},
},
],
2 changes: 1 addition & 1 deletion fixtures/babel-component/.babelrc
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@
["@babel/preset-env", { "targets": { "browsers": "last 1 version" } }],
["@babel/preset-react", { "runtime": "automatic" }]
],
"plugins": [["@compiled/babel-plugin", { "importReact": false }]]
"plugins": [["@compiled/babel-plugin", { "importReact": false, "optimizeCss": false }]]
}
2 changes: 1 addition & 1 deletion fixtures/babel-component/src/index.jsx
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ const Button = styled.button`
color: blue;
font-size: 30px;
border: 2px solid blue;
padding: 8px;
padding: 32px;
`;

export default function BabelComponent({ children }) {
3 changes: 2 additions & 1 deletion fixtures/parcel-transformer-test-app/.compiledcssrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"importReact": false,
"extract": false
"extract": false,
"optimizeCss": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"importReact": false,
"extract": false,
"optimizeCss": false,
"resolve": {
"alias": {
"~": "../"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@parcel/config-default",
"transformers": {
"*.{js,jsx}": ["@compiled/parcel-transformer", "..."]
}
}
11 changes: 11 additions & 0 deletions fixtures/parcel-transformer-test-custom-resolver-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# @compiled/parcel-transformer-test-custom-resolver-app

## 0.0.2

### Patch Changes

- 100f5d5e: Pass a custom resolver from parcel-transformer to babel plugin
- Updated dependencies [13b71dfb]
- @compiled/react@0.11.1

## 0.0.1

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions fixtures/parcel-transformer-test-custom-resolver-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "@compiled/parcel-transformer-test-custom-resolver-app",
"version": "0.0.2",
"private": true,
"dependencies": {
"@compiled/react": "^0.11.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
},
"devDependencies": {
"@compiled/parcel-transformer": "*",
"@parcel/config-default": "^2.3.1"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const color = 'red';
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div id="root"></div>
<script type="module" src="./index.jsx"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import '@compiled/react';
import { color } from '~/src/foo.js';

const App = () => (
<>
<div css={{ color }}>CSS prop</div>
</>
);
3 changes: 2 additions & 1 deletion fixtures/parcel-transformer-test-extract-app/.compiledcssrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"importReact": false,
"extract": true
"extract": true,
"optimizeCss": false
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@
"mini-css-extract-plugin": "^1.6.2",
"nth-check": "^2.0.1",
"react": "^17.0.2",
"typescript": "^4.6.4",
"typescript": "^4.7.4",
"unset-value": "^2.0.1",
"webpack-dev-server": "^4.7.4"
},
@@ -73,7 +73,7 @@
"@babel/preset-env": "^7.17.10",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@changesets/cli": "^2.22.0",
"@changesets/cli": "^2.24.3",
"@compiled-private/module-a": "*",
"@compiled/babel-plugin": "*",
"@compiled/jest": "*",
@@ -84,10 +84,10 @@
"@storybook/manager-webpack5": "^6.4.20",
"@storybook/react": "^6.4.20",
"@types/jest": "^27.5.2",
"@types/node": "^17.0.40",
"@types/react": "^17.0.45",
"@types/node": "^17.0.45",
"@types/react": "^17.0.48",
"@types/react-dom": "^17.0.17",
"@types/svgo": "^2.6.3",
"@types/svgo": "^2.6.4",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"babel-loader": "^8.2.4",
@@ -97,26 +97,26 @@
"eslint-plugin-json-files": "^1.3.0",
"eslint-plugin-react": "^7.30.0",
"eslint-plugin-react-hooks": "^4.5.0",
"flow-bin": "^0.174.1",
"flow-bin": "^0.183.0",
"flowgen": "^1.17.0",
"git-branch-is": "^4.0.0",
"husky": "^4.3.8",
"jest": "^26.6.3",
"jest-extended": "^0.11.5",
"jest-watch-typeahead": "^0.6.5",
"loki": "^0.29.0",
"loki": "^0.30.3",
"prettier": "^2.5.1",
"pretty-quick": "^3.1.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"size-limit": "^7.0.8",
"storybook-addon-performance": "^0.16.1",
"storybook-addon-pseudo-states": "^1.0.0",
"ts-node": "^10.7.0",
"ts-node": "^10.8.2",
"ts-transform-define": "^0.1.10",
"tsconfig-paths": "^3.14.1",
"ttypescript": "^1.5.13",
"typescript": "^4.6.4"
"typescript": "^4.7.4"
},
"engines": {
"node": "^v16.13.2"
@@ -135,7 +135,7 @@
"size-limit": [
{
"path": "./packages/react/dist/browser/runtime.js",
"limit": "48B",
"limit": "50B",
"import": "{ ix }",
"ignore": [
"react"
Original file line number Diff line number Diff line change
@@ -30,7 +30,9 @@ const transform = (
configFile: false,
filename: join(__dirname, 'app.tsx'),
plugins: [
...(bake ? [[compiledBabelPlugin, { importReact: runtime === 'classic' }]] : []),
...(bake
? [[compiledBabelPlugin, { importReact: runtime === 'classic', optimizeCss: false }]]
: []),
...(extract ? [[stripRuntimeBabelPlugin, { styleSheetPath, compiledRequireExclude }]] : []),
],
presets: [['@babel/preset-react', { runtime }]],
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ const transform = (
babelrc: false,
configFile: false,
filename,
plugins: [compiledBabelPlugin],
plugins: [[compiledBabelPlugin, { optimizeCss: false }]],
presets: [
['@babel/preset-env', { targets: { esmodules: true }, modules: modules ?? 'auto' }],
'@babel/preset-typescript',
40 changes: 40 additions & 0 deletions packages/babel-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
# @compiled/babel-plugin

## 0.16.5

### Patch Changes

- fcda0097: Fix bug where props are not forwarded when composing components in the styled API
- dcb333a2: Use less likely to clash variable names in styled template
- 5ee1a866: - Fixes bug where more than one import cannot be used in template literal object property key
- Support string binary operation in object property keys

## 0.16.4

### Patch Changes

- d2bd6305: - Normalize prop usage in styled API to make it easier to avoid name clashing
- Fix bug in styled API where destructuring can remove values out of props
- Ensure props are not displayed as HTML attributes, unless they are valid attributes
- 17de9d1f: Omit rules with empty values from stylesheet
- Updated dependencies [17de9d1f]
- @compiled/css@0.8.5

## 0.16.3

### Patch Changes

- 5272281a: Add configurable options to optimize CSS
- Updated dependencies [5272281a]
- @compiled/css@0.8.4

## 0.16.2

### Patch Changes

- 8912717: Revert "Bug - shadow variable clash with destructured props (#1193)"

## 0.16.1

### Patch Changes

- 6c1ea7f: Support Compiled in files with TypeScript as expressions

## 0.16.0

### Minor Changes
8 changes: 4 additions & 4 deletions packages/babel-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compiled/babel-plugin",
"version": "0.16.0",
"version": "0.16.5",
"description": "A familiar and performant compile time CSS-in-JS library for React.",
"homepage": "https://compiledcssinjs.com/docs/pkg-babel-plugin",
"bugs": "https://github.com/atlassian-labs/compiled/issues/new?assignees=&labels=bug&template=bug_report.md",
@@ -28,9 +28,9 @@
"@babel/template": "^7.16.7",
"@babel/traverse": "^7.17.10",
"@babel/types": "^7.17.10",
"@compiled/css": "^0.8.3",
"@compiled/css": "^0.8.5",
"@compiled/utils": "^0.6.16",
"@emotion/is-prop-valid": "^1.1.2",
"@emotion/is-prop-valid": "^1.2.0",
"resolve": "^1.22.0"
},
"devDependencies": {
@@ -41,7 +41,7 @@
"@types/resolve": "^1.20.2",
"benchmark": "^2.1.4",
"prettier": "^2.5.1",
"ts-node": "^10.7.0",
"ts-node": "^10.8.2",
"tsconfig-paths": "^3.14.1"
}
}
Loading