@donotdev/core 0.0.46 → 0.1.1

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 (68) hide show
  1. package/LICENSE.md +3 -3
  2. package/functions/index.d.ts +11 -166
  3. package/functions/index.js +7 -7
  4. package/i18n/locales/eager/dndev_ar.json +158 -0
  5. package/i18n/locales/eager/dndev_da.json +153 -0
  6. package/i18n/locales/eager/dndev_de.json +158 -0
  7. package/i18n/locales/eager/dndev_en.json +3 -0
  8. package/i18n/locales/eager/dndev_es.json +159 -1
  9. package/i18n/locales/eager/dndev_fr.json +158 -0
  10. package/i18n/locales/eager/dndev_it.json +158 -0
  11. package/i18n/locales/eager/dndev_ja.json +158 -0
  12. package/i18n/locales/eager/dndev_ko.json +158 -0
  13. package/i18n/locales/eager/dndev_nl.json +153 -0
  14. package/i18n/locales/eager/dndev_pt.json +581 -0
  15. package/i18n/locales/eager/dndev_zh.json +581 -0
  16. package/i18n/locales/lazy/ai_en.json +25 -0
  17. package/i18n/locales/lazy/ai_pt.json +25 -0
  18. package/i18n/locales/lazy/ai_zh.json +25 -0
  19. package/i18n/locales/lazy/auth_ar.json +44 -0
  20. package/i18n/locales/lazy/auth_da.json +45 -1
  21. package/i18n/locales/lazy/auth_de.json +44 -0
  22. package/i18n/locales/lazy/auth_en.json +44 -0
  23. package/i18n/locales/lazy/auth_es.json +44 -0
  24. package/i18n/locales/lazy/auth_fr.json +44 -0
  25. package/i18n/locales/lazy/auth_it.json +44 -0
  26. package/i18n/locales/lazy/auth_ja.json +44 -0
  27. package/i18n/locales/lazy/auth_ko.json +44 -0
  28. package/i18n/locales/lazy/auth_nl.json +45 -1
  29. package/i18n/locales/lazy/auth_pt.json +192 -0
  30. package/i18n/locales/lazy/auth_zh.json +192 -0
  31. package/i18n/locales/lazy/billing_en.json +11 -0
  32. package/i18n/locales/lazy/billing_pt.json +93 -0
  33. package/i18n/locales/lazy/billing_zh.json +93 -0
  34. package/i18n/locales/lazy/blog_pt.json +9 -0
  35. package/i18n/locales/lazy/blog_zh.json +9 -0
  36. package/i18n/locales/lazy/cookies_pt.json +32 -0
  37. package/i18n/locales/lazy/cookies_zh.json +32 -0
  38. package/i18n/locales/lazy/crud_ar.json +3 -0
  39. package/i18n/locales/lazy/crud_da.json +3 -0
  40. package/i18n/locales/lazy/crud_de.json +3 -0
  41. package/i18n/locales/lazy/crud_en.json +3 -0
  42. package/i18n/locales/lazy/crud_es.json +3 -0
  43. package/i18n/locales/lazy/crud_fr.json +3 -0
  44. package/i18n/locales/lazy/crud_it.json +3 -0
  45. package/i18n/locales/lazy/crud_ja.json +3 -0
  46. package/i18n/locales/lazy/crud_ko.json +3 -0
  47. package/i18n/locales/lazy/crud_nl.json +3 -0
  48. package/i18n/locales/lazy/crud_pt.json +534 -0
  49. package/i18n/locales/lazy/crud_zh.json +534 -0
  50. package/i18n/locales/lazy/homeTemplate_pt.json +52 -0
  51. package/i18n/locales/lazy/homeTemplate_zh.json +52 -0
  52. package/i18n/locales/lazy/legalNotice_pt.json +55 -0
  53. package/i18n/locales/lazy/legalNotice_zh.json +55 -0
  54. package/i18n/locales/lazy/oauth_pt.json +11 -0
  55. package/i18n/locales/lazy/oauth_zh.json +11 -0
  56. package/i18n/locales/lazy/privacy_pt.json +178 -0
  57. package/i18n/locales/lazy/privacy_zh.json +178 -0
  58. package/i18n/locales/lazy/terms_pt.json +200 -0
  59. package/i18n/locales/lazy/terms_zh.json +200 -0
  60. package/index.d.ts +2834 -4778
  61. package/index.js +44 -516
  62. package/next/index.d.ts +349 -176
  63. package/next/index.js +84 -61
  64. package/package.json +10 -6
  65. package/server.d.ts +1994 -2847
  66. package/server.js +1 -372
  67. package/vite/index.d.ts +298 -181
  68. package/vite/index.js +91 -76
package/LICENSE.md CHANGED
@@ -8,7 +8,7 @@ Copyright © 2025 Ambroise Park Consulting. All rights reserved.
8
8
 
9
9
  ## 1. DEFINITIONS
10
10
 
11
- **1.1 "Framework"** means the DoNotDev commercial software packages (excluding @donotdev/cli and @donotdev/components, which are free), including all compiled JavaScript files, TypeScript definition files, and associated documentation.
11
+ **1.1 "Framework"** means the DoNotDev commercial software packages (excluding @donotdev/cli, @donotdev/components, @donotdev/expo, and @donotdev/templates, which are licensed under MIT), including all compiled JavaScript files, TypeScript definition files, and associated documentation.
12
12
 
13
13
  **1.2 "License Key"** means the unique alphanumeric key provided to you upon purchase, required to suppress watermarks and unlock full Framework functionality.
14
14
 
@@ -231,12 +231,12 @@ Ambroise Park Consulting has no obligation to provide support, updates, or maint
231
231
 
232
232
  Questions about licensing or compliance:
233
233
 
234
- **Email:** mooti.web.app@gmail.com
234
+ **Email:** contact@donotdev.com
235
235
  **Website:** donotdev.com
236
236
 
237
237
  ---
238
238
 
239
239
  **END OF LICENSE AGREEMENT**
240
240
 
241
- **DoNotDev Framework License v2.0**
241
+ **DoNotDev Framework License v1.0**
242
242
  Ambroise Park Consulting – 2025
@@ -1,5 +1,4 @@
1
1
  import { BuildOptions } from 'esbuild';
2
- import * as React from 'react';
3
2
 
4
3
  // packages/core/types/src/functions/functionTypes.ts
5
4
 
@@ -12,7 +11,7 @@ import * as React from 'react';
12
11
  /**
13
12
  * Memory allocation options for Cloud Functions
14
13
  *
15
- * @version 0.0.1
14
+ * @version 0.1.0
16
15
  * @since 0.0.1
17
16
  * @author AMBROISE PARK Consulting
18
17
  */
@@ -28,7 +27,7 @@ type FunctionMemory =
28
27
  /**
29
28
  * Function trigger types
30
29
  *
31
- * @version 0.0.1
30
+ * @version 0.1.0
32
31
  * @since 0.0.1
33
32
  * @author AMBROISE PARK Consulting
34
33
  */
@@ -45,7 +44,7 @@ type FunctionTrigger =
45
44
  * Function-level deployment metadata
46
45
  * @description Per-function configuration for Firebase deployment (like PageMeta for pages)
47
46
  *
48
- * @version 0.0.1
47
+ * @version 0.1.0
49
48
  * @since 0.0.1
50
49
  * @author AMBROISE PARK Consulting
51
50
  */
