@donotdev/core 0.0.11 → 0.0.12

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 (42) hide show
  1. package/functions/index.js +1 -1
  2. package/i18n/locales/eager/dndev_ar.json +122 -106
  3. package/i18n/locales/eager/dndev_de.json +122 -106
  4. package/i18n/locales/eager/dndev_en.json +122 -106
  5. package/i18n/locales/eager/dndev_es.json +122 -106
  6. package/i18n/locales/eager/dndev_fr.json +122 -106
  7. package/i18n/locales/eager/dndev_it.json +122 -106
  8. package/i18n/locales/eager/dndev_ja.json +122 -106
  9. package/i18n/locales/eager/dndev_ko.json +122 -106
  10. package/i18n/locales/lazy/auth_ar.json +121 -0
  11. package/i18n/locales/lazy/auth_de.json +121 -0
  12. package/i18n/locales/lazy/auth_en.json +121 -0
  13. package/i18n/locales/lazy/auth_es.json +121 -0
  14. package/i18n/locales/lazy/auth_fr.json +121 -0
  15. package/i18n/locales/lazy/auth_it.json +121 -0
  16. package/i18n/locales/lazy/auth_ja.json +121 -0
  17. package/i18n/locales/lazy/auth_ko.json +121 -0
  18. package/i18n/locales/lazy/billing_ar.json +12 -2
  19. package/i18n/locales/lazy/billing_de.json +12 -2
  20. package/i18n/locales/lazy/billing_en.json +12 -2
  21. package/i18n/locales/lazy/billing_es.json +12 -2
  22. package/i18n/locales/lazy/billing_fr.json +12 -2
  23. package/i18n/locales/lazy/billing_it.json +12 -2
  24. package/i18n/locales/lazy/billing_ja.json +12 -2
  25. package/i18n/locales/lazy/billing_ko.json +12 -2
  26. package/i18n/locales/lazy/oauth_ar.json +11 -0
  27. package/i18n/locales/lazy/oauth_de.json +11 -0
  28. package/i18n/locales/lazy/oauth_en.json +11 -0
  29. package/i18n/locales/lazy/oauth_es.json +11 -0
  30. package/i18n/locales/lazy/oauth_fr.json +11 -0
  31. package/i18n/locales/lazy/oauth_it.json +11 -0
  32. package/i18n/locales/lazy/oauth_ja.json +11 -0
  33. package/i18n/locales/lazy/oauth_ko.json +11 -0
  34. package/index.d.ts +1085 -107
  35. package/index.js +41 -41
  36. package/next/index.d.ts +10 -1
  37. package/next/index.js +20 -20
  38. package/package.json +2 -2
  39. package/server.d.ts +944 -580
  40. package/server.js +1 -575
  41. package/vite/index.d.ts +10 -1
  42. package/vite/index.js +2 -4
package/vite/index.d.ts CHANGED
@@ -21,6 +21,7 @@ declare const USER_ROLES = {
21
21
  GUEST: 'guest',
22
22
  USER: 'user',
23
23
  ADMIN: 'admin',
24
+ SUPER: 'super',
24
25
  } as const;
25
26
 
26
27
  /**
@@ -245,7 +246,7 @@ type PageAuth =
245
246
  * // Framework provides: auth=false, title from home.title, entity=home
246
247
  * ```
247
248
  *
248
- * @example Dynamic route (just define the path you want):
249
+ * @example Dynamic route (string format - explicit path):
249
250
  * ```tsx
250
251
  * export const meta: PageMeta = {
251
252
  * route: '/blog/:slug' // Creates /blog/:slug
@@ -253,6 +254,14 @@ type PageAuth =
253
254
  * // Framework provides: auth=false, title from blog.title, entity=blog
254
255
  * ```
255
256
  *
257
+ * @example Dynamic route (object format - auto-generates base path):
258
+ * ```tsx
259
+ * export const meta: PageMeta = {
260
+ * route: { params: ['id'] } // Creates /myRoute/:id (base path from file location)
261
+ * };
262
+ * // For file at pages/myRoute/DetailPage.tsx → route becomes /myRoute/:id
263
+ * ```
264
+ *
256
265
  * @example Auth-required (developer must be explicit):
257
266
  * ```tsx
258
267
  * export const meta: PageMeta = {
package/vite/index.js CHANGED
@@ -246,7 +246,6 @@ if (typeof globalThis !== 'undefined') {
246
246
  globalThis._DNDEV_CONFIG_ = {
247
247
  platform: 'vite',
248
248
  mode: '${n}',
249
- version: '1.0.0',
250
249
  context: 'client',
251
250
  timestamp: Date.now(),
252
251
  };
@@ -287,7 +286,6 @@ if (typeof globalThis !== 'undefined') {
287
286
  globalThis._DNDEV_CONFIG_ = {
288
287
  platform: 'vite',
289
288
  mode: '${e.mode||"development"}',
290
- version: '1.0.0',
291
289
  context: 'client',
292
290
  timestamp: Date.now(),
293
291
  };
@@ -311,7 +309,7 @@ export const source = 'empty';
311
309
 
312
310
  export default envData;
313
311
  `},generateInspection:e=>{let{env:t,mode:r}=e;return["/**"," * Generated Environment Variables",` * Mode: ${r}`,` * Generated at: ${new Date().toISOString()}`,` * Total variables: ${Object.keys(t).length}`," */","","```json",JSON.stringify(t,null,2),"```"].join(`
