Skip to content

Commit 98d01d0

Browse files
authored
chore: update dependencies (oct 2025) (#2577)
* chore: update dependencies (oct 2025) * chore: fix JS for linters * fix: remove node-fetch polyfill (no longer needed) * Revert "fix: remove node-fetch polyfill (no longer needed)" This reverts commit ddab6ee. * fix: remove node-fetch polyfill (no longer needed for Node v18+) * chore: remove ajv override (no longer needed?) * chore: remove ignoreFiles from .stylelintrc.js (moved to newspack-scripts) * chore: bump newspack packages
1 parent 15fc1a1 commit 98d01d0

18 files changed

Lines changed: 21282 additions & 16487 deletions

.eslintrc.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require( '@rushstack/eslint-patch/modern-module-resolution' );
2-
31
module.exports = {
4-
extends: [ './node_modules/newspack-scripts/config/eslintrc.js' ],
2+
extends: [ './node_modules/newspack-scripts/.eslintrc.js' ],
53
};

.stylelintrc.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
module.exports = {
2-
ignoreFiles: [
3-
'**/dist/**',
4-
'**/node_modules/**',
5-
'**/release/**',
6-
'**/scripts/**',
7-
],
82
extends: [ './node_modules/newspack-scripts/config/stylelint.config.js' ],
93
};

newspack-theme/js/src/amp-fallback.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,7 @@
190190
if (
191191
body.classList.contains( 'h-stk' ) &&
192192
body.classList.contains( 'h-sub' ) &&
193-
( body.classList.contains( 'single-featured-image-behind' ) ||
194-
body.classList.contains( 'single-featured-image-beside' ) )
193+
( body.classList.contains( 'single-featured-image-behind' ) || body.classList.contains( 'single-featured-image-beside' ) )
195194
) {
196195
let scrollTimer,
197196
lastScrollFireTime = 0;

newspack-theme/js/src/customize-controls.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,7 @@
5656
const visibility = function () {
5757
if ( 'custom' === setting.get() ) {
5858
// Make sure the site is set to use a solid header background.
59-
if (
60-
true === wp.customize.value( 'header_solid_background' )() &&
61-
'custom' === wp.customize.value( 'header_color' )()
62-
) {
59+
if ( true === wp.customize.value( 'header_solid_background' )() && 'custom' === wp.customize.value( 'header_color' )() ) {
6360
control.container.slideDown( 180 );
6461
}
6562
} else {
@@ -136,10 +133,7 @@
136133
wp.customize.control( 'header_color_hex', function ( control ) {
137134
const visibility = function () {
138135
if ( true === setting.get() ) {
139-
if (
140-
'custom' === wp.customize.value( 'header_color' )() &&
141-
'custom' === wp.customize.value( 'theme_colors' )()
142-
) {
136+
if ( 'custom' === wp.customize.value( 'header_color' )() && 'custom' === wp.customize.value( 'theme_colors' )() ) {
143137
control.container.slideDown( 180 );
144138
}
145139
} else {
@@ -195,10 +189,7 @@
195189
wp.customize.control( 'header_color_hex', function ( control ) {
196190
const visibility = function () {
197191
if ( 'custom' === setting.get() ) {
198-
if (
199-
true === wp.customize.value( 'header_solid_background' )() &&
200-
'custom' === wp.customize.value( 'theme_colors' )()
201-
) {
192+
if ( true === wp.customize.value( 'header_solid_background' )() && 'custom' === wp.customize.value( 'theme_colors' )() ) {
202193
control.container.slideDown( 180 );
203194
}
204195
} else {

newspack-theme/js/src/extend-featured-image-editor.js

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,84 +13,76 @@ class RadioCustom extends Component {
1313

1414
return (
1515
<RadioControl
16-
label={__('Featured Image Position')}
17-
selected={meta.newspack_featured_image_position}
18-
options={[
16+
label={ __( 'Featured Image Position' ) }
17+
selected={ meta.newspack_featured_image_position }
18+
options={ [
1919
{
20-
label: __(
21-
'Default (set in Customizer)',
22-
'newspack-theme'
23-
),
20+
label: __( 'Default (set in Customizer)', 'newspack-theme' ),
2421
value: '',
2522
},
26-
{ label: __('Large', 'newspack-theme'), value: 'large' },
27-
{ label: __('Small', 'newspack-theme'), value: 'small' },
23+
{ label: __( 'Large', 'newspack-theme' ), value: 'large' },
24+
{ label: __( 'Small', 'newspack-theme' ), value: 'small' },
2825
{
29-
label: __('Behind article title', 'newspack-theme'),
26+
label: __( 'Behind article title', 'newspack-theme' ),
3027
value: 'behind',
3128
},
3229
{
33-
label: __('Beside article title', 'newspack-theme'),
30+
label: __( 'Beside article title', 'newspack-theme' ),
3431
value: 'beside',
3532
},
3633
{
37-
label: __('Above article title', 'newspack-theme'),
34+
label: __( 'Above article title', 'newspack-theme' ),
3835
value: 'above',
3936
},
40-
{ label: __('Hidden', 'newspack-theme'), value: 'hidden' },
41-
]}
42-
onChange={value => {
43-
this.setState({ value });
44-
updateFeaturedImagePosition(value, meta);
45-
}}
37+
{ label: __( 'Hidden', 'newspack-theme' ), value: 'hidden' },
38+
] }
39+
onChange={ value => {
40+
this.setState( { value } );
41+
updateFeaturedImagePosition( value, meta );
42+
} }
4643
/>
4744
);
4845
}
4946
}
5047

51-
const ComposedRadio = compose([
52-
withSelect(_select => {
53-
const { getCurrentPostAttribute, getEditedPostAttribute } =
54-
_select('core/editor');
48+
const ComposedRadio = compose( [
49+
withSelect( _select => {
50+
const { getCurrentPostAttribute, getEditedPostAttribute } = _select( 'core/editor' );
5551
return {
5652
meta: {
57-
...getCurrentPostAttribute('meta'),
58-
...getEditedPostAttribute('meta'),
53+
...getCurrentPostAttribute( 'meta' ),
54+
...getEditedPostAttribute( 'meta' ),
5955
},
6056
};
61-
}),
62-
withDispatch(dispatch => ({
63-
updateFeaturedImagePosition(value, meta) {
57+
} ),
58+
withDispatch( dispatch => ( {
59+
updateFeaturedImagePosition( value, meta ) {
6460
meta = {
6561
...meta,
6662
newspack_featured_image_position: value,
6763
};
68-
dispatch('core/editor').editPost({ meta });
64+
dispatch( 'core/editor' ).editPost( { meta } );
6965
},
70-
})),
71-
])(RadioCustom);
66+
} ) ),
67+
] )( RadioCustom );
7268

7369
const wrapPostFeaturedImage = OriginalComponent => {
7470
// eslint-disable-next-line react/display-name
7571
return props => {
76-
const post_type = select('core/editor').getCurrentPostType();
72+
const post_type = select( 'core/editor' ).getCurrentPostType();
7773

7874
// eslint-disable-next-line no-undef
79-
if (!newspack_theme_featured_image_post_types.includes(post_type)) {
80-
return <OriginalComponent {...props} />;
75+
if ( ! newspack_theme_featured_image_post_types.includes( post_type ) ) {
76+
return <OriginalComponent { ...props } />;
8177
}
8278

8379
return (
8480
<Fragment>
85-
<OriginalComponent {...props} />
81+
<OriginalComponent { ...props } />
8682
<ComposedRadio />
8783
</Fragment>
8884
);
8985
};
9086
};
9187

92-
addFilter(
93-
'editor.PostFeaturedImage',
94-
'enhance-featured-image/featured-image-position-control',
95-
wrapPostFeaturedImage
96-
);
88+
addFilter( 'editor.PostFeaturedImage', 'enhance-featured-image/featured-image-position-control', wrapPostFeaturedImage );
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
const fontsToLoad = window.newspackFontLoading?.fonts || [];
2-
Promise.all(
3-
fontsToLoad.map(fontName => document.fonts.load(`1rem ${fontName}`))
4-
).then(res => {
5-
if (res.length === fontsToLoad.length) {
6-
document.body.classList.remove('newspack--font-loading');
2+
Promise.all( fontsToLoad.map( fontName => document.fonts.load( `1rem ${ fontName }` ) ) ).then( res => {
3+
if ( res.length === fontsToLoad.length ) {
4+
document.body.classList.remove( 'newspack--font-loading' );
75
}
8-
});
6+
} );

newspack-theme/js/src/post-meta-toggles.js

Lines changed: 35 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -11,101 +11,63 @@ import { __ } from '@wordpress/i18n';
1111
/**
1212
* Hide updated date
1313
*/
14-
const PostStatusExtensions = ({ meta, postType, updateMetaValue }) => {
15-
if (!meta) {
14+
const PostStatusExtensions = ( { meta, postType, updateMetaValue } ) => {
15+
if ( ! meta ) {
1616
return null;
1717
}
18-
const {
19-
newspack_hide_page_title,
20-
newspack_hide_updated_date,
21-
newspack_show_updated_date,
22-
newspack_show_share_buttons,
23-
} = meta;
24-
const {
25-
hide_date = [],
26-
show_date = [],
27-
hide_title = [],
28-
show_share_buttons = [],
29-
} = window.newspack_post_meta_post_types;
30-
const hideDate = 0 <= hide_date.indexOf(postType);
31-
const showDate = 0 <= show_date.indexOf(postType);
32-
const hideTitle = 0 <= hide_title.indexOf(postType);
33-
const showShareButtons = 0 <= show_share_buttons.indexOf(postType);
18+
const { newspack_hide_page_title, newspack_hide_updated_date, newspack_show_updated_date, newspack_show_share_buttons } = meta;
19+
const { hide_date = [], show_date = [], hide_title = [], show_share_buttons = [] } = window.newspack_post_meta_post_types;
20+
const hideDate = 0 <= hide_date.indexOf( postType );
21+
const showDate = 0 <= show_date.indexOf( postType );
22+
const hideTitle = 0 <= hide_title.indexOf( postType );
23+
const showShareButtons = 0 <= show_share_buttons.indexOf( postType );
3424

35-
if (!hideDate && !showDate && !hideTitle && !showShareButtons) {
25+
if ( ! hideDate && ! showDate && ! hideTitle && ! showShareButtons ) {
3626
return null;
3727
}
3828

3929
return (
4030
<PluginPostStatusInfo className="newspack__post-meta-toggles">
41-
{hideDate && (
31+
{ hideDate && (
4232
<div>
43-
<label htmlFor="hide_updated_date">
44-
{__('Hide last updated date', 'newspack-theme')}
45-
</label>
33+
<label htmlFor="hide_updated_date">{ __( 'Hide last updated date', 'newspack-theme' ) }</label>
4634
<FormToggle
47-
checked={newspack_hide_updated_date}
48-
onChange={() =>
49-
updateMetaValue(
50-
'newspack_hide_updated_date',
51-
!newspack_hide_updated_date
52-
)
53-
}
35+
checked={ newspack_hide_updated_date }
36+
onChange={ () => updateMetaValue( 'newspack_hide_updated_date', ! newspack_hide_updated_date ) }
5437
id="hide_updated_date"
5538
/>
5639
</div>
57-
)}
58-
{showDate && (
40+
) }
41+
{ showDate && (
5942
<div>
60-
<label htmlFor="show_updated_date">
61-
{__('Show last updated date', 'newspack-theme')}
62-
</label>
43+
<label htmlFor="show_updated_date">{ __( 'Show last updated date', 'newspack-theme' ) }</label>
6344
<FormToggle
64-
checked={newspack_show_updated_date}
65-
onChange={() =>
66-
updateMetaValue(
67-
'newspack_show_updated_date',
68-
!newspack_show_updated_date
69-
)
70-
}
45+
checked={ newspack_show_updated_date }
46+
onChange={ () => updateMetaValue( 'newspack_show_updated_date', ! newspack_show_updated_date ) }
7147
id="show_updated_date"
7248
/>
7349
</div>
74-
)}
75-
{hideTitle && 'page' === postType && (
50+
) }
51+
{ hideTitle && 'page' === postType && (
7652
<div>
77-
<label htmlFor="hide_page_title">
78-
{__('Hide page title', 'newspack-theme')}
79-
</label>
53+
<label htmlFor="hide_page_title">{ __( 'Hide page title', 'newspack-theme' ) }</label>
8054
<FormToggle
81-
checked={newspack_hide_page_title}
82-
onChange={() =>
83-
updateMetaValue(
84-
'newspack_hide_page_title',
85-
!newspack_hide_page_title
86-
)
87-
}
55+
checked={ newspack_hide_page_title }
56+
onChange={ () => updateMetaValue( 'newspack_hide_page_title', ! newspack_hide_page_title ) }
8857
id="hide_page_title"
8958
/>
9059
</div>
91-
)}
92-
{showShareButtons && 'page' === postType && (
60+
) }
61+
{ showShareButtons && 'page' === postType && (
9362
<div>
94-
<label htmlFor="newspack_show_share_buttons">
95-
{__('Show Jetpack share buttons', 'newspack-theme')}
96-
</label>
63+
<label htmlFor="newspack_show_share_buttons">{ __( 'Show Jetpack share buttons', 'newspack-theme' ) }</label>
9764
<FormToggle
98-
checked={newspack_show_share_buttons}
99-
onChange={() =>
100-
updateMetaValue(
101-
'newspack_show_share_buttons',
102-
!newspack_show_share_buttons
103-
)
104-
}
65+
checked={ newspack_show_share_buttons }
66+
onChange={ () => updateMetaValue( 'newspack_show_share_buttons', ! newspack_show_share_buttons ) }
10567
id="hide_page_title"
10668
/>
10769
</div>
108-
)}
70+
) }
10971
</PluginPostStatusInfo>
11072
);
11173
};
@@ -114,27 +76,23 @@ const PostStatusExtensions = ({ meta, postType, updateMetaValue }) => {
11476
* Map state to props
11577
*/
11678
const mapStateToProps = select => {
117-
const { getCurrentPostType, getEditedPostAttribute } =
118-
select('core/editor');
79+
const { getCurrentPostType, getEditedPostAttribute } = select( 'core/editor' );
11980
return {
120-
meta: getEditedPostAttribute('meta'),
81+
meta: getEditedPostAttribute( 'meta' ),
12182
postType: getCurrentPostType(),
12283
};
12384
};
12485

12586
const mapDispatchToProps = dispatch => {
126-
const { editPost } = dispatch('core/editor');
87+
const { editPost } = dispatch( 'core/editor' );
12788
return {
128-
updateMetaValue: (key, value) => editPost({ meta: { [key]: value } }),
89+
updateMetaValue: ( key, value ) => editPost( { meta: { [ key ]: value } } ),
12990
};
13091
};
13192

13293
/**
13394
* Register plugins
13495
*/
135-
const postStatusSidebar = compose([
136-
withSelect(mapStateToProps),
137-
withDispatch(mapDispatchToProps),
138-
])(PostStatusExtensions);
96+
const postStatusSidebar = compose( [ withSelect( mapStateToProps ), withDispatch( mapDispatchToProps ) ] )( PostStatusExtensions );
13997

140-
registerPlugin('post-status-sidebar', { render: postStatusSidebar });
98+
registerPlugin( 'post-status-sidebar', { render: postStatusSidebar } );

newspack-theme/js/src/post-subtitle/SubtitleEditor.js

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,7 @@ const SubtitleEditor = ( { subtitle, saveSubtitle } ) => {
3131
saveSubtitle( value );
3232
}, [ value ] );
3333

34-
return (
35-
<TextareaControl
36-
value={ value }
37-
onChange={ setValue }
38-
style={ { marginTop: '10px', width: '100%' } }
39-
/>
40-
);
34+
return <TextareaControl value={ value } onChange={ setValue } style={ { marginTop: '10px', width: '100%' } } />;
4135
};
4236

4337
export default decorate( SubtitleEditor );

0 commit comments

Comments
 (0)