{"_id":"create-cookie","_rev":"3-0a0593df0b05cadc0336236f5f9c25eb","name":"create-cookie","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"create-cookie","version":"1.0.0","author":{"url":"https://jp.coffee","name":"JP.Coffee"},"license":"MIT","_id":"create-cookie@1.0.0","maintainers":[{"name":"jp.coffee","email":"me@jp.coffee"}],"homepage":"https://github.com/jp-coffee/create-cookie#readme","bugs":{"url":"https://github.com/jp-coffee/create-cookie/issues"},"dist":{"shasum":"e32ea1734a32214cfdfce84038e34aa498e8cc11","tarball":"https://registry.npmjs.org/create-cookie/-/create-cookie-1.0.0.tgz","fileCount":9,"integrity":"sha512-aMefK6nsk1ioSyun+yxCcNUGTad9fMJEqrdEHgdfTfb3WttAUDhNZeMHQU5OmVwrM7AuumpnshvnuNb6hJ03EQ==","signatures":[{"sig":"MEUCIDKKX8RPDyNRFVw1Om61fnayAt5rHgGb/0la+bmUHDN1AiEA8n0AQ40si3CtsyKxrivSCDEgtac69byXobwVQJoQVJ8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15801},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"ed9f80ae42c1fa08669763c0c3d5774f251aec77","scripts":{"lint":"eslint .","test":"vitest run","build":"npm run prebuild && tsc","clean":"rimraf dist","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run clean","test:watch":"vitest --watch"},"_npmUser":{"name":"jp.coffee","email":"me@jp.coffee"},"repository":{"url":"git+https://github.com/jp-coffee/create-cookie.git","type":"git"},"_npmVersion":"10.9.2","description":"Smarter Cookie Management, Seamless Sync ","directories":{},"displayName":"Create React Cookie","_nodeVersion":"22.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.3","jsdom":"^26.0.0","eslint":"^9.23.0","rimraf":"^6.0.1","vitest":"^3.0.9","typescript":"^5.8.2","@types/react":"^19.0.12","eslint-plugin-react":"^7.37.4","@vitejs/plugin-react":"^4.3.4","eslint-plugin-import":"^2.31.0","@testing-library/react":"^16.2.0","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/parser":"^8.28.0","eslint-plugin-react-hooks":"^5.2.0","@typescript-eslint/eslint-plugin":"^8.28.0"},"peerDependencies":{"react":"^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/create-cookie_1.0.0_1743535183822_0.035086533765734895","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"create-cookie","version":"1.0.1","author":{"url":"https://jp.coffee","name":"JP.Coffee"},"license":"MIT","_id":"create-cookie@1.0.1","maintainers":[{"name":"jp.coffee","email":"me@jp.coffee"}],"homepage":"https://github.com/jp-coffee/create-cookie#readme","bugs":{"url":"https://github.com/jp-coffee/create-cookie/issues"},"dist":{"shasum":"22f9cc18d64ff6831a860fa16864a1191c534b08","tarball":"https://registry.npmjs.org/create-cookie/-/create-cookie-1.0.1.tgz","fileCount":6,"integrity":"sha512-JqsHI4ECcS5Q3o13Yajv2i+LEGnrbqKdAtQxEx4eHUVcLCREnGw2uCe5Z0Dzj6/DmWQ5Q+f7D4UvJtuK2JsgcQ==","signatures":[{"sig":"MEYCIQDscwRgEJxdINFSGwgEo/FL/rUjtAc79z9ryW4BM7oDnwIhAPghQ8ejeMqmhGIcGO0UZLI624sHqP/sxS8Nxj7tI19o","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12331},"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"gitHead":"b19126ca2d7463391ed36bcfc832a1fedd710774","scripts":{"lint":"eslint .","test":"vitest run","build":"npm run prebuild && tsc","clean":"rimraf dist","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run clean","test:watch":"vitest --watch"},"_npmUser":{"name":"jp.coffee","email":"me@jp.coffee"},"repository":{"url":"git+https://github.com/jp-coffee/create-cookie.git","type":"git"},"_npmVersion":"10.9.2","description":"Smarter Cookie Management, Seamless Sync ","directories":{},"displayName":"Create React Cookie","_nodeVersion":"22.14.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^6.2.3","jsdom":"^26.0.0","eslint":"^9.23.0","rimraf":"^6.0.1","vitest":"^3.0.9","typescript":"^5.8.2","@types/react":"^19.0.12","eslint-plugin-react":"^7.37.4","@vitejs/plugin-react":"^4.3.4","eslint-plugin-import":"^2.31.0","@testing-library/react":"^16.2.0","@testing-library/jest-dom":"^6.6.3","@typescript-eslint/parser":"^8.28.0","eslint-plugin-react-hooks":"^5.2.0","@typescript-eslint/eslint-plugin":"^8.28.0"},"peerDependencies":{"react":"^19.0.0"},"_npmOperationalInternal":{"tmp":"tmp/create-cookie_1.0.1_1743535501610_0.2872932553666352","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"create-cookie","displayName":"Create React Cookie","version":"1.1.1","description":"Smarter Cookie Management, Seamless Sync ","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"license":"MIT","author":{"name":"JP.Coffee","url":"https://jp.coffee"},"repository":{"type":"git","url":"git+https://github.com/jp-coffee/create-cookie.git"},"bugs":{"url":"https://github.com/jp-coffee/create-cookie/issues"},"homepage":"https://github.com/jp-coffee/create-cookie#readme","keywords":["react","cookies","cookie-management","hooks","state-management","browser-storage","web-storage","react-hooks"],"exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"}},"scripts":{"build":"npm run prebuild && tsc","clean":"rimraf dist","lint":"eslint .","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run clean","test":"vitest run","test:watch":"vitest --watch","typecheck":"tsc --noEmit","verify-provenance":"./scripts/verify-provenance.sh"},"devDependencies":{"@testing-library/jest-dom":"^6.6.3","@testing-library/react":"^16.2.0","@types/react":"^19.0.12","@typescript-eslint/eslint-plugin":"^8.28.0","@typescript-eslint/parser":"^8.28.0","@vitejs/plugin-react":"^4.3.4","eslint":"^9.23.0","eslint-plugin-import":"^2.31.0","eslint-plugin-react":"^7.37.4","eslint-plugin-react-hooks":"^5.2.0","jsdom":"^26.0.0","rimraf":"^6.0.1","typescript":"^5.8.2","vite":"^6.2.3","vitest":"^3.0.9"},"peerDependencies":{"react":"^19.0.0"},"_id":"create-cookie@1.1.1","gitHead":"87262ee99a7a36b9cd9ecbf6252b8128535f7540","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-ckjCnaM51e8VtDIgQsbeNVMXnBBlhaZwSt1upA6vV28RnRBBg6mFwalCdTFSZiA4UD+onswNH7N7JRwDcLJCtw==","shasum":"838659a4ed08730dc215a23848145098b0a5c95b","tarball":"https://registry.npmjs.org/create-cookie/-/create-cookie-1.1.1.tgz","fileCount":6,"unpackedSize":13592,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/create-cookie@1.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDV8bBKT+7kf7epEmyfnlSARjEubBBfcTQLc3vaPMAYsAiEA5CVKvIHN5/dCDahXdHAt7+sfj+JMKvxY++DR63XcKHw="}]},"_npmUser":{"name":"jp.coffee","email":"me@jp.coffee"},"directories":{},"maintainers":[{"name":"jp.coffee","email":"me@jp.coffee"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/create-cookie_1.1.1_1754512259221_0.37360514266368794"},"_hasShrinkwrap":false}},"time":{"created":"2025-04-01T19:19:43.755Z","modified":"2025-08-06T20:30:59.863Z","1.0.0":"2025-04-01T19:19:44.016Z","1.0.1":"2025-04-01T19:25:01.815Z","1.1.1":"2025-08-06T20:30:59.472Z"},"bugs":{"url":"https://github.com/jp-coffee/create-cookie/issues"},"author":{"name":"JP.Coffee","url":"https://jp.coffee"},"license":"MIT","homepage":"https://github.com/jp-coffee/create-cookie#readme","repository":{"type":"git","url":"git+https://github.com/jp-coffee/create-cookie.git"},"description":"Smarter Cookie Management, Seamless Sync ","maintainers":[{"name":"jp.coffee","email":"me@jp.coffee"}],"readme":"![create-cookie Banner](https://raw.githubusercontent.com/jp-coffee/create-cookie/main/media/create-cookie-banner.png)\n\n**Effortless Cookie Management for React**\nEasily get, set, and sync cookies across components with a simple API.\n\n[![npm version](https://img.shields.io/npm/v/create-cookie.svg)](https://www.npmjs.com/package/create-cookie)\n[![npm downloads](https://img.shields.io/npm/dt/create-cookie.svg)](https://www.npmjs.com/package/create-cookie)\n[![License](https://img.shields.io/github/license/jp-coffee/create-cookie)](LICENSE)\n[![Tests Status](https://img.shields.io/github/actions/workflow/status/jp-coffee/create-cookie/lint-and-test.yml?branch=main)](https://github.com/jp-coffee/create-cookie/actions)\n\n## 🚀 Features\n\n- 🍪 **Simplified Cookie Handling** – Manage cookies without manually dealing with `document.cookie`.\n- 🔄 **Real-time Updates** – React to cookie changes instantly.\n- ⚡ **Lightweight & Dependency-Free** – Minimal impact on your bundle size.\n- 🛠 **Easy API** – Get, set, reset, and check cookies effortlessly.\n- 📡 **Automatic Expiry Handling** – Set expiration dates and paths with ease.\n\n## 📦 Installation\n\nInstall via your preferred package manager:\n\n```sh\n# npm\nnpm install create-cookie\n\n# yarn\nyarn add create-cookie\n\n# pnpm\npnpm add create-cookie\n\n# bun\nbun add create-cookie\n```\n\n## 🔍 Basic Usage\n\n```tsx\n\"use client\";\n\nimport { createCookie } from \"create-cookie\";\n\nconst Page: React.FC = () => {\n  const theme = createCookie(\"theme\", \"light\");\n\n  return (\n    <div>\n      <h1>Theme: {theme.get()}</h1>\n      <button onClick={() => theme.set(\"dark\")}>Set Dark Theme</button>\n      <button onClick={() => theme.reset()}>Reset Theme</button>\n    </div>\n  );\n};\n\nexport default Page;\n```\n\n## 🔍 API Reference\n\n### `createCookie<T>(key: string, initialValue?: T, options?: CookieOptions)`\n\nA React hook for reading and updating cookies easily.\n\n#### Parameters\n\n- `key` (string): The key under which the value is stored in cookies.\n- `initialValue` (T, optional): The initial value to set if the key does not exist.\n- `options` (CookieOptions, optional): Additional settings like `expires` and `path`.\n\n#### Returns\n\n- An object with the following methods:\n  - `get()`: Retrieve the current cookie value.\n  - `set(value: T, options?: CookieOptions)`: Update the cookie value.\n  - `reset()`: Clear the cookie.\n  - `hasValue()`: Check if the cookie exists.\n\n## 💡 Examples\n\n### Storing User Preferences\n\n```tsx\n\"use client\";\n\nimport { createCookie } from \"create-cookie\";\n\nconst Page: React.FC = () => {\n  const language = createCookie(\"language\", \"en\");\n\n  return (\n    <div>\n      <h1>Language: {language.get()}</h1>\n      <button onClick={() => language.set(\"fr\")}>Set to French</button>\n    </div>\n  );\n};\n\nexport default Page;\n```\n\n### Using Expiry Dates\n\n```tsx\n\"use client\";\n\nimport { createCookie } from \"create-cookie\";\n\nconst Page: React.FC = () => {\n  const sessionToken = createCookie(\"session\", \"\", { expires: 7 });\n\n  return (\n    <div>\n      <h1>Session Token: {sessionToken.get()}</h1>\n      <button onClick={() => sessionToken.set(\"abc123\", { expires: 7 })}>\n        Set Token (Expires in 7 days)\n      </button>\n    </div>\n  );\n};\n\nexport default Page;\n```\n\n## 🔒 Security & Provenance\n\nThis package is published with NPM package provenance, which provides supply chain security by cryptographically linking the published package to its source code and build process.\n\n### Verifying Package Provenance\n\nYou can verify that this package was built from the source code in this repository:\n\n```bash\n# Install the package\nnpm install create-cookie\n\n# Verify the provenance\nnpm audit signatures\n\n# Or use the provided verification script\nnpm run verify-provenance\n```\n\n### What This Provides\n\n- **Supply Chain Security**: Prevents malicious package injection\n- **Trust**: Verify package authenticity and origin\n- **Transparency**: Links packages to source code and build process\n- **Compliance**: Meets security requirements for many organizations\n\nFor more information about NPM package provenance, see the [official documentation](https://docs.npmjs.com/generating-provenance-statements).\n\n## 🛠 Contributing\n\nContributions are welcome! To contribute:\n\n1. Fork the repository.\n2. Create a feature branch.\n3. Commit your changes.\n4. Open a Pull Request.\n\n## 📜 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n## 👨‍💻 Created By\n\nThis package is developed and maintained by [JP.Coffee](https://github.com/jp-coffee). Feel free to reach out or open an issue for any questions or suggestions!\n","readmeFilename":"README.md","keywords":["react","cookies","cookie-management","hooks","state-management","browser-storage","web-storage","react-hooks"]}