dn-react-router-toolkit 0.1.1 → 0.1.2

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.
Files changed (284) hide show
  1. package/dist/auth-kit/apple_auth.d.mts +24 -0
  2. package/dist/{esm/auth-kit → auth-kit}/apple_auth.d.ts +11 -2
  3. package/dist/auth-kit/apple_auth.js +75 -0
  4. package/dist/auth-kit/apple_auth.mjs +50 -0
  5. package/dist/auth-kit/auth_service.d.mts +73 -0
  6. package/dist/{esm/auth-kit → auth-kit}/auth_service.d.ts +17 -11
  7. package/dist/auth-kit/auth_service.js +257 -0
  8. package/dist/auth-kit/auth_service.mjs +218 -0
  9. package/dist/auth-kit/client/google_login_button.d.mts +9 -0
  10. package/dist/auth-kit/client/google_login_button.d.ts +9 -0
  11. package/dist/auth-kit/client/google_login_button.js +67 -0
  12. package/dist/auth-kit/client/google_login_button.mjs +32 -0
  13. package/dist/auth-kit/client/redirect_page.d.mts +5 -0
  14. package/dist/auth-kit/client/redirect_page.d.ts +5 -0
  15. package/dist/auth-kit/client/redirect_page.js +53 -0
  16. package/dist/auth-kit/client/redirect_page.mjs +18 -0
  17. package/dist/auth-kit/google_auth.d.mts +27 -0
  18. package/dist/{esm/auth-kit → auth-kit}/google_auth.d.ts +11 -2
  19. package/dist/auth-kit/google_auth.js +144 -0
  20. package/dist/auth-kit/google_auth.mjs +117 -0
  21. package/dist/auth-kit/jwt.d.mts +18 -0
  22. package/dist/{esm/auth-kit → auth-kit}/jwt.d.ts +5 -2
  23. package/dist/auth-kit/jwt.js +76 -0
  24. package/dist/auth-kit/jwt.mjs +51 -0
  25. package/dist/auth-kit/kakao_auth.d.mts +24 -0
  26. package/dist/{esm/auth-kit → auth-kit}/kakao_auth.d.ts +11 -2
  27. package/dist/auth-kit/kakao_auth.js +115 -0
  28. package/dist/auth-kit/kakao_auth.mjs +88 -0
  29. package/dist/auth-kit/repository.d.mts +42 -0
  30. package/dist/{esm/auth-kit → auth-kit}/repository.d.ts +3 -1
  31. package/dist/auth-kit/repository.js +18 -0
  32. package/dist/auth-kit/repository.mjs +0 -0
  33. package/dist/auth-kit/with_auth.d.mts +17 -0
  34. package/dist/auth-kit/with_auth.d.ts +17 -0
  35. package/dist/auth-kit/with_auth.js +108 -0
  36. package/dist/auth-kit/with_auth.mjs +71 -0
  37. package/dist/cn.d.mts +3 -0
  38. package/dist/cn.d.ts +3 -0
  39. package/dist/cn.js +32 -0
  40. package/dist/cn.mjs +7 -0
  41. package/dist/components/index.d.mts +5 -0
  42. package/dist/components/index.d.ts +5 -0
  43. package/dist/components/index.js +261 -0
  44. package/dist/components/index.mjs +219 -0
  45. package/dist/components/modal/fullscreen_container.d.mts +7 -0
  46. package/dist/components/modal/fullscreen_container.d.ts +7 -0
  47. package/dist/components/modal/fullscreen_container.js +102 -0
  48. package/dist/components/modal/fullscreen_container.mjs +68 -0
  49. package/dist/components/modal/hooks.d.mts +18 -0
  50. package/dist/components/modal/hooks.d.ts +18 -0
  51. package/dist/components/modal/hooks.js +236 -0
  52. package/dist/components/modal/hooks.mjs +204 -0
  53. package/dist/components/modal/index.d.mts +4 -0
  54. package/dist/components/modal/index.d.ts +4 -0
  55. package/dist/components/modal/index.js +238 -0
  56. package/dist/components/modal/index.mjs +203 -0
  57. package/dist/components/modal/modal.d.mts +13 -0
  58. package/dist/components/modal/modal.d.ts +13 -0
  59. package/dist/components/modal/modal.js +155 -0
  60. package/dist/components/modal/modal.mjs +130 -0
  61. package/dist/components/styles.d.mts +9 -0
  62. package/dist/components/styles.d.ts +9 -0
  63. package/dist/components/styles.js +48 -0
  64. package/dist/components/styles.mjs +17 -0
  65. package/dist/date.d.mts +3 -0
  66. package/dist/date.d.ts +3 -0
  67. package/dist/date.js +63 -0
  68. package/dist/date.mjs +28 -0
  69. package/dist/file-kit/cdn.d.mts +5 -0
  70. package/dist/file-kit/cdn.d.ts +5 -0
  71. package/dist/file-kit/cdn.js +34 -0
  72. package/dist/file-kit/cdn.mjs +9 -0
  73. package/dist/file-kit/client/drop_file_input.d.mts +33 -0
  74. package/dist/{esm/file-kit → file-kit}/client/drop_file_input.d.ts +10 -8
  75. package/dist/file-kit/client/drop_file_input.js +235 -0
  76. package/dist/file-kit/client/drop_file_input.mjs +205 -0
  77. package/dist/file-kit/client/file_uploader.d.mts +13 -0
  78. package/dist/{esm/file-kit → file-kit}/client/file_uploader.d.ts +4 -2
  79. package/dist/file-kit/client/file_uploader.js +115 -0
  80. package/dist/file-kit/client/file_uploader.mjs +90 -0
  81. package/dist/file-kit/file_service.d.mts +26 -0
  82. package/dist/{esm/file-kit → file-kit}/file_service.d.ts +7 -4
  83. package/dist/file-kit/file_service.js +60 -0
  84. package/dist/file-kit/file_service.mjs +35 -0
  85. package/dist/file-kit/object_storage.d.mts +17 -0
  86. package/dist/{esm/file-kit → file-kit}/object_storage.d.ts +6 -2
  87. package/dist/file-kit/object_storage.js +78 -0
  88. package/dist/file-kit/object_storage.mjs +57 -0
  89. package/dist/file-kit/repository.d.mts +16 -0
  90. package/dist/{esm/file-kit → file-kit}/repository.d.ts +3 -1
  91. package/dist/file-kit/repository.js +18 -0
  92. package/dist/file-kit/repository.mjs +0 -0
  93. package/dist/file-kit/responsive_image.d.mts +20 -0
  94. package/dist/file-kit/responsive_image.d.ts +20 -0
  95. package/dist/file-kit/responsive_image.js +123 -0
  96. package/dist/file-kit/responsive_image.mjs +87 -0
  97. package/dist/http-kit/index.d.mts +1 -0
  98. package/dist/http-kit/index.d.ts +1 -0
  99. package/dist/http-kit/index.js +111 -0
  100. package/dist/http-kit/index.mjs +68 -0
  101. package/dist/http-kit/response.d.mts +19 -0
  102. package/dist/http-kit/response.d.ts +19 -0
  103. package/dist/http-kit/response.js +109 -0
  104. package/dist/http-kit/response.mjs +68 -0
  105. package/dist/index.d.mts +4 -0
  106. package/dist/index.d.ts +4 -0
  107. package/dist/index.js +91 -0
  108. package/dist/index.mjs +51 -0
  109. package/dist/route/api/auth/login/[provider]/route.js +113 -0
  110. package/dist/route/api/auth/login/[provider]/route.mjs +86 -0
  111. package/dist/route/api/auth/login/_provider_/route.d.mts +20 -0
  112. package/dist/route/api/auth/login/_provider_/route.d.ts +20 -0
  113. package/dist/route/api/auth/login/route.d.mts +14 -0
  114. package/dist/route/api/auth/login/route.d.ts +14 -0
  115. package/dist/route/api/auth/login/route.js +107 -0
  116. package/dist/route/api/auth/login/route.mjs +80 -0
  117. package/dist/route/api/auth/logout/route.d.mts +14 -0
  118. package/dist/route/api/auth/logout/route.d.ts +14 -0
  119. package/dist/route/api/auth/logout/route.js +98 -0
  120. package/dist/route/api/auth/logout/route.mjs +71 -0
  121. package/dist/route/api/auth/refresh/route.d.mts +13 -0
  122. package/dist/route/api/auth/refresh/route.d.ts +13 -0
  123. package/dist/route/api/auth/refresh/route.js +92 -0
  124. package/dist/route/api/auth/refresh/route.mjs +65 -0
  125. package/dist/route/api/auth/route.d.mts +13 -0
  126. package/dist/route/api/auth/route.d.ts +13 -0
  127. package/dist/route/api/auth/route.js +82 -0
  128. package/dist/route/api/auth/route.mjs +55 -0
  129. package/dist/route/api/files/[fileId]/route.js +99 -0
  130. package/dist/route/api/files/[fileId]/route.mjs +72 -0
  131. package/dist/route/api/files/_fileId_/route.d.mts +17 -0
  132. package/dist/route/api/files/_fileId_/route.d.ts +17 -0
  133. package/dist/route/api/files/route.d.mts +16 -0
  134. package/dist/route/api/files/route.d.ts +16 -0
  135. package/dist/route/api/files/route.js +106 -0
  136. package/dist/route/api/files/route.mjs +79 -0
  137. package/dist/route/api.d.mts +29 -0
  138. package/dist/route/api.d.ts +29 -0
  139. package/dist/route/api.js +395 -0
  140. package/dist/route/api.mjs +368 -0
  141. package/dist/route/auth/callback/[provider]/route.js +120 -0
  142. package/dist/route/auth/callback/[provider]/route.mjs +93 -0
  143. package/dist/route/auth/callback/_provider_/route.d.mts +20 -0
  144. package/dist/route/auth/callback/_provider_/route.d.ts +20 -0
  145. package/dist/seo-kit/index.d.mts +6 -0
  146. package/dist/seo-kit/index.d.ts +6 -0
  147. package/dist/seo-kit/index.js +321 -0
  148. package/dist/seo-kit/index.mjs +282 -0
  149. package/dist/seo-kit/loader.d.mts +7 -0
  150. package/dist/seo-kit/loader.d.ts +7 -0
  151. package/dist/seo-kit/loader.js +43 -0
  152. package/dist/seo-kit/loader.mjs +18 -0
  153. package/dist/seo-kit/seo.d.mts +103 -0
  154. package/dist/{esm/seo-kit → seo-kit}/seo.d.ts +10 -6
  155. package/dist/seo-kit/seo.js +286 -0
  156. package/dist/seo-kit/seo.mjs +251 -0
  157. package/dist/seo-kit/seo_loader.d.mts +16 -0
  158. package/dist/seo-kit/seo_loader.d.ts +16 -0
  159. package/dist/seo-kit/seo_loader.js +68 -0
  160. package/dist/seo-kit/seo_loader.mjs +31 -0
  161. package/dist/singleton.d.mts +3 -0
  162. package/dist/singleton.d.ts +3 -0
  163. package/dist/singleton.js +37 -0
  164. package/dist/singleton.mjs +12 -0
  165. package/dist/slug.d.mts +3 -0
  166. package/dist/slug.d.ts +3 -0
  167. package/dist/slug.js +32 -0
  168. package/dist/slug.mjs +7 -0
  169. package/package.json +36 -34
  170. package/tsup.config.ts +9 -0
  171. package/dist/cjs/auth-kit/apple_auth.js +0 -61
  172. package/dist/cjs/auth-kit/auth_service.js +0 -204
  173. package/dist/cjs/auth-kit/client/google_login_button.js +0 -19
  174. package/dist/cjs/auth-kit/client/redirect_page.js +0 -18
  175. package/dist/cjs/auth-kit/google_auth.js +0 -69
  176. package/dist/cjs/auth-kit/jwt.js +0 -54
  177. package/dist/cjs/auth-kit/kakao_auth.js +0 -43
  178. package/dist/cjs/auth-kit/repository.js +0 -2
  179. package/dist/cjs/auth-kit/with_auth.js +0 -46
  180. package/dist/cjs/cn.js +0 -6
  181. package/dist/cjs/components/index.js +0 -18
  182. package/dist/cjs/components/modal/fullscreen_container.js +0 -49
  183. package/dist/cjs/components/modal/hooks.js +0 -76
  184. package/dist/cjs/components/modal/index.js +0 -19
  185. package/dist/cjs/components/modal/modal.js +0 -79
  186. package/dist/cjs/components/styles.js +0 -10
  187. package/dist/cjs/date.js +0 -31
  188. package/dist/cjs/file-kit/cdn.js +0 -9
  189. package/dist/cjs/file-kit/client/drop_file_input.js +0 -148
  190. package/dist/cjs/file-kit/client/file_uploader.js +0 -88
  191. package/dist/cjs/file-kit/file_service.js +0 -32
  192. package/dist/cjs/file-kit/object_storage.js +0 -51
  193. package/dist/cjs/file-kit/repository.js +0 -2
  194. package/dist/cjs/file-kit/responsive_image.js +0 -63
  195. package/dist/cjs/http-kit/index.js +0 -17
  196. package/dist/cjs/http-kit/response.js +0 -37
  197. package/dist/cjs/index.js +0 -20
  198. package/dist/cjs/route/api/auth/login/[provider]/route.js +0 -36
  199. package/dist/cjs/route/api/auth/login/route.js +0 -35
  200. package/dist/cjs/route/api/auth/logout/route.js +0 -22
  201. package/dist/cjs/route/api/auth/refresh/route.js +0 -22
  202. package/dist/cjs/route/api/auth/route.js +0 -12
  203. package/dist/cjs/route/api/files/[fileId]/route.js +0 -20
  204. package/dist/cjs/route/api/files/route.js +0 -34
  205. package/dist/cjs/route/auth/callback/[provider]/route.js +0 -38
  206. package/dist/cjs/route/index.js +0 -80
  207. package/dist/cjs/seo-kit/index.js +0 -19
  208. package/dist/cjs/seo-kit/loader.js +0 -17
  209. package/dist/cjs/seo-kit/seo.js +0 -278
  210. package/dist/cjs/seo-kit/seo_loader.js +0 -15
  211. package/dist/cjs/singleton.js +0 -12
  212. package/dist/cjs/slug.js +0 -10
  213. package/dist/esm/auth-kit/apple_auth.js +0 -57
  214. package/dist/esm/auth-kit/auth_service.js +0 -197
  215. package/dist/esm/auth-kit/client/google_login_button.d.ts +0 -5
  216. package/dist/esm/auth-kit/client/google_login_button.js +0 -16
  217. package/dist/esm/auth-kit/client/redirect_page.d.ts +0 -1
  218. package/dist/esm/auth-kit/client/redirect_page.js +0 -15
  219. package/dist/esm/auth-kit/google_auth.js +0 -65
  220. package/dist/esm/auth-kit/jwt.js +0 -50
  221. package/dist/esm/auth-kit/kakao_auth.js +0 -39
  222. package/dist/esm/auth-kit/repository.js +0 -1
  223. package/dist/esm/auth-kit/with_auth.d.ts +0 -12
  224. package/dist/esm/auth-kit/with_auth.js +0 -43
  225. package/dist/esm/cn.d.ts +0 -1
  226. package/dist/esm/cn.js +0 -3
  227. package/dist/esm/components/index.d.ts +0 -2
  228. package/dist/esm/components/index.js +0 -2
  229. package/dist/esm/components/modal/fullscreen_container.d.ts +0 -5
  230. package/dist/esm/components/modal/fullscreen_container.js +0 -45
  231. package/dist/esm/components/modal/hooks.d.ts +0 -15
  232. package/dist/esm/components/modal/hooks.js +0 -67
  233. package/dist/esm/components/modal/index.d.ts +0 -3
  234. package/dist/esm/components/modal/index.js +0 -3
  235. package/dist/esm/components/modal/modal.d.ts +0 -10
  236. package/dist/esm/components/modal/modal.js +0 -43
  237. package/dist/esm/components/styles.d.ts +0 -7
  238. package/dist/esm/components/styles.js +0 -7
  239. package/dist/esm/date.d.ts +0 -1
  240. package/dist/esm/date.js +0 -24
  241. package/dist/esm/file-kit/cdn.d.ts +0 -3
  242. package/dist/esm/file-kit/cdn.js +0 -5
  243. package/dist/esm/file-kit/client/drop_file_input.js +0 -144
  244. package/dist/esm/file-kit/client/file_uploader.js +0 -84
  245. package/dist/esm/file-kit/file_service.js +0 -28
  246. package/dist/esm/file-kit/object_storage.js +0 -47
  247. package/dist/esm/file-kit/repository.js +0 -1
  248. package/dist/esm/file-kit/responsive_image.d.ts +0 -17
  249. package/dist/esm/file-kit/responsive_image.js +0 -58
  250. package/dist/esm/http-kit/index.d.ts +0 -1
  251. package/dist/esm/http-kit/index.js +0 -1
  252. package/dist/esm/http-kit/response.d.ts +0 -17
  253. package/dist/esm/http-kit/response.js +0 -31
  254. package/dist/esm/index.d.ts +0 -4
  255. package/dist/esm/index.js +0 -4
  256. package/dist/esm/route/api/auth/login/[provider]/route.d.ts +0 -10
  257. package/dist/esm/route/api/auth/login/[provider]/route.js +0 -32
  258. package/dist/esm/route/api/auth/login/route.d.ts +0 -6
  259. package/dist/esm/route/api/auth/login/route.js +0 -31
  260. package/dist/esm/route/api/auth/logout/route.d.ts +0 -6
  261. package/dist/esm/route/api/auth/logout/route.js +0 -18
  262. package/dist/esm/route/api/auth/refresh/route.d.ts +0 -4
  263. package/dist/esm/route/api/auth/refresh/route.js +0 -18
  264. package/dist/esm/route/api/auth/route.d.ts +0 -4
  265. package/dist/esm/route/api/auth/route.js +0 -8
  266. package/dist/esm/route/api/files/[fileId]/route.d.ts +0 -8
  267. package/dist/esm/route/api/files/[fileId]/route.js +0 -16
  268. package/dist/esm/route/api/files/route.d.ts +0 -6
  269. package/dist/esm/route/api/files/route.js +0 -30
  270. package/dist/esm/route/auth/callback/[provider]/route.d.ts +0 -11
  271. package/dist/esm/route/auth/callback/[provider]/route.js +0 -34
  272. package/dist/esm/route/index.d.ts +0 -22
  273. package/dist/esm/route/index.js +0 -76
  274. package/dist/esm/seo-kit/index.d.ts +0 -3
  275. package/dist/esm/seo-kit/index.js +0 -3
  276. package/dist/esm/seo-kit/loader.d.ts +0 -5
  277. package/dist/esm/seo-kit/loader.js +0 -14
  278. package/dist/esm/seo-kit/seo.js +0 -275
  279. package/dist/esm/seo-kit/seo_loader.d.ts +0 -12
  280. package/dist/esm/seo-kit/seo_loader.js +0 -12
  281. package/dist/esm/singleton.d.ts +0 -1
  282. package/dist/esm/singleton.js +0 -9
  283. package/dist/esm/slug.d.ts +0 -1
  284. package/dist/esm/slug.js +0 -6
