refactor(admin): split protect guards into dedicated export path

- remove `protectAdmin`/`isAdmin` re-exports from `features/admin/index.js` to avoid top-level `next/headers` import
- add `./features/admin/protect` export entry in `package.json`
- lazy-import `next/headers` in `router.js` `requireAuth` to defer resolution
- update `features/admin/README.md` to document new import paths
- translate `features/auth/index.js` comment to French for consistency
This commit is contained in:
2026-04-25 13:01:06 -04:00
parent 6bbf3f1507
commit 7afcb2cb5a
5 changed files with 22 additions and 10 deletions
+5 -4
View File
@@ -1,10 +1,11 @@
/**
* Zen Authentication — server barrel (Next.js-free).
*
* Does NOT re-export actions.js — that file imports `next/headers` at the
* top level and cannot be pulled in via this barrel (which is imported by
* external modules during instrumentation, before Next.js aliases are active).
* Import server actions explicitly via @zen/core/features/auth/actions.
* Ne re-exporte PAS actions.js — ce fichier importe `next/headers` au niveau
* top-level et ne peut pas être tiré via ce barrel (qui peut être importé par
* des modules externes pendant leur register(), avant que Next.js ait activé
* ses alias de modules). Importer les server actions via
* @zen/core/features/auth/actions.
*/
export {