state-in-url 6.4.0 → 6.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/package.json +34 -31
- package/dist/useIsomorphicLayoutEffect.d.ts +2 -0
- package/dist/useIsomorphicLayoutEffect.js +1 -0
- package/dist/useIsomorphicLayoutEffect.mjs +1 -0
- package/dist/useSharedState/useSharedState.js +1 -1
- package/dist/useSharedState/useSharedState.mjs +1 -1
- package/dist/useUrlStateBase/useUrlStateBase.js +1 -1
- package/dist/useUrlStateBase/useUrlStateBase.mjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +34 -31
- package/skills/feature-state-hook/SKILL.md +1 -1
- package/skills/form-library-integration/SKILL.md +1 -1
- package/skills/input-handling/SKILL.md +1 -1
- package/skills/nextjs-ssr/SKILL.md +1 -1
- package/skills/react-router-remix-setup/SKILL.md +1 -1
- package/skills/shared-state-no-url/SKILL.md +1 -1
- package/dist/useInsertionEffect.d.ts +0 -2
- package/dist/useInsertionEffect.js +0 -1
- package/dist/useInsertionEffect.mjs +0 -1
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "state-in-url",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"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.",
|
|
5
5
|
"homepage": "https://state-in-url.dev",
|
|
6
6
|
"repository": {
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
],
|
|
156
156
|
"service": {
|
|
157
157
|
"readyWhen": {
|
|
158
|
-
"lineMatches": "
|
|
158
|
+
"lineMatches": "Ready in"
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
"command": "pnpm run dev:nextjs15"
|
|
@@ -169,22 +169,23 @@
|
|
|
169
169
|
"command": "pnpm run test:exports && pnpm run test:int"
|
|
170
170
|
},
|
|
171
171
|
"kill-next": {
|
|
172
|
-
"command": "ps aux | grep
|
|
172
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
173
173
|
},
|
|
174
174
|
"kill-vite": {
|
|
175
|
-
"command": "ps aux | grep '
|
|
175
|
+
"command": "ps aux | grep -E 'vite/bin/vite' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
176
176
|
},
|
|
177
177
|
"kill-remix": {
|
|
178
|
-
"command": "ps aux | grep -E 'remix-serve
|
|
178
|
+
"command": "ps aux | grep -E 'remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
179
179
|
},
|
|
180
180
|
"kill-services": {
|
|
181
|
-
"command": "ps aux | grep -E '
|
|
181
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next|vite/bin/vite|remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0",
|
|
182
|
+
"comment": "Patterns match how the servers actually appear in ps, not a loose 'next'. An unescaped dot used to make '.next' match the '-next' in 'example-nextjs16.localhost', so this killed any process whose arguments named a demo app — including CI's own wait-on, which exited the job 137."
|
|
182
183
|
},
|
|
183
184
|
"kill-wireit": {
|
|
184
185
|
"command": "ps axu | grep '[w]ireit' | grep -v grep | awk -v me=$PPID '$2 != me {print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
185
186
|
},
|
|
186
187
|
"kill": {
|
|
187
|
-
"command": "ps aux | grep -E '
|
|
188
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next|vite/bin/vite|remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; ps axu | grep '[w]ireit' | grep -v grep | awk -v me=$PPID '$2 != me {print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
188
189
|
},
|
|
189
190
|
"test:int:ci": {
|
|
190
191
|
"command": "pnpm exec cross-env HOME=/root PLAYWRIGHT_BROWSERS_PATH=0 playwright test"
|
|
@@ -218,27 +219,28 @@
|
|
|
218
219
|
]
|
|
219
220
|
},
|
|
220
221
|
"dev:router6": {
|
|
221
|
-
"command": "cd packages/example-react-router6 && pnpm run dev",
|
|
222
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run dev",
|
|
222
223
|
"service": true
|
|
223
224
|
},
|
|
224
225
|
"dev:router7": {
|
|
225
|
-
"command": "cd packages/example-react-router7 && pnpm run dev",
|
|
226
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run dev",
|
|
226
227
|
"service": true
|
|
227
228
|
},
|
|
228
229
|
"dev:remix2": {
|
|
229
|
-
"command": "cd packages/example-remix2 &&
|
|
230
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run dev",
|
|
230
231
|
"service": true
|
|
231
232
|
},
|
|
232
233
|
"dev:nextjs14": {
|
|
233
|
-
"command": "cd packages/example-nextjs14 && pnpm run dev --turbo",
|
|
234
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run dev --turbo",
|
|
234
235
|
"service": true
|
|
235
236
|
},
|
|
236
237
|
"dev:nextjs15": {
|
|
237
|
-
"command": "cd packages/example-nextjs15 && pnpm run dev
|
|
238
|
-
"service": true
|
|
238
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run dev",
|
|
239
|
+
"service": true,
|
|
240
|
+
"comment": "No --turbo: Turbopack 15.5.19 panics with \"Next.js package not found\" against this pnpm layout (it reports version 0.0.0), and one failed service tears down all seven. 14 and 16 are unaffected."
|
|
239
241
|
},
|
|
240
242
|
"dev:nextjs16": {
|
|
241
|
-
"command": "cd packages/example-nextjs16 && pnpm run dev --turbo",
|
|
243
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run dev --turbo",
|
|
242
244
|
"service": true
|
|
243
245
|
},
|
|
244
246
|
"build:next14": {
|
|
@@ -293,64 +295,64 @@
|
|
|
293
295
|
"dependencies": [
|
|
294
296
|
"build:demo"
|
|
295
297
|
],
|
|
296
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
298
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
297
299
|
"service": true
|
|
298
300
|
},
|
|
299
301
|
"start:demo:ci": {
|
|
300
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
302
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
301
303
|
"service": true
|
|
302
304
|
},
|
|
303
305
|
"start:react": {
|
|
304
|
-
"command": "
|
|
306
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run start",
|
|
305
307
|
"dependencies": [
|
|
306
308
|
"build:react"
|
|
307
309
|
],
|
|
308
310
|
"service": true
|
|
309
311
|
},
|
|
310
312
|
"start:react:ci": {
|
|
311
|
-
"command": "
|
|
313
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run start",
|
|
312
314
|
"dependencies": [
|
|
313
315
|
"kill-services"
|
|
314
316
|
],
|
|
315
317
|
"service": true
|
|
316
318
|
},
|
|
317
319
|
"start:router6": {
|
|
318
|
-
"command": "
|
|
320
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run preview",
|
|
319
321
|
"dependencies": [
|
|
320
322
|
"build:router6"
|
|
321
323
|
],
|
|
322
324
|
"service": true
|
|
323
325
|
},
|
|
324
326
|
"start:router6:ci": {
|
|
325
|
-
"command": "
|
|
327
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run preview",
|
|
326
328
|
"dependencies": [
|
|
327
329
|
"kill-services"
|
|
328
330
|
],
|
|
329
331
|
"service": true
|
|
330
332
|
},
|
|
331
333
|
"start:router7": {
|
|
332
|
-
"command": "
|
|
334
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run preview",
|
|
333
335
|
"dependencies": [
|
|
334
336
|
"build:router7"
|
|
335
337
|
],
|
|
336
338
|
"service": true
|
|
337
339
|
},
|
|
338
340
|
"start:router7:ci": {
|
|
339
|
-
"command": "
|
|
341
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run preview",
|
|
340
342
|
"dependencies": [
|
|
341
343
|
"kill-services"
|
|
342
344
|
],
|
|
343
345
|
"service": true
|
|
344
346
|
},
|
|
345
347
|
"start:remix2": {
|
|
346
|
-
"command": "cd packages/example-remix2 && pnpm run start",
|
|
348
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run start",
|
|
347
349
|
"dependencies": [
|
|
348
350
|
"build:remix2"
|
|
349
351
|
],
|
|
350
352
|
"service": true
|
|
351
353
|
},
|
|
352
354
|
"start:remix2:ci": {
|
|
353
|
-
"command": "cd packages/example-remix2 && pnpm run start",
|
|
355
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run start",
|
|
354
356
|
"dependencies": [
|
|
355
357
|
"kill-services"
|
|
356
358
|
],
|
|
@@ -360,36 +362,36 @@
|
|
|
360
362
|
"dependencies": [
|
|
361
363
|
"build:next14"
|
|
362
364
|
],
|
|
363
|
-
"command": "cd packages/example-nextjs14 && pnpm run start",
|
|
365
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run start",
|
|
364
366
|
"service": true
|
|
365
367
|
},
|
|
366
368
|
"start:demo15": {
|
|
367
369
|
"dependencies": [
|
|
368
370
|
"build:next15"
|
|
369
371
|
],
|
|
370
|
-
"command": "cd packages/example-nextjs15 && pnpm run start",
|
|
372
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run start",
|
|
371
373
|
"service": true
|
|
372
374
|
},
|
|
373
375
|
"start:demo14:ci": {
|
|
374
|
-
"command": "cd packages/example-nextjs14 && pnpm run start",
|
|
376
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run start",
|
|
375
377
|
"dependencies": [
|
|
376
378
|
"kill-services"
|
|
377
379
|
],
|
|
378
380
|
"service": true
|
|
379
381
|
},
|
|
380
382
|
"start:demo15:ci": {
|
|
381
|
-
"command": "cd packages/example-nextjs15 && pnpm run start",
|
|
383
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run start",
|
|
382
384
|
"service": true
|
|
383
385
|
},
|
|
384
386
|
"start:demo16": {
|
|
385
387
|
"dependencies": [
|
|
386
388
|
"build:next16"
|
|
387
389
|
],
|
|
388
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
390
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
389
391
|
"service": true
|
|
390
392
|
},
|
|
391
393
|
"start:demo16:ci": {
|
|
392
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
394
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
393
395
|
"dependencies": [
|
|
394
396
|
"kill-services"
|
|
395
397
|
],
|
|
@@ -420,7 +422,7 @@
|
|
|
420
422
|
"service": true
|
|
421
423
|
},
|
|
422
424
|
"dev:react": {
|
|
423
|
-
"command": "cd packages/example-react && pnpm run dev",
|
|
425
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run dev",
|
|
424
426
|
"service": true
|
|
425
427
|
},
|
|
426
428
|
"build:packages": {
|
|
@@ -531,6 +533,7 @@
|
|
|
531
533
|
"pin-github-action": "^1.9.1",
|
|
532
534
|
"playwright": "^1.55.1",
|
|
533
535
|
"playwright-lighthouse": "^4.0.0",
|
|
536
|
+
"portless": "^0.15.5",
|
|
534
537
|
"prettier": "^3.6.2",
|
|
535
538
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
536
539
|
"react": "^19.2.6",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var u=require("react");function f(e){return e&&e.__esModule?e:{default:e}}var t=f(u);const o=typeof window==="undefined"?t.default.useEffect:t.default.useLayoutEffect;exports.useIsomorphicLayoutEffect=o;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"react";const e=typeof window==="undefined"?o.useEffect:o.useLayoutEffect;export{e as useIsomorphicLayoutEffect};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var b=require("react");var
|
|
1
|
+
"use strict";var b=require("react");var e=require("../subscribers.js");var M=require("../useIsomorphicLayoutEffect.js");var i=require("../utils.js");function g(s){return s&&s.__esModule?s:{default:s}}var a=g(b);function v(s,c){const t=a.default.useRef(s);const[l,o]=a.default.useState(()=>{if(i.isSSR){return c?c?.():t.current}const r=e.stateMap.get(t.current);if(!r){const u=c?.()||t.current;e.stateMap.set(t.current,u);return u}else{return r}});const d=a.default.useCallback(r=>{const u=e.stateMap.get(t.current);const n=typeof r==="function";const f=n?r(u,s):{...u,...r};if(i.isEqual(u,f))return void 0;e.stateMap.set(t.current,f);e.subscribers.get(t.current).forEach(S=>S())},[]);M.useIsomorphicLayoutEffect(()=>{const r=()=>{o(e.stateMap.get(t.current)||t.current)};const u=e.subscribers.add(t.current,r);o(n=>e.stateMap.get(t.current)??n);return u},[]);const p=a.default.useCallback(()=>e.stateMap.get(t.current)||t.current,[]);return{state:l,getState:p,setState:d}}exports.useSharedState=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"react";import{stateMap as
|
|
1
|
+
import c from"react";import{stateMap as n,subscribers as i}from"../subscribers.mjs";import{useIsomorphicLayoutEffect as l}from"../useIsomorphicLayoutEffect.mjs";import{isSSR as b,isEqual as d}from"../utils.mjs";function h(s,u){const t=c.useRef(s);const[m,a]=c.useState(()=>{if(b){return u?u?.():t.current}const e=n.get(t.current);if(!e){const r=u?.()||t.current;n.set(t.current,r);return r}else{return e}});const p=c.useCallback(e=>{const r=n.get(t.current);const o=typeof e==="function";const f=o?e(r,s):{...r,...e};if(d(r,f))return void 0;n.set(t.current,f);i.get(t.current).forEach(g=>g())},[]);l(()=>{const e=()=>{a(n.get(t.current)||t.current)};const r=i.add(t.current,e);a(o=>n.get(t.current)??o);return r},[]);const S=c.useCallback(()=>n.get(t.current)||t.current,[]);return{state:m,getState:S,setState:p}}export{h as useSharedState};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var _=require("react");var k=require("../constants/constants.js");var C=require("../useIsomorphicLayoutEffect.js");var L=require("../useSharedState/useSharedState.js");var T=require("../useUrlEncode/useUrlEncode.js");var r=require("../utils.js");function I(t){return t&&t.__esModule?t:{default:t}}var l=I(_);let s;let o;function P(t,a,S,m){const{parse:d,stringify:f}=T.useUrlEncode(t);const{state:g,getState:u,setState:n}=L.useSharedState(t,()=>S?.({parse:d})||t);const i=l.default.useRef();if(i.current===void 0)i.current=r.getSearch();C.useIsomorphicLayoutEffect(()=>{const e=()=>{n(d(r.filterUnknownParamsClient(t,r.getSearch())))};window.addEventListener(r.popstateEv,e);if(i.current!==r.getSearch())e();return()=>{window.removeEventListener(r.popstateEv,e)}},[]);const c=l.default.useCallback((e,U)=>{const h=typeof e==="function"?e(u(),t):{...u(),...e};const p=f(h,r.getOtherParams(t,window.location.search));const v=b(window.location.pathname,m);const w=`${v}${p.length?"?":""}${p}${window.location.hash}`;const $=`${v}${window.location.search}${window.location.hash}`;if(w===$)return;n(h);const{replace:q,...y}=U||{};clearTimeout(s);s=void 0;o={router:a,method:q?"replace":"push",url:w,opts:y};s=setTimeout(()=>{if(o){o.router[o.method](o.url,o.opts);o=void 0}s=void 0},k.TIMEOUT)},[a,f,u]);const E=l.default.useCallback(e=>{n(t);c(t,e)},[c,n]);return{updateState:n,updateUrl:c,state:g,reset:E,getState:u,pendingUrlUpdate:()=>s!==void 0}}function b(t,a){if(!a||a==="/"){return t}return t.slice(a.length)}exports.useUrlStateBase=P;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u from"react";import{TIMEOUT as T}from"../constants/constants.mjs";import{useIsomorphicLayoutEffect as L}from"../useIsomorphicLayoutEffect.mjs";import{useSharedState as P}from"../useSharedState/useSharedState.mjs";import{useUrlEncode as b}from"../useUrlEncode/useUrlEncode.mjs";import{getSearch as l,popstateEv as v,filterUnknownParamsClient as I,getOtherParams as O}from"../utils.mjs";let i;let o;function x(t,r,g,S){const{parse:p,stringify:d}=b(t);const{state:$,getState:s,setState:n}=P(t,()=>g?.({parse:p})||t);const a=u.useRef();if(a.current===void 0)a.current=l();L(()=>{const e=()=>{n(p(I(t,l())))};window.addEventListener(v,e);if(a.current!==l())e();return()=>{window.removeEventListener(v,e)}},[]);const c=u.useCallback((e,U)=>{const m=typeof e==="function"?e(s(),t):{...s(),...e};const f=d(m,O(t,window.location.search));const h=B(window.location.pathname,S);const w=`${h}${f.length?"?":""}${f}${window.location.hash}`;const k=`${h}${window.location.search}${window.location.hash}`;if(w===k)return;n(m);const{replace:y,...C}=U||{};clearTimeout(i);i=void 0;o={router:r,method:y?"replace":"push",url:w,opts:C};i=setTimeout(()=>{if(o){o.router[o.method](o.url,o.opts);o=void 0}i=void 0},T)},[r,d,s]);const E=u.useCallback(e=>{n(t);c(t,e)},[c,n]);return{updateState:n,updateUrl:c,state:$,reset:E,getState:s,pendingUrlUpdate:()=>i!==void 0}}function B(t,r){if(!r||r==="/"){return t}return t.slice(r.length)}export{x as useUrlStateBase};
|
package/dist/utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const a=n=>{if(n===null)return"null";const t=typeof n;if(t!=="object")return t;if(Array.isArray(n))return"array";if(n instanceof Date)return"date";return"object"};const w=n=>{const t=a(n);return t!=="object"&&t!=="array"};const i=typeof window==="undefined";const h=n=>{if(n instanceof URLSearchParams){return n}if(typeof n==="string"){const t=n.indexOf("?");return new URLSearchParams(t===-1?n:n.slice(t+1))}return new URLSearchParams};const y=(n,t)=>{if(n.length!==t.length)return false;return n.every((r,s)=>c(r,t[s]))};const p=(n,t)=>{const r=Object.keys(n);const s=Object.keys(t);if(r.length!==s.length)return false;return r.every(e=>c(n[e],t[e]))};const c=(n,t)=>{if(n===t)return true;if(n==null||t==null)return false;const r=a(n);const s=a(t);if(r!==s)return false;if(w(n))return false;if(r==="array"){return y(n,t)}if(r==="object"){return p(n,t)}return JSON.stringify(n)===JSON.stringify(t)};function S(n,t){const r=new URLSearchParams;const s=f(n,[...new URLSearchParams(t||"").entries()]);for(const[e,o]of s){r.set(e,o)}return r.toString()}function g(n,t){const r=Object.keys(n);const s=new URLSearchParams;for(const[e,o]of new URLSearchParams(t)){!r.includes(e)&&s.set(e,o)}return s}function m(n,t){const r=t instanceof URLSearchParams?[...t.entries()]:Object.entries(t||{});return Object.fromEntries(f(n,r))}function f(n,t){const r=Object.keys(n);const s=[];for(let e=0;e<t.length;e++){if(r.includes(t[e]?.[0])){s.push([t[e][0].replace(/\+/g," "),t[e][1]])}}return s}function P(n,t){const r=Object.assign({},n);for(const[s]of Object.entries(n)){const e=s;const o=t[e]!==void 0;r[e]=o?t[e]:n[e]}return r}const b={push:n=>{if(typeof window!=="undefined"){window.history.pushState(null,"",n)}},replace:n=>{if(typeof window!=="undefined"){window.history.replaceState(null,"",n)}}};const U=/apple/i.test(!i&&navigator?.userAgent||"");const u="popstate";function O(){return i?"":window.location.search}const l=new Set;let d=false;function j(){if(d||i)return;d=true;for(const n of["pushState","replaceState"]){const t=window.history[n];window.history[n]=function r(...s){const e=t.apply(this,s);for(const o of[...l])o();return e}}}function v(n){if(i)return()=>void 0;j();l.add(n);window.addEventListener(u,n);return()=>{l.delete(n);window.removeEventListener(u,n)}}exports.assignValue=P;exports.filterUnknown=f;exports.filterUnknownParams=m;exports.filterUnknownParamsClient=S;exports.getOtherParams=g;exports.getParams=h;exports.getSearch=O;exports.isEqual=c;exports.isPrimitive=w;exports.isSSR=i;exports.isSafari=U;exports.popstateEv=u;exports.routerHistory=b;exports.subscribeToUrl=v;exports.typeOf=a;
|
|
1
|
+
"use strict";const a=n=>{if(n===null)return"null";const t=typeof n;if(t!=="object")return t;if(Array.isArray(n))return"array";if(n instanceof Date)return"date";return"object"};const w=n=>{const t=a(n);return t!=="object"&&t!=="array"};const i=typeof window==="undefined";const h=n=>{if(n instanceof URLSearchParams){return n}if(typeof n==="string"){const t=n.indexOf("?");return new URLSearchParams(t===-1?n:n.slice(t+1))}return new URLSearchParams};const y=(n,t)=>{if(n.length!==t.length)return false;return n.every((r,s)=>c(r,t[s]))};const p=(n,t)=>{const r=Object.keys(n);const s=Object.keys(t);if(r.length!==s.length)return false;return r.every(e=>c(n[e],t[e]))};const c=(n,t)=>{if(n===t)return true;if(n==null||t==null)return false;const r=a(n);const s=a(t);if(r!==s)return false;if(w(n))return false;if(r==="array"){return y(n,t)}if(r==="object"){return p(n,t)}return JSON.stringify(n)===JSON.stringify(t)};function S(n,t){const r=new URLSearchParams;const s=f(n,[...new URLSearchParams(t||"").entries()]);for(const[e,o]of s){r.set(e,o)}return r.toString()}function g(n,t){const r=Object.keys(n);const s=new URLSearchParams;for(const[e,o]of new URLSearchParams(t)){!r.includes(e)&&s.set(e,o)}return s}function m(n,t){const r=t instanceof URLSearchParams?[...t.entries()]:Object.entries(t||{});return Object.fromEntries(f(n,r))}function f(n,t){const r=Object.keys(n);const s=[];for(let e=0;e<t.length;e++){if(r.includes(t[e]?.[0])){s.push([t[e][0].replace(/\+/g," "),t[e][1]])}}return s}function P(n,t){const r=Object.assign({},n);for(const[s]of Object.entries(n)){const e=s;const o=t[e]!==void 0;r[e]=o?t[e]:n[e]}return r}const b={push:n=>{if(typeof window!=="undefined"){window.history.pushState(null,"",n)}},replace:n=>{if(typeof window!=="undefined"){window.history.replaceState(null,"",n)}}};const U=/apple/i.test(!i&&navigator?.userAgent||"");const u="popstate";function O(){return i?"":window.location.search}const l=new Set;let d=false;function j(){if(d||i)return;d=true;for(const n of["pushState","replaceState"]){const t=window.history[n];window.history[n]=function r(...s){const e=t.apply(this,s);queueMicrotask(()=>{for(const o of[...l])o()});return e}}}function v(n){if(i)return()=>void 0;j();l.add(n);window.addEventListener(u,n);return()=>{l.delete(n);window.removeEventListener(u,n)}}exports.assignValue=P;exports.filterUnknown=f;exports.filterUnknownParams=m;exports.filterUnknownParamsClient=S;exports.getOtherParams=g;exports.getParams=h;exports.getSearch=O;exports.isEqual=c;exports.isPrimitive=w;exports.isSSR=i;exports.isSafari=U;exports.popstateEv=u;exports.routerHistory=b;exports.subscribeToUrl=v;exports.typeOf=a;
|
package/dist/utils.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const c=n=>{if(n===null)return"null";const t=typeof n;if(t!=="object")return t;if(Array.isArray(n))return"array";if(n instanceof Date)return"date";return"object"};const w=n=>{const t=c(n);return t!=="object"&&t!=="array"};const i=typeof window==="undefined";const h=n=>{if(n instanceof URLSearchParams){return n}if(typeof n==="string"){const t=n.indexOf("?");return new URLSearchParams(t===-1?n:n.slice(t+1))}return new URLSearchParams};const y=(n,t)=>{if(n.length!==t.length)return false;return n.every((r,s)=>a(r,t[s]))};const p=(n,t)=>{const r=Object.keys(n);const s=Object.keys(t);if(r.length!==s.length)return false;return r.every(e=>a(n[e],t[e]))};const a=(n,t)=>{if(n===t)return true;if(n==null||t==null)return false;const r=c(n);const s=c(t);if(r!==s)return false;if(w(n))return false;if(r==="array"){return y(n,t)}if(r==="object"){return p(n,t)}return JSON.stringify(n)===JSON.stringify(t)};function S(n,t){const r=new URLSearchParams;const s=f(n,[...new URLSearchParams(t||"").entries()]);for(const[e,o]of s){r.set(e,o)}return r.toString()}function g(n,t){const r=Object.keys(n);const s=new URLSearchParams;for(const[e,o]of new URLSearchParams(t)){!r.includes(e)&&s.set(e,o)}return s}function m(n,t){const r=t instanceof URLSearchParams?[...t.entries()]:Object.entries(t||{});return Object.fromEntries(f(n,r))}function f(n,t){const r=Object.keys(n);const s=[];for(let e=0;e<t.length;e++){if(r.includes(t[e]?.[0])){s.push([t[e][0].replace(/\+/g," "),t[e][1]])}}return s}function b(n,t){const r=Object.assign({},n);for(const[s]of Object.entries(n)){const e=s;const o=t[e]!==void 0;r[e]=o?t[e]:n[e]}return r}const O={push:n=>{if(typeof window!=="undefined"){window.history.pushState(null,"",n)}},replace:n=>{if(typeof window!=="undefined"){window.history.replaceState(null,"",n)}}};const P=/apple/i.test(!i&&navigator?.userAgent||"");const u="popstate";function j(){return i?"":window.location.search}const l=new Set;let d=false;function U(){if(d||i)return;d=true;for(const n of["pushState","replaceState"]){const t=window.history[n];window.history[n]=function r(...s){const e=t.apply(this,s);for(const o of[...l])o();return e}}}function v(n){if(i)return()=>void 0;U();l.add(n);window.addEventListener(u,n);return()=>{l.delete(n);window.removeEventListener(u,n)}}export{b as assignValue,f as filterUnknown,m as filterUnknownParams,S as filterUnknownParamsClient,g as getOtherParams,h as getParams,j as getSearch,a as isEqual,w as isPrimitive,i as isSSR,P as isSafari,u as popstateEv,O as routerHistory,v as subscribeToUrl,c as typeOf};
|
|
1
|
+
const c=n=>{if(n===null)return"null";const t=typeof n;if(t!=="object")return t;if(Array.isArray(n))return"array";if(n instanceof Date)return"date";return"object"};const w=n=>{const t=c(n);return t!=="object"&&t!=="array"};const i=typeof window==="undefined";const h=n=>{if(n instanceof URLSearchParams){return n}if(typeof n==="string"){const t=n.indexOf("?");return new URLSearchParams(t===-1?n:n.slice(t+1))}return new URLSearchParams};const y=(n,t)=>{if(n.length!==t.length)return false;return n.every((r,s)=>a(r,t[s]))};const p=(n,t)=>{const r=Object.keys(n);const s=Object.keys(t);if(r.length!==s.length)return false;return r.every(e=>a(n[e],t[e]))};const a=(n,t)=>{if(n===t)return true;if(n==null||t==null)return false;const r=c(n);const s=c(t);if(r!==s)return false;if(w(n))return false;if(r==="array"){return y(n,t)}if(r==="object"){return p(n,t)}return JSON.stringify(n)===JSON.stringify(t)};function S(n,t){const r=new URLSearchParams;const s=f(n,[...new URLSearchParams(t||"").entries()]);for(const[e,o]of s){r.set(e,o)}return r.toString()}function g(n,t){const r=Object.keys(n);const s=new URLSearchParams;for(const[e,o]of new URLSearchParams(t)){!r.includes(e)&&s.set(e,o)}return s}function m(n,t){const r=t instanceof URLSearchParams?[...t.entries()]:Object.entries(t||{});return Object.fromEntries(f(n,r))}function f(n,t){const r=Object.keys(n);const s=[];for(let e=0;e<t.length;e++){if(r.includes(t[e]?.[0])){s.push([t[e][0].replace(/\+/g," "),t[e][1]])}}return s}function b(n,t){const r=Object.assign({},n);for(const[s]of Object.entries(n)){const e=s;const o=t[e]!==void 0;r[e]=o?t[e]:n[e]}return r}const O={push:n=>{if(typeof window!=="undefined"){window.history.pushState(null,"",n)}},replace:n=>{if(typeof window!=="undefined"){window.history.replaceState(null,"",n)}}};const P=/apple/i.test(!i&&navigator?.userAgent||"");const u="popstate";function j(){return i?"":window.location.search}const l=new Set;let d=false;function U(){if(d||i)return;d=true;for(const n of["pushState","replaceState"]){const t=window.history[n];window.history[n]=function r(...s){const e=t.apply(this,s);queueMicrotask(()=>{for(const o of[...l])o()});return e}}}function v(n){if(i)return()=>void 0;U();l.add(n);window.addEventListener(u,n);return()=>{l.delete(n);window.removeEventListener(u,n)}}export{b as assignValue,f as filterUnknown,m as filterUnknownParams,S as filterUnknownParamsClient,g as getOtherParams,h as getParams,j as getSearch,a as isEqual,w as isPrimitive,i as isSSR,P as isSafari,u as popstateEv,O as routerHistory,v as subscribeToUrl,c as typeOf};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "state-in-url",
|
|
3
|
-
"version": "6.4.
|
|
3
|
+
"version": "6.4.1",
|
|
4
4
|
"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.",
|
|
5
5
|
"homepage": "https://state-in-url.dev",
|
|
6
6
|
"repository": {
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
],
|
|
156
156
|
"service": {
|
|
157
157
|
"readyWhen": {
|
|
158
|
-
"lineMatches": "
|
|
158
|
+
"lineMatches": "Ready in"
|
|
159
159
|
}
|
|
160
160
|
},
|
|
161
161
|
"command": "pnpm run dev:nextjs15"
|
|
@@ -169,22 +169,23 @@
|
|
|
169
169
|
"command": "pnpm run test:exports && pnpm run test:int"
|
|
170
170
|
},
|
|
171
171
|
"kill-next": {
|
|
172
|
-
"command": "ps aux | grep
|
|
172
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
173
173
|
},
|
|
174
174
|
"kill-vite": {
|
|
175
|
-
"command": "ps aux | grep '
|
|
175
|
+
"command": "ps aux | grep -E 'vite/bin/vite' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
176
176
|
},
|
|
177
177
|
"kill-remix": {
|
|
178
|
-
"command": "ps aux | grep -E 'remix-serve
|
|
178
|
+
"command": "ps aux | grep -E 'remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
179
179
|
},
|
|
180
180
|
"kill-services": {
|
|
181
|
-
"command": "ps aux | grep -E '
|
|
181
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next|vite/bin/vite|remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; exit 0",
|
|
182
|
+
"comment": "Patterns match how the servers actually appear in ps, not a loose 'next'. An unescaped dot used to make '.next' match the '-next' in 'example-nextjs16.localhost', so this killed any process whose arguments named a demo app — including CI's own wait-on, which exited the job 137."
|
|
182
183
|
},
|
|
183
184
|
"kill-wireit": {
|
|
184
185
|
"command": "ps axu | grep '[w]ireit' | grep -v grep | awk -v me=$PPID '$2 != me {print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
185
186
|
},
|
|
186
187
|
"kill": {
|
|
187
|
-
"command": "ps aux | grep -E '
|
|
188
|
+
"command": "ps aux | grep -E 'next-server|next/dist/bin/next|vite/bin/vite|remix-serve|remix-run/serve' | grep -v grep | awk '{print $2}' | xargs -r kill -9 2>&1; ps axu | grep '[w]ireit' | grep -v grep | awk -v me=$PPID '$2 != me {print $2}' | xargs -r kill -9 2>&1; exit 0"
|
|
188
189
|
},
|
|
189
190
|
"test:int:ci": {
|
|
190
191
|
"command": "pnpm exec cross-env HOME=/root PLAYWRIGHT_BROWSERS_PATH=0 playwright test"
|
|
@@ -218,27 +219,28 @@
|
|
|
218
219
|
]
|
|
219
220
|
},
|
|
220
221
|
"dev:router6": {
|
|
221
|
-
"command": "cd packages/example-react-router6 && pnpm run dev",
|
|
222
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run dev",
|
|
222
223
|
"service": true
|
|
223
224
|
},
|
|
224
225
|
"dev:router7": {
|
|
225
|
-
"command": "cd packages/example-react-router7 && pnpm run dev",
|
|
226
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run dev",
|
|
226
227
|
"service": true
|
|
227
228
|
},
|
|
228
229
|
"dev:remix2": {
|
|
229
|
-
"command": "cd packages/example-remix2 &&
|
|
230
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run dev",
|
|
230
231
|
"service": true
|
|
231
232
|
},
|
|
232
233
|
"dev:nextjs14": {
|
|
233
|
-
"command": "cd packages/example-nextjs14 && pnpm run dev --turbo",
|
|
234
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run dev --turbo",
|
|
234
235
|
"service": true
|
|
235
236
|
},
|
|
236
237
|
"dev:nextjs15": {
|
|
237
|
-
"command": "cd packages/example-nextjs15 && pnpm run dev
|
|
238
|
-
"service": true
|
|
238
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run dev",
|
|
239
|
+
"service": true,
|
|
240
|
+
"comment": "No --turbo: Turbopack 15.5.19 panics with \"Next.js package not found\" against this pnpm layout (it reports version 0.0.0), and one failed service tears down all seven. 14 and 16 are unaffected."
|
|
239
241
|
},
|
|
240
242
|
"dev:nextjs16": {
|
|
241
|
-
"command": "cd packages/example-nextjs16 && pnpm run dev --turbo",
|
|
243
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run dev --turbo",
|
|
242
244
|
"service": true
|
|
243
245
|
},
|
|
244
246
|
"build:next14": {
|
|
@@ -293,64 +295,64 @@
|
|
|
293
295
|
"dependencies": [
|
|
294
296
|
"build:demo"
|
|
295
297
|
],
|
|
296
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
298
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
297
299
|
"service": true
|
|
298
300
|
},
|
|
299
301
|
"start:demo:ci": {
|
|
300
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
302
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
301
303
|
"service": true
|
|
302
304
|
},
|
|
303
305
|
"start:react": {
|
|
304
|
-
"command": "
|
|
306
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run start",
|
|
305
307
|
"dependencies": [
|
|
306
308
|
"build:react"
|
|
307
309
|
],
|
|
308
310
|
"service": true
|
|
309
311
|
},
|
|
310
312
|
"start:react:ci": {
|
|
311
|
-
"command": "
|
|
313
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run start",
|
|
312
314
|
"dependencies": [
|
|
313
315
|
"kill-services"
|
|
314
316
|
],
|
|
315
317
|
"service": true
|
|
316
318
|
},
|
|
317
319
|
"start:router6": {
|
|
318
|
-
"command": "
|
|
320
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run preview",
|
|
319
321
|
"dependencies": [
|
|
320
322
|
"build:router6"
|
|
321
323
|
],
|
|
322
324
|
"service": true
|
|
323
325
|
},
|
|
324
326
|
"start:router6:ci": {
|
|
325
|
-
"command": "
|
|
327
|
+
"command": "cd packages/example-react-router6 && ../../scripts/portless.sh -- pnpm run preview",
|
|
326
328
|
"dependencies": [
|
|
327
329
|
"kill-services"
|
|
328
330
|
],
|
|
329
331
|
"service": true
|
|
330
332
|
},
|
|
331
333
|
"start:router7": {
|
|
332
|
-
"command": "
|
|
334
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run preview",
|
|
333
335
|
"dependencies": [
|
|
334
336
|
"build:router7"
|
|
335
337
|
],
|
|
336
338
|
"service": true
|
|
337
339
|
},
|
|
338
340
|
"start:router7:ci": {
|
|
339
|
-
"command": "
|
|
341
|
+
"command": "cd packages/example-react-router7 && ../../scripts/portless.sh -- pnpm run preview",
|
|
340
342
|
"dependencies": [
|
|
341
343
|
"kill-services"
|
|
342
344
|
],
|
|
343
345
|
"service": true
|
|
344
346
|
},
|
|
345
347
|
"start:remix2": {
|
|
346
|
-
"command": "cd packages/example-remix2 && pnpm run start",
|
|
348
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run start",
|
|
347
349
|
"dependencies": [
|
|
348
350
|
"build:remix2"
|
|
349
351
|
],
|
|
350
352
|
"service": true
|
|
351
353
|
},
|
|
352
354
|
"start:remix2:ci": {
|
|
353
|
-
"command": "cd packages/example-remix2 && pnpm run start",
|
|
355
|
+
"command": "cd packages/example-remix2 && ../../scripts/portless.sh -- pnpm run start",
|
|
354
356
|
"dependencies": [
|
|
355
357
|
"kill-services"
|
|
356
358
|
],
|
|
@@ -360,36 +362,36 @@
|
|
|
360
362
|
"dependencies": [
|
|
361
363
|
"build:next14"
|
|
362
364
|
],
|
|
363
|
-
"command": "cd packages/example-nextjs14 && pnpm run start",
|
|
365
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run start",
|
|
364
366
|
"service": true
|
|
365
367
|
},
|
|
366
368
|
"start:demo15": {
|
|
367
369
|
"dependencies": [
|
|
368
370
|
"build:next15"
|
|
369
371
|
],
|
|
370
|
-
"command": "cd packages/example-nextjs15 && pnpm run start",
|
|
372
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run start",
|
|
371
373
|
"service": true
|
|
372
374
|
},
|
|
373
375
|
"start:demo14:ci": {
|
|
374
|
-
"command": "cd packages/example-nextjs14 && pnpm run start",
|
|
376
|
+
"command": "cd packages/example-nextjs14 && ../../scripts/portless.sh -- pnpm run start",
|
|
375
377
|
"dependencies": [
|
|
376
378
|
"kill-services"
|
|
377
379
|
],
|
|
378
380
|
"service": true
|
|
379
381
|
},
|
|
380
382
|
"start:demo15:ci": {
|
|
381
|
-
"command": "cd packages/example-nextjs15 && pnpm run start",
|
|
383
|
+
"command": "cd packages/example-nextjs15 && ../../scripts/portless.sh -- pnpm run start",
|
|
382
384
|
"service": true
|
|
383
385
|
},
|
|
384
386
|
"start:demo16": {
|
|
385
387
|
"dependencies": [
|
|
386
388
|
"build:next16"
|
|
387
389
|
],
|
|
388
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
390
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
389
391
|
"service": true
|
|
390
392
|
},
|
|
391
393
|
"start:demo16:ci": {
|
|
392
|
-
"command": "cd packages/example-nextjs16 && pnpm run start",
|
|
394
|
+
"command": "cd packages/example-nextjs16 && ../../scripts/portless.sh -- pnpm run start",
|
|
393
395
|
"dependencies": [
|
|
394
396
|
"kill-services"
|
|
395
397
|
],
|
|
@@ -420,7 +422,7 @@
|
|
|
420
422
|
"service": true
|
|
421
423
|
},
|
|
422
424
|
"dev:react": {
|
|
423
|
-
"command": "cd packages/example-react && pnpm run dev",
|
|
425
|
+
"command": "cd packages/example-react && ../../scripts/portless.sh -- pnpm run dev",
|
|
424
426
|
"service": true
|
|
425
427
|
},
|
|
426
428
|
"build:packages": {
|
|
@@ -531,6 +533,7 @@
|
|
|
531
533
|
"pin-github-action": "^1.9.1",
|
|
532
534
|
"playwright": "^1.55.1",
|
|
533
535
|
"playwright-lighthouse": "^4.0.0",
|
|
536
|
+
"portless": "^0.15.5",
|
|
534
537
|
"prettier": "^3.6.2",
|
|
535
538
|
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
536
539
|
"react": "^19.2.6",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var f=require("react");function u(e){return e&&e.__esModule?e:{default:e}}var t=u(f);const n=t.default?.useInsertionEffect||t.default.useEffect;exports.useInsertionEffect=n;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"react";const t=e?.useInsertionEffect||e.useEffect;export{t as useInsertionEffect};
|