@webdevarif/dashui-setup 0.1.0 → 0.2.0

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/swr.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";var l=Object.create;var i=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var v=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var W=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},c=(e,r,o,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of p(r))!S.call(e,t)&&t!==o&&i(e,t,{get:()=>r[t],enumerable:!(n=R(r,t))||n.enumerable});return e};var h=(e,r,o)=>(o=e!=null?l(v(e)):{},c(r||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),m=e=>c(i({},"__esModule",{value:!0}),e);var g={};W(g,{SWRProvider:()=>d,useFetch:()=>u});module.exports=m(g);var a=require("swr"),f=require("react/jsx-runtime"),P={revalidateOnFocus:!1,revalidateOnReconnect:!0,dedupingInterval:6e4,focusThrottleInterval:3e5};function d({children:e}){return(0,f.jsx)(a.SWRConfig,{value:{fetcher:r=>fetch(r).then(o=>o.json()),...P},children:e})}var s=h(require("swr"));function u(e,r){let{data:o,error:n,isLoading:t}=(0,s.default)(e,r);return{data:o,isLoading:t,error:n,isError:!!n}}0&&(module.exports={SWRProvider,useFetch});
2
+ //# sourceMappingURL=swr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/swr.ts","../src/providers/swr-provider.tsx","../src/hooks/use-fetch.ts"],"sourcesContent":["/**\n * @webdevarif/dashui-setup/swr\n *\n * SWR-only exports — no NextAuth / next-intl / Prisma dependencies.\n * Safe to use in any project that only needs SWR data fetching.\n *\n * Import:\n * import { SWRProvider } from '@webdevarif/dashui-setup/swr'\n * import { useFetch } from '@webdevarif/dashui-setup/swr'\n */\nexport { SWRProvider } from './providers/swr-provider'\nexport { useFetch } from './hooks/use-fetch'\n","'use client'\n\nimport { ReactNode } from 'react'\nimport { SWRConfig } from 'swr'\n\ninterface SWRProviderProps {\n children: ReactNode\n}\n\nconst DEFAULT_SWR_CONFIG = {\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n dedupingInterval: 60000,\n focusThrottleInterval: 300000,\n}\n\n/**\n * SWRProvider - Wraps your app with optimized SWR config\n * \n * Default config:\n * - revalidateOnFocus: false (no refresh on window focus)\n * - revalidateOnReconnect: true (refresh when network reconnects)\n * - dedupingInterval: 60s (deduplicate requests within 60s)\n * - focusThrottleInterval: 5min (throttle focus revalidation)\n * \n * Usage:\n * ```tsx\n * import { SWRProvider } from '@webdevarif/dashui-setup/providers'\n * \n * <SWRProvider>\n * <App />\n * </SWRProvider>\n * ```\n */\nexport function SWRProvider({ children }: SWRProviderProps) {\n return (\n <SWRConfig value={{ fetcher: (url) => fetch(url).then(r => r.json()), ...DEFAULT_SWR_CONFIG }}>\n {children}\n </SWRConfig>\n )\n}\n","import useSWR from 'swr'\n\n/**\n * useFetch - Simplified hook for data fetching with SWR\n * \n * Returns SWR hook result with built-in error handling\n * \n * Usage:\n * ```tsx\n * import { useFetch } from '@webdevarif/dashui-setup/hooks'\n * \n * function UserList() {\n * const { data, isLoading, error } = useFetch('/api/users')\n * \n * if (isLoading) return <div>Loading...</div>\n * if (error) return <div>Error: {error.message}</div>\n * \n * return (\n * <ul>\n * {data?.map(user => <li key={user.id}>{user.name}</li>)}\n * </ul>\n * )\n * }\n * ```\n */\nexport function useFetch<T = any>(\n url: string | null | undefined,\n options?: any\n) {\n const { data, error, isLoading } = useSWR<T>(url, options)\n\n return {\n data,\n isLoading,\n error,\n isError: !!error,\n }\n}\n"],"mappings":"0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,aAAAC,IAAA,eAAAC,EAAAJ,GCGA,IAAAK,EAA0B,eAiCtBC,EAAA,6BA3BEC,EAAqB,CACzB,kBAAmB,GACnB,sBAAuB,GACvB,iBAAkB,IAClB,sBAAuB,GACzB,EAoBO,SAASC,EAAY,CAAE,SAAAC,CAAS,EAAqB,CAC1D,SACE,OAAC,aAAU,MAAO,CAAE,QAAUC,GAAQ,MAAMA,CAAG,EAAE,KAAKC,GAAKA,EAAE,KAAK,CAAC,EAAG,GAAGJ,CAAmB,EACzF,SAAAE,EACH,CAEJ,CCxCA,IAAAG,EAAmB,kBAyBZ,SAASC,EACdC,EACAC,EACA,CACA,GAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,UAAAC,CAAU,KAAI,EAAAC,SAAUL,EAAKC,CAAO,EAEzD,MAAO,CACL,KAAAC,EACA,UAAAE,EACA,MAAAD,EACA,QAAS,CAAC,CAACA,CACb,CACF","names":["swr_exports","__export","SWRProvider","useFetch","__toCommonJS","import_swr","import_jsx_runtime","DEFAULT_SWR_CONFIG","SWRProvider","children","url","r","import_swr","useFetch","url","options","data","error","isLoading","useSWR"]}
package/dist/swr.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import{SWRConfig as i}from"swr";import{jsx as d}from"react/jsx-runtime";var c={revalidateOnFocus:!1,revalidateOnReconnect:!0,dedupingInterval:6e4,focusThrottleInterval:3e5};function a({children:e}){return d(i,{value:{fetcher:r=>fetch(r).then(o=>o.json()),...c},children:e})}import f from"swr";function s(e,r){let{data:o,error:t,isLoading:n}=f(e,r);return{data:o,isLoading:n,error:t,isError:!!t}}export{a as SWRProvider,s as useFetch};
2
+ //# sourceMappingURL=swr.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/providers/swr-provider.tsx","../src/hooks/use-fetch.ts"],"sourcesContent":["'use client'\n\nimport { ReactNode } from 'react'\nimport { SWRConfig } from 'swr'\n\ninterface SWRProviderProps {\n children: ReactNode\n}\n\nconst DEFAULT_SWR_CONFIG = {\n revalidateOnFocus: false,\n revalidateOnReconnect: true,\n dedupingInterval: 60000,\n focusThrottleInterval: 300000,\n}\n\n/**\n * SWRProvider - Wraps your app with optimized SWR config\n * \n * Default config:\n * - revalidateOnFocus: false (no refresh on window focus)\n * - revalidateOnReconnect: true (refresh when network reconnects)\n * - dedupingInterval: 60s (deduplicate requests within 60s)\n * - focusThrottleInterval: 5min (throttle focus revalidation)\n * \n * Usage:\n * ```tsx\n * import { SWRProvider } from '@webdevarif/dashui-setup/providers'\n * \n * <SWRProvider>\n * <App />\n * </SWRProvider>\n * ```\n */\nexport function SWRProvider({ children }: SWRProviderProps) {\n return (\n <SWRConfig value={{ fetcher: (url) => fetch(url).then(r => r.json()), ...DEFAULT_SWR_CONFIG }}>\n {children}\n </SWRConfig>\n )\n}\n","import useSWR from 'swr'\n\n/**\n * useFetch - Simplified hook for data fetching with SWR\n * \n * Returns SWR hook result with built-in error handling\n * \n * Usage:\n * ```tsx\n * import { useFetch } from '@webdevarif/dashui-setup/hooks'\n * \n * function UserList() {\n * const { data, isLoading, error } = useFetch('/api/users')\n * \n * if (isLoading) return <div>Loading...</div>\n * if (error) return <div>Error: {error.message}</div>\n * \n * return (\n * <ul>\n * {data?.map(user => <li key={user.id}>{user.name}</li>)}\n * </ul>\n * )\n * }\n * ```\n */\nexport function useFetch<T = any>(\n url: string | null | undefined,\n options?: any\n) {\n const { data, error, isLoading } = useSWR<T>(url, options)\n\n return {\n data,\n isLoading,\n error,\n isError: !!error,\n }\n}\n"],"mappings":"AAGA,OAAS,aAAAA,MAAiB,MAiCtB,cAAAC,MAAA,oBA3BJ,IAAMC,EAAqB,CACzB,kBAAmB,GACnB,sBAAuB,GACvB,iBAAkB,IAClB,sBAAuB,GACzB,EAoBO,SAASC,EAAY,CAAE,SAAAC,CAAS,EAAqB,CAC1D,OACEH,EAACD,EAAA,CAAU,MAAO,CAAE,QAAUK,GAAQ,MAAMA,CAAG,EAAE,KAAKC,GAAKA,EAAE,KAAK,CAAC,EAAG,GAAGJ,CAAmB,EACzF,SAAAE,EACH,CAEJ,CCxCA,OAAOG,MAAY,MAyBZ,SAASC,EACdC,EACAC,EACA,CACA,GAAM,CAAE,KAAAC,EAAM,MAAAC,EAAO,UAAAC,CAAU,EAAIN,EAAUE,EAAKC,CAAO,EAEzD,MAAO,CACL,KAAAC,EACA,UAAAE,EACA,MAAAD,EACA,QAAS,CAAC,CAACA,CACb,CACF","names":["SWRConfig","jsx","DEFAULT_SWR_CONFIG","SWRProvider","children","url","r","useSWR","useFetch","url","options","data","error","isLoading"]}
package/package.json CHANGED
@@ -1,18 +1,8 @@
1
1
  {
2
2
  "name": "@webdevarif/dashui-setup",
3
- "version": "0.1.0",
4
- "description": "Zero-config providers, hooks, and middleware for Next.js + NextAuth + Next-intl + SWR + Prisma",
5
- "keywords": [
6
- "dashui",
7
- "nextjs",
8
- "nextauth",
9
- "next-intl",
10
- "swr",
11
- "prisma",
12
- "setup",
13
- "providers",
14
- "hooks"
15
- ],
3
+ "version": "0.2.0",
4
+ "description": "Zero-config providers, hooks, and middleware for Next.js + NextAuth + SWR (+ optional next-intl, Prisma)",
5
+ "keywords": ["dashui", "nextjs", "nextauth", "swr", "providers", "hooks"],
16
6
  "author": "webdevarif",
17
7
  "license": "MIT",
18
8
  "main": "./dist/index.js",
@@ -24,32 +14,28 @@
24
14
  "import": "./dist/index.mjs",
25
15
  "require": "./dist/index.js"
26
16
  },
