Socket
Socket
Sign inDemoInstall

@shopify/react-network

Package Overview
Dependencies
Maintainers
24
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-network - npm Package Compare versions

Comparing version 0.0.0-snapshot-20240308174203 to 0.0.0-snapshot-20240620045713

3

build/cjs/components/RequireSriFor.js

@@ -13,11 +13,8 @@ 'use strict';

const value = [];
if (scripts) {
value.push(network.SriAsset.Script);
}
if (styles) {
value.push(network.SriAsset.Style);
}
hooks.useCspDirective(network.CspDirective.RequireSriFor, value);

@@ -24,0 +21,0 @@ return null;

@@ -26,3 +26,2 @@ 'use strict';

const details = React.useContext(context.NetworkUniversalContext);
if (manager) {

@@ -29,0 +28,0 @@ // Server-side: get it directly from network context

@@ -29,3 +29,2 @@ 'use strict';

}
reset() {

@@ -38,11 +37,8 @@ this.statusCodes = [];

}
getHeader(header) {
return this.requestHeaders[header.toLowerCase()];
}
setHeader(header, value) {
this.headers.set(header, value);
}
redirectTo(url, status = network.StatusCode.Found) {

@@ -52,7 +48,5 @@ this.addStatusCode(status);

}
addStatusCode(statusCode) {
this.statusCodes.push(statusCode);
}
addCspDirective(directive, value) {

@@ -65,7 +59,5 @@ const normalizedValue = typeof value === 'string' ? [value] : value;

}
extract() {
const csp = this.csp.size === 0 ? undefined : [...this.csp].map(([key, value]) => {
let printedValue;
if (typeof value === 'boolean') {

@@ -78,11 +70,8 @@ printedValue = '';

}
return `${key}${printedValue ? ' ' : ''}${printedValue}`;
}).join('; ');
const headers = new Map(this.headers);
if (csp) {
headers.set(network.Header.ContentSecurityPolicy, csp);
}
return {

@@ -95,5 +84,3 @@ status: this.statusCodes.length > 0 ? this.statusCodes.reduce((large, code) => Math.max(large, code), 0) : undefined,

}
}
function normalizeHeaders(headers) {

@@ -103,3 +90,2 @@ if (!headers) {

}
return Object.entries(headers).reduce((accumulator, [key, value]) => {

@@ -106,0 +92,0 @@ accumulator[key.toLowerCase()] = value;

@@ -23,3 +23,2 @@ 'use strict';

}
const result = {

@@ -26,0 +25,0 @@ headers: {}

16

build/cjs/server.js

@@ -15,15 +15,11 @@ 'use strict';

} = manager.extract();
if (redirectUrl) {
ctx.redirect(redirectUrl);
}
if (status) {
ctx.status = status;
}
for (const [header, value] of headers) {
ctx.set(header, value);
}
Object.entries(cookies).forEach(([cookie, options]) => {

@@ -33,13 +29,13 @@ const {

...cookieOptions
} = options; // only set cookies that have been changed
} = options;
// only set cookies that have been changed
// decode URI as the manager's cookie value is also decoded
const rawCookieValue = ctx.cookies.get(cookie);
if (rawCookieValue != null && decodeURIComponent(rawCookieValue) === value) {
return;
} // missing 'none` in `sameSite`
}
// missing 'none` in `sameSite`
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/cookies/index.d.ts#L91
ctx.cookies.set(cookie, value, cookieOptions);

@@ -46,0 +42,0 @@ });

@@ -19,3 +19,2 @@ 'use strict';

}
getCookie(name) {

@@ -25,14 +24,11 @@ const cookie = this.cookies.get(name);

}
getCookies() {
const cookies = {};
for (const [key, value] of this.cookies) {
cookies[key] = value;
}
return { ...cookies
return {
...cookies
};
}
setCookie(name, value) {

@@ -44,3 +40,2 @@ const fullCookie = typeof value === 'string' ? {

}
removeCookie(name) {

@@ -52,9 +47,7 @@ this.cookies.set(name, {

}
clear() {
this.cookies.clear();
}
}
exports.ServerCookieManager = ServerCookieManager;
{
"name": "@shopify/react-network",
"version": "0.0.0-snapshot-20240308174203",
"version": "0.0.0-snapshot-20240620045713",
"license": "MIT",

@@ -31,9 +31,9 @@ "description": "A collection of components that allow you to set common HTTP headers from within your React application",

"engines": {
"node": "^14.17.0 || >=16.0.0"
"node": ">=18.12.0"
},
"dependencies": {
"@shopify/network": "^3.2.1",
"@shopify/react-effect": "^5.0.3",
"@shopify/react-hooks": "0.0.0-snapshot-20240308174203",
"@shopify/react-universal-provider": "0.0.0-snapshot-20240308174203",
"@shopify/network": "^3.3.0",
"@shopify/react-effect": "0.0.0-snapshot-20240620045713",
"@shopify/react-hooks": "0.0.0-snapshot-20240620045713",
"@shopify/react-universal-provider": "0.0.0-snapshot-20240620045713",
"@types/accept-language-parser": "1.5.0",

@@ -46,7 +46,7 @@ "@types/cookie": "^0.3.3",

"devDependencies": {
"@shopify/jest-koa-mocks": "^5.1.1"
"@shopify/jest-koa-mocks": "0.0.0-snapshot-20240620045713"
},
"peerDependencies": {
"koa": "^2.5.0",
"react": ">=16.8.0 <19.0.0"
"react": ">=18.0.0 <19.0.0"
},

@@ -53,0 +53,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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