@tanstack/start-storage-context 1.132.47 → 1.133.3
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 +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.
|
|
3
|
+
"version": "1.133.3",
|
|
4
4
|
"description": "Modern and scalable routing for React applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,22 @@
|
|
|
43
43
|
"node": ">=22.12.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@tanstack/router-core": "1.
|
|
46
|
+
"@tanstack/router-core": "1.133.3"
|
|
47
47
|
},
|
|
48
|
-
"scripts": {
|
|
48
|
+
"scripts": {
|
|
49
|
+
"clean": "rimraf ./dist && rimraf ./coverage",
|
|
50
|
+
"test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
|
|
51
|
+
"test:unit": "exit 0; vitest",
|
|
52
|
+
"test:unit:dev": "vitest --watch",
|
|
53
|
+
"test:eslint": "eslint ./src",
|
|
54
|
+
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
|
|
55
|
+
"test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
|
|
56
|
+
"test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
|
|
57
|
+
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
|
|
58
|
+
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
|
|
59
|
+
"test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
|
|
60
|
+
"test:types:ts59": "tsc",
|
|
61
|
+
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
|
|
62
|
+
"build": "vite build"
|
|
63
|
+
}
|
|
49
64
|
}
|