@snokam/auth 2.2.2 → 2.2.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.
- package/CHANGELOG.md +11 -0
- package/lib/middleware.js +1 -1
- package/lib/middleware.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.2.3](https://github.com/snokam/components/compare/@snokam/auth@2.2.2...@snokam/auth@2.2.3) (2025-06-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* simplify check ([554ab54](https://github.com/snokam/components/commit/554ab548ede7e267c6217b19ba0801245e372b80))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [2.2.2](https://github.com/snokam/components/compare/@snokam/auth@2.2.1...@snokam/auth@2.2.2) (2025-06-02)
|
|
7
18
|
|
|
8
19
|
|
package/lib/middleware.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{buildAuthMiddleware:()=>i,config:()=>c,default:()=>
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{buildAuthMiddleware:()=>i,config:()=>c,default:()=>u});const r=require("path-to-regexp"),o=require("next-auth/middleware");var n=function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};const a=["/((?!api|_next/static|_next/image|favicon.ico|.*\\..*).*)"];function i(e={}){var t,{matcher:i=[],callbacks:l={},protectAllRoutes:c}=e,u=n(e,["matcher","callbacks","protectAllRoutes"]);const p="preview"===process.env.NEXT_PUBLIC_VERCEL_ENV;return{middleware:(0,o.withAuth)((e=>{}),Object.assign({pages:{signIn:"/auth/login"},callbacks:{authorized:null!==(t=l.authorized)&&void 0!==t?t:({req:e,token:t})=>{return o=e.nextUrl.pathname,!(p||c&&0===(null==i?void 0:i.length)||i.some((e=>{if(!e)return!1;if(e.endsWith(":path*")){const t=e.replace(/\/:path\*$/,"");return o.startsWith(t)}return!1!==(0,r.match)(e,{end:!0})(o)})))||!!t;var o}}},u)),config:p?{matcher:a}:(null==i?void 0:i.length)>0?{matcher:i}:void 0}}const{middleware:l,config:c}=i(),u=l;return t})()));
|
|
2
2
|
//# sourceMappingURL=middleware.js.map
|
package/lib/middleware.js.map
CHANGED
|
@@ -1 +1 @@
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AIM,EAAIH,EAAEI,OAAQD,IAC3DL,EAAEG,QAAQD,EAAEG,IAAM,GAAKpB,OAAOM,UAAUgB,qBAAqBd,KAAKM,EAAGG,EAAEG,MACvEJ,EAAEC,EAAEG,IAAMN,EAAEG,EAAEG,IAF4B,CAItD,OAAOJ,CACX,EAIA,MAAMO,EAAiB,CACnB,6DAEG,SAASC,EAAoBC,EAAK,CAAC,GACtC,IAAIC,GACA,QAAEC,EAAU,GAAE,UAAEC,EAAY,CAAC,EAAC,iBAAEC,GAAqBJ,EAAIK,EAAOjB,EAAOY,EAAI,CAAC,UAAW,YAAa,qBACxG,MAAMM,EAAmD,YAAvCC,QAAQC,IAAIC,uBA8B9B,MAAO,CAAEC,YAbU,IAAAC,WAAUC,IAAD,GAAerC,OAAOsC,OAAO,CAAEC,MAAO,CAC1DC,OAAQ,eACTZ,UAAW,CACVa,WAA4C,QAA/Bf,EAAKE,EAAUa,kBAA+B,IAAPf,EAAgBA,EAAK,EAAIgB,MAAKC,YAC9E,OAnBeC,EAmBUF,EAAIG,QAAQD,WAlBzCb,GAAcF,GAA2F,KAAtEF,aAAyC,EAASA,EAAQN,SAG1FM,EAAQmB,MAAMC,IACjB,IAAKA,EACD,OAAO,EAEX,GAAIA,EAAQC,SAAS,UAAW,CAC5B,MAAMC,EAAOF,EAAQG,QAAQ,aAAc,IAC3C,OAAON,EAASO,WAAWF,EAC/B,CACA,OAAmD,KAA5C,IAAAG,OAAML,EAAS,CAAEM,KAAK,GAAtB,CAA8BT,EAAmB,QAODD,EAnBrC,IAACC,CAoBlB,IACAd,IAOYwB,OALNvB,EACT,CAAEJ,QAASJ,IACVI,aAAyC,EAASA,EAAQN,QAAU,EACjE,CAAEM,gBACF4B,EAEd,CAEA,MAAM,WAAEpB,EAAU,OAAEmB,GAAW9B,IAE/B,I","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"path-to-regexp\"","webpack://snokam/external commonjs \"next-auth/middleware\"","webpack://snokam/./src/middleware.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"path-to-regexp\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"next-auth/middleware\");","var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport { match } from \"path-to-regexp\";\nimport { withAuth } from \"next-auth/middleware\";\n// Catch-all matcher used in Vercel preview environments\nconst previewMatcher = [\n \"/((?!api|_next/static|_next/image|favicon.ico|.*\\\\..*).*)\",\n];\nexport function buildAuthMiddleware(_a = {}) {\n var _b;\n var { matcher = [], callbacks = {}, protectAllRoutes } = _a, rest = __rest(_a, [\"matcher\", \"callbacks\", \"protectAllRoutes\"]);\n const isPreview = process.env.NEXT_PUBLIC_VERCEL_ENV === \"preview\";\n // Decide at runtime whether the current path should be protected\n const shouldProtectPath = (pathname) => {\n if (isPreview || (protectAllRoutes && (matcher === null || matcher === void 0 ? void 0 : matcher.length) === 0)) {\n return true;\n }\n return matcher.some((pattern) => {\n if (!pattern) {\n return false;\n }\n if (pattern.endsWith(\":path*\")) {\n const base = pattern.replace(/\\/:path\\*$/, \"\");\n return pathname.startsWith(base);\n }\n return match(pattern, { end: true })(pathname) !== false;\n });\n };\n const middleware = withAuth((_req) => { }, Object.assign({ pages: {\n signIn: \"/auth/login\",\n }, callbacks: {\n authorized: (_b = callbacks.authorized) !== null && _b !== void 0 ? _b : (({ req, token }) => {\n return shouldProtectPath(req.nextUrl.pathname) ? !!token : true;\n }),\n } }, rest));\n // Only apply matcher config if needed (to avoid enabling middleware unnecessarily)\n const config = isPreview\n ? { matcher: previewMatcher }\n : (matcher === null || matcher === void 0 ? void 0 : matcher.length) > 0\n ? { matcher }\n : undefined;\n return { middleware, config };\n}\n// Default: protect all HTML pages in preview, do nothing in production\nconst { middleware, config } = buildAuthMiddleware();\nexport { config };\nexport default middleware;\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","__rest","s","e","t","p","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","previewMatcher","buildAuthMiddleware","_a","_b","matcher","callbacks","protectAllRoutes","rest","isPreview","process","env","NEXT_PUBLIC_VERCEL_ENV","middleware","withAuth","_req","assign","pages","signIn","authorized","req","token","pathname","nextUrl","some","pattern","endsWith","base","replace","startsWith","match","end","config","undefined"],"sourceRoot":""}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snokam/auth",
|
|
3
3
|
"description": "Snøkam auth components",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.3",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
7
7
|
"files": [
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
]
|
|
68
68
|
}
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "d789fa57107b363a24a879dfb6d1472192b72409"
|
|
71
71
|
}
|