@graphcommerce/image 9.1.0-canary.54 → 10.0.0-canary.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +86 -0
- package/components/Image.tsx +24 -8
- package/package.json +10 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,91 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0-canary.56
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
|
|
8
|
+
|
|
9
|
+
This major release brings full Turbopack compatibility, dramatically improving development speed.
|
|
10
|
+
|
|
11
|
+
### 🚀 Turbopack-Compatible Interceptor System
|
|
12
|
+
|
|
13
|
+
The entire plugin/interceptor system has been rewritten to work with Turbopack:
|
|
14
|
+
|
|
15
|
+
- **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
|
|
16
|
+
- **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
|
|
17
|
+
- **Direct imports** - Interceptors import from `.original` files instead of embedding source
|
|
18
|
+
- **New CLI commands**:
|
|
19
|
+
- `graphcommerce codegen-interceptors` - Generate interceptor files
|
|
20
|
+
- `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
|
|
21
|
+
- **Stable file hashing** - Deterministic interceptor generation for better caching
|
|
22
|
+
|
|
23
|
+
### ⚙️ Treeshakable Configuration System
|
|
24
|
+
|
|
25
|
+
Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
|
|
26
|
+
|
|
27
|
+
- **New `codegen-config-values` command** - Generates TypeScript files with precise typing
|
|
28
|
+
- **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
|
|
29
|
+
- **Fully treeshakable** - Unused config values are eliminated from the bundle
|
|
30
|
+
- **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
|
|
31
|
+
- **Separate files for nested objects** - Optimal treeshaking for complex configurations
|
|
32
|
+
|
|
33
|
+
### 🔧 withGraphCommerce Changes
|
|
34
|
+
|
|
35
|
+
- **Removed** `InterceptorPlugin` - No longer needed with file-based interception
|
|
36
|
+
- **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
|
|
37
|
+
- **Removed** `@mui/*` alias rewrites - No longer required
|
|
38
|
+
- **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
|
|
39
|
+
- **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
|
|
40
|
+
- **Added** `optimizePackageImports` for better bundle optimization
|
|
41
|
+
- **Added** `images.qualities: [52, 75]` for Next.js image optimization
|
|
42
|
+
|
|
43
|
+
### 📦 Lingui Configuration
|
|
44
|
+
|
|
45
|
+
- **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
|
|
46
|
+
- **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
|
|
47
|
+
- **Simplified** formatter options
|
|
48
|
+
|
|
49
|
+
### ⚛️ React 19 & Next.js 16 Compatibility
|
|
50
|
+
|
|
51
|
+
- Updated `RefObject<T>` types for React 19 (now includes `null` by default)
|
|
52
|
+
- Replaced deprecated `React.VFC` with `React.FC`
|
|
53
|
+
- Fixed `useRef` calls to require explicit initial values
|
|
54
|
+
- Updated `MutableRefObject` usage in `framer-scroller`
|
|
55
|
+
|
|
56
|
+
### 📋 ESLint 9 Flat Config
|
|
57
|
+
|
|
58
|
+
- Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
|
|
59
|
+
- Updated `@typescript-eslint/*` packages to v8
|
|
60
|
+
- Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
|
|
61
|
+
|
|
62
|
+
### 🔄 Apollo Client
|
|
63
|
+
|
|
64
|
+
- Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
|
|
65
|
+
- Updated error handling types to accept `ApolloError | null | undefined`
|
|
66
|
+
|
|
67
|
+
### ⚠️ Breaking Changes
|
|
68
|
+
|
|
69
|
+
- **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
|
|
70
|
+
- **Interceptor files changed** - Original components now at `.original.tsx`
|
|
71
|
+
- **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
|
|
72
|
+
- **ESLint config format** - Must use flat config (`eslint.config.mjs`)
|
|
73
|
+
- **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
|
|
74
|
+
|
|
75
|
+
### 🗑️ Removed
|
|
76
|
+
|
|
77
|
+
- `InterceptorPlugin` webpack plugin
|
|
78
|
+
- `configToImportMeta` utility
|
|
79
|
+
- Webpack `DefinePlugin` usage for config
|
|
80
|
+
- `@mui/*` modern alias rewrites
|
|
81
|
+
- Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
|
|
82
|
+
|
|
83
|
+
## 9.1.0-canary.55
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`76adc6f`](https://github.com/graphcommerce-org/graphcommerce/commit/76adc6f6a5f76eb58998cef36f11a6a899a5e6ac) - Export generateSrcSet from Image component so it can be used for the avatar srcSet directly ([@paales](https://github.com/paales))
|
|
88
|
+
|
|
3
89
|
## 9.1.0-canary.54
|
|
4
90
|
|
|
5
91
|
## 9.1.0-canary.53
|
package/components/Image.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-restricted-imports */
|
|
2
3
|
|
|
3
4
|
/* eslint-disable prefer-const */
|
|
@@ -142,16 +143,31 @@ function getWidths(
|
|
|
142
143
|
type GenImgAttrsData = {
|
|
143
144
|
src: string
|
|
144
145
|
layout: LayoutValue
|
|
145
|
-
loader
|
|
146
|
+
loader?: ImageLoaderWithConfig
|
|
146
147
|
width?: number
|
|
147
148
|
quality?: number
|
|
148
149
|
sizes: string
|
|
149
150
|
scale: number
|
|
150
|
-
config
|
|
151
|
+
config?: ImageConfig
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
function generateSrcSet(props: GenImgAttrsData): string {
|
|
154
|
-
const
|
|
154
|
+
export function generateSrcSet(props: GenImgAttrsData): string {
|
|
155
|
+
const defaultConfig = {
|
|
156
|
+
...imageConfigEnv,
|
|
157
|
+
allSizes: [...imageConfigEnv.deviceSizes, ...imageConfigEnv.imageSizes].sort((a, b) => a - b),
|
|
158
|
+
deviceSizes: imageConfigEnv.deviceSizes.sort((a, b) => a - b),
|
|
159
|
+
}
|
|
160
|
+
const {
|
|
161
|
+
src,
|
|
162
|
+
layout,
|
|
163
|
+
width,
|
|
164
|
+
quality = 52,
|
|
165
|
+
sizes,
|
|
166
|
+
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
167
|
+
loader = defaultImageLoader,
|
|
168
|
+
scale,
|
|
169
|
+
config = defaultConfig,
|
|
170
|
+
} = props
|
|
155
171
|
const { widths, kind } = getWidths(config, width, layout, sizes)
|
|
156
172
|
|
|
157
173
|
return `${widths
|
|
@@ -212,7 +228,7 @@ function generateSizesString(sizes?: Sizes) {
|
|
|
212
228
|
|
|
213
229
|
/** Since we're handling stuff ourselves we omit some stuff */
|
|
214
230
|
type IntrisincImage = Omit<
|
|
215
|
-
JSX.IntrinsicElements['img'],
|
|
231
|
+
React.JSX.IntrinsicElements['img'],
|
|
216
232
|
'src' | 'srcSet' | 'ref' | 'width' | 'height' | 'loading' | 'sizes'
|
|
217
233
|
> & { loading?: LoadingValue }
|
|
218
234
|
|
|
@@ -225,7 +241,7 @@ export type ImageProps = IntrisincImage & {
|
|
|
225
241
|
dontReportWronglySizedImages?: boolean
|
|
226
242
|
width?: number
|
|
227
243
|
height?: number
|
|
228
|
-
pictureProps?: JSX.IntrinsicElements['picture'] & { sx?: SxProps<Theme> }
|
|
244
|
+
pictureProps?: React.JSX.IntrinsicElements['picture'] & { sx?: SxProps<Theme> }
|
|
229
245
|
/**
|
|
230
246
|
* Possible values:
|
|
231
247
|
*
|
|
@@ -249,7 +265,7 @@ const Img = styled('img')({})
|
|
|
249
265
|
const Picture = styled('picture')({})
|
|
250
266
|
|
|
251
267
|
// eslint-disable-next-line no-underscore-dangle
|
|
252
|
-
const
|
|
268
|
+
export const imageConfigEnv = process.env.__NEXT_IMAGE_OPTS as unknown as ImageConfigComplete
|
|
253
269
|
|
|
254
270
|
const Image = React.forwardRef<HTMLImageElement, ImageProps>(
|
|
255
271
|
(
|
|
@@ -278,7 +294,7 @@ const Image = React.forwardRef<HTMLImageElement, ImageProps>(
|
|
|
278
294
|
|
|
279
295
|
const configContext = useContext(ImageConfigContext)
|
|
280
296
|
const config: ImageConfig = useMemo(() => {
|
|
281
|
-
const c =
|
|
297
|
+
const c = imageConfigEnv || configContext || imageConfigDefault
|
|
282
298
|
const allSizes = [...c.deviceSizes, ...c.imageSizes].sort((a, b) => a - b)
|
|
283
299
|
const deviceSizes = c.deviceSizes.sort((a, b) => a - b)
|
|
284
300
|
return { ...c, allSizes, deviceSizes }
|
package/package.json
CHANGED
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
"name": "@graphcommerce/image",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "10.0.0-canary.56",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"scripts": {
|
|
8
8
|
"dev": "tsc -W"
|
|
9
9
|
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./index.ts"
|
|
12
|
+
},
|
|
10
13
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
11
14
|
"eslintConfig": {
|
|
12
15
|
"extends": "@graphcommerce/eslint-config-pwa",
|
|
@@ -15,13 +18,13 @@
|
|
|
15
18
|
}
|
|
16
19
|
},
|
|
17
20
|
"peerDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^
|
|
19
|
-
"@graphcommerce/framer-utils": "^
|
|
20
|
-
"@graphcommerce/prettier-config-pwa": "^
|
|
21
|
-
"@graphcommerce/typescript-config-pwa": "^
|
|
21
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.56",
|
|
22
|
+
"@graphcommerce/framer-utils": "^10.0.0-canary.56",
|
|
23
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.0-canary.56",
|
|
24
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.0-canary.56",
|
|
22
25
|
"@mui/material": "^5.10.16",
|
|
23
26
|
"next": "*",
|
|
24
|
-
"react": "^
|
|
25
|
-
"react-dom": "^
|
|
27
|
+
"react": "^19.2.0",
|
|
28
|
+
"react-dom": "^19.2.0"
|
|
26
29
|
}
|
|
27
30
|
}
|