314
- `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},Jr=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...sf(this.mode,t,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function Mi(e={}){return Fe({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:ee.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Li,defaultInspectionPath:ue.vite.envInspection,manifestFileName:ue.manifests.env,configKey:"env",createDiscovery:(t,r)=>new Jr(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}g();ge();g();ge();var or=class extends _e{constructor(t,r={}){super(t,{fallbackLanguage:"en",...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=Mt("i18n"),o=n.eager||[],a=n.lazy||[],c=n.framework?.eager||[],u=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${c.join(", ")}, framework lazy: ${u.join(", ")}`),c.length===0&&u.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let f=this.pathResolver.normalizePath(r),b=this.pathResolver.normalizePath(s),m=(H,J)=>{let K=this.pathResolver.normalizePath(H),le=this.pathResolver.normalizePath(J);return K.startsWith(le)?K.slice(le.length+1):K},D=o.map(H=>m(H,r)),U=a.map(H=>m(H,r)),V=c.map(H=>m(H,s)),re=u.map(H=>m(H,s)),Y={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},L=await this.pathResolver._globWithNormalization(D,Y),G=await this.pathResolver._globWithNormalization(U,Y),X={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(H=>H!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(X.ignore)}`);let O=await this.pathResolver._globWithNormalization(V,X),F=await this.pathResolver._globWithNormalization(re,X);this.logger.debug(`Found ${L.length} eager, ${G.length} lazy, ${O.length} framework eager, ${F.length} framework lazy files`),O.length>0?this.logger.debug(`Framework eager files (first 3): ${O.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${c.join(", ")}`),F.length>0?this.logger.debug(`Framework lazy files (first 3): ${F.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${u.join(", ")}`);let z=[...new Set([...L,...G,...O,...F])],se=new Set([...L,...O]),M={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},j=new Map,pe=[...O,...F];for(let H of pe){let J=this._processTranslationFile(H,O.includes(H),r);if(J){let K=`${J.namespace}_${J.language}`;j.set(K,J),M.allNamespaces.add(J.namespace),M.supportedLanguages.add(J.language),O.includes(H)&&M.eagerNamespaces.add(J.namespace)}}let me=new Set;for(let H of z){if(pe.includes(H))continue;let J=this._processTranslationFile(H,se.has(H),r);if(J){let{namespace:K,language:le,importPath:Xe,content:Ke}=J,Ye=`${J.namespace}_${J.language}`;if(j.has(Ye)){let de=j.get(Ye);J.content=this._mergeTranslations(de.content,Ke)}M.allNamespaces.add(K),M.supportedLanguages.add(le),me.add(le),se.has(H)&&M.eagerNamespaces.add(K),M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=Xe,J.content&&(M.content[K]||(M.content[K]={}),M.content[K][le]=J.content),M.files.push({path:H,relativePath:this.pathResolver.getRelativePath(H),namespace:K,language:le,eager:se.has(H),size:J.content?JSON.stringify(J.content).length:0})}}for(let[H,J]of j){let[K,le]=H.split("_");(!M.mapping[K]||!M.mapping[K][le])&&(M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=J.importPath,M.content[K]||(M.content[K]={}),M.content[K][le]=J.content)}let dt=me.size>0?[...me].sort():[this.options.fallbackLanguage];return{mapping:M.mapping,content:M.content,eagerNamespaces:[...M.eagerNamespaces].sort(),allNamespaces:[...M.allNamespaces].sort(),supportedLanguages:dt,fallbackLanguage:this.options.fallbackLanguage,files:M.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i=n.match(/^([^_]+)_([^.]+)\.json$/);if(!i)return this.logger.debug(`Invalid translation file name format: ${n}`),null;let[,o,a]=i;if(!o||!a)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let u="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),f;try{if(f=this.pathResolver.readSync(t,{format:"json"}),!f)return this.logger.debug(`Could not read file: ${t}`),null}catch(b){return this.logger.debug(`Error parsing JSON from ${t}: ${b.message}`),null}return{namespace:o,language:a,importPath:u,content:f}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var nf={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:c={}}=e,u={mapping:s,languages:i,eager:n,fallback:o,content:c,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${ee.i18n} - Generated by @donotdev/config
312
+ `)},generateManifest:e=>({totalVars:Object.keys(e?.env||{}).length,mode:e?.mode||"development",variables:Object.keys(e?.env||{}),timestamp:Date.now()}),logStats:(e,t,r)=>{let s=Object.keys(e.env).length;r&&r.info(`${t} Env: ${s} VITE_* variables`)}},Jr=class{constructor(t,r={}){this.pathResolver=t,this.options=r,this.mode=r.mode||"development",this.appRoot=null}async discoverEnv(){try{let t=this.pathResolver.getAppRoot();if(!t)throw new Error("App root not available in EnvDiscovery");let s={...sf(this.mode,t,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${t}/.env`,errors:[]}}catch(t){return{env:{},mode:this.mode,source:"error",errors:[t.message]}}}};function Mi(e={}){return Fe({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:ee.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:Li,defaultInspectionPath:ue.vite.envInspection,manifestFileName:ue.manifests.env,configKey:"env",createDiscovery:(t,r)=>new Jr(t,{...r,mode:e.mode||r.mode||"development"})})({...e,disableHmr:!0})}g();ge();g();ge();var or=class extends _e{constructor(t,r={}){super(t,{fallbackLanguage:"en",...r})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!r||r===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${r}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${r}, repoRoot=${s}`);let n=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${n.eager.length}, lazy: ${n.lazy.length}, framework eager: ${n.framework?.eager?.length||0}, framework lazy: ${n.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let i=Mt("i18n"),o=n.eager||[],a=n.lazy||[],c=n.framework?.eager||[],u=n.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${o.join(", ")}, lazy: ${a.join(", ")}, framework eager: ${c.join(", ")}, framework lazy: ${u.join(", ")}`),c.length===0&&u.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let f=this.pathResolver.normalizePath(r),b=this.pathResolver.normalizePath(s),m=(H,J)=>{let K=this.pathResolver.normalizePath(H),le=this.pathResolver.normalizePath(J);return K.startsWith(le)?K.slice(le.length+1):K},D=o.map(H=>m(H,r)),U=a.map(H=>m(H,r)),V=c.map(H=>m(H,s)),re=u.map(H=>m(H,s)),Y={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r},L=await this.pathResolver._globWithNormalization(D,Y),G=await this.pathResolver._globWithNormalization(U,Y),X={...i,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:i.ignore?.filter(H=>H!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(X.ignore)}`);let O=await this.pathResolver._globWithNormalization(V,X),F=await this.pathResolver._globWithNormalization(re,X);this.logger.debug(`Found ${L.length} eager, ${G.length} lazy, ${O.length} framework eager, ${F.length} framework lazy files`),O.length>0?this.logger.debug(`Framework eager files (first 3): ${O.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${c.join(", ")}`),F.length>0?this.logger.debug(`Framework lazy files (first 3): ${F.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${u.join(", ")}`);let z=[...new Set([...L,...G,...O,...F])],se=new Set([...L,...O]),M={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},j=new Map,pe=[...O,...F];for(let H of pe){let J=this._processTranslationFile(H,O.includes(H),r);if(J){let K=`${J.namespace}_${J.language}`;j.set(K,J),M.allNamespaces.add(J.namespace),M.supportedLanguages.add(J.language),O.includes(H)&&M.eagerNamespaces.add(J.namespace)}}let me=new Set;for(let H of z){if(pe.includes(H))continue;let J=this._processTranslationFile(H,se.has(H),r);if(J){let{namespace:K,language:le,importPath:Xe,content:Ke}=J,Ye=`${J.namespace}_${J.language}`;if(j.has(Ye)){let de=j.get(Ye);J.content=this._mergeTranslations(de.content,Ke)}M.allNamespaces.add(K),M.supportedLanguages.add(le),me.add(le),se.has(H)&&M.eagerNamespaces.add(K),M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=Xe,J.content&&(M.content[K]||(M.content[K]={}),M.content[K][le]=J.content),M.files.push({path:H,relativePath:this.pathResolver.getRelativePath(H),namespace:K,language:le,eager:se.has(H),size:J.content?JSON.stringify(J.content).length:0})}}for(let[H,J]of j){let[K,le]=H.split("_");(!M.mapping[K]||!M.mapping[K][le])&&(M.mapping[K]||(M.mapping[K]={}),M.mapping[K][le]=J.importPath,M.content[K]||(M.content[K]={}),M.content[K][le]=J.content)}let dt=me.size>0?[...me].sort():[this.options.fallbackLanguage];return{mapping:M.mapping,content:M.content,eagerNamespaces:[...M.eagerNamespaces].sort(),allNamespaces:[...M.allNamespaces].sort(),supportedLanguages:dt,fallbackLanguage:this.options.fallbackLanguage,files:M.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(t=!1){if(!t&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let r=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let n=Date.now()-r;return this.logger.debug(`Discovery completed in ${n}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(t=!1){return await this.discover(t)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(t,r,s){let n=t.split("/").pop()||t.split("\\").pop()||"",i,o,a=n.match(/^([^_]+)_([^.]+)\.json$/);if(!a)return this.logger.debug(`Invalid translation file name format: ${n}`),null;if([,i,o]=a,!i||!o)return this.logger.debug(`Invalid namespace or language in file: ${n}`),null;let u="./"+this.pathResolver.getRelativePath(t).replace(/\\/g,"/"),f;try{if(f=this.pathResolver.readSync(t,{format:"json"}),!f)return this.logger.debug(`Could not read file: ${t}`),null}catch(b){return this.logger.debug(`Error parsing JSON from ${t}: ${b.message}`),null}return{namespace:i,language:o,importPath:u,content:f}}_mergeTranslations(t,r){let s={...t};for(let[n,i]of Object.entries(r))typeof i=="object"&&i!==null&&!Array.isArray(i)?s[n]=this._mergeTranslations(s[n]||{},i):s[n]=i;return s}};var nf={isEmpty:e=>!e.mapping||Object.keys(e.mapping).length===0,generateModule:(e,t,r="i18n")=>{let{mapping:s,eagerNamespaces:n,supportedLanguages:i,fallbackLanguage:o,stats:a,content:c={}}=e,u={mapping:s,languages:i,eager:n,fallback:o,content:c,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:a?.totalFiles||0,totalNamespaces:a?.totalNamespaces||0,totalLanguages:a?.totalLanguages||0,eagerNamespaces:a?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:t};return`// ${ee.i18n} - Generated by @donotdev/config
315
313
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
316
314
  // Generated at: ${new Date().toISOString()}
317
315
 
@@ -637,7 +635,7 @@ registerRoute(
637
635
  }),
638
636
  'POST'
639
637
  );
640
- `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let c=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of c){let f=this.pathResolver.getRelativePath(u);if(f.startsWith(`${t}/static/`)){let b=`/_next/${f.replace(`${t}/static/`,"")}`;i.push({url:b,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function qi(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let f=Z("PWA",e.debug,!0);f.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),f.warn(" Add these to your src/config/app.ts:"),f.warn(" export const appConfig: AppConfig = {"),f.warn(" app: {"),t.name||f.warn(' name: "Your App Name",'),t.shortName||f.warn(' shortName: "App",'),t.description||f.warn(' description: "Your app description",'),f.warn(" },"),f.warn(" // ... rest of config"),f.warn(" };"),f.warn("")}let s=ne.getInstance(),n=Vr.data;if(!n)try{let f=s.resolveAppPath(ue.vite.assetInspection);s.pathExists(f)}catch{}let i=new ar(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let f=e.app||{},m=(await i.discoverPWAAssets()).assets.filter(D=>D.type==="icon").map(D=>({src:`/${D.path}`,sizes:`${D.size.width}x${D.size.height}`,type:`image/${D.format}`,purpose:D.purpose}));return{name:f.name,short_name:f.shortName,description:f.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:m.length>0?m:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:f})=>f.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[f=>{let b=f.find(m=>m.url==="/index.html"||m.url==="index.html");return b&&!f.find(m=>m.url==="/")&&f.push({url:"/",revision:b.revision}),{manifest:f,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},u={...a,manifest:async()=>{let f=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let b=await e.manifest();return{...f,...b}}return{...f,...e.manifest}}return f},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return uf(u)}g();ge();g();ge();g();function Wi(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(c,u)=>`icon: '${u}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(c=>{let u=c[1],f=c[2];n=n.replace(new RegExp(`\\b${u}\\b`,"g"),`'${f}'`)}),Function(`return ${n}`)()}catch{return null}}var Ft=null,Hi=null;function ff(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var lr=class extends _e{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=p.env.DNDEV_BUILD_ID;if(Ft&&Hi===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ft.routes,this.errors=Ft.errors,this.source=Ft.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/")),Ft={routes:this.routes,errors:this.errors,source:this.source},Hi=p.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,u=>this._analyzePageFile(u,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let c=new Map;for(let u of this.routes){let f=u.path;if(c.has(f)){let b=c.get(f);throw new Error(`Route conflict: Multiple routes found for path '${f}'. Routes: ${b.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}c.set(f,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=ff(i),u=a===dr.HOMEPAGE_COMPONENT?dr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),f=this._extractPageMeta(n,s),{entity:b,action:m,...D}=o||{};return{path:u,component:a,importPath:i,auth:o?.auth||!1,meta:{...f,...D,entity:f.entity,action:f.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=Wi(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param"`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var hf={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
638
+ `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(t=".next"){let r=this.pathResolver.resolveAppPath(`${t}/static`),s=this.pathResolver.resolveAppPath(`${t}/static/chunks`),n=this.pathResolver.resolveAppPath(`${t}/static/css`),i=[];try{let o=[`${r}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${n}/**/*.css`];for(let a of o){let c=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),a.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of c){let f=this.pathResolver.getRelativePath(u);if(f.startsWith(`${t}/static/`)){let b=`/_next/${f.replace(`${t}/static/`,"")}`;i.push({url:b,revision:null})}}}}catch(o){this.logger?.warn(`Failed to discover Next.js build assets: ${o.message}`)}return i}generatePrecacheManifest(t=[],r=null){let s=t;return r&&typeof r=="function"&&(s=r(s)),s}async discoverPWAAssets(t=!1){return await this.discover(t)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};function qi(e={}){if(!e.enabled)return null;let t=e.app||{},r=[];if(t.name||r.push("name"),t.shortName||r.push("shortName"),t.description||r.push("description"),r.length>0){let f=Z("PWA",e.debug,!0);f.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${r.join(", ")}`),f.warn(" Add these to your src/config/app.ts:"),f.warn(" export const appConfig: AppConfig = {"),f.warn(" app: {"),t.name||f.warn(' name: "Your App Name",'),t.shortName||f.warn(' shortName: "App",'),t.description||f.warn(' description: "Your app description",'),f.warn(" },"),f.warn(" // ... rest of config"),f.warn(" };"),f.warn("")}let s=ne.getInstance(),n=Vr.data;if(!n)try{let f=s.resolveAppPath(ue.vite.assetInspection);s.pathExists(f)}catch{}let i=new ar(s,{...e,assetData:n}),o=e.devEnabled===!0,a={registerType:"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let f=e.app||{},m=(await i.discoverPWAAssets()).assets.filter(D=>D.type==="icon").map(D=>({src:`/${D.path}`,sizes:`${D.size.width}x${D.size.height}`,type:`image/${D.format}`,purpose:D.purpose}));return{name:f.name,short_name:f.shortName,description:f.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:m.length>0?m:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:f})=>f.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[f=>{let b=f.find(m=>m.url==="/index.html"||m.url==="index.html");return b&&!f.find(m=>m.url==="/")&&f.push({url:"/",revision:b.revision}),{manifest:f,warnings:[]}}]},devOptions:{enabled:o,type:"module"}},u={...a,manifest:async()=>{let f=await a.manifest();if(e.manifest){if(typeof e.manifest=="function"){let b=await e.manifest();return{...f,...b}}return{...f,...e.manifest}}return f},workbox:{...a.workbox,...e.workbox||{},runtimeCaching:[...a.workbox.runtimeCaching,...e.workbox?.runtimeCaching||[]],manifestTransforms:[...a.workbox.manifestTransforms||[],...e.workbox?.manifestTransforms||[]]}};return uf(u)}g();ge();g();ge();g();function Wi(e,t="unknown"){try{let r=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=e.match(r);if(!s)return null;let n=s[1];n=n.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(c,u)=>`icon: '${u}'`);let i=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...e.matchAll(i)].forEach(c=>{let u=c[1],f=c[2];n=n.replace(new RegExp(`\\b${u}\\b`,"g"),`'${f}'`)}),Function(`return ${n}`)()}catch{return null}}var Ft=null,Hi=null;function ff(e){let r=(e.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return r.charAt(0).toUpperCase()+r.slice(1)}var lr=class extends _e{constructor(t,r={}){super(t,{additionalPatterns:[],...r}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(t){let r=this.pathResolver.getAppRoot(),s=p.env.DNDEV_BUILD_ID;if(Ft&&Hi===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ft.routes,this.errors=Ft.errors,this.source=Ft.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${r}`),this.options.verbose||this.options.debug){let n=t?.consumerFiles?.length||0;if(this.logger.info(`\u{1F50D} Route discovery: Scanning ${n} files in ${r}`),this.options.debug){let i=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(i)}`)}}return await this._performAutoDiscovery(t,r),(this.options.verbose||this.options.debug)&&(this.logger.info(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/")),Ft={routes:this.routes,errors:this.errors,source:this.source},Hi=p.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(t=!1){return await this.discover(t)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(t,r){let{consumerFiles:s}=t,n=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,r)),i=await this._scanAdditionalPatterns(r),o=await this._batchProcessFiles(i,u=>this._analyzePageFile(u,r)),a=[...n,...o];this.logger.debug(`Auto-discovering from ${s.length} app + ${i.length} additional files`),this.routes=a.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let c=new Map;for(let u of this.routes){let f=u.path;if(c.has(f)){let b=c.get(f);throw new Error(`Route conflict: Multiple routes found for path '${f}'. Routes: ${b.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}c.set(f,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+i.length} files`)}async _scanAdditionalPatterns(t){let r=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(r.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:r,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(t,r){let s=await this.pathResolver.read(t.absolutePath,{format:"text"});if(!s)return null;let n=t.relativePath,i="/src/"+n.replace(/\\/g,"/");i=i.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let o=this._extractMetaExport(s,t.absolutePath),a=ff(i),u=a===dr.HOMEPAGE_COMPONENT?dr.HOMEPAGE_PATH:this._resolveRoutePath(o,n,t.absolutePath),f=this._extractPageMeta(n,s),{entity:b,action:m,...D}=o||{};return{path:u,component:a,importPath:i,auth:o?.auth||!1,meta:{...f,...D,entity:f.entity,action:f.action},metaExport:o,file:n}}_extractMetaExport(t,r){try{let s=Wi(t,r);return s?(this.logger.debug(`Extracted meta export from ${r}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${r}: ${s.message}`),null}}_generateRoutePath(t){let r=t.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(r.endsWith("/index")||r==="index")&&(r=r.replace(/\/index$/,"")||"/"),r==="/"?"/":"/"+r.replace(/\/+/g,"/")}_resolveRoutePath(t,r,s){if(!t?.route)return this._generateRoutePath(r);if(typeof t.route=="string"){let n=t.route.trim();return n==="/"?"/":(n=n.replace(/\/+/g,"/"),n.startsWith("/")||(n="/"+n),n)}if(typeof t.route=="object"&&t.route!==null){let n=this._generateRoutePath(r),i=t.route.params;if(Array.isArray(i)&&i.length>0){let o=i.map(a=>`:${a}`).join("/");return`${n}/${o}`}return n}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param" or object format: route: { params: ['id'] }`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(r)}_extractPageMeta(t,r){let s=t.split("/").pop()?.replace(".tsx","")||"",n=s.replace(/Page$/,"");n=n.replace(/([A-Z])/g," $1").trim(),n=n.charAt(0).toUpperCase()+n.slice(1);let i=t.split("/"),o=null,a=null;return i.length>1&&(o=i[i.length-2],s.includes("List")?a="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?a="form":(s.includes("Detail")||s.includes("View"))&&(a="detail")),{title:n,entity:o,action:a,file:t}}};var hf={isEmpty:e=>!e.routes||e.routes.length===0,generateModule:(e,t,r="routes")=>{let s={totalRoutes:e.routes.length,authRequired:e.routes.filter(i=>i.auth&&i.auth.required).length,publicRoutes:e.routes.filter(i=>!i.auth||i.auth===!1).length,source:e.source,generatedAt:new Date().toISOString(),errors:e.errors.length},n=e.routes.map(i=>` {
641
639
  path: '${i.path}',
642
640
  component: () => import('${i.importPath}'),
643
641
  auth: ${JSON.stringify(i.auth,null,2).replace(/\n/g,`