Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into eslint9
Browse files Browse the repository at this point in the history
  • Loading branch information
soren121 committed Dec 15, 2024
2 parents 7a6a8d5 + cce67ec commit e2edd45
Show file tree
Hide file tree
Showing 36 changed files with 461 additions and 487 deletions.
5 changes: 0 additions & 5 deletions .changeset/fluffy-garlics-smash.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/grumpy-suits-cough.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/rotten-baboons-knock.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/young-ears-give.md

This file was deleted.

6 changes: 6 additions & 0 deletions packages/cache/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @emotion/cache

## 11.14.0

### Minor Changes

- [#3277](https://github.com/emotion-js/emotion/pull/3277) [`8dc1a6d`](https://github.com/emotion-js/emotion/commit/8dc1a6dd19d2dc9ce435ef0aff85ccf5647f5d2e) Thanks [@Andarist](https://github.com/Andarist)! - Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.

## 11.13.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emotion/cache",
"version": "11.13.5",
"version": "11.14.0",
"description": "emotion's cache",
"main": "dist/emotion-cache.cjs.js",
"module": "dist/emotion-cache.esm.js",
Expand Down
6 changes: 6 additions & 0 deletions packages/css-prettifier/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @emotion/css-prettifier

## 1.2.0

### Minor Changes

- [#3278](https://github.com/emotion-js/emotion/pull/3278) [`282b61d`](https://github.com/emotion-js/emotion/commit/282b61d2ad4e39ea65af88351a894a903c2d42c4) Thanks [@Andarist](https://github.com/Andarist)! - Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.

## 1.1.4

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/css-prettifier/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emotion/css-prettifier",
"version": "1.1.4",
"version": "1.2.0",
"description": "Simple Stylis-based CSS prettifier",
"keywords": [
"emotion"
Expand Down
4 changes: 2 additions & 2 deletions packages/jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
},
"dependencies": {
"@babel/runtime": "^7.18.3",
"@emotion/css-prettifier": "^1.1.4",
"@emotion/css-prettifier": "^1.2.0",
"chalk": "^4.1.0",
"specificity": "^0.4.1",
"stylis": "4.2.0"
Expand All @@ -77,7 +77,7 @@
"devDependencies": {
"@definitelytyped/dtslint": "0.0.112",
"@emotion/css": "11.13.5",
"@emotion/react": "11.13.5",
"@emotion/react": "11.14.0",
"@types/jest": "^29.5.12",
"enzyme-to-json": "^3.6.1",
"pretty-format": "^22.4.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/primitives-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"react": ">=16.8.0"
},
"devDependencies": {
"@emotion/react": "11.13.5",
"@emotion/react": "11.14.0",
"@types/css-to-react-native": "^3.0.0",
"react": "16.14.0"
},
Expand Down
12 changes: 12 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# @emotion/react

## 11.14.0

### Minor Changes

- [#3281](https://github.com/emotion-js/emotion/pull/3281) [`fc4d7bd`](https://github.com/emotion-js/emotion/commit/fc4d7bd744c205f55513dcd4e4e5134198c219de) Thanks [@Andarist](https://github.com/Andarist)! - Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.

### Patch Changes

- Updated dependencies [[`8dc1a6d`](https://github.com/emotion-js/emotion/commit/8dc1a6dd19d2dc9ce435ef0aff85ccf5647f5d2e), [`e1bf17e`](https://github.com/emotion-js/emotion/commit/e1bf17ee87ec51da1412eb5291460ea95a39d27a)]:
- @emotion/cache@11.14.0
- @emotion/use-insertion-effect-with-fallbacks@1.2.0

## 11.13.5

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emotion/react",
"version": "11.13.5",
"version": "11.14.0",
"main": "dist/emotion-react.cjs.js",
"module": "dist/emotion-react.esm.js",
"types": "dist/emotion-react.cjs.d.ts",
Expand Down Expand Up @@ -262,9 +262,9 @@
"dependencies": {
"@babel/runtime": "^7.18.3",
"@emotion/babel-plugin": "^11.13.5",
"@emotion/cache": "^11.13.5",
"@emotion/cache": "^11.14.0",
"@emotion/serialize": "^1.3.3",
"@emotion/use-insertion-effect-with-fallbacks": "^1.1.0",
"@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",
"@emotion/utils": "^1.4.2",
"@emotion/weak-memoize": "^0.4.0",
"hoist-non-react-statics": "^3.3.1"
Expand All @@ -280,9 +280,9 @@
"devDependencies": {
"@definitelytyped/dtslint": "0.0.112",
"@emotion/css": "11.13.5",
"@emotion/css-prettifier": "1.1.4",
"@emotion/css-prettifier": "1.2.0",
"@emotion/server": "11.11.0",
"@emotion/styled": "11.13.5",
"@emotion/styled": "11.14.0",
"@types/hoist-non-react-statics": "^3.3.5",
"html-tag-names": "^1.1.2",
"react": "16.14.0",
Expand Down
87 changes: 43 additions & 44 deletions packages/react/src/jsx-namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,53 @@ type WithConditionalCSSProp<P> = 'className' extends keyof P
: {}

// unpack all here to avoid infinite self-referencing when defining our own JSX namespace for the pre-React 19 case
type ReactJSXElement = true extends IsPreReact19
? /** @ts-ignore */
JSX.Element
: /** @ts-ignore */
React.JSX.Element
type ReactJSXElementClass = true extends IsPreReact19
? /** @ts-ignore */
JSX.ElementClass
: /** @ts-ignore */
React.JSX.ElementClass
type ReactJSXElementAttributesProperty = true extends IsPreReact19
? /** @ts-ignore */
JSX.ElementAttributesProperty
: /** @ts-ignore */
React.JSX.ElementAttributesProperty
type ReactJSXElementChildrenAttribute = true extends IsPreReact19
? /** @ts-ignore */
JSX.ElementChildrenAttribute
: /** @ts-ignore */
React.JSX.ElementChildrenAttribute
type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19
? /** @ts-ignore */
JSX.LibraryManagedAttributes<C, P>
: /** @ts-ignore */
React.JSX.LibraryManagedAttributes<C, P>
type ReactJSXIntrinsicAttributes = true extends IsPreReact19
? /** @ts-ignore */
JSX.IntrinsicAttributes
: /** @ts-ignore */
React.JSX.IntrinsicAttributes
type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19
? /** @ts-ignore */
JSX.IntrinsicClassAttributes<T>
: /** @ts-ignore */
React.JSX.IntrinsicClassAttributes<T>
type ReactJSXIntrinsicElements = true extends IsPreReact19
? /** @ts-ignore */
JSX.IntrinsicElements
: /** @ts-ignore */
React.JSX.IntrinsicElements

// the IsPreReact19 and @ts-ignore comments are to allow @emotion/react to support three different cases of types
// - pre-React 18.something which didn't have `React.JSX`
// - React 18.something with `React.JSX`
// - React 19 with `React.JSX` and no global `JSX`
// we support both pre-React 19 cases by using the global `JSX` and with the React 19 types, we use `React.JSX`
// to make this work, we need @ts-ignore comments to ignore references that are invalid
// though note that the error types resulting from ignoring the errors will never be used
// since the pre vs post React 19 conditional will pick the one that won't error

// prettier-ignore
/** @ts-ignore */
type ReactJSXElement = true extends IsPreReact19 ? JSX.Element : React.JSX.Element

// prettier-ignore
/** @ts-ignore */
type ReactJSXElementClass = true extends IsPreReact19 ? JSX.ElementClass : React.JSX.ElementClass

// prettier-ignore
/** @ts-ignore */
type ReactJSXElementAttributesProperty = true extends IsPreReact19 ? JSX.ElementAttributesProperty : React.JSX.ElementAttributesProperty

// prettier-ignore
/** @ts-ignore */
type ReactJSXElementChildrenAttribute = true extends IsPreReact19 ? JSX.ElementChildrenAttribute : React.JSX.ElementChildrenAttribute

// prettier-ignore
/** @ts-ignore */
type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19 ? JSX.LibraryManagedAttributes<C, P> : React.JSX.LibraryManagedAttributes<C, P>

// prettier-ignore
/** @ts-ignore */
type ReactJSXIntrinsicAttributes = true extends IsPreReact19 ? JSX.IntrinsicAttributes : React.JSX.IntrinsicAttributes

// prettier-ignore
/** @ts-ignore */
type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19 ? JSX.IntrinsicClassAttributes<T> : React.JSX.IntrinsicClassAttributes<T>

// prettier-ignore
/** @ts-ignore */
type ReactJSXIntrinsicElements = true extends IsPreReact19 ? JSX.IntrinsicElements : React.JSX.IntrinsicElements

// based on the code from @types/[email protected]
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/3197efc097d522c4bf02b94e1a0766d007d6cdeb/types/react/index.d.ts#LL3204C13-L3204C13
// prettier-ignore
/** @ts-ignore */
type ReactJSXElementType = true extends IsPreReact19
? string | React.JSXElementConstructor<any>
: /** @ts-ignore */
React.JSX.ElementType
type ReactJSXElementType = true extends IsPreReact19 ? string | React.JSXElementConstructor<any> : React.JSX.ElementType

export namespace ReactJSX {
export type ElementType = ReactJSXElementType
Expand Down
6 changes: 3 additions & 3 deletions packages/serialize/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ export function serializeStyles(
strings as Interpolation
)
} else {
const asTemplateStringsArr = strings as TemplateStringsArray
if (isDevelopment && asTemplateStringsArr[0] === undefined) {
const templateStringsArr = strings as TemplateStringsArray
if (isDevelopment && templateStringsArr[0] === undefined) {
console.error(ILLEGAL_ESCAPE_SEQUENCE_ERROR)
}
styles += asTemplateStringsArr[0]
styles += templateStringsArr[0]
}
// we start at 1 since we've already handled the first arg
for (let i = 1; i < args.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@definitelytyped/dtslint": "0.0.112",
"@emotion/babel-plugin": "11.13.5",
"@emotion/css": "11.13.5",
"@emotion/css-prettifier": "1.1.4",
"@emotion/css-prettifier": "1.2.0",
"@types/node": "^12.20.37",
"typescript": "^5.4.5"
},
Expand Down
11 changes: 11 additions & 0 deletions packages/styled/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @emotion/styled

## 11.14.0

### Minor Changes

- [#3284](https://github.com/emotion-js/emotion/pull/3284) [`a19d019`](https://github.com/emotion-js/emotion/commit/a19d019bd418ebc3b9cba0e58f58b36ac2862a42) Thanks [@Andarist](https://github.com/Andarist)! - Source code has been migrated to TypeScript. From now on type declarations will be emitted based on that, instead of being hand-written.

### Patch Changes

- Updated dependencies [[`e1bf17e`](https://github.com/emotion-js/emotion/commit/e1bf17ee87ec51da1412eb5291460ea95a39d27a)]:
- @emotion/use-insertion-effect-with-fallbacks@1.2.0

## 11.13.5

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/styled/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"main": "dist/emotion-styled-base.cjs.js",
"module": "dist/emotion-styled-base.esm.js",
"umd:main": "dist/emotion-styled-base.umd.min.js",
"types": "../types/base",
"types": "dist/emotion-styled-base.cjs.d.ts",
"preconstruct": {
"umdName": "emotionStyledBase"
}
Expand Down
27 changes: 13 additions & 14 deletions packages/styled/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@emotion/styled",
"version": "11.13.5",
"version": "11.14.0",
"description": "styled API for emotion",
"main": "dist/emotion-styled.cjs.js",
"module": "dist/emotion-styled.esm.js",
"types": "types/index.d.ts",
"types": "dist/emotion-styled.cjs.d.ts",
"license": "MIT",
"repository": "https://github.com/emotion-js/emotion/tree/main/packages/styled",
"scripts": {
Expand All @@ -15,7 +15,7 @@
"@emotion/babel-plugin": "^11.13.5",
"@emotion/is-prop-valid": "^1.3.0",
"@emotion/serialize": "^1.3.3",
"@emotion/use-insertion-effect-with-fallbacks": "^1.1.0",
"@emotion/use-insertion-effect-with-fallbacks": "^1.2.0",
"@emotion/utils": "^1.4.2"
},
"peerDependencies": {
Expand All @@ -29,7 +29,7 @@
},
"devDependencies": {
"@definitelytyped/dtslint": "0.0.112",
"@emotion/react": "11.13.5",
"@emotion/react": "11.14.0",
"react": "16.14.0",
"typescript": "^5.4.5"
},
Expand All @@ -40,7 +40,6 @@
"src",
"dist",
"base",
"types/*.d.ts",
"macro.*"
],
"umd:main": "dist/emotion-styled.umd.min.js",
Expand Down Expand Up @@ -164,22 +163,22 @@
},
"imports": {
"#is-development": {
"development": "./src/conditions/true.js",
"default": "./src/conditions/false.js"
"development": "./src/conditions/true.ts",
"default": "./src/conditions/false.ts"
},
"#is-browser": {
"edge-light": "./src/conditions/false.js",
"workerd": "./src/conditions/false.js",
"worker": "./src/conditions/false.js",
"browser": "./src/conditions/true.js",
"default": "./src/conditions/is-browser.js"
"edge-light": "./src/conditions/false.ts",
"workerd": "./src/conditions/false.ts",
"worker": "./src/conditions/false.ts",
"browser": "./src/conditions/true.ts",
"default": "./src/conditions/is-browser.ts"
}
},
"preconstruct": {
"umdName": "emotionStyled",
"entrypoints": [
"./index.js",
"./base.js"
"./index.ts",
"./base.tsx"
],
"exports": {
"extra": {
Expand Down
2 changes: 0 additions & 2 deletions packages/styled/src/base.d.ts

This file was deleted.

Loading

0 comments on commit e2edd45

Please sign in to comment.