initial
This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.1.18] - 2026-06-26
|
||||
### Changed
|
||||
- Update package dependencies. [#49271]
|
||||
|
||||
## [0.1.17] - 2026-06-25
|
||||
### Changed
|
||||
- Pin `@wordpress/private-apis` to an exact version instead of the floating `next` tag. [#49838]
|
||||
|
||||
## [0.1.16] - 2026-06-23
|
||||
### Fixed
|
||||
- Private APIs: Keep the private APIs polyfill active through WordPress 7.0 and older Gutenberg versions. [#49793]
|
||||
- Private APIs: Track the @next private-apis release so the bundled allowlist covers newer dashboard packages such as @wordpress/widget-dashboard. [#49793]
|
||||
|
||||
## [0.1.15] - 2026-06-22
|
||||
### Changed
|
||||
- Update package dependencies. [#49631] [#49691] [#49757]
|
||||
|
||||
## [0.1.14] - 2026-06-15
|
||||
### Changed
|
||||
- Internal updates.
|
||||
|
||||
## [0.1.13] - 2026-06-09
|
||||
### Changed
|
||||
- Update package dependencies. [#49273]
|
||||
|
||||
## [0.1.12] - 2026-06-08
|
||||
### Changed
|
||||
- Update dependencies. [#49354]
|
||||
|
||||
## [0.1.11] - 2026-06-01
|
||||
### Changed
|
||||
- Update package dependencies. [#48404] [#49152]
|
||||
|
||||
## [0.1.10] - 2026-05-25
|
||||
### Changed
|
||||
- Update package dependencies. [#48405]
|
||||
|
||||
## [0.1.9] - 2026-05-19
|
||||
### Fixed
|
||||
- Fix notices loading on older WordPress versions by bundling a compatibility helper for newer `@wordpress/notices` dependencies. [#48743]
|
||||
|
||||
## [0.1.8] - 2026-05-14
|
||||
### Changed
|
||||
- Update dependencies. [#48778]
|
||||
|
||||
## [0.1.7] - 2026-05-11
|
||||
### Changed
|
||||
- Build: Update @wordpress/admin-ui to 2.0.0. [#48410]
|
||||
|
||||
## [0.1.6] - 2026-05-04
|
||||
### Changed
|
||||
- Internal: No longer require automattic/jetpack-changelogger as a per-project dev dependency. [#48225]
|
||||
|
||||
## [0.1.5] - 2026-04-20
|
||||
### Changed
|
||||
- Update package dependencies. [#48106] [#48141]
|
||||
|
||||
## [0.1.4] - 2026-04-15
|
||||
### Changed
|
||||
- Update package dependencies. [#47907]
|
||||
|
||||
## [0.1.3] - 2026-04-13
|
||||
### Changed
|
||||
- Update package dependencies. [#47890]
|
||||
|
||||
### Fixed
|
||||
- Skip force-replacing polyfill scripts when the Gutenberg plugin is active, preventing crashes from allowlist mismatches (e.g. @wordpress/views). [#47956]
|
||||
|
||||
## [0.1.2] - 2026-04-06
|
||||
### Fixed
|
||||
- Update @wordpress/private-apis to v1.43.0 to include @wordpress/views in the core modules allowlist, fixing a crash with latest Gutenberg trunk. [#47905]
|
||||
|
||||
## [0.1.1] - 2026-03-30
|
||||
### Changed
|
||||
- Update dependencies.
|
||||
|
||||
## 0.1.0 - 2026-03-23
|
||||
### Added
|
||||
- Create wp-build polyfills package. [#47367]
|
||||
|
||||
### Changed
|
||||
- Update @wordpress/boot version [#47644]
|
||||
- Update package dependencies. [#47684]
|
||||
|
||||
### Fixed
|
||||
- Add @wordpress/ui to devDependencies so the boot module bundles it instead of externalizing it as an unregistered wp-ui script handle, which caused a blank page at runtime. [#47727]
|
||||
|
||||
[0.1.18]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.17...v0.1.18
|
||||
[0.1.17]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.16...v0.1.17
|
||||
[0.1.16]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.15...v0.1.16
|
||||
[0.1.15]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.14...v0.1.15
|
||||
[0.1.14]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.13...v0.1.14
|
||||
[0.1.13]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.12...v0.1.13
|
||||
[0.1.12]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.11...v0.1.12
|
||||
[0.1.11]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.10...v0.1.11
|
||||
[0.1.10]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.9...v0.1.10
|
||||
[0.1.9]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.8...v0.1.9
|
||||
[0.1.8]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.7...v0.1.8
|
||||
[0.1.7]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.6...v0.1.7
|
||||
[0.1.6]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.5...v0.1.6
|
||||
[0.1.5]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.4...v0.1.5
|
||||
[0.1.4]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.3...v0.1.4
|
||||
[0.1.3]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.2...v0.1.3
|
||||
[0.1.2]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.1...v0.1.2
|
||||
[0.1.1]: https://github.com/Automattic/jetpack-wp-build-polyfills/compare/v0.1.0...v0.1.1
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '4666106116db64c0');
|
||||
+1
@@ -0,0 +1 @@
|
||||
var e={718(e,t,n){function r(){const e=document.getElementsByClassName("a11y-speak-region"),t=document.getElementById("a11y-speak-intro-text");for(let t=0;t<e.length;t++)e[t].textContent="";t&&t.setAttribute("hidden","hidden")}n.d(t,{A:()=>r})},303(e,t,n){n.d(t,{A:()=>o});var r="";function o(e){return e=e.replace(/<[^<>]+>/g," "),r===e&&(e+=" "),r=e,e}},593(e,t,n){n.d(t,{L:()=>a});var r=n(718),o=n(303);function a(e,t){(0,r.A)(),e=(0,o.A)(e);const n=document.getElementById("a11y-speak-intro-text"),a=document.getElementById("a11y-speak-assertive"),s=document.getElementById("a11y-speak-polite");a&&"assertive"===t?a.textContent=e:s&&(s.textContent=e),n&&n.removeAttribute("hidden")}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var a=t[r]={exports:{}};return e[r](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var r={};n.d(r,{L:()=>o.L,m:()=>a});var o=n(593),a=()=>{};const s=r.m,d=r.L;export{s as setup,d as speak};
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-primitives', 'wp-private-apis', 'wp-theme', 'wp-url'), 'module_dependencies' => array(array('id' => '@wordpress/a11y', 'import' => 'static'), array('id' => '@wordpress/lazy-editor', 'import' => 'dynamic'), array('id' => '@wordpress/route', 'import' => 'static')), 'version' => '188faf6c64fdd1b4');
|
||||
+5
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-private-apis'), 'version' => '41dc781fd8708207');
|
||||
+2
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @license React
|
||||
* use-sync-external-store-shim/with-selector.production.js
|
||||
*
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-polyfill'), 'version' => 'c6269b78b51d25fe37c1');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={479(e,t,n){n.d(t,{b:()=>i});const i=e=>t=>(n={},i)=>{const r=i[e];if(void 0===r)return n;const s=t(n[r],i);return s===n[r]?n:{...n,[r]:s}}},790(e){e.exports=window.ReactJSXRuntime},427(e){e.exports=window.wp.components},143(e){e.exports=window.wp.data},22(e,t,n){function i(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=i(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}n.d(t,{A:()=>r});const r=function(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=i(e))&&(r&&(r+=" "),r+=t);return r}},809(e,t,n){n.d(t,{A:()=>a});var i=n(22),r=n(427),s=n(143),o=n(642),c=n(790);function a({children:e,className:t,pinnedNoticesClassName:n,dismissibleNoticesClassName:a,context:l}){const u=(0,s.useSelect)(e=>e(o.M).getNotices(l),[l]),{removeNotice:d}=(0,s.useDispatch)(o.M),p=u.filter(({isDismissible:e,type:t})=>e&&"default"===t),f=u.filter(({isDismissible:e,type:t})=>!e&&"default"===t),m=f.length>0,N=p.length>0||function(e){return null!=e&&!1!==e&&""!==e}(e);return m||N?(0,c.jsxs)("div",{className:(0,i.A)("notices-inline-notices-wrapper",t),children:[m&&(0,c.jsx)(r.NoticeList,{notices:f,className:(0,i.A)("components-notices__pinned",n)}),N&&(0,c.jsx)(r.NoticeList,{notices:p,className:(0,i.A)("components-notices__dismissible",a),onRemove:e=>d(e,l),children:e})]}):null}},591(e,t,n){n.d(t,{A:()=>a});var i=n(22),r=n(427),s=n(143),o=n(642),c=n(790);function a({className:e,context:t}){const n=(0,s.useSelect)(e=>e(o.M).getNotices(t),[t]),{removeNotice:a}=(0,s.useDispatch)(o.M),l=n.filter(({type:e})=>"snackbar"===e).slice(-3);return(0,c.jsx)(r.SnackbarList,{notices:l,className:(0,i.A)("components-notices__snackbar",e),onRemove:e=>a(e,t)})}},455(e,t,n){n.r(t),n.d(t,{createErrorNotice:()=>a,createInfoNotice:()=>c,createNotice:()=>s,createSuccessNotice:()=>o,createWarningNotice:()=>l,removeAllNotices:()=>d,removeNotice:()=>u,removeNotices:()=>p});var i=n(425),r=0;function s(e=i.B,t,n={}){const{speak:s=!0,isDismissible:o=!0,context:c=i.A,id:a=`${c}${++r}`,actions:l=[],type:u="default",__unstableHTML:d,icon:p=null,explicitDismiss:f=!1,onDismiss:m}=n;return{type:"CREATE_NOTICE",context:c,notice:{id:a,status:e,content:t=String(t),spokenMessage:s?t:null,__unstableHTML:d,isDismissible:o,actions:l,type:u,icon:p,explicitDismiss:f,onDismiss:m}}}function o(e,t){return s("success",e,t)}function c(e,t){return s("info",e,t)}function a(e,t){return s("error",e,t)}function l(e,t){return s("warning",e,t)}function u(e,t=i.A){return{type:"REMOVE_NOTICE",id:e,context:t}}function d(e="default",t=i.A){return{type:"REMOVE_ALL_NOTICES",noticeType:e,context:t}}function p(e,t=i.A){return{type:"REMOVE_NOTICES",ids:e,context:t}}},425(e,t,n){n.d(t,{A:()=>i,B:()=>r});var i="global",r="info"},642(e,t,n){n.d(t,{M:()=>c});var i=n(143),r=n(241),s=n(455),o=n(472),c=(0,i.createReduxStore)("core/notices",{reducer:r.A,actions:s,selectors:o});(0,i.register)(c)},472(e,t,n){n.r(t),n.d(t,{getNotices:()=>s});var i=n(425),r=[];function s(e,t=i.A){return e[t]||r}},241(e,t,n){n.d(t,{A:()=>i});var i=(0,n(479).b)("context")((e=[],t)=>{switch(t.type){case"CREATE_NOTICE":return[...e.filter(({id:e})=>e!==t.notice.id),t.notice];case"REMOVE_NOTICE":return e.filter(({id:e})=>e!==t.id);case"REMOVE_NOTICES":return e.filter(({id:e})=>!t.ids.includes(e));case"REMOVE_ALL_NOTICES":return e.filter(({type:e})=>e!==t.noticeType);default:return e}})}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var s=t[i]={exports:{}};return e[i](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};n.r(i),n.d(i,{InlineNotices:()=>s.A,SnackbarNotices:()=>o.A,store:()=>r.M});var r=n(642),s=n(809),o=n(591);(window.wp=window.wp||{}).notices=i})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '6ab605a6919c6e0efe05');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={816(e,r,o){o.d(r,{yf:()=>t});var s=["@wordpress/admin-ui","@wordpress/api-fetch","@wordpress/block-directory","@wordpress/block-editor","@wordpress/block-library","@wordpress/blocks","@wordpress/boot","@wordpress/commands","@wordpress/compose","@wordpress/connectors","@wordpress/workflows","@wordpress/components","@wordpress/content-types","@wordpress/core-commands","@wordpress/core-data","@wordpress/customize-widgets","@wordpress/data","@wordpress/edit-post","@wordpress/edit-site","@wordpress/edit-widgets","@wordpress/editor","@wordpress/font-list-route","@wordpress/format-library","@wordpress/patterns","@wordpress/preferences","@wordpress/reusable-blocks","@wordpress/rich-text","@wordpress/route","@wordpress/router","@wordpress/routes","@wordpress/storybook","@wordpress/sync","@wordpress/theme","@wordpress/dataviews","@wordpress/fields","@wordpress/lazy-editor","@wordpress/media-editor","@wordpress/media-utils","@wordpress/upload-media","@wordpress/global-styles-ui","@wordpress/ui","@wordpress/views","@wordpress/widget-dashboard"],t=(e,r)=>{if(!s.includes(r))throw new Error(`You tried to opt-in to unstable APIs as module "${r}". This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will be removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on one of the next WordPress releases.`);if("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress."!==e)throw new Error("You tried to opt-in to unstable APIs without confirming you know the consequences. This feature is only for JavaScript modules shipped with WordPress core. Please do not use it in plugins and themes as the unstable APIs will removed without a warning. If you ignore this error and depend on unstable features, your product will inevitably break on the next WordPress release.");return{lock:n,unlock:d}};function n(e,r){if(!e)throw new Error("Cannot lock an undefined object.");const o=e;a in o||(o[a]={}),i.set(o[a],r)}function d(e){if(!e)throw new Error("Cannot unlock an undefined object.");const r=e;if(!(a in r))throw new Error("Cannot unlock an object that was not locked before. ");return i.get(r[a])}var i=new WeakMap,a=Symbol("Private API ID")}},r={};function o(s){var t=r[s];if(void 0!==t)return t.exports;var n=r[s]={exports:{}};return e[s](n,n.exports,o),n.exports}o.d=(e,r)=>{for(var s in r)o.o(r,s)&&!o.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:r[s]})},o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var s={};o.r(s),o.d(s,{__dangerousOptInToUnstableAPIsOnlyForCoreModules:()=>t.yf});var t=o(816);(window.wp=window.wp||{}).privateApis=s})();
|
||||
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-element', 'wp-polyfill', 'wp-private-apis'), 'version' => '251c2ea199773891b13a');
|
||||
+1
File diff suppressed because one or more lines are too long
+1
@@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('wp-core-data', 'wp-data', 'wp-element', 'wp-polyfill', 'wp-preferences', 'wp-private-apis'), 'version' => 'd9f51d10cd25f8392774');
|
||||
+1
@@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e={582(e){e.exports=window.wp.coreData},143(e){e.exports=window.wp.data},87(e){e.exports=window.wp.element},233(e){e.exports=window.wp.preferences},53(e){e.exports=window.wp.privateApis},686(e,t,r){r.d(t,{j:()=>n});var o=Object.prototype.hasOwnProperty;function i(e,t,r){for(r of e.keys())if(n(r,t))return r}function n(e,t){var r,s,a;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((s=e.length)===t.length)for(;s--&&n(e[s],t[s]););return-1===s}if(r===Set){if(e.size!==t.size)return!1;for(s of e){if((a=s)&&"object"==typeof a&&!(a=i(t,a)))return!1;if(!t.has(a))return!1}return!0}if(r===Map){if(e.size!==t.size)return!1;for(s of e){if((a=s[0])&&"object"==typeof a&&!(a=i(t,a)))return!1;if(!n(s[1],t.get(a)))return!1}return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((s=e.byteLength)===t.byteLength)for(;s--&&e.getInt8(s)===t.getInt8(s););return-1===s}if(ArrayBuffer.isView(e)){if((s=e.byteLength)===t.byteLength)for(;s--&&e[s]===t[s];);return-1===s}if(!r||"object"==typeof e){for(r in s=0,e){if(o.call(e,r)&&++s&&!o.call(t,r))return!1;if(!(r in t)||!n(e[r],t[r]))return!1}return Object.keys(t).length===s}}return e!=e&&t!=t}},263(e,t,r){r.d(t,{P:()=>i,z:()=>n});var o=["titleField","mediaField","descriptionField","showTitle","showMedia","showDescription","showLevels","infiniteScrollEnabled"];function i(e,t,r){if(!t)return e;let i=e;for(const e of o)e in t&&(i={...i,[e]:t[e]});if(t.filters&&t.filters.length>0){const r=new Set(t.filters.map(e=>e.field)),o=(e.filters??[]).filter(e=>!r.has(e.field));i={...i,filters:[...o,...t.filters]}}if(t.sort){r&&e.sort?.field===r.sort?.field&&e.sort?.direction===r.sort?.direction&&(i={...i,sort:t.sort})}return t.layout&&(i={...i,layout:{...i.layout,...t.layout}}),t.groupBy&&(i={...i,groupBy:t.groupBy}),i}function n(e,t,r){if(!t)return e;let i=e;for(const e of o)if(e in t){const{[e]:t,...r}=i;i=r}if(t.filters&&t.filters.length>0){const r=new Set(t.filters.map(e=>e.field));i={...i,filters:(e.filters??[]).filter(e=>!r.has(e.field))}}if(t.sort&&e.sort?.field===t.sort.field&&e.sort?.direction===t.sort.direction&&(i={...i,sort:r?.sort}),t.layout&&"layout"in i&&i.layout){const e={...i.layout};for(const r of Object.keys(t.layout))delete e[r];i={...i,layout:Object.keys(e).length>0?e:void 0}}if(t.groupBy&&"groupBy"in i){const{groupBy:e,...t}=i;i=t}return i}},513(e,t,r){r.d(t,{Q:()=>a});var o=r(143),i=r(233),n=r(431),s=r(263);async function a(e){const{kind:t,name:r,slug:a,defaultView:f,activeViewOverrides:u,queryParams:l}=e,c=(0,n.A)(t,r,a),d=(0,o.select)(i.store).get("core/views",c)??f,p=l?.page??1,w=l?.search??"",y=e.defaultLayouts?.[d?.type],g={...y&&!0!==y?y:{},...u};return(0,s.P)({...d,page:p,search:w},g,f)}},553(e,t,r){r.d(t,{T:()=>n});var o=r(53),{lock:i,unlock:n}=(0,o.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/views")},431(e,t,r){function o(e,t,r){return`dataviews-${e}-${t}-${r}`}r.d(t,{A:()=>o})},351(e,t,r){r.d(t,{n:()=>s});var o=r(143),i=r(582),n=r(553);function s({kind:e,name:t}){return(0,o.useSelect)(r=>(0,n.T)(r(i.store)).getViewConfig(e,t),[e,t])}},196(e,t,r){r.d(t,{l:()=>u});var o=r(686),i=r(87),n=r(143),s=r(233),a=r(431),f=r(263);function u(e){const{kind:t,name:r,slug:u,defaultView:l,activeViewOverrides:c,queryParams:d,onChangeQueryParams:p}=e,w=(0,a.A)(t,r,u),y=(0,n.useSelect)(e=>e(s.store).get("core/views",w),[w]),{set:g}=(0,n.useDispatch)(s.store),v=(0,i.useMemo)(()=>y??l??{},[y,l]),h=Number(d?.page??v.page??1),b=d?.search??v.search??"",m=(0,i.useMemo)(()=>{const t=e.defaultLayouts?.[v.type];return{...t&&!0!==t?t:{},...c}},[e.defaultLayouts,v.type,c]);return{view:(0,i.useMemo)(()=>(0,f.P)({...v,page:h,search:b},m,l),[v,h,b,m,l]),isModified:!!y,updateView:(0,i.useCallback)(e=>{const t={page:e?.page,search:e?.search},r=(0,f.z)(function(e,t){const r={...e};for(const e of t)delete r[e];return r}(e,["page","search"]),m,l);p&&!(0,o.j)(t,{page:h,search:b})&&p(t);const i=(0,f.z)(v,m,l),n=(0,f.z)(l,m,l);(0,o.j)(i,r)||((0,o.j)(r,n)?g("core/views",w,void 0):g("core/views",w,r))},[p,h,b,v,l,m,g,w]),resetToDefault:(0,i.useCallback)(()=>{g("core/views",w,void 0)},[w,g])}}}},t={};function r(o){var i=t[o];if(void 0!==i)return i.exports;var n=t[o]={exports:{}};return e[o](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};r.r(o),r.d(o,{loadView:()=>n.Q,useView:()=>i.l,useViewConfig:()=>s.n});var i=r(196),n=r(513),s=r(351);(window.wp=window.wp||{}).views=o})();
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
<?php
|
||||
/**
|
||||
* Polyfill registration for Core packages not available or incomplete in older WordPress versions.
|
||||
*
|
||||
* Conditionally registers wp-notices, wp-private-apis, wp-theme (classic scripts) and
|
||||
* `@wordpress/boot`, `@wordpress/route`, `@wordpress/a11y` (script modules)
|
||||
* ONLY when they are not already provided by Core or Gutenberg.
|
||||
*
|
||||
* @package automattic/jetpack-wp-build-polyfills
|
||||
*/
|
||||
|
||||
namespace Automattic\Jetpack\WP_Build_Polyfills;
|
||||
|
||||
/**
|
||||
* Registers polyfill scripts and modules for WordPress Core packages.
|
||||
*/
|
||||
class WP_Build_Polyfills {
|
||||
|
||||
/**
|
||||
* Available polyfill handles for classic scripts.
|
||||
*/
|
||||
const SCRIPT_HANDLES = array( 'wp-notices', 'wp-private-apis', 'wp-theme', 'wp-views' );
|
||||
|
||||
/**
|
||||
* Available polyfill module IDs.
|
||||
*/
|
||||
const MODULE_IDS = array( '@wordpress/boot', '@wordpress/route', '@wordpress/a11y' );
|
||||
|
||||
/**
|
||||
* Minimum Gutenberg plugin version known to ship a private-apis allowlist
|
||||
* that includes the dashboard packages used by this package's current build.
|
||||
*/
|
||||
const GUTENBERG_PRIVATE_APIS_MIN_VERSION = '23.5.0';
|
||||
|
||||
/**
|
||||
* Tracks which polyfills have been requested and by which consumers.
|
||||
*
|
||||
* Keys are polyfill handles/module IDs, values are arrays of consumer names.
|
||||
*
|
||||
* @var array<string, string[]>
|
||||
*/
|
||||
private static $requested = array();
|
||||
|
||||
/**
|
||||
* Whether the wp_default_scripts hook has already been added.
|
||||
*
|
||||
* @var bool
|
||||
*/
|
||||
private static $hooked = false;
|
||||
|
||||
/**
|
||||
* The WordPress version below which force-replacements are applied.
|
||||
* When multiple consumers call register() with different thresholds,
|
||||
* the highest threshold wins (most conservative approach).
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $wp_version_threshold = '7.0';
|
||||
|
||||
/**
|
||||
* Register polyfill scripts and modules.
|
||||
*
|
||||
* Call this early (e.g. during plugin load) — it hooks into wp_default_scripts
|
||||
* at priority 20 so Core (default) and Gutenberg (priority 10) register first.
|
||||
*
|
||||
* When multiple consumers call this method with different thresholds, the
|
||||
* highest threshold wins (most conservative — polyfills active on more versions).
|
||||
*
|
||||
* @param string $consumer A unique identifier for the consumer (e.g. plugin slug).
|
||||
* @param string[] $polyfills List of polyfill handles/module IDs to register.
|
||||
* Use class constants SCRIPT_HANDLES and MODULE_IDS for reference.
|
||||
* @param string $wp_version_threshold The WordPress version below which force-replacements
|
||||
* are applied. Defaults to '7.0'.
|
||||
*/
|
||||
public static function register( $consumer, $polyfills, $wp_version_threshold = '7.0' ) {
|
||||
foreach ( $polyfills as $handle ) {
|
||||
if ( ! in_array( $handle, self::SCRIPT_HANDLES, true ) && ! in_array( $handle, self::MODULE_IDS, true ) ) {
|
||||
continue;
|
||||
}
|
||||
if ( ! isset( self::$requested[ $handle ] ) ) {
|
||||
self::$requested[ $handle ] = array();
|
||||
}
|
||||
if ( ! in_array( $consumer, self::$requested[ $handle ], true ) ) {
|
||||
self::$requested[ $handle ][] = $consumer;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version_compare( $wp_version_threshold, self::$wp_version_threshold, '>' ) ) {
|
||||
self::$wp_version_threshold = $wp_version_threshold;
|
||||
}
|
||||
|
||||
if ( self::$hooked ) {
|
||||
return;
|
||||
}
|
||||
self::$hooked = true;
|
||||
|
||||
$package_root = dirname( __DIR__ );
|
||||
$build_dir = $package_root . '/build';
|
||||
$base_file = $package_root . '/composer.json';
|
||||
|
||||
// `wp_default_scripts` fires once when the WP_Scripts singleton is
|
||||
// instantiated. If something has already initialized `wp_scripts()` —
|
||||
// common on admin requests where WP or other plugins register scripts
|
||||
// before `admin_menu` priority 1 runs — adding this hook here is too
|
||||
// late and the polyfills never register. Detect that case and run the
|
||||
// registration synchronously so consumers can rely on the script
|
||||
// handles and module IDs being available regardless of init order.
|
||||
if ( did_action( 'wp_default_scripts' ) ) {
|
||||
self::register_scripts( wp_scripts(), $build_dir, $base_file, self::$wp_version_threshold );
|
||||
self::register_modules( $build_dir, $base_file );
|
||||
return;
|
||||
}
|
||||
|
||||
add_action(
|
||||
'wp_default_scripts',
|
||||
function ( $scripts ) use ( $build_dir, $base_file ) {
|
||||
self::register_scripts( $scripts, $build_dir, $base_file, self::$wp_version_threshold );
|
||||
self::register_modules( $build_dir, $base_file );
|
||||
},
|
||||
20
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the map of requested polyfills and their consumers.
|
||||
*
|
||||
* @return array<string, string[]> Keys are polyfill handles/module IDs, values are consumer names.
|
||||
*/
|
||||
public static function get_consumers() {
|
||||
return self::$requested;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register polyfill classic scripts.
|
||||
*
|
||||
* @param \WP_Scripts $scripts The WP_Scripts instance.
|
||||
* @param string $build_dir Absolute path to the build directory.
|
||||
* @param string $base_file File path for plugins_url() computation.
|
||||
* @param string $wp_version_threshold WP version below which force-replacements apply.
|
||||
*/
|
||||
private static function register_scripts( $scripts, $build_dir, $base_file, $wp_version_threshold ) {
|
||||
// Force-replace only when Core's bundled scripts are incomplete and
|
||||
// Gutenberg cannot be trusted to provide a compatible implementation.
|
||||
$gutenberg_version = defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : null;
|
||||
|
||||
$polyfills = array(
|
||||
'wp-notices' => array(
|
||||
'path' => 'notices',
|
||||
'force_threshold' => '7.0',
|
||||
// Only force-replace on older WP without Gutenberg: older Core
|
||||
// versions ship notices without SnackbarNotices and InlineNotices
|
||||
// component exports that @wordpress/boot depends on.
|
||||
),
|
||||
'wp-private-apis' => array(
|
||||
'path' => 'private-apis',
|
||||
'force_threshold' => '7.1',
|
||||
'gutenberg_min_version' => self::GUTENBERG_PRIVATE_APIS_MIN_VERSION,
|
||||
// WP 7.0 and older versions ship private-apis with an incomplete
|
||||
// allowlist that rejects @wordpress/theme, @wordpress/route, and
|
||||
// newer dashboard packages. Active Gutenberg is only a safe
|
||||
// substitute once its private-apis allowlist includes those
|
||||
// dashboard packages too.
|
||||
),
|
||||
'wp-theme' => array(
|
||||
'path' => 'theme',
|
||||
),
|
||||
'wp-views' => array(
|
||||
'path' => 'views',
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( $polyfills as $handle => $data ) {
|
||||
if ( ! isset( self::$requested[ $handle ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$asset_file = $build_dir . '/scripts/' . $data['path'] . '/index.asset.php';
|
||||
|
||||
if ( ! file_exists( $asset_file ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$force_threshold = $data['force_threshold'] ?? null;
|
||||
if ( null !== $force_threshold && version_compare( $wp_version_threshold, $force_threshold, '>' ) ) {
|
||||
$force_threshold = $wp_version_threshold;
|
||||
}
|
||||
|
||||
$force = null !== $force_threshold
|
||||
&& ! self::is_gutenberg_version_safe( $data['gutenberg_min_version'] ?? null, $gutenberg_version )
|
||||
&& version_compare( $GLOBALS['wp_version'] ?? '0', $force_threshold, '<' );
|
||||
|
||||
if ( ! $force && $scripts->query( $handle, 'registered' ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Deregister first when forcing replacement of an existing registration.
|
||||
if ( $force && $scripts->query( $handle, 'registered' ) ) {
|
||||
$scripts->remove( $handle );
|
||||
}
|
||||
|
||||
$asset = require $asset_file;
|
||||
|
||||
$scripts->add(
|
||||
$handle,
|
||||
plugins_url( 'build/scripts/' . $data['path'] . '/index.js', $base_file ),
|
||||
$asset['dependencies'],
|
||||
$asset['version']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the active Gutenberg plugin can satisfy a forced script.
|
||||
*
|
||||
* @param string|null $minimum_version Minimum Gutenberg version required for the script, or null when any active Gutenberg is sufficient.
|
||||
* @param string|null $gutenberg_version Active Gutenberg version, or null when Gutenberg is inactive.
|
||||
* @return bool True when Gutenberg is active and new enough.
|
||||
*/
|
||||
private static function is_gutenberg_version_safe( $minimum_version, $gutenberg_version ) {
|
||||
if ( null === $gutenberg_version ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( null === $minimum_version ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return version_compare( $gutenberg_version, $minimum_version, '>=' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Register polyfill script modules.
|
||||
*
|
||||
* Call to wp_register_script_module() silently ignores duplicate registrations (first wins),
|
||||
* so no explicit is_registered check is needed.
|
||||
*
|
||||
* @param string $build_dir Absolute path to the build directory.
|
||||
* @param string $base_file File path for plugins_url() computation.
|
||||
*/
|
||||
private static function register_modules( $build_dir, $base_file ) {
|
||||
if ( ! function_exists( 'wp_register_script_module' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$modules = array( 'boot', 'route', 'a11y' );
|
||||
|
||||
foreach ( $modules as $name ) {
|
||||
$module_id = '@wordpress/' . $name;
|
||||
|
||||
if ( ! isset( self::$requested[ $module_id ] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$asset_file = $build_dir . '/modules/' . $name . '/index.asset.php';
|
||||
|
||||
if ( ! file_exists( $asset_file ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$asset = require $asset_file;
|
||||
|
||||
wp_register_script_module(
|
||||
$module_id,
|
||||
plugins_url( 'build/modules/' . $name . '/index.js', $base_file ),
|
||||
$asset['module_dependencies'] ?? array(),
|
||||
$asset['version']
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Local `keyedReducer` higher-order reducer.
|
||||
*
|
||||
* `@wordpress/notices` >= 5.45.0 imports `keyedReducer` from `@wordpress/data`,
|
||||
* which only added this export in `@wordpress/data` 10.45.0 (Gutenberg
|
||||
* consolidated copies previously maintained inside notices and core-data;
|
||||
* see WordPress/gutenberg#77364). The polyfill externalizes `@wordpress/data`
|
||||
* to the runtime `window.wp.data` global so notices state stays in the shared
|
||||
* registry. On sites that still ship an older `@wordpress/data` (current
|
||||
* WordPress Core), `window.wp.data.keyedReducer` is `undefined` and the
|
||||
* polyfill bundle throws at load time.
|
||||
*
|
||||
* To keep `@wordpress/data` externalized for every other symbol (so the store
|
||||
* registers in the shared registry) while staying robust to the missing
|
||||
* helper, we ship a local copy and alias only the file that needs it.
|
||||
* Implementation kept byte-identical to upstream.
|
||||
*
|
||||
* @see https://github.com/WordPress/gutenberg/pull/77364
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns a higher-order reducer that maintains a sub-state keyed by
|
||||
* `action[ actionProperty ]`. The wrapped reducer runs against the slice of
|
||||
* state belonging to that key.
|
||||
*
|
||||
* @param {string} actionProperty - Action key whose value selects the sub-state.
|
||||
* @return {Function} Higher-order reducer factory.
|
||||
*/
|
||||
export const keyedReducer =
|
||||
actionProperty =>
|
||||
reducer =>
|
||||
( state = {}, action ) => {
|
||||
const key = action[ actionProperty ];
|
||||
if ( key === undefined ) {
|
||||
return state;
|
||||
}
|
||||
const nextKeyState = reducer( state[ key ], action );
|
||||
if ( nextKeyState === state[ key ] ) {
|
||||
return state;
|
||||
}
|
||||
return {
|
||||
...state,
|
||||
[ key ]: nextKeyState,
|
||||
};
|
||||
};
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* Webpack loader that rewrites the `keyedReducer` named import of
|
||||
* `@wordpress/data` to a local copy bundled with the polyfill.
|
||||
*
|
||||
* `@wordpress/notices` >= 5.45.0 imports `keyedReducer` from `@wordpress/data`
|
||||
* (consolidated upstream in `@wordpress/data` 10.45.0; see
|
||||
* WordPress/gutenberg#77364). The polyfill externalizes `@wordpress/data` to
|
||||
* the runtime `window.wp.data` global so the notices store registers in the
|
||||
* shared registry. On sites that still ship an older `@wordpress/data`
|
||||
* (current WordPress Core), `window.wp.data.keyedReducer` is `undefined` and
|
||||
* the bundle throws at load time.
|
||||
*
|
||||
* This loader leaves every other `@wordpress/data` named import untouched so
|
||||
* those continue to be resolved against the runtime global. The DEP plugin's
|
||||
* `externals` callback runs before module resolution, which means a
|
||||
* `Rule.resolve.alias` mapping for `@wordpress/data` is bypassed for the
|
||||
* externalized request. Rewriting the import in source — before webpack sees
|
||||
* the request — is the only path that survives the externals pipeline.
|
||||
*/
|
||||
|
||||
/* global __dirname */
|
||||
|
||||
const path = require( 'path' );
|
||||
|
||||
const LOCAL_PATH = path.resolve( __dirname, 'src/internal/keyed-reducer.js' );
|
||||
|
||||
/**
|
||||
* Rewrites `import { keyedReducer } from '@wordpress/data'` (alone or
|
||||
* combined with other named imports) so `keyedReducer` resolves to the local
|
||||
* shim while every other name continues to resolve to `@wordpress/data`.
|
||||
*
|
||||
* Bails out without changes when the import does not include `keyedReducer`
|
||||
* or when the import shape isn't a simple named-imports list (we don't try to
|
||||
* be clever about renames or namespace imports — there are none in the
|
||||
* affected upstream files, and a loud miss is preferable to a quiet rewrite).
|
||||
*
|
||||
* @param {string} source - Source code of the matched module.
|
||||
* @return {string} Rewritten source.
|
||||
*/
|
||||
module.exports = function wpDataKeyedReducerLoader( source ) {
|
||||
const importRegex = /import\s*\{\s*([^}]+?)\s*\}\s*from\s*(['"])@wordpress\/data\2\s*;?/g;
|
||||
const localImport = `import { keyedReducer } from ${ JSON.stringify( LOCAL_PATH ) };`;
|
||||
|
||||
return source.replace( importRegex, ( match, namedList, quote ) => {
|
||||
const names = namedList
|
||||
.split( ',' )
|
||||
.map( n => n.trim() )
|
||||
.filter( Boolean );
|
||||
if ( ! names.includes( 'keyedReducer' ) ) {
|
||||
return match;
|
||||
}
|
||||
const remaining = names.filter( n => n !== 'keyedReducer' );
|
||||
if ( remaining.length === 0 ) {
|
||||
return localImport;
|
||||
}
|
||||
const remainingImport = `import { ${ remaining.join(
|
||||
', '
|
||||
) } } from ${ quote }@wordpress/data${ quote };`;
|
||||
return `${ remainingImport } ${ localImport }`;
|
||||
} );
|
||||
};
|
||||
Reference in New Issue
Block a user