UNPKG

state-in-url

Version:

Store state in URL as in object, types and structure are preserved, with TS validation. Same API as React.useState, wthout any hasssle or boilerplate. Next.js@14-15, react-router@6-7, and remix@2.

578 lines (577 loc) 16 kB
{ "name": "state-in-url", "version": "6.1.1", "description": "Store state in URL as in object, types and structure are preserved, with TS validation. Same API as React.useState, wthout any hasssle or boilerplate. Next.js@14-15, react-router@6-7, and remix@2.", "homepage": "https://state-in-url.dev", "repository": { "type": "git", "url": "git+https://github.com/asmyshlyaev177/state-in-url.git" }, "author": { "name": "asmyshlyaev177", "email": "asmyshlyaev177@gmail.com", "url": "https://www.linkedin.com/in/asmyshlyaev177/" }, "publishConfig": { "registry": "https://registry.npmjs.org/", "tag": "latest", "provenance": true }, "license": "MIT", "funding": { "type": "patreon", "url": "https://patreon.com/asmyshlyaev177" }, "bugs": { "url": "https://github.com/asmyshlyaev177/state-in-url/issues" }, "files": [ "dist" ], "main": "./dist/index.js", "module": "dist/index.mjs", "exports": { ".": { "require": "./dist/index.js", "types": "./dist/index.d.ts", "default": "./dist/index.mjs" }, "./next": { "require": "./dist/next/index.js", "types": "./dist/next/index.d.ts", "default": "./dist/next/index.mjs" }, "./react-router6": { "require": "./dist/react-router6/index.js", "types": "./dist/react-router6/index.d.ts", "default": "./dist/react-router6/index.mjs" }, "./react-router": { "require": "./dist/react-router/index.js", "types": "./dist/react-router/index.d.ts", "default": "./dist/react-router/index.mjs" }, "./remix": { "require": "./dist/remix/index.js", "types": "./dist/remix/index.d.ts", "default": "./dist/remix/index.mjs" }, "./encodeState": { "require": "./dist/encodeState/index.js", "types": "./dist/encodeState/index.d.ts", "default": "./dist/encodeState/index.mjs" }, "./encoder": { "require": "./dist/encoder/index.js", "types": "./dist/encoder/index.d.ts", "default": "./dist/encoder/index.mjs" }, "./useSharedState": { "require": "./dist/useSharedState/index.js", "types": "./dist/useSharedState/index.d.ts", "default": "./dist/useSharedState/index.mjs" }, "./useUrlEncode": { "require": "./dist/useUrlEncode/index.js", "types": "./dist/useUrlEncode/index.d.ts", "default": "./dist/useUrlEncode/index.mjs" }, "./useUrlStateBase": { "require": "./dist/useUrlStateBase/index.js", "types": "./dist/useUrlStateBase/index.d.ts", "default": "./dist/useUrlStateBase/index.mjs" }, "./utils": { "require": "./dist/utils.js", "types": "./dist/utils.d.ts", "default": "./dist/utils.mjs" } }, "types": "./dist/index.d.ts", "scripts": { "test:unit": "wireit", "test:int": "wireit", "test:int:ci": "wireit", "test:exports": "pnpm run build && npx babel-node --extensions .js,.mjs,.ts,.mts --config-file ./babel.config.json -- ./packages/urlstate/exportsTest.ts", "install:all": "pnpm install", "install:ci": "pnpm install --frozen-lockfile", "test": "wireit", "tsc": "wireit", "dev": "wireit", "dev:lib": "wireit", "dev:nextjs14": "wireit", "dev:nextjs15": "wireit", "dev:nextjs16": "wireit", "dev:remix2": "wireit", "bump": "npx standard-version --no-verify", "build": "wireit", "build:demo": "wireit", "start:demo": "wireit", "build:packages": "wireit", "start:demo15": "wireit", "start:demo15:ci": "wireit", "start:react": "wireit", "start": "wireit", "start:ci": "wireit", "kill-next": "wireit", "kill-vite": "wireit", "kill": "wireit", "rmdist": "rm -rf dist", "cleanup": "rm -rf dist .wireit node_modules test-results playwright-report coverage-reports nyc_coverage packages/example-nextjs14/node_modules packages/example-nextjs14/.next packages/example-nextjs15/node_modules packages/example-nextjs15/.next packages/example-nextjs16/node_modules packages/example-nextjs16/.next packages/example-react/node_modules packages/example-react-router6/node_modules packages/example-react-router7/node_modules packages/example-remix2/node_modules", "reinstall": "pnpm run cleanup && pnpm install", "setup": "playwright install --with-deps", "prepack": "pnpm run build && cp package.json dist/package.json && pnpm run build:demo", "pin-gh-deps": "pin-github-action -i .github/workflows/tests.yml", "prepare": "pnpm exec husky" }, "wireit": { "dev": { "dependencies": [ "dev:lib", "dev:react", "dev:remix2", "dev:router6", "dev:router7", "dev:nextjs16", "start:demo14" ], "service": { "readyWhen": { "lineMatches": "http://localhost:3000" } }, "command": "pnpm run dev:nextjs15" }, "test": { "dependencies": [ "tsc", "test:unit", "build:packages" ], "command": "pnpm run test:exports && pnpm run test:int" }, "kill-next": { "command": "ps aux | grep .next | grep -v grep | awk '{print $2}' | xargs kill -9 2>&1; exit 0" }, "kill-vite": { "command": "ps aux | grep '.bin/vite' | grep -v grep | awk '{print $2}' | xargs kill -9 2>&1; exit 0" }, "kill-wireit": { "command": "ps axu | grep wireit | awk '{print $2}' | xargs kill -9" }, "kill": { "command": "killed", "dependencies": [ "kill-next", "kill-vite", "kill-wireit" ] }, "test:int:ci": { "command": "npx cross-env HOME=/root PLAYWRIGHT_BROWSERS_PATH=0 playwright test" }, "test:int": { "command": "playwright test --project=chromium --retries=2" }, "tsc": { "command": "npx tsc --noEmit" }, "test:unit": { "dependencies": [ "tsc" ], "command": "npx vitest" }, "dev:lib": { "command": "cross-env IS_DEVELOPMENT=true rollup -c rollup.config.mjs -w", "service": { "readyWhen": { "lineMatches": "created " } }, "dependencies": [ "rmdist" ] }, "dev:router6": { "command": "cd packages/example-react-router6 && pnpm run dev", "service": true }, "dev:router7": { "command": "cd packages/example-react-router7 && pnpm run dev", "service": true }, "dev:remix2": { "command": "cd packages/example-remix2 && PORT=3003 pnpm run dev", "service": true }, "dev:nextjs14": { "command": "cd packages/example-nextjs14 && pnpm run dev --turbo", "service": true }, "dev:nextjs15": { "command": "cd packages/example-nextjs15 && pnpm run dev --turbo", "service": true }, "dev:nextjs16": { "command": "cd packages/example-nextjs16 && pnpm run dev --turbo", "service": true }, "build:next14": { "command": "cd packages/example-nextjs14 && pnpm run build", "dependencies": [ "build" ] }, "build:next15": { "command": "cd packages/example-nextjs15 && pnpm run build", "dependencies": [ "build" ] }, "build:next16": { "command": "cd packages/example-nextjs16 && pnpm run build", "dependencies": [ "build" ] }, "build:router6": { "command": "cd packages/example-react-router6 && pnpm run build", "dependencies": [ "build" ] }, "build:router7": { "command": "cd packages/example-react-router7 && pnpm run build", "dependencies": [ "build" ] }, "build:remix2": { "command": "cd packages/example-remix2 && pnpm run build", "dependencies": [ "build" ] }, "build:demo": { "dependencies": [ "build" ], "command": "cd packages/example-nextjs15 && pnpm run build" }, "build:demo:tests": { "dependencies": [ "build" ], "command": "cd packages/example-nextjs15 && npx cross-env TEST=true pnpm run build" }, "start:demo": { "dependencies": [ "build:demo" ], "command": "cd packages/example-nextjs15 && pnpm run start", "service": true }, "start:demo:ci": { "command": "cd packages/example-nextjs15 && pnpm run start", "service": true }, "start:react": { "command": "npx vite preview --port 5180 packages/example-react", "dependencies": [ "build:react" ], "service": true }, "start:react:ci": { "command": "npx vite preview --port 5180 packages/example-react", "service": true }, "start:router6": { "command": "npx vite preview --port 5181 packages/example-react-router6", "dependencies": [ "build:router6" ], "service": true }, "start:router6:ci": { "command": "npx vite preview --port 5181 packages/example-react-router6", "service": true }, "start:router7": { "command": "npx vite preview --port 5183 packages/example-react-router7", "dependencies": [ "build:router7" ], "service": true }, "start:router7:ci": { "command": "npx vite preview --port 5183 packages/example-react-router7", "service": true }, "start:remix2": { "command": "cd packages/example-remix2 && pnpm run start", "dependencies": [ "build:remix2" ], "service": true }, "start:remix2:ci": { "command": "cd packages/example-remix2 && pnpm run start", "service": true }, "start:demo14": { "dependencies": [ "build:next14" ], "command": "cd packages/example-nextjs14 && pnpm run start", "service": true }, "start:demo15": { "dependencies": [ "build:next15" ], "command": "cd packages/example-nextjs15 && pnpm run start", "service": true }, "start:demo14:ci": { "command": "cd packages/example-nextjs14 && pnpm run start", "service": true }, "start:demo15:ci": { "command": "cd packages/example-nextjs15 && pnpm run start", "service": true }, "start:demo16": { "dependencies": [ "build:next16" ], "command": "cd packages/example-nextjs16 && pnpm run start", "service": true }, "start:demo16:ci": { "command": "cd packages/example-nextjs16 && pnpm run start", "service": true }, "start": { "command": "pnpm run start:demo15", "dependencies": [ "start:demo14", "start:demo16", "start:react", "start:router6", "start:router7", "start:remix2" ], "service": true }, "start:ci": { "command": "pnpm run start:demo15:ci", "dependencies": [ "start:demo14:ci", "start:demo16:ci", "start:react:ci", "start:router6:ci", "start:router7:ci", "start:remix2:ci" ], "service": true }, "dev:react": { "command": "cd packages/example-react && pnpm run dev", "service": true }, "build:packages": { "dependencies": [ "build", "build:react", "build:demo:tests", "build:next14", "build:next16", "build:router6", "build:router7", "build:remix2" ] }, "build:react": { "command": "cd packages/example-react && pnpm run build" }, "build": { "command": "rollup -c rollup.config.mjs", "dependencies": [ "rmdist" ] } }, "browserslist": [ "last 5 Chrome versions", "last 5 ChromeAndroid versions", "last 5 Firefox versions", "last 5 FirefoxAndroid versions", "Firefox ESR", "last 2 Safari major versions", "last 2 iOS major versions" ], "lint-staged": { "*.{js,jsx,ts,tsx}": [ "eslint --fix" ], "*.{html,css,less,ejs,json}": [ "prettier --write" ] }, "config": { "commitizen": { "path": "cz-conventional-changelog" } }, "commitlint": { "extends": [ "@commitlint/config-conventional" ], "rules": { "body-max-line-length": [ 0, "always", "Infinity" ] } }, "devDependencies": { "@babel/core": "^7.28.4", "@babel/node": "^7.28.0", "@babel/preset-env": "^7.28.3", "@babel/preset-typescript": "^7.27.1", "@commitlint/cli": "^19.8.1", "@commitlint/config-conventional": "^19.8.1", "@playwright/test": "^1.55.1", "@rollup/plugin-node-resolve": "^15.3.1", "@rollup/plugin-typescript": "^12.1.4", "@semantic-release/changelog": "^6.0.3", "@semantic-release/commit-analyzer": "^13.0.1", "@semantic-release/git": "^10.0.1", "@semantic-release/npm": "^13.1.3", "@semantic-release/release-notes-generator": "^14.1.0", "@testing-library/dom": "^10.4.1", "@testing-library/jest-dom": "^6.9.0", "@testing-library/react": "^16.3.0", "@testing-library/react-hooks": "^8.0.1", "@types/node": "^20.19.18", "@types/react": "^18.3.25", "@types/react-dom": "^18.3.7", "@vitest/coverage-istanbul": "^2.1.9", "auto-changelog": "^2.4.0", "babel-plugin-module-resolver": "^5.0.2", "baseline-browser-mapping": "^2.8.32", "chokidar": "^4.0.3", "commitizen": "^4.3.0", "commitlint": "^19.8.1", "conventional-recommended-bump": "^10.0.0", "cross-env": "^7.0.3", "cz": "^1.8.2", "cz-conventional-changelog": "^3.3.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-maintainable": "^0.4.4", "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-simple-import-sort": "^12.1.1", "glob": "^13.0.0", "happy-dom": "^15.11.7", "husky": "^9.1.7", "lint-staged": "^15.5.2", "nyc": "^17.1.0", "only-allow": "^1.2.1", "pin-github-action": "^1.9.1", "playwright": "^1.55.1", "prettier": "^3.6.2", "prettier-plugin-tailwindcss": "^0.6.14", "react-router": "^7.10.1", "release-it": "^17.11.0", "rollup": "^4.52.3", "rollup-plugin-esbuild": "^6.2.1", "rollup-plugin-filesize": "^10.0.0", "rollup-plugin-sourcemaps": "^0.6.3", "semantic-release": "^25.0.2", "standard-version": "^9.5.0", "ts-node": "^10.9.2", "typescript": "^5.9.2", "unplugin-auto-import": "^0.18.6", "vitest": "^2.1.9", "wait-on": "^8.0.5", "wireit": "^0.14.12", "next": "^15.5.9", "react": "^19.2.1", "react-dom": "^19.2.1" }, "keywords": [ "state in url", "useSearchParams", "useUrlState", "url state", "search params", "nuqs alternative", "reactive", "json", "state sync", "state management", "encode", "decode", "Next.js", "react-router", "remix", "remixjs", "url", "url synchronization", "url sync", "state synchronization", "synchronized state", "state-in-url", "store", "react hook", "state hook", "url-state", "client components communication", "query string", "query-string", "querystring", "search-params", "searchparams", "params", "parse", "stringify", "query params", "typescript", "hooks", "react.js", "reactjs", "react", "NextJS", "query params parser", "query params parsing", "shared state", "state sharing", "front-end", "state-management", "state-sync", "search", "encode url", "decode url", "fast" ], "packageManager": "pnpm@10.26.0", "pnpm": { "overrides": { "@remix-run/react>react": "18.3.1", "@remix-run/react>react-dom": "18.3.1" }, "onlyBuiltDependencies": [ "@parcel/watcher", "core-js", "esbuild", "less", "sharp", "unrs-resolver" ] } }