@tanstack/solid-router-ssr-query 1.133.19

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021-present Tanner Linsley
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @tanstack/solid-router-ssr-query
2
+
3
+ SSR query integration for TanStack Solid Router and TanStack Solid Query.
4
+
5
+ This package provides seamless integration between TanStack Router and TanStack Query for server-side rendering in Solid applications.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @tanstack/solid-router-ssr-query
11
+ # or
12
+ pnpm add @tanstack/solid-router-ssr-query
13
+ # or
14
+ yarn add @tanstack/solid-router-ssr-query
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```tsx
20
+ import { QueryClient } from '@tanstack/solid-query'
21
+ import { createRouter } from '@tanstack/solid-router'
22
+ import { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query'
23
+
24
+ const queryClient = new QueryClient()
25
+ const router = createRouter({
26
+ routeTree,
27
+ context: { queryClient },
28
+ })
29
+
30
+ setupRouterSsrQueryIntegration({
31
+ router,
32
+ queryClient,
33
+ })
34
+ ```
35
+
36
+ ## License
37
+
38
+ MIT
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const web = require("solid-js/web");
4
+ const solidQuery = require("@tanstack/solid-query");
5
+ const routerSsrQueryCore = require("@tanstack/router-ssr-query-core");
6
+ function setupRouterSsrQueryIntegration(opts) {
7
+ routerSsrQueryCore.setupCoreRouterSsrQueryIntegration(opts);
8
+ if (opts.wrapQueryClient === false) {
9
+ return;
10
+ }
11
+ const OGWrap = opts.router.options.Wrap || ((props) => props.children);
12
+ opts.router.options.Wrap = (props) => {
13
+ return web.createComponent(solidQuery.QueryClientProvider, {
14
+ get client() {
15
+ return opts.queryClient;
16
+ },
17
+ get children() {
18
+ return web.createComponent(OGWrap, {
19
+ get children() {
20
+ return props.children;
21
+ }
22
+ });
23
+ }
24
+ });
25
+ };
26
+ }
27
+ exports.setupRouterSsrQueryIntegration = setupRouterSsrQueryIntegration;
28
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../src/index.tsx"],"sourcesContent":["import { QueryClientProvider } from '@tanstack/solid-query'\nimport { setupCoreRouterSsrQueryIntegration } from '@tanstack/router-ssr-query-core'\nimport type { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { JSX } from 'solid-js'\n\nexport type Options<TRouter extends AnyRouter> =\n RouterSsrQueryOptions<TRouter> & {\n wrapQueryClient?: boolean\n }\n\nexport function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(\n opts: Options<TRouter>,\n) {\n setupCoreRouterSsrQueryIntegration(opts)\n\n if (opts.wrapQueryClient === false) {\n return\n }\n\n const OGWrap =\n opts.router.options.Wrap ||\n ((props: { children: JSX.Element }) => props.children)\n\n opts.router.options.Wrap = (props) => {\n return (\n <QueryClientProvider client={opts.queryClient}>\n <OGWrap>{props.children}</OGWrap>\n </QueryClientProvider>\n )\n }\n}\n"],"names":["setupRouterSsrQueryIntegration","opts","setupCoreRouterSsrQueryIntegration","wrapQueryClient","OGWrap","router","options","Wrap","props","children","_$createComponent","QueryClientProvider","client","queryClient"],"mappings":";;;;;AAWO,SAASA,+BACdC,MACA;AACAC,qBAAAA,mCAAmCD,IAAI;AAEvC,MAAIA,KAAKE,oBAAoB,OAAO;AAClC;AAAA,EACF;AAEA,QAAMC,SACJH,KAAKI,OAAOC,QAAQC,SACnB,CAACC,UAAqCA,MAAMC;AAE/CR,OAAKI,OAAOC,QAAQC,OAAQC,CAAAA,UAAU;AACpC,WAAAE,IAAAA,gBACGC,WAAAA,qBAAmB;AAAA,MAAA,IAACC,SAAM;AAAA,eAAEX,KAAKY;AAAAA,MAAW;AAAA,MAAA,IAAAJ,WAAA;AAAA,eAAAC,IAAAA,gBAC1CN,QAAM;AAAA,UAAA,IAAAK,WAAA;AAAA,mBAAED,MAAMC;AAAAA,UAAQ;AAAA,QAAA,CAAA;AAAA,MAAA;AAAA,IAAA,CAAA;AAAA,EAG7B;AACF;;"}
@@ -0,0 +1,6 @@
1
+ import { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core';
2
+ import { AnyRouter } from '@tanstack/solid-router';
3
+ export type Options<TRouter extends AnyRouter> = RouterSsrQueryOptions<TRouter> & {
4
+ wrapQueryClient?: boolean;
5
+ };
6
+ export declare function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(opts: Options<TRouter>): void;
@@ -0,0 +1,6 @@
1
+ import { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core';
2
+ import { AnyRouter } from '@tanstack/solid-router';
3
+ export type Options<TRouter extends AnyRouter> = RouterSsrQueryOptions<TRouter> & {
4
+ wrapQueryClient?: boolean;
5
+ };
6
+ export declare function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(opts: Options<TRouter>): void;
@@ -0,0 +1,28 @@
1
+ import { createComponent } from "solid-js/web";
2
+ import { QueryClientProvider } from "@tanstack/solid-query";
3
+ import { setupCoreRouterSsrQueryIntegration } from "@tanstack/router-ssr-query-core";
4
+ function setupRouterSsrQueryIntegration(opts) {
5
+ setupCoreRouterSsrQueryIntegration(opts);
6
+ if (opts.wrapQueryClient === false) {
7
+ return;
8
+ }
9
+ const OGWrap = opts.router.options.Wrap || ((props) => props.children);
10
+ opts.router.options.Wrap = (props) => {
11
+ return createComponent(QueryClientProvider, {
12
+ get client() {
13
+ return opts.queryClient;
14
+ },
15
+ get children() {
16
+ return createComponent(OGWrap, {
17
+ get children() {
18
+ return props.children;
19
+ }
20
+ });
21
+ }
22
+ });
23
+ };
24
+ }
25
+ export {
26
+ setupRouterSsrQueryIntegration
27
+ };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/index.tsx"],"sourcesContent":["import { QueryClientProvider } from '@tanstack/solid-query'\nimport { setupCoreRouterSsrQueryIntegration } from '@tanstack/router-ssr-query-core'\nimport type { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core'\nimport type { AnyRouter } from '@tanstack/solid-router'\nimport type { JSX } from 'solid-js'\n\nexport type Options<TRouter extends AnyRouter> =\n RouterSsrQueryOptions<TRouter> & {\n wrapQueryClient?: boolean\n }\n\nexport function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(\n opts: Options<TRouter>,\n) {\n setupCoreRouterSsrQueryIntegration(opts)\n\n if (opts.wrapQueryClient === false) {\n return\n }\n\n const OGWrap =\n opts.router.options.Wrap ||\n ((props: { children: JSX.Element }) => props.children)\n\n opts.router.options.Wrap = (props) => {\n return (\n <QueryClientProvider client={opts.queryClient}>\n <OGWrap>{props.children}</OGWrap>\n </QueryClientProvider>\n )\n }\n}\n"],"names":["setupRouterSsrQueryIntegration","opts","setupCoreRouterSsrQueryIntegration","wrapQueryClient","OGWrap","router","options","Wrap","props","children","_$createComponent","QueryClientProvider","client","queryClient"],"mappings":";;;AAWO,SAASA,+BACdC,MACA;AACAC,qCAAmCD,IAAI;AAEvC,MAAIA,KAAKE,oBAAoB,OAAO;AAClC;AAAA,EACF;AAEA,QAAMC,SACJH,KAAKI,OAAOC,QAAQC,SACnB,CAACC,UAAqCA,MAAMC;AAE/CR,OAAKI,OAAOC,QAAQC,OAAQC,CAAAA,UAAU;AACpC,WAAAE,gBACGC,qBAAmB;AAAA,MAAA,IAACC,SAAM;AAAA,eAAEX,KAAKY;AAAAA,MAAW;AAAA,MAAA,IAAAJ,WAAA;AAAA,eAAAC,gBAC1CN,QAAM;AAAA,UAAA,IAAAK,WAAA;AAAA,mBAAED,MAAMC;AAAAA,UAAQ;AAAA,QAAA,CAAA;AAAA,MAAA;AAAA,IAAA,CAAA;AAAA,EAG7B;AACF;"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@tanstack/solid-router-ssr-query",
3
+ "version": "1.133.19",
4
+ "description": "Modern and scalable routing for Solid applications",
5
+ "author": "Tanner Linsley",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/TanStack/router.git",
10
+ "directory": "packages/solid-router-ssr-query"
11
+ },
12
+ "homepage": "https://tanstack.com/router",
13
+ "funding": {
14
+ "type": "github",
15
+ "url": "https://github.com/sponsors/tannerlinsley"
16
+ },
17
+ "keywords": [
18
+ "solidjs",
19
+ "location",
20
+ "router",
21
+ "routing",
22
+ "async",
23
+ "async router",
24
+ "typescript"
25
+ ],
26
+ "type": "module",
27
+ "types": "dist/esm/index.d.ts",
28
+ "main": "dist/cjs/index.cjs",
29
+ "module": "dist/esm/index.js",
30
+ "exports": {
31
+ ".": {
32
+ "import": {
33
+ "types": "./dist/esm/index.d.ts",
34
+ "default": "./dist/esm/index.js"
35
+ },
36
+ "require": {
37
+ "types": "./dist/cjs/index.d.cts",
38
+ "default": "./dist/cjs/index.cjs"
39
+ }
40
+ },
41
+ "./package.json": "./package.json"
42
+ },
43
+ "sideEffects": false,
44
+ "files": [
45
+ "dist",
46
+ "src"
47
+ ],
48
+ "engines": {
49
+ "node": ">=12"
50
+ },
51
+ "dependencies": {
52
+ "eslint-plugin-solid": "^0.14.5",
53
+ "@tanstack/router-ssr-query-core": "1.133.19"
54
+ },
55
+ "devDependencies": {
56
+ "@tanstack/solid-query": ">=5.66.0",
57
+ "solid-js": "^1.9.5",
58
+ "vite-plugin-solid": "^2.11.8",
59
+ "@tanstack/solid-router": "1.133.19"
60
+ },
61
+ "peerDependencies": {
62
+ "@tanstack/query-core": ">=5.66.0",
63
+ "@tanstack/solid-query": ">=5.66.2",
64
+ "@tanstack/solid-router": ">=1.127.0",
65
+ "solid-js": "^1.9.5"
66
+ },
67
+ "scripts": {
68
+ "clean": "rimraf ./dist && rimraf ./coverage",
69
+ "test:eslint": "eslint ./src",
70
+ "test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
71
+ "test:types:ts54": "node ../../node_modules/typescript54/lib/tsc.js",
72
+ "test:types:ts55": "node ../../node_modules/typescript55/lib/tsc.js",
73
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
74
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
75
+ "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
76
+ "test:types:ts59": "tsc",
77
+ "test:unit": "exit 0; vitest",
78
+ "test:unit:dev": "pnpm run test:unit --watch",
79
+ "test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
80
+ "build": "vite build"
81
+ }
82
+ }
package/src/index.tsx ADDED
@@ -0,0 +1,32 @@
1
+ import { QueryClientProvider } from '@tanstack/solid-query'
2
+ import { setupCoreRouterSsrQueryIntegration } from '@tanstack/router-ssr-query-core'
3
+ import type { RouterSsrQueryOptions } from '@tanstack/router-ssr-query-core'
4
+ import type { AnyRouter } from '@tanstack/solid-router'
5
+ import type { JSX } from 'solid-js'
6
+
7
+ export type Options<TRouter extends AnyRouter> =
8
+ RouterSsrQueryOptions<TRouter> & {
9
+ wrapQueryClient?: boolean
10
+ }
11
+
12
+ export function setupRouterSsrQueryIntegration<TRouter extends AnyRouter>(
13
+ opts: Options<TRouter>,
14
+ ) {
15
+ setupCoreRouterSsrQueryIntegration(opts)
16
+
17
+ if (opts.wrapQueryClient === false) {
18
+ return
19
+ }
20
+
21
+ const OGWrap =
22
+ opts.router.options.Wrap ||
23
+ ((props: { children: JSX.Element }) => props.children)
24
+
25
+ opts.router.options.Wrap = (props) => {
26
+ return (
27
+ <QueryClientProvider client={opts.queryClient}>
28
+ <OGWrap>{props.children}</OGWrap>
29
+ </QueryClientProvider>
30
+ )
31
+ }
32
+ }