@@ -0,0 +1,16 @@
1
+ import { LoaderFn } from './loader.js';
2
+ import * as react_router from 'react-router';
3
+ import React, { JSX } from 'react';
4
+ import { SEO } from './seo.js';
5
+ import 'schema-dts';
6
+
7
+ declare function createSEOLoader<T, U extends JSX.IntrinsicAttributes & {
8
+ seo: SEO;
9
+ }>(fn?: LoaderFn<T, U>): {
10
+ meta: (props: T) => Promise<react_router.MetaFunction<unknown, Record<string, unknown>>>;
11
+ Page(Fc: React.FC<U>): (props: T) => Promise<JSX.Element>;
12
+ getData(): U;
13
+ wrap<V>(mapper: (props: U) => V | Promise<V>): (props: T) => Promise<V>;
14
+ };
15
+
16
+ export { createSEOLoader };
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/seo-kit/seo_loader.tsx
31
+ var seo_loader_exports = {};
32
+ __export(seo_loader_exports, {
33
+ createSEOLoader: () => createSEOLoader
34
+ });
35
+ module.exports = __toCommonJS(seo_loader_exports);
36
+
37
+ // src/seo-kit/loader.ts
38
+ function createLoader(fn = () => ({})) {
39
+ let loadedData;
40
+ return {
41
+ getData() {
42
+ return loadedData;
43
+ },
44
+ wrap(mapper) {
45
+ return async function Thing(props) {
46
+ loadedData = await fn(props);
47
+ return mapper(loadedData);
48
+ };
49
+ }
50
+ };
51
+ }
52
+
53
+ // src/seo-kit/seo_loader.tsx
54
+ var import_react = __toESM(require("react"));
55
+ function createSEOLoader(fn = () => ({})) {
56
+ const loader = createLoader(fn);
57
+ return {
58
+ ...loader,
59
+ meta: loader.wrap((data) => data.seo.meta),
60
+ Page(Fc) {
61
+ return loader.wrap((data) => /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, data.seo?.generateJSONLD(), /* @__PURE__ */ import_react.default.createElement(Fc, { ...data })));
62
+ }
63
+ };
64
+ }
65
+ // Annotate the CommonJS export names for ESM import in node:
66
+ 0 && (module.exports = {
67
+ createSEOLoader
68
+ });
@@ -0,0 +1,31 @@
1
+ // src/seo-kit/loader.ts
2
+ function createLoader(fn = () => ({})) {
3
+ let loadedData;
4
+ return {
5
+ getData() {
6
+ return loadedData;
7
+ },
8
+ wrap(mapper) {
9
+ return async function Thing(props) {
10
+ loadedData = await fn(props);
11
+ return mapper(loadedData);
12
+ };
13
+ }
14
+ };
15
+ }
16
+
17
+ // src/seo-kit/seo_loader.tsx
18
+ import React from "react";
19
+ function createSEOLoader(fn = () => ({})) {
20
+ const loader = createLoader(fn);
21
+ return {
22
+ ...loader,
23
+ meta: loader.wrap((data) => data.seo.meta),
24
+ Page(Fc) {
25
+ return loader.wrap((data) => /* @__PURE__ */ React.createElement(React.Fragment, null, data.seo?.generateJSONLD(), /* @__PURE__ */ React.createElement(Fc, { ...data })));
26
+ }
27
+ };
28
+ }
29
+ export {
30
+ createSEOLoader
31
+ };
@@ -0,0 +1,3 @@
1
+ declare function singleton<T>(name: string, fn: () => T): T;
2
+
3
+ export { singleton };
@@ -0,0 +1,3 @@
1
+ declare function singleton<T>(name: string, fn: () => T): T;
2
+
3
+ export { singleton };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/singleton.ts
21
+ var singleton_exports = {};
22
+ __export(singleton_exports, {
23
+ singleton: () => singleton
24
+ });
25
+ module.exports = __toCommonJS(singleton_exports);
26
+ function singleton(name, fn) {
27
+ const globalAny = globalThis;
28
+ globalAny.__singletons = globalAny.__singletons || {};
29
+ if (!globalAny.__singletons[name]) {
30
+ globalAny.__singletons[name] = fn();
31
+ }
32
+ return globalAny.__singletons[name];
33
+ }
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ singleton
37
+ });
@@ -0,0 +1,12 @@
1
+ // src/singleton.ts
2
+ function singleton(name, fn) {
3
+ const globalAny = globalThis;
4
+ globalAny.__singletons = globalAny.__singletons || {};
5
+ if (!globalAny.__singletons[name]) {
6
+ globalAny.__singletons[name] = fn();
7
+ }
8
+ return globalAny.__singletons[name];
9
+ }
10
+ export {
11
+ singleton
12
+ };
@@ -0,0 +1,3 @@
1
+ declare const toSlug: (str: string) => string;
2
+
3
+ export { toSlug };
package/dist/slug.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ declare const toSlug: (str: string) => string;
2
+
3
+ export { toSlug };
package/dist/slug.js ADDED
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/slug.ts
21
+ var slug_exports = {};
22
+ __export(slug_exports, {
23
+ toSlug: () => toSlug
24
+ });
25
+ module.exports = __toCommonJS(slug_exports);
26
+ var toSlug = (str) => {
27
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
28
+ };
29
+ // Annotate the CommonJS export names for ESM import in node:
30
+ 0 && (module.exports = {
31
+ toSlug
32
+ });
package/dist/slug.mjs ADDED
@@ -0,0 +1,7 @@
1
+ // src/slug.ts
2
+ var toSlug = (str) => {
3
+ return str.toLowerCase().replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-").replace(/^-|-$/g, "");
4
+ };
5
+ export {
6
+ toSlug
7
+ };
package/package.json CHANGED
@@ -1,48 +1,49 @@
1
1
  {
2
2
  "name": "dn-react-router-toolkit",
3
- "version": "0.1.1",
4
- "types": "./dist/esm/index.d.ts",
5
- "main": "./dist/cjs/index.js",
6
- "module": "./dist/esm/index.js",
3
+ "version": "0.1.2",
4
+ "types": "./dist/index.d.ts",
5
+ "main": "./dist/index.mjs",
6
+ "module": "./dist/index.js",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./dist/esm/index.d.ts",
10
- "import": "./dist/esm/index.js",
11
- "require": "./dist/cjs/index.js"
12
- },
13
- "./route": {
14
- "types": "./dist/esm/route/index.d.ts",
15
- "import": "./dist/esm/route/index.js",
16
- "require": "./dist/cjs/route/index.js"
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js"
17
12
  },
