New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wordpress/router

Package Overview
Dependencies
Maintainers
24
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wordpress/router - npm Package Compare versions

Comparing version 0.26.0 to 0.27.0

22

build-module/history.js

@@ -13,4 +13,22 @@ /**

const originalHistoryReplace = history.replace;
// Preserve the `wp_theme_preview` query parameter when navigating
// around the Site Editor.
// TODO: move this hack out of the router into Site Editor code.
function preserveThemePreview(params) {
if (params.hasOwnProperty('wp_theme_preview')) {
return params;
}
const currentSearch = new URLSearchParams(history.location.search);
const currentThemePreview = currentSearch.get('wp_theme_preview');
if (currentThemePreview === null) {
return params;
}
return {
...params,
wp_theme_preview: currentThemePreview
};
}
function push(params, state) {
const search = buildQueryString(params);
const search = buildQueryString(preserveThemePreview(params));
return originalHistoryPush.call(history, {

@@ -21,3 +39,3 @@ search

function replace(params, state) {
const search = buildQueryString(params);
const search = buildQueryString(preserveThemePreview(params));
return originalHistoryReplace.call(history, {

@@ -24,0 +42,0 @@ search

@@ -20,4 +20,22 @@ "use strict";

const originalHistoryReplace = history.replace;
// Preserve the `wp_theme_preview` query parameter when navigating
// around the Site Editor.
// TODO: move this hack out of the router into Site Editor code.
function preserveThemePreview(params) {
if (params.hasOwnProperty('wp_theme_preview')) {
return params;
}
const currentSearch = new URLSearchParams(history.location.search);
const currentThemePreview = currentSearch.get('wp_theme_preview');
if (currentThemePreview === null) {
return params;
}
return {
...params,
wp_theme_preview: currentThemePreview
};
}
function push(params, state) {
const search = (0, _url.buildQueryString)(params);
const search = (0, _url.buildQueryString)(preserveThemePreview(params));
return originalHistoryPush.call(history, {

@@ -28,3 +46,3 @@ search

function replace(params, state) {
const search = (0, _url.buildQueryString)(params);
const search = (0, _url.buildQueryString)(preserveThemePreview(params));
return originalHistoryReplace.call(history, {

@@ -31,0 +49,0 @@ search

@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->

## 0.27.0 (2024-05-16)
## 0.26.0 (2024-05-02)

@@ -7,0 +9,0 @@

10

package.json
{
"name": "@wordpress/router",
"version": "0.26.0",
"version": "0.27.0",
"description": "Router API for WordPress pages.",

@@ -29,5 +29,5 @@ "author": "The WordPress Contributors",

"@babel/runtime": "^7.16.0",
"@wordpress/element": "^5.34.0",
"@wordpress/private-apis": "^0.39.0",
"@wordpress/url": "^3.58.0",
"@wordpress/element": "^5.35.0",
"@wordpress/private-apis": "^0.40.0",
"@wordpress/url": "^3.59.0",
"history": "^5.3.0"

@@ -41,3 +41,3 @@ },

},
"gitHead": "581d8a5580dba8f600b7268d51eb554771ae482c"
"gitHead": "42f38f287506a6b3ed8ccba839b18ad066821044"
}

@@ -16,4 +16,19 @@ /**

// Preserve the `wp_theme_preview` query parameter when navigating
// around the Site Editor.
// TODO: move this hack out of the router into Site Editor code.
function preserveThemePreview( params ) {
if ( params.hasOwnProperty( 'wp_theme_preview' ) ) {
return params;
}
const currentSearch = new URLSearchParams( history.location.search );
const currentThemePreview = currentSearch.get( 'wp_theme_preview' );
if ( currentThemePreview === null ) {
return params;
}
return { ...params, wp_theme_preview: currentThemePreview };
}
function push( params, state ) {
const search = buildQueryString( params );
const search = buildQueryString( preserveThemePreview( params ) );
return originalHistoryPush.call( history, { search }, state );

@@ -23,3 +38,3 @@ }

function replace( params, state ) {
const search = buildQueryString( params );
const search = buildQueryString( preserveThemePreview( params ) );
return originalHistoryReplace.call( history, { search }, state );

@@ -26,0 +41,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc