Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solid-primitives/storage

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solid-primitives/storage - npm Package Compare versions

Comparing version 3.7.0 to 3.7.1

5

dist/index/index.d.ts

@@ -103,3 +103,3 @@ import { S as StringStorageProps, a as StorageWithOptions, b as StorageObject, c as StorageSetter, d as StorageActions, A as AnyStorageProps, e as AsyncStorage, f as AsyncStorageWithOptions, g as AsyncStorageObject, h as AsyncStorageSetter, i as AsyncStorageActions, j as StorageSignalProps, k as StorageProps } from '../types-C92rHTXK.js';

};
type CookieProperties = {
type CookiePropertyTypes = {
domain?: string;

@@ -113,2 +113,5 @@ expires?: Date | number | String;

};
type CookieProperties = {
[key in keyof CookiePropertyTypes]: CookiePropertyTypes[key];
};
/**

@@ -115,0 +118,0 @@ * handle cookies exactly like you would handle localStorage

33

dist/index/index.js

@@ -444,11 +444,25 @@ import { createHydratableSignal } from '@solid-primitives/utils';

// src/cookies.ts
var cookiePropertyMap = {
domain: "Domain",
expires: "Expires",
path: "Path",
secure: "Secure",
httpOnly: "HttpOnly",
maxAge: "Max-Age",
sameSite: "SameSite"
};
function serializeCookieOptions(options) {
if (!options)
return "";
return Object.entries(options).map(([key, value]) => {
if (key === "maxAge") {
key = "max-age";
}
return value instanceof Date ? `; ${key}=${value.toUTCString()}` : typeof value === "boolean" ? `; ${key}` : `; ${key}=${value}`;
}).join("");
const result = Object.entries(options).map(([key, value]) => {
const serializedKey = cookiePropertyMap[key];
if (!serializedKey)
return void 0;
if (value instanceof Date)
return `${serializedKey}=${value.toUTCString()}`;
if (typeof value === "boolean")
return value ? `${serializedKey}` : void 0;
return `${serializedKey}=${value}`;
}).filter((v) => !!v);
return result.length != 0 ? `; ${result.join("; ")}` : "";
}

@@ -477,10 +491,7 @@ function deserializeCookieOptions(cookie, key) {

const responseHeaders = getResponseHeaders();
const currentCookies = responseHeaders?.get("Set-Cookie")?.split(", ")?.filter((cookie) => cookie && !cookie.startsWith(`${key}=`)) ?? [];
responseHeaders.set(
"Set-Cookie",
(responseHeaders.get("Set-Cookie") || "").replace(
new RegExp(`(?:^|, )${key}=[^,]+`, "g"),
""
)
[...currentCookies, `${key}=${value}${serializeCookieOptions(options)}`].join(", ")
);
responseHeaders.append("Set-Cookie", `${key}=${value}${serializeCookieOptions(options)}`);
} : (key, value, options) => {

@@ -487,0 +498,0 @@ document.cookie = `${key}=${value}${serializeCookieOptions(options)}`;

{
"name": "@solid-primitives/storage",
"version": "3.7.0",
"version": "3.7.1",
"description": "Primitive that provides reactive wrappers for storage access",

@@ -5,0 +5,0 @@ "author": "Alex Lohr <alex.lohr@logmein.com>",

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