@tanstack/start-storage-context 1.132.45 → 1.132.48

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.
@@ -1,6 +1,7 @@
1
1
  import { Awaitable, RegisteredRouter } from '@tanstack/router-core';
2
2
  export interface StartStorageContext {
3
3
  getRouter: () => Awaitable<RegisteredRouter>;
4
+ request: Request;
4
5
  startOptions: any;
5
6
  contextAfterGlobalMiddlewares: any;
6
7
  }
@@ -1 +1 @@
1
- {"version":3,"file":"async-local-storage.js","sources":["../../src/async-local-storage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { Awaitable, RegisteredRouter } from '@tanstack/router-core'\n\nexport interface StartStorageContext {\n getRouter: () => Awaitable<RegisteredRouter>\n\n // TODO type this properly\n startOptions: /* AnyStartInstanceOptions*/ any\n\n contextAfterGlobalMiddlewares: any\n}\n\nconst startStorage = new AsyncLocalStorage<StartStorageContext>()\n\nexport async function runWithStartContext<T>(\n context: StartStorageContext,\n fn: () => T | Promise<T>,\n): Promise<T> {\n return startStorage.run(context, fn)\n}\n\nexport function getStartContext<TThrow extends boolean = true>(opts?: {\n throwIfNotFound?: TThrow\n}): TThrow extends false\n ? StartStorageContext | undefined\n : StartStorageContext {\n const context = startStorage.getStore()\n if (!context && opts?.throwIfNotFound !== false) {\n throw new Error(\n `No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`,\n )\n }\n return context as any\n}\n"],"names":[],"mappings":";AAYA,MAAM,eAAe,IAAI,kBAAA;AAEzB,eAAsB,oBACpB,SACA,IACY;AACZ,SAAO,aAAa,IAAI,SAAS,EAAE;AACrC;AAEO,SAAS,gBAA+C,MAIvC;AACtB,QAAM,UAAU,aAAa,SAAA;AAC7B,MAAI,CAAC,WAAW,MAAM,oBAAoB,OAAO;AAC/C,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;"}
1
+ {"version":3,"file":"async-local-storage.js","sources":["../../src/async-local-storage.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { Awaitable, RegisteredRouter } from '@tanstack/router-core'\n\nexport interface StartStorageContext {\n getRouter: () => Awaitable<RegisteredRouter>\n request: Request\n // TODO type this properly\n startOptions: /* AnyStartInstanceOptions*/ any\n\n contextAfterGlobalMiddlewares: any\n}\n\nconst startStorage = new AsyncLocalStorage<StartStorageContext>()\n\nexport async function runWithStartContext<T>(\n context: StartStorageContext,\n fn: () => T | Promise<T>,\n): Promise<T> {\n return startStorage.run(context, fn)\n}\n\nexport function getStartContext<TThrow extends boolean = true>(opts?: {\n throwIfNotFound?: TThrow\n}): TThrow extends false\n ? StartStorageContext | undefined\n : StartStorageContext {\n const context = startStorage.getStore()\n if (!context && opts?.throwIfNotFound !== false) {\n throw new Error(\n `No Start context found in AsyncLocalStorage. Make sure you are using the function within the server runtime.`,\n )\n }\n return context as any\n}\n"],"names":[],"mappings":";AAYA,MAAM,eAAe,IAAI,kBAAA;AAEzB,eAAsB,oBACpB,SACA,IACY;AACZ,SAAO,aAAa,IAAI,SAAS,EAAE;AACrC;AAEO,SAAS,gBAA+C,MAIvC;AACtB,QAAM,UAAU,aAAa,SAAA;AAC7B,MAAI,CAAC,WAAW,MAAM,oBAAoB,OAAO;AAC/C,UAAM,IAAI;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AACA,SAAO;AACT;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tanstack/start-storage-context",
3
- "version": "1.132.45",
3
+ "version": "1.132.48",
4
4
  "description": "Modern and scalable routing for React applications",
5
5
  "author": "Tanner Linsley",
6
6
  "license": "MIT",
@@ -43,7 +43,7 @@
43
43
  "node": ">=22.12.0"
44
44
  },
45
45
  "dependencies": {
46
- "@tanstack/router-core": "1.132.45"
46
+ "@tanstack/router-core": "1.132.47"
47
47
  },
48
48
  "scripts": {}
49
49
  }
@@ -3,7 +3,7 @@ import type { Awaitable, RegisteredRouter } from '@tanstack/router-core'
3
3
 
4
4
  export interface StartStorageContext {
5
5
  getRouter: () => Awaitable<RegisteredRouter>
6
-
6
+ request: Request
7
7
  // TODO type this properly
8
8
  startOptions: /* AnyStartInstanceOptions*/ any
9
9