@@ -79,7 +78,7 @@ interface FunctionMeta {
79
78
  /**
80
79
  * CRUD entity configuration for auto-generation
81
80
  *
82
- * @version 0.0.1
81
+ * @version 0.1.0
83
82
  * @since 0.0.1
84
83
  * @author AMBROISE PARK Consulting
85
84
  */
@@ -93,7 +92,7 @@ interface CrudConfig {
93
92
  /**
94
93
  * App-level defaults for all functions
95
94
  *
96
- * @version 0.0.1
95
+ * @version 0.1.0
97
96
  * @since 0.0.1
98
97
  * @author AMBROISE PARK Consulting
99
98
  */
@@ -132,7 +131,7 @@ interface FunctionDefaults {
132
131
  * };
133
132
  * ```
134
133
  *
135
- * @version 0.0.1
134
+ * @version 0.1.0
136
135
  * @since 0.0.1
137
136
  * @author AMBROISE PARK Consulting
138
137
  */
@@ -145,166 +144,12 @@ interface FunctionsConfig {
145
144
  crud?: CrudConfig;
146
145
  }
147
146
 
148
- type $MergeBy<T, K> = Omit<T, keyof K> & K;
149
-
150
- type $PreservedValue<Value, Fallback> = [Value] extends [never] ? Fallback : Value;
151
-
152
- /**
153
- * This interface can be augmented by users to add types to `i18next` default TypeOptions.
154
- *
155
- * Usage:
156
- * ```ts
157
- * // i18next.d.ts
158
- * import 'i18next';
159
- * declare module 'i18next' {
160
- * interface CustomTypeOptions {
161
- * defaultNS: 'custom';
162
- * returnNull: false;
163
- * returnObjects: false;
164
- * nsSeparator: ':';
165
- * keySeparator: '.';
166
- * compatibilityJSON: 'v4';
167
- * allowObjectInHTMLChildren: false;
168
- * resources: {
169
- * custom: {
170
- * foo: 'foo';
171
- * };
172
- * };
173
- * }
174
- * }
175
- * ```
176
- */
177
- interface CustomTypeOptions {}
178
-
179
- type TypeOptions = $MergeBy<
180
- {
181
- /** @see {InitOptions.returnNull} */
182
- returnNull: false;
183
-
184
- /** @see {InitOptions.returnEmptyString} */
185
- returnEmptyString: true;
186
-
187
- /** @see {InitOptions.returnObjects} */
188
- returnObjects: false;
189
-
190
- /** @see {InitOptions.keySeparator} */
191
- keySeparator: '.';
192
-
193
- /** @see {InitOptions.nsSeparator} */
194
- nsSeparator: ':';
195
-
196
- /** @see {InitOptions.pluralSeparator} */
197
- pluralSeparator: '_';
198
-
199
- /** @see {InitOptions.contextSeparator} */
200
- contextSeparator: '_';
201
-
202
- /** @see {InitOptions.defaultNS} */
203
- defaultNS: 'translation';
204
-
205
- /** @see {InitOptions.fallbackNS} */
206
- fallbackNS: false;
207
-
208
- /** @see {InitOptions.compatibilityJSON} */
209
- compatibilityJSON: 'v4';
210
-
211
- /** @see {InitOptions.resources} */
212
- resources: object;
213
-
214
- /**
215
- * Flag that allows HTML elements to receive objects. This is only useful for React applications
216
- * where you pass objects to HTML elements so they can be replaced to their respective interpolation
217
- * values (mostly with Trans component)
218
- */
219
- allowObjectInHTMLChildren: false;
220
-
221
- /**
222
- * Flag that enables strict key checking even if a `defaultValue` has been provided.
223
- * This ensures all calls of `t` function don't accidentally use implicitly missing keys.
224
- */
225
- strictKeyChecks: false;
226
-
227
- /**
228
- * Prefix for interpolation
229
- */
230
- interpolationPrefix: '{{';
231
-
232
- /**
233
- * Suffix for interpolation
234
- */
235
- interpolationSuffix: '}}';
236
-
237
- /** @see {InterpolationOptions.unescapePrefix} */
238
- unescapePrefix: '-';
239
-
240
- /** @see {InterpolationOptions.unescapeSuffix} */
241
- unescapeSuffix: '';
242
-
243
- /**
244
- * Use a proxy-based selector to select a translation.
245
- *
246
- * Enables features like go-to definition, and better DX/faster autocompletion
247
- * for TypeScript developers.
248
- *
249
- * If you're working with an especially large set of translations and aren't
250
- * using context, you set `enableSelector` to `"optimize"` and i18next won't do
251
- * any type-level processing of your translations at all.
252
- *
253
- * With `enableSelector` set to `"optimize"`, i18next is capable of supporting
254
- * arbitrarily large/deep translation sets without causing any IDE slowdown
255
- * whatsoever.
256
- *
257
- * @default false
258
- */
259
- enableSelector: false;
260
- },
261
- CustomTypeOptions
262
- >;
263
-
264
- type FlatNamespace = $PreservedValue<keyof TypeOptions['resources'], string>;
265
- type Namespace<T = FlatNamespace> = T | readonly T[];
266
-
267
- interface ReportNamespaces {
268
- addUsedNamespaces(namespaces: Namespace): void;
269
- getUsedNamespaces(): string[];
270
- }
271
-
272
- declare module 'i18next' {
273
- // interface i18n {
274
- // reportNamespaces?: ReportNamespaces;
275
- // }
276
- interface CustomInstanceExtensions {
277
- reportNamespaces?: ReportNamespaces;
278
- }
279
- }
280
-
281
- type ObjectOrNever = TypeOptions['allowObjectInHTMLChildren'] extends true
282
- ? Record<string, unknown>
283
- : never;
284
-
285
- type ReactI18NextChildren = React.ReactNode | ObjectOrNever;
286
-
287
- declare module 'react' {
288
- namespace JSX {
289
- interface IntrinsicAttributes {
290
- i18nIsDynamicList?: boolean;
291
- }
292
- }
293
-
294
- interface HTMLAttributes<T> {
295
- // This union is inspired by the typings for React.ReactNode. We do this to fix "This JSX tag's 'children' prop
296
- // expects a single child of type 'ReactI18NextChildren', but multiple children were provided":
297
- // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1e9f91ed0143adede394adb3f540e650455f71/types/react/index.d.ts#L268
298
- children?: ReactI18NextChildren | Iterable<ReactI18NextChildren>;
299
- }
300
- }
301
-
302
147
  // packages/core/config/functions/index.d.ts
303
148
  /**
304
149
  * @fileoverview Type Definitions for esbuild Configuration
305
150
  * @description TypeScript type definitions for esbuild configuration used in Firebase and Vercel function builds.
306
151
  *
307
- * @version 0.0.1
152
+ * @version 0.1.0
308
153
  * @since 0.0.1
309
154
  * @author AMBROISE PARK Consulting
310
155
  */
@@ -314,7 +159,7 @@ declare module 'react' {
314
159
  /**
315
160
  * Esbuild configuration options
316
161
  *
317
- * @version 0.0.1
162
+ * @version 0.1.0
318
163
  * @since 0.0.1
319
164
  * @author AMBROISE PARK Consulting
320
165
  */
@@ -332,7 +177,7 @@ interface EsbuildOptions {
332
177
  /**
333
178
  * Create esbuild configuration for functions
334
179
  *
335
- * @version 0.0.1
180
+ * @version 0.1.0
336
181
  * @since 0.0.1
337
182
  * @author AMBROISE PARK Consulting
338
183
  */
@@ -342,7 +187,7 @@ declare function createFunctionsEsbuildConfig(
342
187
  /**
343
188
  * Create root functions esbuild configuration
344
189
  *
345
- * @version 0.0.1
190
+ * @version 0.1.0
346
191
  * @since 0.0.1
347
192
  * @author AMBROISE PARK Consulting
348
193
  */
@@ -352,7 +197,7 @@ declare function createRootFunctionsConfig(
352
197
  /**
353
198
  * Create app functions esbuild configuration
354
199
  *
355
- * @version 0.0.1
200
+ * @version 0.1.0
356
201
  * @since 0.0.1
357
202
  * @author AMBROISE PARK Consulting
358
203
  */
@@ -1,20 +1,20 @@
1
- import A from"node:fs";import P from"node:path";import{fileURLToPath as oe}from"node:url";var ne=oe(import.meta.url),be=P.dirname(ne);function D(){let a=process.cwd(),e=10;for(let t=0;t<e;t++){let o=P.join(a,"package.json");if(A.existsSync(o))try{let s=JSON.parse(A.readFileSync(o,"utf8")),r=s.workspaces&&Array.isArray(s.workspaces);if(r&&s.workspaces.some(i=>i==="packages/**"||i.startsWith("packages/"))&&(A.existsSync(P.join(a,"packages","core"))||A.existsSync(P.join(a,"packages","functions"))))return{type:"dndev",root:a};if(r&&s.workspaces.some(i=>i.includes("dndev/packages"))){let u=s.workspaces.find(m=>m.includes("dndev/packages")).replace(/\/packages.*$/,""),d=P.resolve(a,u);if(A.existsSync(P.join(d,"packages","core")))return{type:"dndev",root:d}}}catch{}let n=P.dirname(a);if(n===a)break;a=n}return{type:"npm",root:process.cwd()}}function ie(a){return a.type==="dndev"?a.root:null}function H(a){let e={};if(a.type==="dndev"){let t=ie(a);t&&(e["@donotdev/types"]=P.join(t,"packages","core","types","src"),e["@donotdev/functions"]=P.join(t,"packages","functions","src"),e["@donotdev/utils"]=P.join(t,"packages","core","utils","src"),e["@donotdev/schemas"]=P.join(t,"packages","core","schemas","src"),e["@donotdev/core"]=P.join(t,"packages","core"))}return e}import*as h from"node:fs";import"node:fs";import{createRequire as ce}from"node:module";import{resolve as O,join as S,dirname as x,relative as K,normalize as le,sep as q,extname as ue}from"node:path";import{fileURLToPath as pe}from"node:url";import fe from"fast-glob";var T={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},w={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${T.SOURCE_EAGER}/*_*.json`],lazy:[`${T.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]};var Y={base:{absolute:!0,onlyFiles:!0,ignore:w.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...w.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...w.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:w.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:w.globalIgnore}};function V(a,e=null){let t=w[a];if(!t)throw new Error(`Unknown pattern type: ${a}`);return e&&t.framework?{...t,framework:t.framework.map(o=>`${e}/${o}`)}:t}function J(a){return Y[a]||Y.base}var _={getGlobOptionsFor:J||void 0,SCAN_PATTERNS:w||void 0,getPatternsFor:V||void 0,I18N_PATHS:T||void 0},y={error:(a,e)=>{},warn:(a,e)=>{},info:a=>{}};function X(a,e){return a().catch(t=>{throw new Error(`${e}: ${t instanceof Error?t.message:String(t)}`)})}var Z={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},z=class a{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(e={}){return a._instance||(a._instance=new a(e)),a._instance}static _reset(){a._instance=null}constructor(e={}){if(a._instance)return a._instance;this.options={maxLevels:e.maxLevels??10,customMarkers:e.customMarkers||[],cache:e.cache??!1,debug:e.debug??!1};try{let t=process.cwd();if(!t)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(t)}catch(t){throw new Error(`PathResolver constructor failed: ${t instanceof Error?t.message:String(t)}. cwd: ${process.cwd()}`)}this._appRoot=null,a._instance=this}normalizePath(e){if(!e)return"";try{return le(e).split(q).join("/")}catch{return String(e).split(q).join("/")}}getRelativePath(e){let t=this.getAppRoot(),o=K(t,e);return this.normalizePath(o)}getBasename(e){if(!e)return"";let o=this.normalizePath(e).split("/");return o[o.length-1]||""}getDirname(e){return e?this.normalizePath(x(e)):""}resolvePackage(e,t=null){try{let o=t||this.getAppRoot(),s=ce(S(o,"package.json")).resolve(e);return this.normalizePath(s)}catch{return null}}resolveFrameworkPackage(e,t=null){let o=this.resolvePackage(`${e}/package.json`,t);if(o)return this.getDirname(o);if(this.isMonorepo()&&e.startsWith("@donotdev/")){let r=e.replace("@donotdev/",""),c=this.resolveRepoPath(`packages/${r}`);if(this.pathExists(c))return c;if(["auth","billing","crud","oauth"].includes(r)){let l=this.resolveRepoPath(`packages/features/${r}`);if(this.pathExists(l))return l}if(r==="firebase"){let l=this.resolveRepoPath(`packages/providers/${r}`);if(this.pathExists(l))return l}}let n=this.resolveAppPath(`node_modules/${e}`);if(this.pathExists(n))return n;let s=this.resolveRepoPath(`node_modules/${e}`);return this.pathExists(s)?s:null}resolvePackageAsset(e,t=null){return this.resolvePackage(e,t)}resolveAppPath(e){let t=this.getAppRoot(),o=O(t,e);return this.normalizePath(o)}resolveRepoPath(e){let t=this.getRepoRoot(),o=this.normalizePath(e),n=O(t,o);return this.normalizePath(n)}resolvePath(e,t){let o=this.normalizePath(t),n=this.normalizePath(e),s=O(o,n);return this.normalizePath(s)}createImportPath(e){return"./"+this.getRelativePath(e)}getFileInfo(e){try{let t=h.statSync(e);return{absolutePath:this.normalizePath(e),relativePath:this.getRelativePath(e),importPath:this.createImportPath(e),size:t.size,isFile:t.isFile(),isDirectory:t.isDirectory()}}catch{return null}}_detectFormat(e,t){return t&&t!=="auto"?t:ue(e).toLowerCase()===".json"?"json":"text"}async read(e,t={}){let{format:o="auto",encoding:n="utf8"}=t,s=this._detectFormat(e,o);try{if(s==="buffer")return await h.promises.readFile(e);let r=await h.promises.readFile(e,n),c=this.stripBom(r);return s==="json"?JSON.parse(c):c}catch(r){return this.options.debug&&y.warn(`Failed to read file: ${e}`,r),null}}readSync(e,t={}){let{format:o="auto",encoding:n="utf8"}=t,s=this._detectFormat(e,o);try{if(s==="buffer")return h.readFileSync(e);let r=h.readFileSync(e,n),c=this.stripBom(r);return s==="json"?JSON.parse(c):c}catch(r){return this.options.debug&&y.warn(`Failed to read file: ${e}`,r),null}}async write(e,t,o={}){let{format:n="auto",overwrite:s=!1,dryRun:r=!1,verbose:c=!1}=o,l=this.normalizePath(e),f=this.normalizePath(x(l)),i=this.pathExists(l);if(i&&!s)return c&&y.info(`Skipping existing file: ${l}`),!1;if(r)return y.info(`[DRY RUN] Would write file: ${l}`),!0;try{await h.promises.mkdir(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let u=this._detectFormat(e,n),d;Buffer.isBuffer(t)?d=t:u==="json"&&typeof t=="object"?d=JSON.stringify(t,null,2):d=String(t);try{return await X(async()=>(Buffer.isBuffer(d)?await h.promises.writeFile(l,d):await h.promises.writeFile(l,d,"utf8"),c&&y.info(`${i?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(e,t,o={}){let{format:n="auto",overwrite:s=!1,dryRun:r=!1,verbose:c=!1}=o,l=this.normalizePath(e),f=this.normalizePath(x(l)),i=this.pathExists(l);if(i&&!s)return c&&y.info(`Skipping existing file: ${l}`),!1;if(r)return y.info(`[DRY RUN] Would write file: ${l}`),!0;try{h.mkdirSync(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let u=this._detectFormat(e,n),d;Buffer.isBuffer(t)?d=t:u==="json"&&typeof t=="object"?d=JSON.stringify(t,null,2):d=String(t);try{return Buffer.isBuffer(d)?h.writeFileSync(l,d):h.writeFileSync(l,d,"utf8"),c&&y.info(`${i?"Updated":"Created"} file: ${l}`),!0}catch(m){throw new Error(`Failed to write file: ${l}: ${m instanceof Error?m.message:String(m)}`)}}async copy(e,t,o={}){let{overwrite:n=!1,dryRun:s=!1,verbose:r=!1}=o,c=this.normalizePath(t),l=this.pathExists(c);if(l&&!n)return r&&y.info(`Skipping existing file: ${c}`),!1;if(s)return y.info(`[DRY RUN] Would copy file: ${c}`),!0;let f=this.normalizePath(x(c));try{await h.promises.mkdir(f,{recursive:!0})}catch(i){if(i?.code!=="EEXIST")throw i}try{return await X(async()=>(await h.promises.copyFile(e,c),r&&y.info(`${l?"Updated":"Created"} file: ${c}`),!0),`Failed to copy file from ${e} to ${c}`)}catch{return!1}}copySync(e,t,o={}){let{overwrite:n=!1,dryRun:s=!1,verbose:r=!1}=o,c=this.normalizePath(t),l=this.pathExists(c);if(l&&!n)return r&&y.info(`Skipping existing file: ${c}`),!1;if(s)return y.info(`[DRY RUN] Would copy file: ${c}`),!0;let f=this.normalizePath(x(c));try{h.mkdirSync(f,{recursive:!0})}catch(i){if(i?.code!=="EEXIST")throw i}try{return h.copyFileSync(e,c),r&&y.info(`${l?"Updated":"Created"} file: ${c}`),!0}catch{return!1}}pathExists(e,t=!1){try{return h.existsSync(e)}catch(o){return t||y.error(`Error checking path existence: ${e}`,o),!1}}mkdir(e){try{let t=e.startsWith("/")||e.match(/^[A-Z]:/)?this.normalizePath(e):this.resolveAppPath(e);return h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),!0}catch{return!1}}readdirSync(e,t){try{return h.readdirSync(e,t)}catch(o){return this.options.debug&&y.warn(`Failed to read directory: ${e}`,o),t&&typeof t=="object"&&"withFileTypes"in t&&t.withFileTypes?[]:[]}}statSync(e){try{return h.statSync(e)}catch(t){return this.options.debug&&y.warn(`Failed to stat file: ${e}`,t),null}}realpathSync(e){return h.realpathSync(e)}watch(e,t,o){return h.watch(e,t,o)}lstatSync(e){try{return h.lstatSync(e)}catch(t){return this.options.debug&&y.warn(`Failed to lstat file: ${e}`,t),null}}async ensureDir(e){try{await h.promises.mkdir(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}ensureDirSync(e){try{h.mkdirSync(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}async remove(e){await h.promises.rm(e,{recursive:!0,force:!0})}removeSync(e){h.rmSync(e,{recursive:!0,force:!0})}async readdir(e,t){return h.promises.readdir(e,t)}stripBom(e){return e.charCodeAt(0)===65279?e.slice(1):e}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(e){if(!e)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(e)}isMonorepo(){let e=S(this._repoRoot,"packages");return this.pathExists(e)}isWithinApp(e){let t=this.normalizePath(O(e)),o=this.getAppRoot(),n=K(o,t),s=this.normalizePath(n);return!s.startsWith("../")&&!s.startsWith("/")}async findFiles(e,t,o={}){let n=this.normalizePath(S(e,t)),s=this.getAppRoot(),r=this.normalizePath(s),c=n.startsWith(r)?n.slice(r.length+1):n,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:_.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([c],{...l,...o})}clearCache(){}async _resolveFrameworkI18nPattern(e){let t=_.I18N_PATHS;if(!t)return null;let o=e.replace(t.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let s=this.normalizePath(S(n,t.PUBLISHED_ROOT,o)),r=s.replace(/\/[^/]*\*.*$/,"");return this.pathExists(r),s}async _globWithNormalization(e,t){return(await fe(e,t)).map(n=>{let s=typeof n=="string"?n:n.path;return this.normalizePath(s)})}async resolveFiles(e,t="css"){if(!e||typeof e!="object")return{frameworkFiles:[],consumerFiles:[]};if(t==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(e.framework)||(e.framework=[]),!Array.isArray(e.consumer))return{frameworkFiles:[],consumerFiles:[]};let o=[...e.framework,...e.consumer];for(let i of o)if(typeof i!="string"||i.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),s=_.getGlobOptionsFor?_.getGlobOptionsFor(t):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},r=this.normalizePath(n),c=e.framework.map(i=>{let u=this.normalizePath(i);return u.startsWith(r)?u.slice(r.length+1):u}),l=e.consumer.map(i=>{let u=this.normalizePath(i);return u.startsWith(r)?u.slice(r.length+1):u}),f={...s,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let i=c.length>0?await this._globWithNormalization(c,f):[],u=await this._globWithNormalization(l,f);return{frameworkFiles:i,consumerFiles:u}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(e){if(!_.getPatternsFor)return{framework:[],consumer:[],all:[]};let t=this.getAppRoot(),o=this.getRepoRoot();if(e==="i18n"&&(!t||t===o))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${t}, repoRoot: ${o}). Ensure configResolved hook has run before discovery.`);let n=_.getPatternsFor(e),s=this.isMonorepo();if(e==="i18n"){let l=n,f={eager:l.eager.map(i=>i.startsWith("!")?"!"+this.resolveAppPath(i.slice(1)):this.resolveAppPath(i)),lazy:l.lazy.map(i=>i.startsWith("!")?"!"+this.resolveAppPath(i.slice(1)):this.resolveAppPath(i)),framework:{eager:s?(l.framework?.eager||[]).map(i=>this.resolveRepoPath(i)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(i=>this._resolveFrameworkI18nPattern(i))).then(i=>i.filter(Boolean)),lazy:s?(l.framework?.lazy||[]).map(i=>this.resolveRepoPath(i)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(i=>this._resolveFrameworkI18nPattern(i))).then(i=>i.filter(Boolean))},all:[]};return f.all=[...f.eager,...f.lazy,...f.framework.eager,...f.framework.lazy],f}let r=n,c={framework:s?(r.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(r.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return c.all=[...c.consumer,...c.framework],c}getEmptyModulePath(){return this.getEmptyCjsModulePath().replace(/\.cjs$/,".js")}getEmptyFlagModulePath(){let e=x(pe(import.meta.url));return this.normalizePath(O(e,"emptyFlag.js"))}getEmptyCjsModulePath(){let e=this.resolvePackage("@donotdev/core/empty");if(!e)throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");return e}_findRepoRoot(e){let t=this.normalizePath(e),o=0,n=this.options.maxLevels;for(;o<n;){let s=this.normalizePath(S(t,Z.TOOLING)),r=this.normalizePath(S(t,Z.CORE));if(this.pathExists(s)&&this.pathExists(r))return t;let c=S(t,"apps");if(this.pathExists(c)&&this.statSync(c)?.isDirectory())return this.normalizePath(t);let l=this.normalizePath(S(t,"package.json"));if(this.pathExists(l)&&this.normalizePath(x(t))===t)return t;let f=this.normalizePath(x(t));if(f===t)break;t=f,o++}return this.normalizePath(e)}};function N(a={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",workspace:r,bundleWorkspaceDeps:c=!1,importFramework:l=!1,external:f=!1,...i}=a,u=z.getInstance(),d=H(r),m={entryPoints:[e],bundle:!0,platform:"node",target:"node20",format:"esm",outdir:t,outExtension:{".js":".js"},minify:o,sourcemap:n,metafile:!0,logLevel:"info",loader:{".ts":"ts",".tsx":"tsx",".css":"empty"},keepNames:!0,treeShaking:!0,...i};c&&Object.keys(d).length>0&&(m.alias=Object.fromEntries(Object.entries(d).map(([v,p])=>[v,u.normalizePath(p)]))),m.mainFields=["module","main"],m.conditions=["import","module","node"];let j=["fs","path","crypto","util","stream","events","buffer","url","querystring","http","https","zlib","os","child_process","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","perf_hooks","async_hooks"],I=[];if(c)try{let v=r?.root||process.cwd(),p=process.cwd(),g=10;for(let k=0;k<g;k++){let R=u.normalizePath(`${p}/package.json`);if(u.pathExists(R)){let b=u.readSync(R,{format:"json"});if(b&&Array.isArray(b.workspaces)){v=u.normalizePath(p);for(let F of b.workspaces)F==="apps/*"||F==="functions"||!F.includes("*")&&!F.includes("/")&&I.push(F);break}}let E=u.getDirname(p);if(E===p)break;p=E}}catch{}let W={name:"external-node-modules",setup(v){v.onResolve({filter:/^firebase($|\/)/},p=>{if(p.path==="firebase-admin"||p.path.startsWith("firebase-admin/")||p.path==="firebase-functions"||p.path.startsWith("firebase-functions/"))return null;let g;if(r?.type==="dndev"&&r.root)g=u.normalizePath(`${r.root}/packages/core/config/functions/firebase-stub.js`);else{let k=import.meta.url,E=new URL(k).pathname.replace(/^\/([A-Z]:)/i,"$1"),b=u.getDirname(E);g=u.normalizePath(`${b}/firebase-stub.js`)}return{path:g}}),v.onResolve({filter:/.*/},p=>{if(p.kind==="entry-point")return null;if(p.path.match(/@donotdev\/functions\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/functions/","");return{path:u.normalizePath(`${r.root}/packages/functions/src/${g}/index.ts`)}}if(p.path==="@donotdev/utils")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/core/utils/src/server/index.ts`)}:v.resolve("@donotdev/utils/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path.match(/@donotdev\/utils\/.+/)&&r?.type==="dndev"){let g=p.path.replace("@donotdev/utils/","");return{path:u.normalizePath(`${r.root}/packages/core/utils/src/${g}/index.ts`)}}if(p.path==="@donotdev/supabase")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/providers/supabase/src/server/index.ts`)}:v.resolve("@donotdev/supabase/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path==="@donotdev/core")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/core/server.ts`)}:v.resolve("@donotdev/core/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path.match(/@donotdev\/core\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/core/","");return{path:u.normalizePath(`${r.root}/packages/core/${g}.ts`)}}if(p.path==="firebase-admin"||p.path.startsWith("firebase-admin/")||p.path==="firebase-functions"||p.path.startsWith("firebase-functions/"))return{path:p.path,external:!0};if(p.path.match(/@donotdev\/core\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/core/","");return{path:u.normalizePath(`${r.root}/packages/core/${g}.ts`)}}if(p.path.startsWith("@donotdev/")||p.path==="valibot"||p.path.startsWith("valibot/"))return null;if(I.length>0){let g=p.path.split("/")[0];if(I.includes(g))return null}return p.path.startsWith(".")||p.path.startsWith("/")?null:{path:p.path,external:!0}})}};if(m.external=[...j,"firebase-admin","firebase-functions"],m.plugins=[W,...m.plugins||[]],m.define={"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"production"),...m.define||{}},l&&r.type==="dndev"){let v=r.root,p=u.normalizePath(`${v}/functions/lib`);m.alias={...m.alias,"@donotdev/functions":p}}if(s==="framework"){let v=z.getInstance(),p=r?.root?v.normalizePath(`${r.root}/packages/functions`):process.cwd(),g=v.normalizePath(`${p}/package.json`),k=v.readSync(g,{format:"json"});if(k?.exports){let R={};for(let[,E]of Object.entries(k.exports)){let b=E?.import||E?.default||(typeof E=="string"?E:null);if(!b||!b.endsWith(".ts"))continue;let F=b.replace(/^\.\/src\//,"").replace(/\.ts$/,"");R[F]=b}Object.keys(R).length>0&&(m.entryPoints=R)}}return m}import{readFileSync as C,writeFileSync as B,existsSync as L}from"fs";import"path";var U=["create","get","list","listCard","update","delete"];function Q(a,e=0){let t=" ".repeat(e),o="";for(let[n,s]of Object.entries(a))if(s!=null)if(typeof s=="object"&&!Array.isArray(s))Object.keys(s).length===0?o+=`${t}${n}: {}
1
+ import z from"node:fs";import P from"node:path";import{fileURLToPath as re}from"node:url";var se=re(import.meta.url),ye=P.dirname(se);function T(){let a=process.cwd(),e=10;for(let t=0;t<e;t++){let o=P.join(a,"package.json");if(z.existsSync(o))try{let s=JSON.parse(z.readFileSync(o,"utf8")),r=s.workspaces&&Array.isArray(s.workspaces);if(r&&s.workspaces.some(i=>i==="packages/**"||i.startsWith("packages/"))&&(z.existsSync(P.join(a,"packages","core"))||z.existsSync(P.join(a,"packages","functions"))))return{type:"dndev",root:a};if(r&&s.workspaces.some(i=>i.includes("dndev/packages"))){let u=s.workspaces.find(m=>m.includes("dndev/packages")).replace(/\/packages.*$/,""),d=P.resolve(a,u);if(z.existsSync(P.join(d,"packages","core")))return{type:"dndev",root:d}}}catch{}let n=P.dirname(a);if(n===a)break;a=n}return{type:"npm",root:process.cwd()}}function oe(a){return a.type==="dndev"?a.root:null}function M(a){let e={};if(a.type==="dndev"){let t=oe(a);t&&(e["@donotdev/types"]=P.join(t,"packages","core","types","src"),e["@donotdev/functions"]=P.join(t,"packages","functions","src"),e["@donotdev/utils"]=P.join(t,"packages","core","utils","src"),e["@donotdev/schemas"]=P.join(t,"packages","core","schemas","src"),e["@donotdev/core"]=P.join(t,"packages","core"))}return e}import*as h from"node:fs";import"node:fs";import{createRequire as ie}from"node:module";import{resolve as $,join as F,dirname as _,relative as V,normalize as ae,sep as J,extname as ce}from"node:path";import{fileURLToPath as le}from"node:url";import ue from"fast-glob";var N={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},R={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${N.SOURCE_EAGER}/*_*.json`],lazy:[`${N.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]};var G={base:{absolute:!0,onlyFiles:!0,ignore:R.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...R.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...R.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:R.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:R.globalIgnore}};function H(a,e=null){let t=R[a];if(!t)throw new Error(`Unknown pattern type: ${a}`);return e&&t.framework?{...t,framework:t.framework.map(o=>`${e}/${o}`)}:t}function Y(a){return G[a]||G.base}var O={getGlobOptionsFor:Y||void 0,SCAN_PATTERNS:R||void 0,getPatternsFor:H||void 0,I18N_PATHS:N||void 0},y={error:(a,e)=>{},warn:(a,e)=>{},info:a=>{}};function K(a,e){return a().catch(t=>{throw new Error(`${e}: ${t instanceof Error?t.message:String(t)}`)})}var q={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},S=class a{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(e={}){return a._instance||(a._instance=new a(e)),a._instance}static _reset(){a._instance=null}constructor(e={}){if(a._instance)return a._instance;this.options={maxLevels:e.maxLevels??10,customMarkers:e.customMarkers||[],cache:e.cache??!1,debug:e.debug??!1};try{let t=process.cwd();if(!t)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(t)}catch(t){throw new Error(`PathResolver constructor failed: ${t instanceof Error?t.message:String(t)}. cwd: ${process.cwd()}`)}this._appRoot=null,a._instance=this}normalizePath(e){if(!e)return"";try{return ae(e).split(J).join("/")}catch{return String(e).split(J).join("/")}}getRelativePath(e){let t=this.getAppRoot(),o=V(t,e);return this.normalizePath(o)}getBasename(e){if(!e)return"";let o=this.normalizePath(e).split("/");return o[o.length-1]||""}getDirname(e){return e?this.normalizePath(_(e)):""}resolvePackage(e,t=null){try{let o=t||this.getAppRoot(),s=ie(F(o,"package.json")).resolve(e);return this.normalizePath(s)}catch{return null}}resolveFrameworkPackage(e,t=null){let o=this.resolvePackage(`${e}/package.json`,t);if(o)return this.getDirname(o);if(this.isMonorepo()&&e.startsWith("@donotdev/")){let r=e.replace("@donotdev/",""),c=this.resolveRepoPath(`packages/${r}`);if(this.pathExists(c))return c;if(["auth","billing","crud","oauth"].includes(r)){let l=this.resolveRepoPath(`packages/features/${r}`);if(this.pathExists(l))return l}if(r==="firebase"){let l=this.resolveRepoPath(`packages/providers/${r}`);if(this.pathExists(l))return l}}let n=this.resolveAppPath(`node_modules/${e}`);if(this.pathExists(n))return n;let s=this.resolveRepoPath(`node_modules/${e}`);return this.pathExists(s)?s:null}resolvePackageAsset(e,t=null){return this.resolvePackage(e,t)}resolveAppPath(e){let t=this.getAppRoot(),o=$(t,e);return this.normalizePath(o)}resolveRepoPath(e){let t=this.getRepoRoot(),o=this.normalizePath(e),n=$(t,o);return this.normalizePath(n)}resolvePath(e,t){let o=this.normalizePath(t),n=this.normalizePath(e),s=$(o,n);return this.normalizePath(s)}createImportPath(e){return"./"+this.getRelativePath(e)}getFileInfo(e){try{let t=h.statSync(e);return{absolutePath:this.normalizePath(e),relativePath:this.getRelativePath(e),importPath:this.createImportPath(e),size:t.size,isFile:t.isFile(),isDirectory:t.isDirectory()}}catch{return null}}_detectFormat(e,t){return t&&t!=="auto"?t:ce(e).toLowerCase()===".json"?"json":"text"}async read(e,t={}){let{format:o="auto",encoding:n="utf8"}=t,s=this._detectFormat(e,o);try{if(s==="buffer")return await h.promises.readFile(e);let r=await h.promises.readFile(e,n),c=this.stripBom(r);return s==="json"?JSON.parse(c):c}catch(r){return this.options.debug&&y.warn(`Failed to read file: ${e}`,r),null}}readSync(e,t={}){let{format:o="auto",encoding:n="utf8"}=t,s=this._detectFormat(e,o);try{if(s==="buffer")return h.readFileSync(e);let r=h.readFileSync(e,n),c=this.stripBom(r);return s==="json"?JSON.parse(c):c}catch(r){return this.options.debug&&y.warn(`Failed to read file: ${e}`,r),null}}async write(e,t,o={}){let{format:n="auto",overwrite:s=!1,dryRun:r=!1,verbose:c=!1}=o,l=this.normalizePath(e),f=this.normalizePath(_(l)),i=this.pathExists(l);if(i&&!s)return c&&y.info(`Skipping existing file: ${l}`),!1;if(r)return y.info(`[DRY RUN] Would write file: ${l}`),!0;try{await h.promises.mkdir(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let u=this._detectFormat(e,n),d;Buffer.isBuffer(t)?d=t:u==="json"&&typeof t=="object"?d=JSON.stringify(t,null,2):d=String(t);try{return await K(async()=>(Buffer.isBuffer(d)?await h.promises.writeFile(l,d):await h.promises.writeFile(l,d,"utf8"),c&&y.info(`${i?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(e,t,o={}){let{format:n="auto",overwrite:s=!1,dryRun:r=!1,verbose:c=!1}=o,l=this.normalizePath(e),f=this.normalizePath(_(l)),i=this.pathExists(l);if(i&&!s)return c&&y.info(`Skipping existing file: ${l}`),!1;if(r)return y.info(`[DRY RUN] Would write file: ${l}`),!0;try{h.mkdirSync(f,{recursive:!0})}catch(m){if(m?.code!=="EEXIST")throw m}let u=this._detectFormat(e,n),d;Buffer.isBuffer(t)?d=t:u==="json"&&typeof t=="object"?d=JSON.stringify(t,null,2):d=String(t);try{return Buffer.isBuffer(d)?h.writeFileSync(l,d):h.writeFileSync(l,d,"utf8"),c&&y.info(`${i?"Updated":"Created"} file: ${l}`),!0}catch(m){throw new Error(`Failed to write file: ${l}: ${m instanceof Error?m.message:String(m)}`)}}async copy(e,t,o={}){let{overwrite:n=!1,dryRun:s=!1,verbose:r=!1}=o,c=this.normalizePath(t),l=this.pathExists(c);if(l&&!n)return r&&y.info(`Skipping existing file: ${c}`),!1;if(s)return y.info(`[DRY RUN] Would copy file: ${c}`),!0;let f=this.normalizePath(_(c));try{await h.promises.mkdir(f,{recursive:!0})}catch(i){if(i?.code!=="EEXIST")throw i}try{return await K(async()=>(await h.promises.copyFile(e,c),r&&y.info(`${l?"Updated":"Created"} file: ${c}`),!0),`Failed to copy file from ${e} to ${c}`)}catch{return!1}}copySync(e,t,o={}){let{overwrite:n=!1,dryRun:s=!1,verbose:r=!1}=o,c=this.normalizePath(t),l=this.pathExists(c);if(l&&!n)return r&&y.info(`Skipping existing file: ${c}`),!1;if(s)return y.info(`[DRY RUN] Would copy file: ${c}`),!0;let f=this.normalizePath(_(c));try{h.mkdirSync(f,{recursive:!0})}catch(i){if(i?.code!=="EEXIST")throw i}try{return h.copyFileSync(e,c),r&&y.info(`${l?"Updated":"Created"} file: ${c}`),!0}catch{return!1}}pathExists(e,t=!1){try{return h.existsSync(e)}catch(o){return t||y.error(`Error checking path existence: ${e}`,o),!1}}mkdir(e){try{let t=e.startsWith("/")||e.match(/^[A-Z]:/)?this.normalizePath(e):this.resolveAppPath(e);return h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),!0}catch{return!1}}readdirSync(e,t){try{return h.readdirSync(e,t)}catch(o){return this.options.debug&&y.warn(`Failed to read directory: ${e}`,o),t&&typeof t=="object"&&"withFileTypes"in t&&t.withFileTypes?[]:[]}}statSync(e){try{return h.statSync(e)}catch(t){return this.options.debug&&y.warn(`Failed to stat file: ${e}`,t),null}}realpathSync(e){return h.realpathSync(e)}watch(e,t,o){return h.watch(e,t,o)}lstatSync(e){try{return h.lstatSync(e)}catch(t){return this.options.debug&&y.warn(`Failed to lstat file: ${e}`,t),null}}async ensureDir(e){try{await h.promises.mkdir(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}ensureDirSync(e){try{h.mkdirSync(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}async remove(e){await h.promises.rm(e,{recursive:!0,force:!0})}removeSync(e){h.rmSync(e,{recursive:!0,force:!0})}async readdir(e,t){return h.promises.readdir(e,t)}stripBom(e){return e.charCodeAt(0)===65279?e.slice(1):e}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(e){if(!e)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(e)}isMonorepo(){let e=F(this._repoRoot,"packages");return this.pathExists(e)}isWithinApp(e){let t=this.normalizePath($(e)),o=this.getAppRoot(),n=V(o,t),s=this.normalizePath(n);return!s.startsWith("../")&&!s.startsWith("/")}async findFiles(e,t,o={}){let n=this.normalizePath(F(e,t)),s=this.getAppRoot(),r=this.normalizePath(s),c=n.startsWith(r)?n.slice(r.length+1):n,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:O.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([c],{...l,...o})}clearCache(){}async _resolveFrameworkI18nPattern(e){let t=O.I18N_PATHS;if(!t)return null;let o=e.replace(t.SOURCE_ROOT+"/",""),n=this.resolveFrameworkPackage("@donotdev/core");if(!n)return null;let s=this.normalizePath(F(n,t.PUBLISHED_ROOT,o)),r=s.replace(/\/[^/]*\*.*$/,"");return this.pathExists(r),s}async _globWithNormalization(e,t){return(await ue(e,t)).map(n=>{let s=typeof n=="string"?n:n.path;return this.normalizePath(s)})}async resolveFiles(e,t="css"){if(!e||typeof e!="object")return{frameworkFiles:[],consumerFiles:[]};if(t==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(e.framework)||(e.framework=[]),!Array.isArray(e.consumer))return{frameworkFiles:[],consumerFiles:[]};let o=[...e.framework,...e.consumer];for(let i of o)if(typeof i!="string"||i.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),s=O.getGlobOptionsFor?O.getGlobOptionsFor(t):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},r=this.normalizePath(n),c=e.framework.map(i=>{let u=this.normalizePath(i);return u.startsWith(r)?u.slice(r.length+1):u}),l=e.consumer.map(i=>{let u=this.normalizePath(i);return u.startsWith(r)?u.slice(r.length+1):u}),f={...s,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:n};try{let i=c.length>0?await this._globWithNormalization(c,f):[],u=await this._globWithNormalization(l,f);return{frameworkFiles:i,consumerFiles:u}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(e){if(!O.getPatternsFor)return{framework:[],consumer:[],all:[]};let t=this.getAppRoot(),o=this.getRepoRoot();if(e==="i18n"&&(!t||t===o))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${t}, repoRoot: ${o}). Ensure configResolved hook has run before discovery.`);let n=O.getPatternsFor(e),s=this.isMonorepo();if(e==="i18n"){let l=n,f={eager:l.eager.map(i=>i.startsWith("!")?"!"+this.resolveAppPath(i.slice(1)):this.resolveAppPath(i)),lazy:l.lazy.map(i=>i.startsWith("!")?"!"+this.resolveAppPath(i.slice(1)):this.resolveAppPath(i)),framework:{eager:s?(l.framework?.eager||[]).map(i=>this.resolveRepoPath(i)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(i=>this._resolveFrameworkI18nPattern(i))).then(i=>i.filter(Boolean)),lazy:s?(l.framework?.lazy||[]).map(i=>this.resolveRepoPath(i)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(i=>this._resolveFrameworkI18nPattern(i))).then(i=>i.filter(Boolean))},all:[]};return f.all=[...f.eager,...f.lazy,...f.framework.eager,...f.framework.lazy],f}let r=n,c={framework:s?(r.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(r.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return c.all=[...c.consumer,...c.framework],c}getEmptyModulePath(){return this.getEmptyCjsModulePath().replace(/\.cjs$/,".js")}getEmptyFlagModulePath(){let e=_(le(import.meta.url));return this.normalizePath($(e,"emptyFlag.js"))}getEmptyCjsModulePath(){let e=this.resolvePackage("@donotdev/core/empty");if(!e)throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");return e}_findRepoRoot(e){let t=this.normalizePath(e),o=0,n=this.options.maxLevels;for(;o<n;){let s=this.normalizePath(F(t,q.TOOLING)),r=this.normalizePath(F(t,q.CORE));if(this.pathExists(s)&&this.pathExists(r))return t;let c=F(t,"apps");if(this.pathExists(c)&&this.statSync(c)?.isDirectory())return this.normalizePath(t);let l=this.normalizePath(F(t,"package.json"));if(this.pathExists(l)&&this.normalizePath(_(t))===t)return t;let f=this.normalizePath(_(t));if(f===t)break;t=f,o++}return this.normalizePath(e)}};function C(a={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",workspace:r,bundleWorkspaceDeps:c=!1,importFramework:l=!1,external:f=!1,...i}=a,u=S.getInstance(),d=M(r),m={entryPoints:[e],bundle:!0,platform:"node",target:"node20",format:"esm",outdir:t,outExtension:{".js":".js"},minify:o,sourcemap:n,metafile:!0,logLevel:"info",loader:{".ts":"ts",".tsx":"tsx",".css":"empty"},keepNames:!0,treeShaking:!0,...i};c&&Object.keys(d).length>0&&(m.alias=Object.fromEntries(Object.entries(d).map(([v,p])=>[v,u.normalizePath(p)]))),m.mainFields=["module","main"],m.conditions=["import","module","node"];let I=["fs","path","crypto","util","stream","events","buffer","url","querystring","http","https","zlib","os","child_process","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","perf_hooks","async_hooks"],D=[];if(c)try{let v=r?.root||process.cwd(),p=process.cwd(),g=10;for(let k=0;k<g;k++){let x=u.normalizePath(`${p}/package.json`);if(u.pathExists(x)){let E=u.readSync(x,{format:"json"});if(E&&Array.isArray(E.workspaces)){v=u.normalizePath(p);for(let A of E.workspaces)A==="apps/*"||A==="functions"||!A.includes("*")&&!A.includes("/")&&D.push(A);break}}let w=u.getDirname(p);if(w===p)break;p=w}}catch{}let L={name:"external-node-modules",setup(v){v.onResolve({filter:/^firebase($|\/)/},p=>{if(p.path==="firebase-admin"||p.path.startsWith("firebase-admin/")||p.path==="firebase-functions"||p.path.startsWith("firebase-functions/"))return null;let g;if(r?.type==="dndev"&&r.root)g=u.normalizePath(`${r.root}/packages/core/config/functions/firebase-stub.js`);else{let k=import.meta.url,w=new URL(k).pathname.replace(/^\/([A-Z]:)/i,"$1"),E=u.getDirname(w);g=u.normalizePath(`${E}/firebase-stub.js`)}return{path:g}}),v.onResolve({filter:/.*/},p=>{if(p.kind==="entry-point")return null;if(p.path.match(/@donotdev\/functions\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/functions/","");return{path:u.normalizePath(`${r.root}/packages/functions/src/${g}/index.ts`)}}if(p.path==="@donotdev/utils")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/core/utils/src/server/index.ts`)}:v.resolve("@donotdev/utils/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path.match(/@donotdev\/utils\/.+/)&&r?.type==="dndev"){let g=p.path.replace("@donotdev/utils/","");return{path:u.normalizePath(`${r.root}/packages/core/utils/src/${g}/index.ts`)}}if(p.path==="@donotdev/supabase")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/providers/supabase/src/server/index.ts`)}:v.resolve("@donotdev/supabase/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path==="@donotdev/core")return r?.type==="dndev"?{path:u.normalizePath(`${r.root}/packages/core/server.ts`)}:v.resolve("@donotdev/core/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path.match(/@donotdev\/core\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/core/","");return{path:u.normalizePath(`${r.root}/packages/core/${g}.ts`)}}if(p.path==="firebase-admin"||p.path.startsWith("firebase-admin/")||p.path==="firebase-functions"||p.path.startsWith("firebase-functions/"))return{path:p.path,external:!0};if(p.path.match(/@donotdev\/core\/.+/)&&c&&r?.type==="dndev"){let g=p.path.replace("@donotdev/core/","");return{path:u.normalizePath(`${r.root}/packages/core/${g}.ts`)}}if(p.path.startsWith("@donotdev/")||p.path==="valibot"||p.path.startsWith("valibot/"))return null;if(D.length>0){let g=p.path.split("/")[0];if(D.includes(g))return null}return p.path.startsWith(".")||p.path.startsWith("/")?null:{path:p.path,external:!0}})}};if(m.external=[...I,"firebase-admin","firebase-functions"],m.plugins=[L,...m.plugins||[]],m.define={"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"production"),...m.define||{}},l&&r.type==="dndev"){let v=r.root,p=u.normalizePath(`${v}/functions/lib`);m.alias={...m.alias,"@donotdev/functions":p}}if(s==="framework"){let v=S.getInstance(),p=r?.root?v.normalizePath(`${r.root}/packages/functions`):process.cwd(),g=v.normalizePath(`${p}/package.json`),k=v.readSync(g,{format:"json"});if(k?.exports){let x={};for(let[,w]of Object.entries(k.exports)){let E=w?.import||w?.default||(typeof w=="string"?w:null);if(!E||!E.endsWith(".ts"))continue;let A=E.replace(/^\.\/src\//,"").replace(/\.ts$/,"");x[A]=E}Object.keys(x).length>0&&(m.entryPoints=x)}}return m}var b=S.getInstance(),W=["create","get","list","listCard","update","delete"];function X(a,e=0){let t=" ".repeat(e),o="";for(let[n,s]of Object.entries(a))if(s!=null)if(typeof s=="object"&&!Array.isArray(s))Object.keys(s).length===0?o+=`${t}${n}: {}
2
2
  `:o+=`${t}${n}:
3
- ${Q(s,e+1)}`;else if(Array.isArray(s))if(s.length===0)o+=`${t}${n}: []
3
+ ${X(s,e+1)}`;else if(Array.isArray(s))if(s.length===0)o+=`${t}${n}: []
4
4
  `;else{o+=`${t}${n}:
5
5
  `;for(let r of s)if(typeof r=="object"&&r!==null){let c=Object.entries(r),[l,f]=c[0];o+=`${t} - ${l}: ${f}
6
6
  `;for(let i=1;i<c.length;i++){let[u,d]=c[i];o+=`${t} ${u}: ${d}
7
7
  `}}else o+=`${t} - ${r}
8
8
  `}else o+=`${t}${n}: ${s}
9
- `;return o}var de=["X_GOOGLE_","FIREBASE_","EXT_","GCLOUD_"],he=["FIREBASE_REGION","FIREBASE_PROJECT_ID","FIREBASE_AUTH_DOMAIN","ENABLE_RATE_LIMITING","DISABLE_RATE_LIMITING","ENABLE_METRICS","DISABLE_METRICS","ENFORCE_APP_CHECK"];function ee(a){if(!L(a))return[];let e=C(a,"utf-8"),t=[],o=e.matchAll(/export\s*\{([^}]+)\}/g);for(let s of o)if(s[1]){let r=s[1].split(",").map(c=>{let l=c.trim().split(/\s+as\s+/);return(l[1]||l[0]||"").trim()}).filter(Boolean);t.push(...r)}let n=e.matchAll(/export\s+const\s+(\w+)/g);for(let s of n)s[1]&&t.push(s[1]);return[...new Set(t)]}function $(a=".env"){if(!L(a))return[];let e=C(a,"utf-8"),t=[];for(let o of e.split(/\r?\n/)){let n=o.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let r=n.substring(0,s).trim();he.includes(r)||de.some(c=>r.startsWith(c))||t.push(r)}return t}function te(a){return U.some(e=>a.startsWith(`${e}_`))}function re(a,e={}){let t=a.defaults||{},o=t.labels||{},n={},s=e.envPath?$(e.envPath):$(),r=s.length>0?s.map(u=>({key:u})):void 0,c=e.entryFile?ee(e.entryFile):[],l=a.functions||{},f=new Set(Object.keys(l));for(let u of c)!te(u)&&!f.has(u)&&f.add(u);for(let u of f){let d=l[u]||{},m={...o,...d.labels};d.category&&(m.category=d.category),n[u]={region:d.region||t.region||["europe-west1"],platform:d.platform||t.platform||"gcfv2",entryPoint:d.entryPoint||u,labels:m},d.trigger==="http"?n[u].httpsTrigger={}:n[u].callableTrigger={},d.secrets?.length?n[u].secretEnvironmentVariables=d.secrets.map(j=>({key:j})):r&&(n[u].secretEnvironmentVariables=r)}if(a.crud?.entities)for(let u of a.crud.entities)for(let d of U){let m=`${d}_${u}`;n[m]={region:t.region||["europe-west1"],platform:t.platform||"gcfv2",callableTrigger:{},entryPoint:m,labels:{...o,category:"crud"}},r&&(n[m].secretEnvironmentVariables=r)}return`# Firebase Functions Configuration
9
+ `;return o}var pe=["X_GOOGLE_","FIREBASE_","EXT_","GCLOUD_"],fe=["FIREBASE_REGION","FIREBASE_PROJECT_ID","FIREBASE_AUTH_DOMAIN","ENABLE_RATE_LIMITING","DISABLE_RATE_LIMITING","ENABLE_METRICS","DISABLE_METRICS","ENFORCE_APP_CHECK"];function Z(a){if(!b.pathExists(a))return[];let e=b.readSync(a,{format:"text"}),t=[],o=e.matchAll(/export\s*\{([^}]+)\}/g);for(let s of o)if(s[1]){let r=s[1].split(",").map(c=>{let l=c.trim().split(/\s+as\s+/);return(l[1]||l[0]||"").trim()}).filter(Boolean);t.push(...r)}let n=e.matchAll(/export\s+const\s+(\w+)/g);for(let s of n)s[1]&&t.push(s[1]);return[...new Set(t)]}function j(a=".env"){if(!b.pathExists(a))return[];let e=b.readSync(a),t=[];for(let o of e.split(/\r?\n/)){let n=o.trim();if(!n||n.startsWith("#"))continue;let s=n.indexOf("=");if(s<=0)continue;let r=n.substring(0,s).trim();fe.includes(r)||pe.some(c=>r.startsWith(c))||t.push(r)}return t}function Q(a){return W.some(e=>a.startsWith(`${e}_`))}function ee(a,e={}){let t=a.defaults||{},o=t.labels||{},n={},s=e.envPath?j(e.envPath):j(),r=s.length>0?s.map(u=>({key:u})):void 0,c=e.entryFile?Z(e.entryFile):[],l=a.functions||{},f=new Set(Object.keys(l));for(let u of c)!Q(u)&&!f.has(u)&&f.add(u);for(let u of f){let d=l[u]||{},m={...o,...d.labels};d.category&&(m.category=d.category),n[u]={region:d.region||t.region||["europe-west1"],platform:d.platform||t.platform||"gcfv2",entryPoint:d.entryPoint||u,labels:m},d.trigger==="http"?n[u].httpsTrigger={}:n[u].callableTrigger={},d.secrets?.length?n[u].secretEnvironmentVariables=d.secrets.map(I=>({key:I})):r&&(n[u].secretEnvironmentVariables=r)}if(a.crud?.entities)for(let u of a.crud.entities)for(let d of W){let m=`${d}_${u}`;n[m]={region:t.region||["europe-west1"],platform:t.platform||"gcfv2",callableTrigger:{},entryPoint:m,labels:{...o,category:"crud"}},r&&(n[m].secretEnvironmentVariables=r)}return`# Firebase Functions Configuration
10
10
  # Generated by @donotdev/core/functions - DO NOT EDIT MANUALLY
11
11
  # Generated at: ${new Date().toISOString()}
12
12
 
13
- `+Q({endpoints:n,specVersion:"v1alpha1",requiredAPIs:[]})}function M(a,e={}){let t=Object.keys(a.functions||{}),o=[];if(a.crud?.entities)for(let l of a.crud.entities)for(let f of U)o.push(`${f}_${l}`);let s=(e.entryFile?ee(e.entryFile):[]).filter(l=>!te(l)&&!t.includes(l)),r=[...t,...s],c=e.envPath?$(e.envPath):$();return{yaml:re(a,e),functions:[...r,...o],staticFunctions:r,crudFunctions:o,autoDetected:s,autoSecrets:c}}function G(a){let e=new Set;for(let f of Object.values(a.functions||{}))if(f.secrets)for(let i of f.secrets)e.add(i);let t=$();for(let f of t)e.add(f);if(e.size===0||!L(".env"))return{stripped:[],kept:0};let n=C(".env","utf-8").split(/\r?\n/),s=[],r=[];for(let f of n){let i=f.trim();if(!i||i.startsWith("#")){s.push(f);continue}let u=i.indexOf("="),d=u>0?i.substring(0,u).trim():"";e.has(d)?r.push(f):s.push(f)}if(r.length===0)return{stripped:[],kept:s.length};B(".env",s.join(`
13
+ `+X({endpoints:n,specVersion:"v1alpha1",requiredAPIs:[]})}function B(a,e={}){let t=Object.keys(a.functions||{}),o=[];if(a.crud?.entities)for(let l of a.crud.entities)for(let f of W)o.push(`${f}_${l}`);let s=(e.entryFile?Z(e.entryFile):[]).filter(l=>!Q(l)&&!t.includes(l)),r=[...t,...s],c=e.envPath?j(e.envPath):j();return{yaml:ee(a,e),functions:[...r,...o],staticFunctions:r,crudFunctions:o,autoDetected:s,autoSecrets:c}}function U(a){let e=new Set;for(let f of Object.values(a.functions||{}))if(f.secrets)for(let i of f.secrets)e.add(i);let t=j();for(let f of t)e.add(f);if(e.size===0||!b.pathExists(".env"))return{stripped:[],kept:0};let n=b.readSync(".env").split(/\r?\n/),s=[],r=[];for(let f of n){let i=f.trim();if(!i||i.startsWith("#")){s.push(f);continue}let u=i.indexOf("="),d=u>0?i.substring(0,u).trim():"";e.has(d)?r.push(f):s.push(f)}if(r.length===0)return{stripped:[],kept:s.length};b.writeSync(".env",s.join(`
14
14
  `));let c=`# Secrets managed by sync-secrets (auto-filtered by build)
15
- `;if(L(".env.local")){let f=C(".env.local","utf-8"),i=new Set(f.split(/\r?\n/).filter(d=>d.trim()&&!d.trim().startsWith("#")).map(d=>d.split("=")[0].trim())),u=r.filter(d=>!i.has(d.split("=")[0].trim()));u.length>0&&B(".env.local",f.trimEnd()+`
15
+ `;if(b.pathExists(".env.local")){let f=b.readSync(".env.local"),i=new Set(f.split(/\r?\n/).filter(d=>d.trim()&&!d.trim().startsWith("#")).map(d=>d.split("=")[0].trim())),u=r.filter(d=>!i.has(d.split("=")[0].trim()));u.length>0&&b.writeSync(".env.local",f.trimEnd()+`
16
16
  `+c+u.join(`
17
17
  `)+`
18
- `)}else B(".env.local",c+r.join(`
18
+ `)}else b.writeSync(".env.local",c+r.join(`
19
19
  `)+`
20
- `);return{stripped:r.map(f=>f.split("=")[0].trim()),kept:s.length}}import{writeFileSync as me}from"fs";function ge(a={}){let e=D();return N({...a,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0,workspace:e})}async function ve(a,e={}){let{entry:t="src/index.ts",outDir:o="lib",minify:n=process.env.NODE_ENV==="production",sourcemap:s=!0,analyze:r=!1,entryFile:c="src/index.ts",envPath:l=".env",...f}=e;try{let{build:i}=await import("esbuild"),u=ge({entry:t,outDir:o,minify:n,sourcemap:s,...f}),d=await i(u);d.errors.length>0&&process.exit(1),d.warnings.length>0;let{yaml:m,staticFunctions:j,crudFunctions:I,autoDetected:W,autoSecrets:v}=M(a,{entryFile:c,envPath:l});me("functions.yaml",m),W.length>0,v.length>0;let{stripped:p}=G(a);if(p.length>0,r&&d.metafile){let{analyzeMetafile:g}=await import("esbuild"),k=await g(d.metafile)}}catch{process.exit(1)}}function se(a={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",...r}=a,c=D();return N({entry:e,outDir:t,minify:o,sourcemap:n,platform:s,workspace:c,...r})}function He(a={}){return se({...a,platform:"framework",bundleWorkspaceDeps:!0})}function Ye(a={}){return se({...a,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0})}export{ve as buildFunctions,Ye as createAppFunctionsConfig,se as createFunctionsEsbuildConfig,He as createRootFunctionsConfig,G as filterEnvSecrets,re as generateFunctionsYaml,M as generateFunctionsYamlWithInfo};
20
+ `);return{stripped:r.map(f=>f.split("=")[0].trim()),kept:s.length}}function de(a={}){let e=T();return C({...a,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0,workspace:e})}async function he(a,e={}){let{entry:t="src/index.ts",outDir:o="lib",minify:n=process.env.NODE_ENV==="production",sourcemap:s=!0,analyze:r=!1,entryFile:c="src/index.ts",envPath:l=".env",...f}=e;try{let{build:i}=await import("esbuild"),u=de({entry:t,outDir:o,minify:n,sourcemap:s,...f}),d=await i(u);d.errors.length>0&&process.exit(1),d.warnings.length>0;let{yaml:m,staticFunctions:I,crudFunctions:D,autoDetected:L,autoSecrets:v}=B(a,{entryFile:c,envPath:l});S.getInstance().writeSync("functions.yaml",m),L.length>0,v.length>0;let{stripped:g}=U(a);if(g.length>0,r&&d.metafile){let{analyzeMetafile:k}=await import("esbuild"),x=await k(d.metafile)}}catch{process.exit(1)}}function te(a={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",...r}=a,c=T();return C({entry:e,outDir:t,minify:o,sourcemap:n,platform:s,workspace:c,...r})}function We(a={}){return te({...a,platform:"framework",bundleWorkspaceDeps:!0})}function Be(a={}){return te({...a,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0})}export{he as buildFunctions,Be as createAppFunctionsConfig,te as createFunctionsEsbuildConfig,We as createRootFunctionsConfig,U as filterEnvSecrets,ee as generateFunctionsYaml,B as generateFunctionsYamlWithInfo};
@@ -129,6 +129,9 @@
129
129
  "download": "تحميل",
130
130
  "close": "إغلاق"
131
131
  },
132
+ "guard": {
133
+ "signInRequired": "يرجى تسجيل الدخول للوصول إلى هذه الصفحة"
134
+ },
132
135
  "messages": {
133
136
  "createSuccess": "تم إنشاء {{entity}} بنجاح",
134
137
  "updateSuccess": "تم تحديث {{entity}} بنجاح",
@@ -343,6 +346,11 @@
343
346
  "pageSource": "كود المصدر",
344
347
  "inspectPageSourceCode": "فحص كود المصدر للصفحة"
345
348
  },
349
+ "sheet": {
350
+ "navigation": "التنقل",
351
+ "codeInspector": "فاحص الكود",
352
+ "debugPanel": "لوحة التصحيح"
353
+ },
346
354
  "routeError": {
347
355
  "title": "حدث خطأ ما",
348
356
  "description": "حدث خطأ أثناء تحميل هذه الصفحة.",
@@ -419,5 +427,155 @@
419
427
  "subtitle": "تحقق من صندوق الوارد",
420
428
  "ariaLabel": "جاري إرسال بريد التحقق، يرجى الانتظار"
421
429
  }
430
+ },
431
+ "templates": {
432
+ "home": {
433
+ "hero": {
434
+ "badge": "مرحباً",
435
+ "title": "ابنِ شيئاً رائعاً",
436
+ "subtitle": "منصة حديثة لإطلاق مشروعك التالي وتنميته وتوسيع نطاقه - بشكل أسرع من أي وقت مضى.",
437
+ "primaryAction": "ابدأ الآن",
438
+ "secondaryAction": "اعرف المزيد"
439
+ },
440
+ "features": {
441
+ "title": "الميزات",
442
+ "feature1": {
443
+ "title": "سرعة فائقة",
444
+ "description": "مُحسَّن للسرعة مع تحميل فوري للصفحات وتحديثات فورية جاهزة للاستخدام."
445
+ },
446
+ "feature2": {
447
+ "title": "آمن بالتصميم",
448
+ "description": "أمان بمستوى المؤسسات مع مصادقة وتحكم بالوصول وتشفير مدمج."
449
+ },
450
+ "feature3": {
451
+ "title": "جاهز للتوسع",
452
+ "description": "من النموذج الأولي إلى الإنتاج - توسَّع بسهولة مع بنية معمارية متينة وقابلة للتوسع."
453
+ }
454
+ },
455
+ "howItWorks": {
456
+ "title": "كيف يعمل",
457
+ "step1": {
458
+ "title": "إنشاء حساب",
459
+ "description": "أنشئ حسابك في ثوانٍ. لا يلزم بطاقة ائتمان للبدء."
460
+ },
461
+ "step2": {
462
+ "title": "الإعداد",
463
+ "description": "أعدَّ مساحة عملك وادعُ فريقك وخصِّص سير عملك."
464
+ },
465
+ "step3": {
466
+ "title": "الإطلاق",
467
+ "description": "انطلق بثقة. انشر وراقب وطوِّر بالسرعة التي تناسبك."
468
+ }
469
+ },
470
+ "showcase": {
471
+ "title": "لماذا نحن",
472
+ "item1": {
473
+ "title": "تقنية حديثة",
474
+ "description": "مبني على أحدث التقنيات للأداء والموثوقية وسعادة المطور."
475
+ },
476
+ "item2": {
477
+ "title": "مفتوح المصدر",
478
+ "description": "شفاف وبمساهمة المجتمع ومجاني الاستخدام."
479
+ },
480
+ "item3": {
481
+ "title": "المطور أولاً",
482
+ "description": "مُصمَّم من مطورين لمطورين. واجهات برمجية نظيفة وتوثيق ممتاز."
483
+ },
484
+ "item4": {
485
+ "title": "جاهز عالمياً",
486
+ "description": "متعدد اللغات والمناطق وقابل للوصول منذ اليوم الأول."
487
+ }
488
+ },
489
+ "cta": {
490
+ "title": "هل أنت مستعد للبدء؟",
491
+ "subtitle": "انضم إلى آلاف الفرق التي تبني منتجات أفضل وأسرع.",
492
+ "primaryAction": "ابدأ مجاناً",
493
+ "secondaryAction": "تواصل مع المبيعات"
494
+ }
495
+ },
496
+ "dashboard": {
497
+ "title": "لوحة التحكم",
498
+ "stats": {
499
+ "revenue": "الإيرادات",
500
+ "orders": "الطلبات",
501
+ "customers": "العملاء",
502
+ "conversion": "معدل التحويل"
503
+ },
504
+ "activity": {
505
+ "title": "النشاط الأخير",
506
+ "item1": "طلب جديد #1234 تم تقديمه",
507
+ "time1": "منذ دقيقتين",
508
+ "item2": "العميل John D. سجَّل حساباً",
509
+ "time2": "منذ 15 دقيقة",
510
+ "item3": "المنتج 'Pro Plan' تم تحديثه",
511
+ "time3": "منذ ساعة",
512
+ "item4": "تم استلام دفعة بقيمة $299",
513
+ "time4": "منذ 3 ساعات"
514
+ },
515
+ "actions": {
516
+ "title": "إجراءات سريعة",
517
+ "newProduct": "منتج جديد",
518
+ "viewReports": "عرض التقارير",
519
+ "manageTeam": "إدارة الفريق"
520
+ }
521
+ },
522
+ "settings": {
523
+ "title": "الإعدادات",
524
+ "tabs": {
525
+ "general": "عام",
526
+ "notifications": "الإشعارات",
527
+ "appearance": "المظهر"
528
+ },
529
+ "general": {
530
+ "appInfo": "التطبيق",
531
+ "appName": "الاسم",
532
+ "description": "الوصف",
533
+ "language": "اللغة",
534
+ "languageHint": "يمكن تغيير اللغة من قائمة الرأس."
535
+ },
536
+ "notifications": {
537
+ "preferences": "تفضيلات الإشعارات",
538
+ "email": "إشعارات البريد الإلكتروني",
539
+ "emailDesc": "تلقِّ التحديثات والتنبيهات عبر البريد الإلكتروني.",
540
+ "push": "الإشعارات الفورية",
541
+ "pushDesc": "تلقِّ إشعارات فورية في الوقت الفعلي.",
542
+ "marketing": "رسائل تسويقية",
543
+ "marketingDesc": "تلقِّ تحديثات المنتج والعروض الترويجية."
544
+ },
545
+ "appearance": {
546
+ "theme": "السمة",
547
+ "darkMode": "الوضع الداكن",
548
+ "currentTheme": "السمة الحالية"
549
+ }
550
+ },
551
+ "profile": {
552
+ "title": "الملف الشخصي",
553
+ "subtitle": "إدارة إعدادات حسابك وتفضيلاتك.",
554
+ "identity": {
555
+ "title": "الهوية",
556
+ "displayName": "اسم العرض",
557
+ "email": "البريد الإلكتروني",
558
+ "emailVerified": "مُحقَّق",
559
+ "emailUnverified": "غير مُحقَّق"
560
+ },
561
+ "security": {
562
+ "title": "الأمان",
563
+ "updatePassword": "تحديث كلمة المرور",
564
+ "linkedProviders": "الموفرون المرتبطون"
565
+ },
566
+ "subscription": {
567
+ "title": "الاشتراك",
568
+ "currentPlan": "الخطة الحالية",
569
+ "status": "الحالة",
570
+ "manageBilling": "إدارة الفواتير",
571
+ "noPlan": "لا توجد خطة نشطة"
572
+ },
573
+ "dangerZone": {
574
+ "title": "منطقة الخطر",
575
+ "deleteAccount": "حذف الحساب",
576
+ "deleteWarning": "هذا الإجراء نهائي ولا يمكن التراجع عنه. سيتم حذف جميع بياناتك."
577
+ },
578
+ "signOut": "تسجيل الخروج"
579
+ }
422
580
  }
423
581
  }