dn-react-router-toolkit 0.1.1 → 0.1.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.
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 +106 -0
  36. package/dist/auth-kit/with_auth.mjs +69 -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
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.thirdPartyAuthCallbackHandler = void 0;
4
- const http_kit_1 = require("../../../../http-kit");
5
- const thirdPartyAuthCallbackHandler = async (request, { provider, }, { AUTH, GOOGLE_AUTH, APPLE_AUTH, SITE_ORIGIN, }) => {
6
- const url = new URL(request.url);
7
- const code = url.searchParams.get("code");
8
- if (!code) {
9
- throw (0, http_kit_1.BAD_REQUEST)("코드가 없습니다.");
10
- }
11
- const getThirdPartyAuth = (provider) => {
12
- switch (provider) {
13
- case "google":
14
- return GOOGLE_AUTH;
15
- case "apple":
16
- return APPLE_AUTH;
17
- default:
18
- throw (0, http_kit_1.BAD_REQUEST)("지원하지 않는 인증 제공자입니다.");
19
- }
20
- };
21
- const { accessToken, refreshToken } = await getThirdPartyAuth(provider).signIn(code);
22
- const [accessTokenSetCookie, refreshTokenSetCookie] = await Promise.all([
23
- AUTH.getAccessTokenSetCookie(accessToken),
24
- AUTH.getRefreshTokenSetCookie(refreshToken),
25
- ]);
26
- const headers = new Headers();
27
- headers.append("Set-Cookie", accessTokenSetCookie);
28
- headers.append("Set-Cookie", refreshTokenSetCookie);
29
- const redirectUrl = url.searchParams.get("state") || SITE_ORIGIN;
30
- return new Response("Temporary Redirect", {
31
- status: 307,
32
- headers: {
33
- ...headers,
34
- Location: new URL(`/r?redirectUrl=${encodeURIComponent(redirectUrl)}`, request.url).toString(),
35
- },
36
- });
37
- };
38
- exports.thirdPartyAuthCallbackHandler = thirdPartyAuthCallbackHandler;
@@ -1,80 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAuthAPIHandler = void 0;
4
- const route_1 = require("./auth/callback/[provider]/route");
5
- const route_2 = require("./api/files/route");
6
- const route_3 = require("./api/files/[fileId]/route");
7
- const route_4 = require("./api/auth/route");
8
- const route_5 = require("./api/auth/login/[provider]/route");
9
- const route_6 = require("./api/auth/login/route");
10
- const route_7 = require("./api/auth/logout/route");
11
- const route_8 = require("./api/auth/refresh/route");
12
- const createAuthAPIHandler = ({ AUTH, GOOGLE_AUTH, APPLE_AUTH, KAKAO_AUTH, JWT_MANAGER, FILE_SERVICE, SITE_ORIGIN, authRepository, fileRepository, }) => {
13
- const handler = async ({ request, params, }) => {
14
- const method = request.method.toUpperCase();
15
- const slug = params["*"].split("/");
16
- if (slug[0] === "auth") {
17
- if (!slug[1]) {
18
- if (method === "GET") {
19
- return (0, route_4.getAuthHandler)(request, { AUTH });
20
- }
21
- }
22
- if (slug[1] === "login") {
23
- if (slug[2]) {
24
- const provider = slug[2];
25
- if (method === "POST") {
26
- return (0, route_5.loginThirdPartyHandler)(request, { provider }, { GOOGLE_AUTH, KAKAO_AUTH, APPLE_AUTH });
27
- }
28
- }
29
- if (method === "POST") {
30
- return (0, route_6.loginCredentialHandler)(request, {
31
- AUTH,
32
- JWT_MANAGER,
33
- });
34
- }
35
- }
36
- if (slug[1] === "logout") {
37
- if (method === "POST") {
38
- return (0, route_7.logoutHandler)(request, {
39
- AUTH,
40
- repository: authRepository,
41
- });
42
- }
43
- }
44
- if (slug[1] === "refresh") {
45
- if (method === "GET") {
46
- return (0, route_8.authRefreshHandler)(request, { AUTH });
47
- }
48
- }
49
- if (slug[1] === "callback") {
50
- if (slug[2]) {
51
- const provider = slug[2];
52
- if (method === "GET") {
53
- return (0, route_1.thirdPartyAuthCallbackHandler)(request, { provider }, {
54
- AUTH,
55
- GOOGLE_AUTH,
56
- APPLE_AUTH,
57
- SITE_ORIGIN,
58
- });
59
- }
60
- }
61
- }
62
- }
63
- if (slug[0] === "files") {
64
- if (!slug[1]) {
65
- if (method === "POST") {
66
- return (0, route_2.fileUploadHandler)(request, { AUTH, FILE_SERVICE });
67
- }
68
- }
69
- if (slug[1]) {
70
- if (method === "DELETE") {
71
- const fileId = slug[1];
72
- return (0, route_3.fileDeleteHandler)(request, { fileId }, { AUTH, repository: fileRepository });
73
- }
74
- }
75
- }
76
- return new Response("Not Found", { status: 404 });
77
- };
78
- return handler;
79
- };
80
- exports.createAuthAPIHandler = createAuthAPIHandler;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./loader"), exports);
18
- __exportStar(require("./seo_loader"), exports);
19
- __exportStar(require("./seo"), exports);
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createLoader = createLoader;
4
- function createLoader(fn = () => ({})) {
5
- let loadedData;
6
- return {
7
- getData() {
8
- return loadedData;
9
- },
10
- wrap(mapper) {
11
- return async function Thing(props) {
12
- loadedData = await fn(props);
13
- return mapper(loadedData);
14
- };
15
- },
16
- };
17
- }
@@ -1,278 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.configSEO = configSEO;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- function configSEO(config) {
6
- return {
7
- config,
8
- async init(props = {}) {
9
- const canonicalPath = props.canonicalPath;
10
- const url = canonicalPath
11
- ? `${config.origin}${canonicalPath}`
12
- : `${config.origin}${props.path || ""}`;
13
- const pageTitle = props.title
14
- ? `${props.title} | ${config.siteName}`
15
- : config.siteName;
16
- const description = props.description || config.description;
17
- const keywords = props.keywords || config.keywords;
18
- const websiteSchemaId = `${config.origin}/#website`;
19
- const websiteSchema = {
20
- "@type": "WebSite",
21
- "@id": websiteSchemaId,
22
- url: config.origin,
23
- name: config.siteName,
24
- alternateName: config.siteName,
25
- description: config.description,
26
- inLanguage: "ko",
27
- };
28
- const thumbnailSchemaId = `${url}/#thumbnail`;
29
- const thumbnail = props.thumbnail ||
30
- (typeof config.thumbnail === "function"
31
- ? await config.thumbnail()
32
- : config.thumbnail);
33
- const thumbnailUrl = thumbnail?.url;
34
- const socialImage = thumbnail
35
- ? [
36
- typeof thumbnail === "string"
37
- ? {
38
- url: thumbnail,
39
- alt: `${props.title} 대표 이미지`,
40
- }
41
- : thumbnail,
42
- ]
43
- : [];
44
- const images = [
45
- ...(thumbnailUrl
46
- ? [
47
- {
48
- id: thumbnailSchemaId,
49
- url: thumbnailUrl,
50
- alt: `${props.title} 대표 이미지`,
51
- },
52
- ]
53
- : []),
54
- ...(props.images || []),
55
- ...(props.collection?.map((portfolio) => portfolio.thumbnail) || []),
56
- ].filter(Boolean);
57
- const image = images
58
- .filter((file) => file.id)
59
- .map((file) => ({
60
- "@type": "ImageObject",
61
- "@id": `${url}/#${file.id}`,
62
- }));
63
- const breadcrumbSchemaId = `${url}#breadcrumb`;
64
- const updatedAt = props.updatedAt;
65
- const createdAt = props.createdAt;
66
- const meta = () => {
67
- return [
68
- { title: pageTitle },
69
- { name: "description", content: description },
70
- { name: "keywords", content: keywords?.join(", ") || "" },
71
- {
72
- tagName: "link",
73
- rel: "canonical",
74
- href: url,
75
- },
76
- { property: "og:type", content: props.type || "website" },
77
- { property: "og:title", content: pageTitle },
78
- { property: "og:description", content: description },
79
- { property: "og:url", content: url },
80
- { property: "og:site_name", content: config.siteName },
81
- ...socialImage.map((file) => ({
82
- property: "og:image",
83
- content: file.url,
84
- })),
85
- {
86
- property: "twitter:card",
87
- content: socialImage.length > 0 ? "summary_large_image" : "summary",
88
- },
89
- { property: "twitter:title", content: pageTitle },
90
- { property: "twitter:description", content: description },
91
- ...socialImage.map((file) => ({
92
- property: "twitter:image",
93
- content: file.url,
94
- })),
95
- ];
96
- };
97
- const additionalStructedData = [
98
- ...(typeof props.structedData === "function"
99
- ? await props.structedData()
100
- : props.structedData || []),
101
- ...(typeof config.structedData === "function"
102
- ? await config.structedData()
103
- : config.structedData || []),
104
- ];
105
- function getStructedData() {
106
- const collectionMainEntity = props.collection
107
- ? {
108
- "@type": "ItemList",
109
- numberOfItems: props.collection.length,
110
- itemListElement: props.collection.map((item, index) => ({
111
- "@type": "ListItem",
112
- position: index + 1,
113
- url: item.url,
114
- item: {
115
- "@type": "WebPage",
116
- "@id": `${item.url}#webpage`,
117
- url: item.url,
118
- name: item.title,
119
- thumbnailUrl: item.thumbnail?.url,
120
- dateModified: item.updatedAt?.toISOString(),
121
- dateCreated: item.createdAt?.toISOString(),
122
- datePublished: item.createdAt?.toISOString(),
123
- },
124
- })),
125
- }
126
- : undefined;
127
- return {
128
- "@context": "https://schema.org",
129
- "@graph": [
130
- {
131
- "@type": "WebPage",
132
- "@id": `${url}#webpage`,
133
- url,
134
- name: pageTitle,
135
- description,
136
- keywords: keywords,
137
- dateModified: updatedAt?.toISOString(),
138
- datePublished: createdAt?.toISOString(),
139
- dateCreated: createdAt?.toISOString(),
140
- primaryImageOfPage: thumbnail
141
- ? {
142
- "@id": thumbnailSchemaId,
143
- }
144
- : undefined,
145
- isPartOf: {
146
- "@id": websiteSchemaId,
147
- },
148
- inLanguage: "ko",
149
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
150
- ? {
151
- "@id": breadcrumbSchemaId,
152
- }
153
- : undefined,
154
- image,
155
- mainEntity: collectionMainEntity,
156
- },
157
- props.article &&
158
- {
159
- "@type": "Article",
160
- "@id": `${url}#article`,
161
- url,
162
- name: pageTitle,
163
- description,
164
- keywords: keywords,
165
- headline: pageTitle,
166
- dateModified: updatedAt?.toISOString(),
167
- datePublished: createdAt?.toISOString(),
168
- dateCreated: createdAt?.toISOString(),
169
- isPartOf: {
170
- "@id": websiteSchemaId,
171
- },
172
- inLanguage: "ko",
173
- image,
174
- },
175
- props.blogPosting &&
176
- {
177
- "@type": "BlogPosting",
178
- "@id": `${url}/#blogposting`,
179
- url,
180
- headline: pageTitle,
181
- description: description,
182
- thumbnailUrl,
183
- datePublished: createdAt?.toISOString(),
184
- dateModified: updatedAt?.toISOString(),
185
- isPartOf: { "@id": websiteSchemaId },
186
- image,
187
- },
188
- props.creativeWork &&
189
- {
190
- "@type": "CreativeWork",
191
- "@id": `${url}/#creativework`,
192
- url,
193
- name: pageTitle,
194
- description: description,
195
- datePublished: createdAt?.toISOString(),
196
- dateModified: updatedAt?.toISOString(),
197
- isPartOf: { "@id": websiteSchemaId },
198
- thumbnailUrl,
199
- image,
200
- },
201
- props.visualArtwork &&
202
- {
203
- "@type": "VisualArtwork",
204
- "@id": `${url}/#visualartwork`,
205
- url,
206
- name: pageTitle,
207
- description: description,
208
- datePublished: createdAt?.toISOString(),
209
- dateModified: updatedAt?.toISOString(),
210
- isPartOf: { "@id": websiteSchemaId },
211
- thumbnailUrl,
212
- image,
213
- },
214
- props.collection &&
215
- {
216
- "@type": "CollectionPage",
217
- "@id": `${url}/#collectionpage`,
218
- url: url,
219
- name: pageTitle,
220
- description: description,
221
- isPartOf: { "@id": websiteSchemaId },
222
- image,
223
- inLanguage: "ko-KR",
224
- breadcrumb: props.breadcrumbs && props.breadcrumbs.length > 0
225
- ? {
226
- "@id": `${url}/#breadcrumb`,
227
- }
228
- : undefined,
229
- mainEntity: collectionMainEntity,
230
- },
231
- websiteSchema,
232
- props.breadcrumbs &&
233
- props.breadcrumbs.length > 0 &&
234
- {
235
- "@id": breadcrumbSchemaId,
236
- "@type": "BreadcrumbList",
237
- itemListElement: props.breadcrumbs.map((breadcrumb, index) => ({
238
- "@type": "ListItem",
239
- position: index + 1,
240
- name: breadcrumb.label,
241
- item: `${config.origin}${breadcrumb.href}`,
242
- })),
243
- },
244
- ...additionalStructedData,
245
- ...images.map((file) => {
246
- return {
247
- "@type": "ImageObject",
248
- "@id": `${url}/#${file.id}`,
249
- url: file.url,
250
- contentUrl: file.url,
251
- name: file.alt,
252
- description: file.alt,
253
- width: file?.width?.toString(),
254
- height: file?.height?.toString(),
255
- creditText: config.copyright,
256
- license: `${config.origin}/terms`,
257
- copyrightNotice: config.copyright,
258
- acquireLicensePage: `${config.origin}/terms`,
259
- };
260
- }),
261
- ].filter(Boolean),
262
- };
263
- }
264
- function generateJSONLD() {
265
- const structedData = getStructedData();
266
- return ((0, jsx_runtime_1.jsx)("script", { type: "application/ld+json", dangerouslySetInnerHTML: {
267
- __html: JSON.stringify(structedData).replace(/</g, "\\u003c"),
268
- } }));
269
- }
270
- return {
271
- config,
272
- props,
273
- meta,
274
- generateJSONLD,
275
- };
276
- },
277
- };
278
- }
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSEOLoader = createSEOLoader;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const loader_1 = require("./loader");
6
- function createSEOLoader(fn = () => ({})) {
7
- const loader = (0, loader_1.createLoader)(fn);
8
- return {
9
- ...loader,
10
- meta: loader.wrap((data) => data.seo.meta),
11
- Page(Fc) {
12
- return loader.wrap((data) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [data.seo?.generateJSONLD(), (0, jsx_runtime_1.jsx)(Fc, { ...data })] })));
13
- },
14
- };
15
- }
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.singleton = singleton;
4
- function singleton(name, fn) {
5
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
- const globalAny = globalThis;
7
- globalAny.__singletons = globalAny.__singletons || {};
8
- if (!globalAny.__singletons[name]) {
9
- globalAny.__singletons[name] = fn();
10
- }
11
- return globalAny.__singletons[name];
12
- }
package/dist/cjs/slug.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toSlug = void 0;
4
- const toSlug = (str) => {
5
- return str
6
- .toLowerCase()
7
- .replace(/[^a-zA-Z0-9가-힣ㄱ-ㅎㅏ-ㅣ]+/g, "-")
8
- .replace(/^-|-$/g, "");
9
- };
10
- exports.toSlug = toSlug;
@@ -1,57 +0,0 @@
1
- import { decodeJwt, importPKCS8, SignJWT } from "jose";
2
- export class AppleAuth {
3
- AUTH;
4
- constructor(AUTH) {
5
- this.AUTH = AUTH;
6
- }
7
- async signIn(code, type = "web") {
8
- const url = "https://appleid.apple.com/auth/token";
9
- const client_secret = await this.generateAppleClientSecret(type);
10
- const res = await fetch(url, {
11
- method: "POST",
12
- headers: {
13
- "Content-Type": "application/x-www-form-urlencoded",
14
- },
15
- body: new URLSearchParams({
16
- client_id: type === "web"
17
- ? process.env.APPLE_SERVICE_ID
18
- : process.env.APPLE_CLIENT_ID,
19
- client_secret,
20
- code,
21
- grant_type: "authorization_code",
22
- }),
23
- });
24
- if (!res.ok) {
25
- console.error(await res.text());
26
- throw new Error("Apple 인증에 실패했습니다.");
27
- }
28
- const data = await res.json();
29
- const { id_token } = data;
30
- const payload = decodeJwt(id_token);
31
- const { sub, email, name } = payload;
32
- const user = await this.AUTH.getOrCreateUser("apple", {
33
- id: sub,
34
- email,
35
- name,
36
- });
37
- const { accessToken, refreshToken } = await this.AUTH.issueTokenPair(user);
38
- return { user, accessToken, refreshToken };
39
- }
40
- async generateAppleClientSecret(type = "web") {
41
- const authKey = process.env.APPLE_AUTH_KEY;
42
- const teamId = process.env.APPLE_TEAM_ID;
43
- const keyId = process.env.APPLE_KEY_ID;
44
- const clientId = type === "web"
45
- ? process.env.APPLE_SERVICE_ID
46
- : process.env.APPLE_CLIENT_ID;
47
- const keyObject = await importPKCS8(authKey, "ES256");
48
- return new SignJWT()
49
- .setProtectedHeader({ alg: "ES256", kid: keyId })
50
- .setIssuedAt()
51
- .setIssuer(teamId)
52
- .setExpirationTime("1h")
53
- .setAudience("https://appleid.apple.com")
54
- .setSubject(clientId)
55
- .sign(keyObject);
56
- }
57
- }