From eec2c065a26ae6a663a0040f662a0db2b9bede63 Mon Sep 17 00:00:00 2001 From: Jon Surrell Date: Fri, 11 Oct 2024 11:10:11 +0200 Subject: [PATCH] Interactivity: Update preact packages (#66008) * Update preact packages * Update package-lock * Fix some EffectFn types * Remove outdated ts-expect-error * Add changelog Co-authored-by: sirreal Co-authored-by: gziolo Co-authored-by: cbravobernal --- package-lock.json | 61 +++++++++++++++-------------- packages/interactivity/CHANGELOG.md | 4 ++ packages/interactivity/package.json | 4 +- packages/interactivity/src/utils.ts | 4 +- packages/interactivity/src/vdom.ts | 1 - 5 files changed, 40 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6bfb7f0bdddfb3..f8b10405897d30 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7263,10 +7263,27 @@ "integrity": "sha512-C16M+IYz0rgRhWZdCmK+h58JMv8vijAA61gmz2rspCSwKwzBebpdcsiUmwrtJRdphuY30i6BSLEOP8ppbNLyLg==", "dev": true }, + "node_modules/@preact/signals": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@preact/signals/-/signals-1.3.0.tgz", + "integrity": "sha512-EOMeg42SlLS72dhoq6Vjq08havnLseWmPQ8A0YsgIAqMgWgx7V1a39+Pxo6i7SY5NwJtH4849JogFq3M67AzWg==", + "license": "MIT", + "dependencies": { + "@preact/signals-core": "^1.7.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + }, + "peerDependencies": { + "preact": "10.x" + } + }, "node_modules/@preact/signals-core": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/@preact/signals-core/-/signals-core-1.4.0.tgz", - "integrity": "sha512-5iYoZBhELLIhUQceZI7sDTQWPb+xcVSn2qk8T/aNl/VMh+A4AiPX9YRSh4XO7fZ6pncrVxl1Iln82poVqYVbbw==", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@preact/signals-core/-/signals-core-1.8.0.tgz", + "integrity": "sha512-OBvUsRZqNmjzCZXWLxkZfhcgT+Fk8DDcT/8vD6a1xhDemodyy87UJRJfASMuSD8FaAIeGgGm85ydXhm7lr4fyA==", + "license": "MIT", "funding": { "type": "opencollective", "url": "https://opencollective.com/preact" @@ -42097,6 +42114,16 @@ "node": ">=0.10.0" } }, + "node_modules/preact": { + "version": "10.24.2", + "resolved": "https://registry.npmjs.org/preact/-/preact-10.24.2.tgz", + "integrity": "sha512-1cSoF0aCC8uaARATfrlz4VCBqE8LwZwRfLgkxJOQwAlQt6ayTmi0D9OF7nXid1POI5SZidFuG9CnlXbDfLqY/Q==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/preact" + } + }, "node_modules/prebuild-install": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", @@ -55683,8 +55710,8 @@ "version": "6.9.0", "license": "GPL-2.0-or-later", "dependencies": { - "@preact/signals": "^1.2.2", - "preact": "^10.19.3" + "@preact/signals": "^1.3.0", + "preact": "^10.24.2" }, "engines": { "node": ">=18.12.0", @@ -55704,30 +55731,6 @@ "npm": ">=8.19.2" } }, - "packages/interactivity/node_modules/@preact/signals": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@preact/signals/-/signals-1.2.2.tgz", - "integrity": "sha512-ColCqdo4cRP18bAuIR4Oik5rDpiyFtPIJIygaYPMEAwTnl4buWkBOflGBSzhYyPyJfKpkwlekrvK+1pzQ2ldWw==", - "dependencies": { - "@preact/signals-core": "^1.4.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/preact" - }, - "peerDependencies": { - "preact": "10.x" - } - }, - "packages/interactivity/node_modules/preact": { - "version": "10.19.3", - "resolved": "https://registry.npmjs.org/preact/-/preact-10.19.3.tgz", - "integrity": "sha512-nHHTeFVBTHRGxJXKkKu5hT8C/YWBkPso4/Gad6xuj5dbptt9iF9NZr9pHbPhBrnT2klheu7mHTxTZ/LjwJiEiQ==", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/preact" - } - }, "packages/interface": { "name": "@wordpress/interface", "version": "6.9.0", diff --git a/packages/interactivity/CHANGELOG.md b/packages/interactivity/CHANGELOG.md index 7a510bd89b0f78..be6bdeefe81e0d 100644 --- a/packages/interactivity/CHANGELOG.md +++ b/packages/interactivity/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Internal + +- Upgrade preact libraries [#66008](https://github.com/WordPress/gutenberg/pull/66008). + ### Bug Fixes - Fix an issue where "default" could not be used as a directive suffix ([#65815](https://github.com/WordPress/gutenberg/pull/65815)). diff --git a/packages/interactivity/package.json b/packages/interactivity/package.json index 417ec8a2d337ba..2519e983e93446 100644 --- a/packages/interactivity/package.json +++ b/packages/interactivity/package.json @@ -31,8 +31,8 @@ "./debug": "./build-module/debug.js" }, "dependencies": { - "@preact/signals": "^1.2.2", - "preact": "^10.19.3" + "@preact/signals": "^1.3.0", + "preact": "^10.24.2" }, "publishConfig": { "access": "public" diff --git a/packages/interactivity/src/utils.ts b/packages/interactivity/src/utils.ts index c5eb91681294f2..4f10ed517de502 100644 --- a/packages/interactivity/src/utils.ts +++ b/packages/interactivity/src/utils.ts @@ -67,9 +67,9 @@ export const splitTask = () => { * @param notify The function that notifies listeners when the value is flushed. * @return The Flusher object with `flush` and `dispose` properties. */ -function createFlusher( compute: () => unknown, notify: () => void ): Flusher { +function createFlusher( compute: () => void, notify: () => void ): Flusher { let flush: () => void = () => undefined; - const dispose = effect( function ( this: any ) { + const dispose = effect( function ( this: any ): void { flush = this.c.bind( this ); this.x = compute; this.c = notify; diff --git a/packages/interactivity/src/vdom.ts b/packages/interactivity/src/vdom.ts index b533a130e4a6f0..9a1ec7ec5d76f0 100644 --- a/packages/interactivity/src/vdom.ts +++ b/packages/interactivity/src/vdom.ts @@ -161,7 +161,6 @@ export function toVdom( root: Node ): Array< ComponentChild > { }, {} ); } - // @ts-expect-error Fixed in upcoming preact release https://github.com/preactjs/preact/pull/4334 if ( localName === 'template' ) { props.content = [ ...( elementNode as HTMLTemplateElement ).content.childNodes,