17
+ "./swr": {
18
+ "types": "./dist/swr.d.ts",
19
+ "import": "./dist/swr.mjs",
20
+ "require": "./dist/swr.js"
21
+ },
27
22
  "./providers": {
28
- "types": "./dist/providers/index.d.ts",
29
- "import": "./dist/providers/index.mjs",
30
- "require": "./dist/providers/index.js"
23
+ "types": "./dist/providers.d.ts",
24
+ "import": "./dist/providers.mjs",
25
+ "require": "./dist/providers.js"
31
26
  },
32
27
  "./hooks": {
33
- "types": "./dist/hooks/index.d.ts",
34
- "import": "./dist/hooks/index.mjs",
35
- "require": "./dist/hooks/index.js"
36
- },
37
- "./middleware": {
38
- "types": "./dist/middleware/index.d.ts",
39
- "import": "./dist/middleware/index.mjs",
40
- "require": "./dist/middleware/index.js"
28
+ "types": "./dist/hooks.d.ts",
29
+ "import": "./dist/hooks.mjs",
30
+ "require": "./dist/hooks.js"
41
31
  },
42
32
  "./lib": {
43
- "types": "./dist/lib/index.d.ts",
44
- "import": "./dist/lib/index.mjs",
45
- "require": "./dist/lib/index.js"
33
+ "types": "./dist/lib.d.ts",
34
+ "import": "./dist/lib.mjs",
35
+ "require": "./dist/lib.js"
46
36
  }
47
37
  },
48
- "files": [
49
- "dist",
50
- "templates",
51
- "README.md"
52
- ],
38
+ "files": ["dist", "templates", "README.md"],
53
39
  "scripts": {
54
40
  "build": "tsup",
55
41
  "dev": "tsup --watch",
@@ -57,12 +43,14 @@
57
43
  },
58
44
  "peerDependencies": {
59
45
  "next": ">=14",
60
- "next-auth": ">=5",
61
- "next-intl": ">=3",
62
- "swr": ">=2",
63
- "@prisma/client": ">=5",
64
46
  "react": ">=18",
65
- "react-dom": ">=18"
47
+ "react-dom": ">=18",
48
+ "swr": ">=2",
49
+ "next-auth": ">=4"
50
+ },
51
+ "peerDependenciesMeta": {
52
+ "next-intl": { "optional": true },
53
+ "@prisma/client": { "optional": true }
66
54
  },
67
55
  "devDependencies": {
68
56
  "@types/node": "^20",
@@ -71,7 +59,5 @@
71
59
  "tsup": "^8.3.5",
72
60
  "typescript": "^5"
73
61
  },
74
- "publishConfig": {
75
- "access": "public"
76
- }
62
+ "publishConfig": { "access": "public" }
77
63
  }