@draftlab/auth 0.13.1 → 0.15.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/util.mjs CHANGED
@@ -100,6 +100,29 @@ const lazy = (fn) => {
100
100
  return value;
101
101
  };
102
102
  };
103
+ /**
104
+ * Utility function to immediately invoke a function and return its result.
105
+ * Useful for complex conditional rendering logic in JSX/TSX where you want
106
+ * to use if/else statements instead of ternary operators.
107
+ *
108
+ * @template T - The return type of the function
109
+ * @param fn - Function to execute immediately
110
+ * @returns The result of executing the function
111
+ *
112
+ * @example
113
+ * ```tsx
114
+ * return (
115
+ * <div>
116
+ * {run(() => {
117
+ * if (state === "loading") return <Spinner />
118
+ * if (state === "error") return <Error />
119
+ * return <Content />
120
+ * })}
121
+ * </div>
122
+ * )
123
+ * ```
124
+ */
125
+ const run = (fn) => fn();
103
126
 
104
127
  //#endregion
105
- export { getRelativeUrl, isDomainMatch, lazy };
128
+ export { getRelativeUrl, isDomainMatch, lazy, run };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@draftlab/auth",
3
- "version": "0.13.1",
3
+ "version": "0.15.0",
4
4
  "type": "module",
5
5
  "description": "Core implementation for @draftlab/auth",
6
6
  "author": "Matheus Pergoli",
@@ -39,7 +39,7 @@
39
39
  "devDependencies": {
40
40
  "@types/node": "^25.0.3",
41
41
  "@types/qrcode": "^1.5.6",
42
- "tsdown": "^0.18.3",
42
+ "tsdown": "0.19.0-beta.5",
43
43
  "typescript": "^5.9.3",
44
44
  "@draftlab/tsconfig": "0.1.0"
45
45
  },
@@ -60,10 +60,9 @@
60
60
  "@standard-schema/spec": "^1.1.0",
61
61
  "jose": "^6.1.3",
62
62
  "otpauth": "^9.4.1",
63
- "preact": "^10.28.1",
64
- "preact-render-to-string": "^6.6.4",
65
- "qrcode": "^1.5.4",
66
- "@draftlab/auth-router": "0.5.0"
63
+ "preact": "^10.28.2",
64
+ "preact-render-to-string": "^6.6.5",
65
+ "qrcode": "^1.5.4"
67
66
  },
68
67
  "engines": {
69
68
  "node": ">=18"