Skip to content

Commit

Permalink
refactor(vike-solid-query): use tsc only for development and build
Browse files Browse the repository at this point in the history
  • Loading branch information
phonzammi committed Sep 23, 2024
1 parent 99bdb86 commit f6af6c4
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 78 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
},
"pnpm": {
"overrides": {
"vike-solid": "link:./packages/vike-solid/"
"vike-solid": "link:./packages/vike-solid/",
"vike-solid-query": "link:./packages/vike-solid-query/"
}
},
"devDependencies": {
Expand Down
11 changes: 1 addition & 10 deletions packages/vike-solid-query/integration/+config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import type { Config } from "vike/types";
import type { QueryClientConfig } from "@tanstack/solid-query";
import "vike-solid/config"; // Needed for declaration merging of Config

export default {
name: "vike-solid-query",
require: {
"vike-solid": ">=0.7.3",
"vike-solid": ">=0.7.4",
},
Wrapper: "import:vike-solid-query/__internal/integration/Wrapper:default",
queryClientConfig: {
Expand All @@ -24,11 +23,3 @@ export default {
},
},
} satisfies Config;

declare global {
namespace Vike {
interface Config {
queryClientConfig?: QueryClientConfig;
}
}
}
3 changes: 1 addition & 2 deletions packages/vike-solid-query/integration/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";
import type { JSX } from "solid-js";
import { usePageContext } from "vike-solid/usePageContext";

export default function Wrapper(props: { children: JSX.Element }) {
export default function Wrapper(props: { children?: JSX.Element }) {
const pageContext = usePageContext();
const queryClient = new QueryClient(pageContext.config.queryClientConfig);

return <QueryClientProvider client={queryClient}>{props.children}</QueryClientProvider>;
}
3 changes: 3 additions & 0 deletions packages/vike-solid-query/integration/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Wrapper from "./Wrapper.jsx";

export default Wrapper;
27 changes: 12 additions & 15 deletions packages/vike-solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,34 @@
"name": "vike-solid-query",
"version": "0.0.1",
"type": "module",
"main": "dist/src/index.js",
"typings": "dist/src/index.js",
"exports": {
".": "./dist/src/index.js",
"./config": "./dist/integration/+config.js",
"./__internal/integration/Wrapper": "./dist/integration/index.js"
},
"scripts": {
"dev": "rollup -c rollup.config.js --watch",
"dev": "tsc --watch",
"dev:typecheck": "tsc --noEmit --watch",
"build": "rollup -c rollup.config.js && tsc",
"build": "rimraf dist/ && tsc",
"release": "LANG=en_US release-me patch",
"release:minor": "LANG=en_US release-me minor",
"release:commit": "LANG=en_US release-me commit"
},
"peerDependencies": {
"@tanstack/solid-query": ">=5.0.0",
"solid-js": "^1.8.7",
"vike-solid": "workspace:^"
"vike-solid": ">=0.7.4"
},
"devDependencies": {
"@brillout/release-me": "^0.4.1",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@tanstack/solid-query": "^5.56.2",
"rimraf": "^6.0.1",
"rollup": "^4.21.3",
"rollup-plugin-dts": "^6.1.1",
"solid-js": "^1.8.22",
"typescript": "^5.6.2",
"vike": "^0.4.195",
"vike-solid": "workspace:*",
"vite": "^5.4.6"
},
"exports": {
".": "./dist/src/index.js",
"./config": "./dist/integration/+config.js",
"./__internal/integration/Wrapper": "./dist/integration/Wrapper.js"
"vike-solid": "^0.7.5"
},
"typesVersions": {
"*": {
Expand All @@ -45,7 +42,7 @@
}
},
"files": [
"dist/"
"dist"
],
"repository": "github:vikejs/vike-solid",
"license": "MIT"
Expand Down
18 changes: 0 additions & 18 deletions packages/vike-solid-query/rollup.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/vike-solid-query/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export { QueryBoundary } from "./QueryBoundary";
export { QueryBoundary } from "./QueryBoundary.jsx";
26 changes: 11 additions & 15 deletions packages/vike-solid-query/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"noUncheckedIndexedAccess": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"types": ["vite/client"],
"isolatedModules": true,
"outDir": "./dist",
"declaration": true,
"module": "ES2022",
"moduleResolution": "Bundler",
"target": "ES2020",
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"esModuleInterop": true,
"skipLibCheck": true,
"rootDir": "./"
},
"include": ["src/*", "global.d.ts"]
"allowSyntheticDefaultImports": true,
"verbatimModuleSyntax": true,
"strict": true,
"declaration": true,
"outDir": "./dist/"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ declare global {
}
}
}

export {};
18 changes: 2 additions & 16 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f6af6c4

Please sign in to comment.