18
13
  "./auth-kit/*": {
19
- "types": "./dist/esm/auth-kit/*.d.ts",
20
- "import": "./dist/esm/auth-kit/*.js",
21
- "require": "./dist/cjs/auth-kit/*.js"
14
+ "types": "./dist/auth-kit/*.d.ts",
15
+ "import": "./dist/auth-kit/*.mjs",
16
+ "require": "./dist/auth-kit/*.js"
17
+ },
18
+ "./file-kit/*": {
19
+ "types": "./dist/file-kit/*.d.ts",
20
+ "import": "./dist/file-kit/*.mjs",
21
+ "require": "./dist/file-kit/*.js"
22
22
  },
23
- "./components": {
24
- "types": "./dist/esm/components/index.d.ts",
25
- "import": "./dist/esm/components/index.js",
26
- "require": "./dist/cjs/components/index.js"
23
+ "./route/*": {
24
+ "types": "./dist/route/*.d.ts",
25
+ "import": "./dist/route/*.mjs",
26
+ "require": "./dist/route/*.js"
27
27
  },
28
- "./http-kit": {
29
- "types": "./dist/esm/http-kit/index.d.ts",
30
- "import": "./dist/esm/http-kit/index.js",
31
- "require": "./dist/cjs/http-kit/index.js"
28
+ "./components/*": {
29
+ "types": "./dist/components/*.d.ts",
30
+ "import": "./dist/components/*.mjs",
31
+ "require": "./dist/components/*.js"
32
32
  },
33
- "./file-kit/*": {
34
- "types": "./dist/esm/file-kit/*.d.ts",
35
- "import": "./dist/esm/file-kit/*.js",
36
- "require": "./dist/cjs/file-kit/*.js"
33
+ "./http-kit/*": {
34
+ "types": "./dist/http-kit/*.d.ts",
35
+ "import": "./dist/http-kit/*.mjs",
36
+ "require": "./dist/http-kit/*.js"
37
37
  },
38
- "./seo-kit": {
39
- "types": "./dist/esm/seo-kit/index.d.ts",
40
- "import": "./dist/esm/seo-kit/index.js",
41
- "require": "./dist/cjs/seo-kit/index.js"
38
+ "./seo-kit/*": {
39
+ "types": "./dist/seo-kit/*.d.ts",
40
+ "import": "./dist/seo-kit/*.mjs",
41
+ "require": "./dist/seo-kit/*.js"
42
42
  }
43
43
  },
44
44
  "scripts": {
45
- "build": "rimraf dist && tsc -p tsconfig.cjs.json && tsc -p tsconfig.json"
45
+ "build": "tsup",
46
+ "dev": "tsup --watch"
46
47
  },
47
48
  "repository": {
48
49
  "type": "git",
@@ -61,6 +62,7 @@
61
62
  "@types/react-dom": "^19",
62
63
  "rimraf": "^6.0.1",
63
64
  "schema-dts": "^1.1.5",
65
+ "tsup": "^8.5.1",
64
66
  "typescript": "^5.7.3"
65
67
  },
66
68
  "dependencies": {
@@ -74,8 +76,8 @@
74
76
  },
75
77
  "peerDependencies": {
76
78
  "drizzle-orm": "^0.44",
77
- "react-router": "^7",
78
79
  "react": "^19",
79
- "react-dom": "^19"
80
+ "react-dom": "^19",
81
+ "react-router": "^7"
80
82
  }
81
83
  }
package/tsup.config.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { defineConfig } from "tsup";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/**/*.ts", "src/**/*.tsx"], // Your entry file(s)
5
+ format: ["cjs", "esm"], // Output both CommonJS (.cjs) and ESM (.js/.mjs)
6
+ dts: true, // Generate .d.ts files for both formats
7
+ splitting: false,
8
+ clean: true, // Clean dist folder before build
9
+ });
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AppleAuth = void 0;
4
- const jose_1 = require("jose");
5
- class AppleAuth {
6
- AUTH;
7
- constructor(AUTH) {
8
- this.AUTH = AUTH;
9
- }
10
- async signIn(code, type = "web") {
11
- const url = "https://appleid.apple.com/auth/token";
12
- const client_secret = await this.generateAppleClientSecret(type);
13
- const res = await fetch(url, {
14
- method: "POST",
15
- headers: {
16
- "Content-Type": "application/x-www-form-urlencoded",
17
- },
18
- body: new URLSearchParams({
19
- client_id: type === "web"
20
- ? process.env.APPLE_SERVICE_ID
21
- : process.env.APPLE_CLIENT_ID,
22
- client_secret,
23
- code,
24
- grant_type: "authorization_code",
25
- }),
26
- });
27
- if (!res.ok) {
28
- console.error(await res.text());
29
- throw new Error("Apple 인증에 실패했습니다.");
30
- }
31
- const data = await res.json();
32
- const { id_token } = data;
33
- const payload = (0, jose_1.decodeJwt)(id_token);
34
- const { sub, email, name } = payload;
35
- const user = await this.AUTH.getOrCreateUser("apple", {
36
- id: sub,
37
- email,
38
- name,
39
- });
40
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
41
- return { user, accessToken, refreshToken };
42
- }
43
- async generateAppleClientSecret(type = "web") {
44
- const authKey = process.env.APPLE_AUTH_KEY;
45
- const teamId = process.env.APPLE_TEAM_ID;
46
- const keyId = process.env.APPLE_KEY_ID;
47
- const clientId = type === "web"
48
- ? process.env.APPLE_SERVICE_ID
49
- : process.env.APPLE_CLIENT_ID;
50
- const keyObject = await (0, jose_1.importPKCS8)(authKey, "ES256");
51
- return new jose_1.SignJWT()
52
- .setProtectedHeader({ alg: "ES256", kid: keyId })
53
- .setIssuedAt()
54
- .setIssuer(teamId)
55
- .setExpirationTime("1h")
56
- .setAudience("https://appleid.apple.com")
57
- .setSubject(clientId)
58
- .sign(keyObject);
59
- }
60
- }
61
- exports.AppleAuth = AppleAuth;
@@ -1,204 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.AuthService = exports.REFRESH_TOKEN_COOKIE = exports.ACCESS_TOKEN_COOKIE = exports.REFRESH_TOKEN_KEY = exports.ACCESS_TOKEN_KEY = void 0;
7
- const bcryptjs_1 = __importDefault(require("bcryptjs"));
8
- const uuid_1 = require("uuid");
9
- const react_router_1 = require("react-router");
10
- exports.ACCESS_TOKEN_KEY = "access_token";
11
- exports.REFRESH_TOKEN_KEY = "refresh_token";
12
- exports.ACCESS_TOKEN_COOKIE = (0, react_router_1.createCookie)(exports.ACCESS_TOKEN_KEY, {
13
- path: "/",
14
- httpOnly: process.env.NODE_ENV === "production",
15
- secure: process.env.NODE_ENV === "production",
16
- sameSite: "strict",
17
- });
18
- exports.REFRESH_TOKEN_COOKIE = (0, react_router_1.createCookie)(exports.REFRESH_TOKEN_KEY, {
19
- path: "/",
20
- httpOnly: process.env.NODE_ENV === "production",
21
- secure: process.env.NODE_ENV === "production",
22
- sameSite: "strict",
23
- });
24
- class AuthService {
25
- repository;
26
- JWT_MANAGER;
27
- OBJECT_STORAGE;
28
- constructor({ repository, JWT_MANAGER, OBJECT_STORAGE, }) {
29
- this.repository = repository;
30
- this.JWT_MANAGER = JWT_MANAGER;
31
- this.OBJECT_STORAGE = OBJECT_STORAGE;
32
- }
33
- async verify(request) {
34
- const accessToken = request?.headers.get("Authorization")?.replace("Bearer ", "") ||
35
- (await this.getAccessTokenFromCookies(request));
36
- if (accessToken) {
37
- return this.JWT_MANAGER.verifyAccessToken(accessToken);
38
- }
39
- }
40
- async verifyOrRefresh(request) {
41
- const payload = await this.verify(request);
42
- if (payload) {
43
- return payload;
44
- }
45
- return this.refresh(request);
46
- }
47
- async getAccessTokenFromCookies(request) {
48
- const cookieStore = await exports.ACCESS_TOKEN_COOKIE.parse(request.headers.get("cookie"));
49
- return cookieStore.get(exports.ACCESS_TOKEN_KEY)?.value;
50
- }
51
- async getRefreshTokenFromCookies(request) {
52
- const cookieStore = await exports.REFRESH_TOKEN_COOKIE.parse(request.headers.get("cookie"));
53
- return cookieStore.get(exports.REFRESH_TOKEN_KEY)?.value;
54
- }
55
- async refresh(request) {
56
- const refreshToken = await this.getRefreshTokenFromCookies(request);
57
- if (refreshToken) {
58
- try {
59
- const refreshedAccessToken = await this.refreshAccessToken(refreshToken);
60
- await this.getAccessTokenSetCookie(refreshedAccessToken);
61
- const payload = this.JWT_MANAGER.decode(refreshedAccessToken);
62
- if (payload) {
63
- return payload;
64
- }
65
- }
66
- catch (e) {
67
- if (e instanceof Error) {
68
- console.log(e.message);
69
- }
70
- return;
71
- }
72
- }
73
- }
74
- async signIn({ id, password }) {
75
- const credential = await this.repository.findCredentialById(id);
76
- if (!credential) {
77
- throw Error("아이디 또는 비밀번호가 틀렸습니다.");
78
- }
79
- if (!(await bcryptjs_1.default.compare(password, credential.password))) {
80
- throw Error("아이디 또는 비밀번호가 틀렸습니다.");
81
- }
82
- const user = await this.repository.findUserById(credential.userId);
83
- if (!user) {
84
- throw Error("회원 정보를 찾을 수 없습니다.");
85
- }
86
- const { accessToken, refreshToken } = await this.issueTokenPair(user);
87
- return {
88
- accessToken,
89
- refreshToken,
90
- };
91
- }
92
- async issueAccessToken(user) {
93
- return this.JWT_MANAGER.signAccessToken({
94
- userId: user.id,
95
- role: user.role,
96
- name: user.name,
97
- });
98
- }
99
- async issueTokenPair(user) {
100
- const refreshToken = await this.JWT_MANAGER.signRefreshToken({
101
- userId: user.id,
102
- role: user.role,
103
- name: user.name,
104
- });
105
- await this.repository.updateUserRefreshToken(user.id, await bcryptjs_1.default.hash(refreshToken, 10));
106
- const accessToken = await this.issueAccessToken(user);
107
- return { refreshToken, accessToken };
108
- }
109
- async refreshAccessToken(refreshToken) {
110
- const payload = await this.JWT_MANAGER.verifyRefreshToken(refreshToken);
111
- if (!payload) {
112
- throw new Error("토큰이 유효하지 않습니다.");
113
- }
114
- const { userId } = payload;
115
- if (typeof userId !== "string") {
116
- throw new Error("토큰이 유효하지 않습니다.");
117
- }
118
- const user = await this.repository.findUserById(userId);
119
- if (!user) {
120
- throw Error("이용자를 찾지 못했습니다.");
121
- }
122
- if (!user.refreshToken) {
123
- throw Error("인증 정보를 찾지 못했습니다.");
124
- }
125
- if (await bcryptjs_1.default.compare(user.refreshToken, refreshToken)) {
126
- throw Error("토큰이 유효하지 않습니다.");
127
- }
128
- const accessToken = await this.issueAccessToken(user);
129
- return accessToken;
130
- }
131
- async getAccessTokenSetCookie(accessToken) {
132
- return exports.ACCESS_TOKEN_COOKIE.serialize(accessToken, {
133
- expires: accessToken
134
- ? this.JWT_MANAGER.getExpirationTime(accessToken)
135
- : new Date(0),
136
- });
137
- }
138
- async getRefreshTokenSetCookie(refreshToken) {
139
- return exports.REFRESH_TOKEN_COOKIE.serialize(refreshToken, {
140
- expires: refreshToken
141
- ? this.JWT_MANAGER.getExpirationTime(refreshToken)
142
- : new Date(0),
143
- });
144
- }
145
- async findUser(provider, info) {
146
- const thirdPartyAuth = await this.repository.findThirdPartyAuth(provider, info.id);
147
- if (thirdPartyAuth) {
148
- const user = await this.repository.findUserById(thirdPartyAuth.userId);
149
- if (user) {
150
- return user;
151
- }
152
- }
153
- }
154
- async getOrCreateUser(provider, info) {
155
- const thirdPartyAuth = await this.repository.findThirdPartyAuth(provider, info.id);
156
- if (thirdPartyAuth) {
157
- const user = await this.repository.findUserById(thirdPartyAuth.userId);
158
- if (user) {
159
- return user;
160
- }
161
- }
162
- const userId = (0, uuid_1.v4)();
163
- const email = info.email;
164
- const name = info.name || "익명";
165
- const picture = info.picture;
166
- const profileImageId = (await this.savePicture(picture)) || null;
167
- const result = await this.repository.createUser({
168
- id: userId,
169
- role: "user",
170
- profileImageId,
171
- name,
172
- email,
173
- });
174
- await this.repository.createThirdPartyAuth({
175
- id: info.id,
176
- provider,
177
- userId,
178
- });
179
- return result;
180
- }
181
- async savePicture(picture) {
182
- if (!picture) {
183
- return;
184
- }
185
- const res = await fetch(picture);
186
- if (!res.ok) {
187
- return;
188
- }
189
- const buffer = await res.arrayBuffer();
190
- const id = (0, uuid_1.v4)();
191
- const key = `/users/${id}/picture`;
192
- await this.OBJECT_STORAGE.put(key, Buffer.from(buffer));
193
- await this.repository.createFile({
194
- id,
195
- name: "picture",
196
- type: "image/*",
197
- key,
198
- size: buffer.byteLength,
199
- metadata: {},
200
- });
201
- return id;
202
- }
203
- }
204
- exports.AuthService = AuthService;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleLoginButton = GoogleLoginButton;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const fc_1 = require("react-icons/fc");
6
- const react_router_1 = require("react-router");
7
- function GoogleLoginButton({ className = "max-w-[300px] w-full", GOOGLE_CLIENT_ID, GOOGLE_REDIRECT_URI, }) {
8
- const [searchParams] = (0, react_router_1.useSearchParams)();
9
- const redirectUrl = searchParams.get("redirectUrl") || "";
10
- const googleClientId = GOOGLE_CLIENT_ID || "";
11
- const googleRedirectUrl = GOOGLE_REDIRECT_URI || "";
12
- const href = new URL("https://accounts.google.com/o/oauth2/v2/auth");
13
- href.searchParams.append("client_id", googleClientId);
14
- href.searchParams.append("redirect_uri", googleRedirectUrl);
15
- href.searchParams.append("response_type", "code");
16
- href.searchParams.append("scope", "email profile");
17
- href.searchParams.append("state", redirectUrl);
18
- return ((0, jsx_runtime_1.jsx)("div", { className: className, children: (0, jsx_runtime_1.jsxs)("a", { href: href.toString(), className: "relative flex items-center border border-neutral-300 px-4 py-3 no-underline hover:no-underline bg-white hover:bg-neutral-100 rounded", children: [(0, jsx_runtime_1.jsx)(fc_1.FcGoogle, {}), (0, jsx_runtime_1.jsx)("p", { className: "text-[14px] text-black absolute left-0 right-0 text-center", children: "\uAD6C\uAE00\uB85C \uACC4\uC18D\uD558\uAE30" })] }) }));
19
- }
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RedirectPage = RedirectPage;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("react");
6
- const react_router_1 = require("react-router");
7
- function RedirectPage() {
8
- const navigate = (0, react_router_1.useNavigate)();
9
- (0, react_1.useEffect)(() => {
10
- const searchParams = new URLSearchParams(window.location.search);
11
- const redirectUrl = searchParams.get("redirectUrl") ||
12
- new URL("/", window.location.origin).toString();
13
- if (redirectUrl) {
14
- navigate(redirectUrl);
15
- }
16
- }, [navigate]);
17
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
18
- }