@donotdev/core 0.1.1 → 0.1.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -242
- package/README.md +2 -20
- package/empty.cjs +0 -0
- package/empty.js +0 -0
- package/functions/index.js +20 -10
- package/i18n/locales/eager/dndev_ar.json +35 -0
- package/i18n/locales/eager/dndev_da.json +63 -8
- package/i18n/locales/eager/dndev_de.json +35 -0
- package/i18n/locales/eager/dndev_en.json +52 -1
- package/i18n/locales/eager/dndev_es.json +35 -0
- package/i18n/locales/eager/dndev_fr.json +52 -1
- package/i18n/locales/eager/dndev_it.json +35 -0
- package/i18n/locales/eager/dndev_ja.json +35 -0
- package/i18n/locales/eager/dndev_ko.json +35 -0
- package/i18n/locales/eager/dndev_nl.json +59 -7
- package/i18n/locales/eager/dndev_pt.json +35 -0
- package/i18n/locales/eager/dndev_zh.json +36 -1
- package/i18n/locales/lazy/ai_en.json +0 -0
- package/i18n/locales/lazy/ai_pt.json +0 -0
- package/i18n/locales/lazy/ai_zh.json +0 -0
- package/i18n/locales/lazy/auth_ar.json +0 -0
- package/i18n/locales/lazy/auth_da.json +0 -0
- package/i18n/locales/lazy/auth_de.json +0 -0
- package/i18n/locales/lazy/auth_en.json +0 -0
- package/i18n/locales/lazy/auth_es.json +0 -0
- package/i18n/locales/lazy/auth_fr.json +0 -0
- package/i18n/locales/lazy/auth_it.json +0 -0
- package/i18n/locales/lazy/auth_ja.json +0 -0
- package/i18n/locales/lazy/auth_ko.json +0 -0
- package/i18n/locales/lazy/auth_nl.json +0 -0
- package/i18n/locales/lazy/auth_pt.json +0 -0
- package/i18n/locales/lazy/auth_zh.json +0 -0
- package/i18n/locales/lazy/billing_ar.json +0 -0
- package/i18n/locales/lazy/billing_da.json +0 -0
- package/i18n/locales/lazy/billing_de.json +0 -0
- package/i18n/locales/lazy/billing_en.json +0 -0
- package/i18n/locales/lazy/billing_es.json +0 -0
- package/i18n/locales/lazy/billing_fr.json +0 -0
- package/i18n/locales/lazy/billing_it.json +0 -0
- package/i18n/locales/lazy/billing_ja.json +0 -0
- package/i18n/locales/lazy/billing_ko.json +0 -0
- package/i18n/locales/lazy/billing_nl.json +0 -0
- package/i18n/locales/lazy/billing_pt.json +0 -0
- package/i18n/locales/lazy/billing_zh.json +0 -0
- package/i18n/locales/lazy/blog_ar.json +0 -0
- package/i18n/locales/lazy/blog_da.json +0 -0
- package/i18n/locales/lazy/blog_de.json +0 -0
- package/i18n/locales/lazy/blog_en.json +0 -0
- package/i18n/locales/lazy/blog_es.json +0 -0
- package/i18n/locales/lazy/blog_fr.json +0 -0
- package/i18n/locales/lazy/blog_it.json +0 -0
- package/i18n/locales/lazy/blog_ja.json +0 -0
- package/i18n/locales/lazy/blog_ko.json +0 -0
- package/i18n/locales/lazy/blog_nl.json +0 -0
- package/i18n/locales/lazy/blog_pt.json +0 -0
- package/i18n/locales/lazy/blog_zh.json +0 -0
- package/i18n/locales/lazy/cookies_ar.json +0 -0
- package/i18n/locales/lazy/cookies_da.json +0 -0
- package/i18n/locales/lazy/cookies_de.json +0 -0
- package/i18n/locales/lazy/cookies_en.json +0 -0
- package/i18n/locales/lazy/cookies_es.json +0 -0
- package/i18n/locales/lazy/cookies_fr.json +0 -0
- package/i18n/locales/lazy/cookies_it.json +0 -0
- package/i18n/locales/lazy/cookies_ja.json +0 -0
- package/i18n/locales/lazy/cookies_ko.json +0 -0
- package/i18n/locales/lazy/cookies_nl.json +0 -0
- package/i18n/locales/lazy/cookies_pt.json +0 -0
- package/i18n/locales/lazy/cookies_zh.json +0 -0
- package/i18n/locales/lazy/crud_ar.json +6 -5
- package/i18n/locales/lazy/crud_da.json +6 -5
- package/i18n/locales/lazy/crud_de.json +6 -5
- package/i18n/locales/lazy/crud_en.json +7 -5
- package/i18n/locales/lazy/crud_es.json +6 -5
- package/i18n/locales/lazy/crud_fr.json +7 -5
- package/i18n/locales/lazy/crud_it.json +6 -5
- package/i18n/locales/lazy/crud_ja.json +6 -5
- package/i18n/locales/lazy/crud_ko.json +6 -5
- package/i18n/locales/lazy/crud_nl.json +6 -5
- package/i18n/locales/lazy/crud_pt.json +6 -5
- package/i18n/locales/lazy/crud_zh.json +6 -5
- package/i18n/locales/lazy/homeTemplate_ar.json +0 -0
- package/i18n/locales/lazy/homeTemplate_da.json +0 -0
- package/i18n/locales/lazy/homeTemplate_de.json +0 -0
- package/i18n/locales/lazy/homeTemplate_en.json +0 -0
- package/i18n/locales/lazy/homeTemplate_es.json +0 -0
- package/i18n/locales/lazy/homeTemplate_fr.json +0 -0
- package/i18n/locales/lazy/homeTemplate_it.json +0 -0
- package/i18n/locales/lazy/homeTemplate_ja.json +0 -0
- package/i18n/locales/lazy/homeTemplate_ko.json +0 -0
- package/i18n/locales/lazy/homeTemplate_nl.json +0 -0
- package/i18n/locales/lazy/homeTemplate_pt.json +0 -0
- package/i18n/locales/lazy/homeTemplate_zh.json +0 -0
- package/i18n/locales/lazy/legalNotice_en.json +0 -0
- package/i18n/locales/lazy/legalNotice_fr.json +0 -0
- package/i18n/locales/lazy/legalNotice_pt.json +0 -0
- package/i18n/locales/lazy/legalNotice_zh.json +0 -0
- package/i18n/locales/lazy/oauth_ar.json +0 -0
- package/i18n/locales/lazy/oauth_da.json +0 -0
- package/i18n/locales/lazy/oauth_de.json +0 -0
- package/i18n/locales/lazy/oauth_en.json +0 -0
- package/i18n/locales/lazy/oauth_es.json +0 -0
- package/i18n/locales/lazy/oauth_fr.json +0 -0
- package/i18n/locales/lazy/oauth_it.json +0 -0
- package/i18n/locales/lazy/oauth_ja.json +0 -0
- package/i18n/locales/lazy/oauth_ko.json +0 -0
- package/i18n/locales/lazy/oauth_nl.json +0 -0
- package/i18n/locales/lazy/oauth_pt.json +0 -0
- package/i18n/locales/lazy/oauth_zh.json +0 -0
- package/i18n/locales/lazy/privacy_ar.json +0 -0
- package/i18n/locales/lazy/privacy_da.json +0 -0
- package/i18n/locales/lazy/privacy_de.json +0 -0
- package/i18n/locales/lazy/privacy_en.json +0 -0
- package/i18n/locales/lazy/privacy_es.json +0 -0
- package/i18n/locales/lazy/privacy_fr.json +0 -0
- package/i18n/locales/lazy/privacy_it.json +0 -0
- package/i18n/locales/lazy/privacy_ja.json +0 -0
- package/i18n/locales/lazy/privacy_ko.json +0 -0
- package/i18n/locales/lazy/privacy_nl.json +0 -0
- package/i18n/locales/lazy/privacy_pt.json +0 -0
- package/i18n/locales/lazy/privacy_zh.json +1 -1
- package/i18n/locales/lazy/terms_ar.json +0 -0
- package/i18n/locales/lazy/terms_da.json +0 -0
- package/i18n/locales/lazy/terms_de.json +0 -0
- package/i18n/locales/lazy/terms_en.json +0 -0
- package/i18n/locales/lazy/terms_es.json +0 -0
- package/i18n/locales/lazy/terms_fr.json +0 -0
- package/i18n/locales/lazy/terms_it.json +0 -0
- package/i18n/locales/lazy/terms_ja.json +0 -0
- package/i18n/locales/lazy/terms_ko.json +0 -0
- package/i18n/locales/lazy/terms_nl.json +0 -0
- package/i18n/locales/lazy/terms_pt.json +0 -0
- package/i18n/locales/lazy/terms_zh.json +0 -0
- package/index.d.ts +928 -215
- package/index.js +44 -44
- package/next/index.js +256 -66
- package/package.json +7 -7
- package/server.d.ts +866 -119
- package/server.js +1 -1
- package/vite/index.d.ts +8 -0
- package/vite/index.js +66 -58
package/LICENSE.md
CHANGED
|
@@ -1,242 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
- Hosted applications operated on behalf of a paying client, regardless of code access
|
|
23
|
-
|
|
24
|
-
**1.6 "Internal Use"** means software applications built using the Framework for your own use or your employer's internal use, including SaaS products you own and operate where end-users have no access to Framework code.
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## 2. LICENSE GRANT
|
|
29
|
-
|
|
30
|
-
**2.1 Developer License**
|
|
31
|
-
|
|
32
|
-
Subject to payment of applicable fees and compliance with this Agreement, Ambroise Park Consulting grants you a non-exclusive, non-transferable, perpetual license to:
|
|
33
|
-
|
|
34
|
-
(a) Install Framework packages from npm
|
|
35
|
-
(b) Use the Framework to develop software applications
|
|
36
|
-
(c) Deploy applications for Internal Use without additional fees
|
|
37
|
-
(d) Incorporate the Framework into applications as compiled/minified code
|
|
38
|
-
|
|
39
|
-
**2.2 Project Deployment License**
|
|
40
|
-
|
|
41
|
-
For each Client Project, you must obtain a Project Deployment License prior to delivery. Each Project Deployment License grants you the right to deliver one Client Project containing the Framework.
|
|
42
|
-
|
|
43
|
-
**2.3 Multi-Developer Projects**
|
|
44
|
-
|
|
45
|
-
When multiple developers collaborate on a project:
|
|
46
|
-
- Each developer must hold a Developer License with their own License Key
|
|
47
|
-
- Only one Project Deployment License is required per Client Project (regardless of team size)
|
|
48
|
-
|
|
49
|
-
---
|
|
50
|
-
|
|
51
|
-
## 3. LICENSE KEY REQUIREMENT
|
|
52
|
-
|
|
53
|
-
**3.1 License Key Activation**
|
|
54
|
-
|
|
55
|
-
Upon purchasing a Developer License or Project Deployment License, you will receive a License Key. You must configure your applications with this key:
|
|
56
|
-
|
|
57
|
-
```javascript
|
|
58
|
-
// Environment variable (recommended)
|
|
59
|
-
DONOTDEV_LICENSE_KEY=your-license-key-here
|
|
60
|
-
|
|
61
|
-
// Or in code
|
|
62
|
-
globalThis.__DONOTDEV_LICENSE_KEY__ = 'your-license-key-here';
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
**3.2 Watermark Enforcement**
|
|
66
|
-
|
|
67
|
-
Applications running without a valid License Key will display a watermark:
|
|
68
|
-
- "⚠️ Unlicensed DoNotDev Framework - Visit donotdev.com"
|
|
69
|
-
- Console warnings in development mode
|
|
70
|
-
|
|
71
|
-
**3.3 License Key Types**
|
|
72
|
-
|
|
73
|
-
- **Developer License Key:** For Internal Use and development
|
|
74
|
-
- **Project Deployment License Key:** For Client Project deployment (suppresses watermark in production)
|
|
75
|
-
|
|
76
|
-
**3.4 Key Management**
|
|
77
|
-
|
|
78
|
-
- Do not commit License Keys to public repositories
|
|
79
|
-
- Use environment variables or secure secret management for production deployments
|
|
80
|
-
- Each developer uses their own Developer License Key for development
|
|
81
|
-
- Project Deployment Keys are provisioned per client project
|
|
82
|
-
|
|
83
|
-
---
|
|
84
|
-
|
|
85
|
-
## 4. PERMITTED USES
|
|
86
|
-
|
|
87
|
-
You may:
|
|
88
|
-
|
|
89
|
-
(a) Build unlimited applications for Internal Use with a Developer License
|
|
90
|
-
(b) Develop SaaS products you own and operate (no Project Deployment License required if clients cannot access Framework code)
|
|
91
|
-
(c) Create internal tools for your organization
|
|
92
|
-
(d) Build applications that include the Framework as compiled dependencies
|
|
93
|
-
(e) Open-source applications built on top of the Framework (provided end-users obtain their own licenses to suppress watermarks)
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 5. RESTRICTIONS
|
|
98
|
-
|
|
99
|
-
You may not:
|
|
100
|
-
|
|
101
|
-
(a) Redistribute Framework packages independently of your applications
|
|
102
|
-
(b) Share, publish, or transfer your License Key to unlicensed parties
|
|
103
|
-
(c) Decompile, reverse engineer, or attempt to extract source code from minified files
|
|
104
|
-
(d) Remove or obscure copyright notices or watermarks from Framework code
|
|
105
|
-
(e) Sublicense, resell, or transfer your Developer License to another individual
|
|
106
|
-
(f) Deliver Client Projects without obtaining a Project Deployment License
|
|
107
|
-
(g) Modify Framework code to bypass license validation or watermark enforcement
|
|
108
|
-
(h) Create derivative frameworks intended for redistribution
|
|
109
|
-
(i) Use a single Project Deployment License for multiple client projects
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
## 6. LICENSE TYPES & FEES
|
|
114
|
-
|
|
115
|
-
**6.1 Developer License**
|
|
116
|
-
- **Scope:** Per individual developer
|
|
117
|
-
- **Term:** Perpetual (lifetime access)
|
|
118
|
-
- **Fee:** Set forth in purchase agreement or donotdev.com pricing
|
|
119
|
-
- **Entitlements:** Unlimited Internal Use projects; Client Projects require additional Project Deployment Licenses
|
|
120
|
-
- **License Key:** One Developer License Key provided
|
|
121
|
-
|
|
122
|
-
**6.2 Project Deployment License**
|
|
123
|
-
- **Scope:** Per Client Project delivered
|
|
124
|
-
- **Term:** Perpetual for the specific project
|
|
125
|
-
- **Fee:** Set forth in purchase agreement or donotdev.com pricing
|
|
126
|
-
- **Purchaser:** Typically purchased by the developer/agency; client payment arrangements are permitted
|
|
127
|
-
- **License Key:** One Project Deployment Key provided per project
|
|
128
|
-
|
|
129
|
-
**6.3 Volume Licensing**
|
|
130
|
-
|
|
131
|
-
Organizations requiring multiple Developer Licenses may contact Ambroise Park Consulting for volume pricing and enterprise key management.
|
|
132
|
-
|
|
133
|
-
---
|
|
134
|
-
|
|
135
|
-
## 7. PAYMENT & VERIFICATION
|
|
136
|
-
|
|
137
|
-
**7.1 Payment**
|
|
138
|
-
|
|
139
|
-
All fees must be paid in full before License Key issuance. Payment terms and pricing are specified at donotdev.com or in separate purchase agreements.
|
|
140
|
-
|
|
141
|
-
**7.2 Compliance Verification**
|
|
142
|
-
|
|
143
|
-
Ambroise Park Consulting may request reasonable verification of Project Deployment License compliance. You agree to cooperate with such verification requests in good faith.
|
|
144
|
-
|
|
145
|
-
**7.3 Enforcement**
|
|
146
|
-
|
|
147
|
-
License compliance is primarily honor-based. Watermarks serve as technical reminders. Ambroise Park Consulting reserves the right to audit usage and pursue legal remedies for material breaches.
|
|
148
|
-
|
|
149
|
-
---
|
|
150
|
-
|
|
151
|
-
## 8. TERM & TERMINATION
|
|
152
|
-
|
|
153
|
-
**8.1 Perpetual Term**
|
|
154
|
-
|
|
155
|
-
Developer Licenses and Project Deployment Licenses are perpetual and do not expire, subject to Section 8.2.
|
|
156
|
-
|
|
157
|
-
**8.2 Termination for Breach**
|
|
158
|
-
|
|
159
|
-
Ambroise Park Consulting may terminate your license(s) and revoke your License Key(s) if you:
|
|
160
|
-
- Breach any material term of this Agreement
|
|
161
|
-
- Fail to pay applicable fees
|
|
162
|
-
- Engage in unauthorized redistribution or License Key sharing
|
|
163
|
-
- Attempt to bypass license validation mechanisms
|
|
164
|
-
|
|
165
|
-
**8.3 Effect of Termination**
|
|
166
|
-
|
|
167
|
-
Upon termination:
|
|
168
|
-
- Your License Key(s) will be revoked and watermarks will reappear
|
|
169
|
-
- Your right to use the Framework ceases
|
|
170
|
-
- Previously deployed applications may continue to function but will display watermarks
|
|
171
|
-
- You must cease distribution of any Client Projects in development
|
|
172
|
-
- You must remove the Framework from any ongoing projects
|
|
173
|
-
|
|
174
|
-
**8.4 Survival**
|
|
175
|
-
|
|
176
|
-
Sections 5 (Restrictions), 9 (Warranty Disclaimer), 10 (Limitation of Liability), and 11 (General Provisions) survive termination.
|
|
177
|
-
|
|
178
|
-
---
|
|
179
|
-
|
|
180
|
-
## 9. WARRANTY DISCLAIMER
|
|
181
|
-
|
|
182
|
-
THE FRAMEWORK IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
183
|
-
|
|
184
|
-
Ambroise Park Consulting does not warrant that the Framework will be error-free, uninterrupted, or meet your specific requirements.
|
|
185
|
-
|
|
186
|
-
---
|
|
187
|
-
|
|
188
|
-
## 10. LIMITATION OF LIABILITY
|
|
189
|
-
|
|
190
|
-
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL AMBROISE PARK CONSULTING BE LIABLE FOR ANY INDIRECT, INCIDENTAL, SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES (INCLUDING LOSS OF PROFITS, DATA, OR BUSINESS OPPORTUNITIES) ARISING OUT OF OR RELATED TO THIS AGREEMENT OR USE OF THE FRAMEWORK, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
191
|
-
|
|
192
|
-
Ambroise Park Consulting's total cumulative liability under this Agreement shall not exceed the fees you paid for the specific license giving rise to the claim.
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## 11. GENERAL PROVISIONS
|
|
197
|
-
|
|
198
|
-
**11.1 Governing Law**
|
|
199
|
-
|
|
200
|
-
This Agreement is governed by the laws of Quebec, Canada, without regard to conflict of law principles. Any disputes arising under this Agreement shall be resolved exclusively in the courts of Quebec, Canada.
|
|
201
|
-
|
|
202
|
-
**11.2 Severability**
|
|
203
|
-
|
|
204
|
-
If any provision of this Agreement is found unenforceable, the remaining provisions continue in full force and effect.
|
|
205
|
-
|
|
206
|
-
**11.3 Assignment**
|
|
207
|
-
|
|
208
|
-
You may not assign or transfer this Agreement or any licenses granted hereunder without prior written consent of Ambroise Park Consulting. Ambroise Park Consulting may assign this Agreement without restriction.
|
|
209
|
-
|
|
210
|
-
**11.4 Entire Agreement**
|
|
211
|
-
|
|
212
|
-
This Agreement, together with any applicable purchase agreements or order forms, constitutes the entire agreement between you and Ambroise Park Consulting regarding the Framework and supersedes all prior agreements and understandings.
|
|
213
|
-
|
|
214
|
-
**11.5 Amendments**
|
|
215
|
-
|
|
216
|
-
Ambroise Park Consulting may update this Agreement from time to time. Updates apply to licenses purchased after the effective date of the update. Existing licenses remain governed by the version in effect at the time of purchase unless you opt-in to updated terms.
|
|
217
|
-
|
|
218
|
-
**11.6 Export Compliance**
|
|
219
|
-
|
|
220
|
-
You agree to comply with all applicable export and import laws and regulations in your use of the Framework.
|
|
221
|
-
|
|
222
|
-
**11.7 Force Majeure**
|
|
223
|
-
|
|
224
|
-
Neither party is liable for failure to perform due to causes beyond reasonable control, including but not limited to acts of God, war, strikes, or third-party service outages.
|
|
225
|
-
|
|
226
|
-
**11.8 No Support Obligation**
|
|
227
|
-
|
|
228
|
-
Ambroise Park Consulting has no obligation to provide support, updates, or maintenance. Any support provided is at sole discretion and may be discontinued without notice.
|
|
229
|
-
|
|
230
|
-
**11.9 Contact**
|
|
231
|
-
|
|
232
|
-
Questions about licensing or compliance:
|
|
233
|
-
|
|
234
|
-
**Email:** contact@donotdev.com
|
|
235
|
-
**Website:** donotdev.com
|
|
236
|
-
|
|
237
|
-
---
|
|
238
|
-
|
|
239
|
-
**END OF LICENSE AGREEMENT**
|
|
240
|
-
|
|
241
|
-
**DoNotDev Framework License v1.0**
|
|
242
|
-
Ambroise Park Consulting – 2025
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AMBROISE PARK Consulting
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -23,25 +23,7 @@ bun install @donotdev/core
|
|
|
23
23
|
|
|
24
24
|
## License
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
**View pricing:** [donotdev.com/pricing](https://donotdev.com/pricing)
|
|
29
|
-
**Purchase license:** [donotdev.com/purchase](https://donotdev.com/purchase)
|
|
30
|
-
|
|
31
|
-
**Configure your license key:**
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# In .env file (Vite projects)
|
|
35
|
-
VITE_DONOTDEV_LICENSE_KEY=dndev_your_key_here
|
|
36
|
-
|
|
37
|
-
# In .env file (Next.js projects)
|
|
38
|
-
NEXT_PUBLIC_DONOTDEV_LICENSE_KEY=dndev_your_key_here
|
|
39
|
-
|
|
40
|
-
# Or in code (before framework initialization)
|
|
41
|
-
globalThis.__DONOTDEV_LICENSE_KEY__ = 'dndev_your_key_here';
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
For detailed setup instructions, see [License Key Setup Guide](../../docs/guides/LICENSE_KEY_SETUP.md).
|
|
26
|
+
MIT. See [LICENSE.md](./LICENSE.md).
|
|
45
27
|
|
|
46
28
|
## Usage
|
|
47
29
|
|
|
@@ -67,4 +49,4 @@ const myStore = Stores.createDoNotDevStore({ ... });
|
|
|
67
49
|
|
|
68
50
|
## License
|
|
69
51
|
|
|
70
|
-
|
|
52
|
+
MIT. See [LICENSE.md](./LICENSE.md).
|
package/empty.cjs
CHANGED
|
File without changes
|
package/empty.js
CHANGED
|
File without changes
|
package/functions/index.js
CHANGED
|
@@ -1,20 +1,30 @@
|
|
|
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}: {}
|
|
1
|
+
import j from"node:fs";import P from"node:path";import{fileURLToPath as se}from"node:url";var oe=se(import.meta.url),ke=P.dirname(oe);function T(){let i=process.cwd(),e=10;for(let t=0;t<e;t++){let o=P.join(i,"package.json");if(j.existsSync(o))try{let s=JSON.parse(j.readFileSync(o,"utf8")),r=s.workspaces&&Array.isArray(s.workspaces);if(r&&s.workspaces.some(c=>c==="packages/**"||c.startsWith("packages/"))&&(j.existsSync(P.join(i,"packages","core"))||j.existsSync(P.join(i,"packages","functions"))))return{type:"dndev",root:i};if(r&&s.workspaces.some(c=>c.includes("dndev/packages"))){let u=s.workspaces.find(m=>m.includes("dndev/packages")).replace(/\/packages.*$/,""),d=P.resolve(i,u);if(j.existsSync(P.join(d,"packages","core")))return{type:"dndev",root:d}}}catch{}let n=P.dirname(i);if(n===i)break;i=n}return{type:"npm",root:process.cwd()}}function ne(i){return i.type==="dndev"?i.root:null}function M(i){let e={};if(i.type==="dndev"){let t=ne(i);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 ae}from"node:module";import{resolve as I,join as _,dirname as A,relative as V,normalize as ce,sep as J,extname as le}from"node:path";import{fileURLToPath as ue}from"node:url";import pe 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"},F={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:F.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...F.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...F.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:F.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:F.globalIgnore}};function H(i,e=null){let t=F[i];if(!t)throw new Error(`Unknown pattern type: ${i}`);return e&&t.framework?{...t,framework:t.framework.map(o=>`${e}/${o}`)}:t}function Y(i){return G[i]||G.base}var z={getGlobOptionsFor:Y||void 0,SCAN_PATTERNS:F||void 0,getPatternsFor:H||void 0,I18N_PATHS:N||void 0},v={error:(i,e)=>{},warn:(i,e)=>{},info:i=>{}};function K(i,e){return i().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"},x=class i{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(e={}){return i._instance||(i._instance=new i(e)),i._instance}static _reset(){i._instance=null}constructor(e={}){if(i._instance)return i._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,i._instance=this}normalizePath(e){if(!e)return"";try{return ce(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(A(e)):""}resolvePackage(e,t=null){try{let o=t||this.getAppRoot(),s=ae(_(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/",""),a=this.resolveRepoPath(`packages/${r}`);if(this.pathExists(a))return a;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=I(t,e);return this.normalizePath(o)}resolveRepoPath(e){let t=this.getRepoRoot(),o=this.normalizePath(e),n=I(t,o);return this.normalizePath(n)}resolvePath(e,t){let o=this.normalizePath(t),n=this.normalizePath(e),s=I(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:le(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),a=this.stripBom(r);return s==="json"?JSON.parse(a):a}catch(r){return this.options.debug&&v.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),a=this.stripBom(r);return s==="json"?JSON.parse(a):a}catch(r){return this.options.debug&&v.warn(`Failed to read file: ${e}`,r),null}}async write(e,t,o={}){let{format:n="auto",overwrite:s=!1,dryRun:r=!1,verbose:a=!1}=o,l=this.normalizePath(e),f=this.normalizePath(A(l)),c=this.pathExists(l);if(c&&!s)return a&&v.info(`Skipping existing file: ${l}`),!1;if(r)return v.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"),a&&v.info(`${c?"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:a=!1}=o,l=this.normalizePath(e),f=this.normalizePath(A(l)),c=this.pathExists(l);if(c&&!s)return a&&v.info(`Skipping existing file: ${l}`),!1;if(r)return v.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"),a&&v.info(`${c?"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,a=this.normalizePath(t),l=this.pathExists(a);if(l&&!n)return r&&v.info(`Skipping existing file: ${a}`),!1;if(s)return v.info(`[DRY RUN] Would copy file: ${a}`),!0;let f=this.normalizePath(A(a));try{await h.promises.mkdir(f,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return await K(async()=>(await h.promises.copyFile(e,a),r&&v.info(`${l?"Updated":"Created"} file: ${a}`),!0),`Failed to copy file from ${e} to ${a}`)}catch{return!1}}copySync(e,t,o={}){let{overwrite:n=!1,dryRun:s=!1,verbose:r=!1}=o,a=this.normalizePath(t),l=this.pathExists(a);if(l&&!n)return r&&v.info(`Skipping existing file: ${a}`),!1;if(s)return v.info(`[DRY RUN] Would copy file: ${a}`),!0;let f=this.normalizePath(A(a));try{h.mkdirSync(f,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return h.copyFileSync(e,a),r&&v.info(`${l?"Updated":"Created"} file: ${a}`),!0}catch{return!1}}pathExists(e,t=!1){try{return h.existsSync(e)}catch(o){return t||v.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&&v.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&&v.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&&v.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=_(this._repoRoot,"packages");return this.pathExists(e)}isWithinApp(e){let t=this.normalizePath(I(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(_(e,t)),s=this.getAppRoot(),r=this.normalizePath(s),a=n.startsWith(r)?n.slice(r.length+1):n,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:z.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([a],{...l,...o})}clearCache(){}async _resolveFrameworkI18nPattern(e){let t=z.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(_(n,t.PUBLISHED_ROOT,o)),r=s.replace(/\/[^/]*\*.*$/,"");return this.pathExists(r),s}async _globWithNormalization(e,t){return(await pe(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 c of o)if(typeof c!="string"||c.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let n=this.getAppRoot(),s=z.getGlobOptionsFor?z.getGlobOptionsFor(t):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},r=this.normalizePath(n),a=e.framework.map(c=>{let u=this.normalizePath(c);return u.startsWith(r)?u.slice(r.length+1):u}),l=e.consumer.map(c=>{let u=this.normalizePath(c);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 c=a.length>0?await this._globWithNormalization(a,f):[],u=await this._globWithNormalization(l,f);return{frameworkFiles:c,consumerFiles:u}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(e){if(!z.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=z.getPatternsFor(e),s=this.isMonorepo();if(e==="i18n"){let l=n,f={eager:l.eager.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),lazy:l.lazy.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),framework:{eager:s?(l.framework?.eager||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean)),lazy:s?(l.framework?.lazy||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean))},all:[]};return f.all=[...f.eager,...f.lazy,...f.framework.eager,...f.framework.lazy],f}let r=n,a={framework:s?(r.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(r.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return a.all=[...a.consumer,...a.framework],a}getEmptyModulePath(){return this.getEmptyCjsModulePath().replace(/\.cjs$/,".js")}getEmptyFlagModulePath(){let e=A(ue(import.meta.url));return this.normalizePath(I(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(_(t,q.TOOLING)),r=this.normalizePath(_(t,q.CORE));if(this.pathExists(s)&&this.pathExists(r))return t;let a=_(t,"apps");if(this.pathExists(a)&&this.statSync(a)?.isDirectory())return this.normalizePath(t);let l=this.normalizePath(_(t,"package.json"));if(this.pathExists(l)&&this.normalizePath(A(t))===t)return t;let f=this.normalizePath(A(t));if(f===t)break;t=f,o++}return this.normalizePath(e)}};function C(i={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",workspace:r,bundleWorkspaceDeps:a=!1,importFramework:l=!1,external:f=!1,...c}=i,u=x.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,...c};a&&Object.keys(d).length>0&&(m.alias=Object.fromEntries(Object.entries(d).map(([y,p])=>[y,u.normalizePath(p)]))),m.mainFields=["module","main"],m.conditions=["import","module","node"];let R=["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"],$=[];if(a)try{let y=r?.root||process.cwd(),p=process.cwd(),g=10;for(let k=0;k<g;k++){let S=u.normalizePath(`${p}/package.json`);if(u.pathExists(S)){let w=u.readSync(S,{format:"json"});if(w&&Array.isArray(w.workspaces)){y=u.normalizePath(p);for(let O of w.workspaces)O==="apps/*"||O==="functions"||!O.includes("*")&&!O.includes("/")&&$.push(O);break}}let E=u.getDirname(p);if(E===p)break;p=E}}catch{}let B={name:"external-node-modules",setup(y){y.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"),w=u.getDirname(E);g=u.normalizePath(`${w}/firebase-stub.js`)}return{path:g}}),y.onResolve({filter:/.*/},p=>{if(p.kind==="entry-point")return null;if(p.path.match(/@donotdev\/functions\/.+/)&&a&&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`)}:y.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`)}:y.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`)}:y.resolve("@donotdev/core/server",{kind:p.kind,resolveDir:p.resolveDir});if(p.path.match(/@donotdev\/core\/.+/)&&a&&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\/.+/)&&a&&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($.length>0){let g=p.path.split("/")[0];if($.includes(g))return null}return p.path.startsWith(".")||p.path.startsWith("/")?null:{path:p.path,external:!0}})}};if(m.external=[...R,"firebase-admin","firebase-functions"],m.plugins=[B,...m.plugins||[]],m.define={"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"production"),...m.define||{}},l&&r.type==="dndev"){let y=r.root,p=u.normalizePath(`${y}/functions/lib`);m.alias={...m.alias,"@donotdev/functions":p}}if(s==="framework"){let y=x.getInstance(),p=r?.root?y.normalizePath(`${r.root}/packages/functions`):process.cwd(),g=y.normalizePath(`${p}/package.json`),k=y.readSync(g,{format:"json"});if(k?.exports){let S={};for(let[,E]of Object.entries(k.exports)){let w=E?.import||E?.default||(typeof E=="string"?E:null);if(!w||!w.endsWith(".ts"))continue;let O=w.replace(/^\.\/src\//,"").replace(/\.ts$/,"");S[O]=w}Object.keys(S).length>0&&(m.entryPoints=S)}}return m}var b=x.getInstance(),L=["create","get","list","listCard","update","delete","bulk"];function X(i,e=0){let t=" ".repeat(e),o="";for(let[n,s]of Object.entries(i))if(s!=null)if(typeof s=="object"&&!Array.isArray(s))Object.keys(s).length===0?o+=`${t}${n}: {}
|
|
2
2
|
`:o+=`${t}${n}:
|
|
3
3
|
${X(s,e+1)}`;else if(Array.isArray(s))if(s.length===0)o+=`${t}${n}: []
|
|
4
4
|
`;else{o+=`${t}${n}:
|
|
5
|
-
`;for(let r of s)if(typeof r=="object"&&r!==null){let
|
|
6
|
-
`;for(let
|
|
5
|
+
`;for(let r of s)if(typeof r=="object"&&r!==null){let a=Object.entries(r),[l,f]=a[0];o+=`${t} - ${l}: ${f}
|
|
6
|
+
`;for(let c=1;c<a.length;c++){let[u,d]=a[c];o+=`${t} ${u}: ${d}
|
|
7
7
|
`}}else o+=`${t} - ${r}
|
|
8
8
|
`}else o+=`${t}${n}: ${s}
|
|
9
|
-
`;return o}var
|
|
9
|
+
`;return o}var fe=["X_GOOGLE_","FIREBASE_","EXT_","GCLOUD_"],de=["FIREBASE_REGION","FIREBASE_PROJECT_ID","FIREBASE_AUTH_DOMAIN","ENABLE_RATE_LIMITING","DISABLE_RATE_LIMITING","ENABLE_METRICS","DISABLE_METRICS","ENFORCE_APP_CHECK"];function Z(i){if(!b.pathExists(i))return[];let e=b.readSync(i,{format:"text"}),t=[],o=e.matchAll(/export\s*\{([^}]+)\}/g);for(let s of o)if(s[1]){let r=s[1].split(",").map(a=>{let l=a.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 D(i=".env"){if(!b.pathExists(i))return[];let e=b.readSync(i),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();de.includes(r)||fe.some(a=>r.startsWith(a))||t.push(r)}return t}function Q(i){return L.some(e=>i.startsWith(`${e}_`))}function ee(i,e={}){let t=i.defaults||{},o=t.labels||{},n={},s=e.envPath?D(e.envPath):D(),r=s.length>0?s.map(u=>({key:u})):void 0,a=e.entryFile?Z(e.entryFile):[],l=i.functions||{},f=new Set(Object.keys(l));for(let u of a)!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(R=>({key:R})):r&&(n[u].secretEnvironmentVariables=r)}if(i.crud?.entities)for(let u of i.crud.entities)for(let d of L){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
|
-
`+X({endpoints:n,specVersion:"v1alpha1",requiredAPIs:[]})}function
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
`+X({endpoints:n,specVersion:"v1alpha1",requiredAPIs:[]})}function te(i){let e=i.crud?.entities||[],o=[`// Auto-generated CRUD exports - DO NOT EDIT MANUALLY
|
|
14
|
+
// Generated by @donotdev/core/functions at ${new Date().toISOString()}
|
|
15
|
+
|
|
16
|
+
import * as entities from 'entities';
|
|
17
|
+
import { createCrudFunctions } from '@donotdev/functions/firebase';
|
|
18
|
+
|
|
19
|
+
const crud = createCrudFunctions(entities);
|
|
20
|
+
`];for(let n of e){let s=[""];for(let r of L){let a=`${r}_${n}`;s.push(`export const ${a} = crud['${a}'];`)}o.push(s.join(`
|
|
21
|
+
`))}return o.join(`
|
|
22
|
+
`)+`
|
|
23
|
+
`}function W(i,e={}){let t=Object.keys(i.functions||{}),o=[];if(i.crud?.entities)for(let l of i.crud.entities)for(let f of L)o.push(`${f}_${l}`);let s=(e.entryFile?Z(e.entryFile):[]).filter(l=>!Q(l)&&!t.includes(l)),r=[...t,...s],a=e.envPath?D(e.envPath):D();return{yaml:ee(i,e),functions:[...r,...o],staticFunctions:r,crudFunctions:o,autoDetected:s,autoSecrets:a}}function U(i){let e=new Set;for(let f of Object.values(i.functions||{}))if(f.secrets)for(let c of f.secrets)e.add(c);let t=D();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 c=f.trim();if(!c||c.startsWith("#")){s.push(f);continue}let u=c.indexOf("="),d=u>0?c.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(`
|
|
24
|
+
`));let a=`# Secrets managed by sync-secrets (auto-filtered by build)
|
|
25
|
+
`;if(b.pathExists(".env.local")){let f=b.readSync(".env.local"),c=new Set(f.split(/\r?\n/).filter(d=>d.trim()&&!d.trim().startsWith("#")).map(d=>d.split("=")[0].trim())),u=r.filter(d=>!c.has(d.split("=")[0].trim()));u.length>0&&b.writeSync(".env.local",f.trimEnd()+`
|
|
26
|
+
`+a+u.join(`
|
|
17
27
|
`)+`
|
|
18
|
-
`)}else b.writeSync(".env.local",
|
|
28
|
+
`)}else b.writeSync(".env.local",a+r.join(`
|
|
19
29
|
`)+`
|
|
20
|
-
`);return{stripped:r.map(f=>f.split("=")[0].trim()),kept:s.length}}function
|
|
30
|
+
`);return{stripped:r.map(f=>f.split("=")[0].trim()),kept:s.length}}function he(i={}){let e=T();return C({...i,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0,workspace:e})}async function me(i,e={}){let{entry:t="src/index.ts",outDir:o="lib",minify:n=process.env.NODE_ENV==="production",sourcemap:s=!0,analyze:r=!1,entryFile:a="src/index.ts",envPath:l=".env",...f}=e;try{let c=x.getInstance(),u=te(i);c.writeSync("src/.generated/crud-exports.ts",u,{overwrite:!0});let{build:d}=await import("esbuild"),m=he({entry:t,outDir:o,minify:n,sourcemap:s,...f}),R=await d(m);R.errors.length>0&&process.exit(1),R.warnings.length>0;let{yaml:$,staticFunctions:B,crudFunctions:y,autoDetected:p,autoSecrets:g}=W(i,{entryFile:a,envPath:l});c.writeSync("functions.yaml",$,{overwrite:!0}),p.length>0,g.length>0;let{stripped:k}=U(i);if(k.length>0,r&&R.metafile){let{analyzeMetafile:S}=await import("esbuild"),E=await S(R.metafile)}}catch{process.exit(1)}}function re(i={}){let{entry:e="src/index.ts",outDir:t="lib",minify:o=!1,sourcemap:n=!0,platform:s="firebase",...r}=i,a=T();return C({entry:e,outDir:t,minify:o,sourcemap:n,platform:s,workspace:a,...r})}function Ue(i={}){return re({...i,platform:"framework",bundleWorkspaceDeps:!0})}function Be(i={}){return re({...i,platform:"firebase",bundleWorkspaceDeps:!0,importFramework:!0})}export{me as buildFunctions,Be as createAppFunctionsConfig,re as createFunctionsEsbuildConfig,Ue as createRootFunctionsConfig,U as filterEnvSecrets,ee as generateFunctionsYaml,W as generateFunctionsYamlWithInfo};
|
|
@@ -577,5 +577,40 @@
|
|
|
577
577
|
},
|
|
578
578
|
"signOut": "تسجيل الخروج"
|
|
579
579
|
}
|
|
580
|
+
},
|
|
581
|
+
"canvas": {
|
|
582
|
+
"checklist": {
|
|
583
|
+
"addItem": "Add item",
|
|
584
|
+
"noItems": "لا توجد عناصر بعد.",
|
|
585
|
+
"remove": "إزالة",
|
|
586
|
+
"toggleAria": "تبديل \"{{text}}\"",
|
|
587
|
+
"removeAria": "إزالة {{text}}"
|
|
588
|
+
},
|
|
589
|
+
"brainSearch": {
|
|
590
|
+
"resultsFor": "Results for ",
|
|
591
|
+
"match": "match",
|
|
592
|
+
"matches": "matches",
|
|
593
|
+
"noMatches": "No matches.",
|
|
594
|
+
"tagFiltersLabel": "Tag filters"
|
|
595
|
+
},
|
|
596
|
+
"mailTriage": {
|
|
597
|
+
"noMessages": "No messages.",
|
|
598
|
+
"columns": {
|
|
599
|
+
"sender": "Sender",
|
|
600
|
+
"subject": "Subject",
|
|
601
|
+
"received": "Received",
|
|
602
|
+
"actions": "Actions"
|
|
603
|
+
},
|
|
604
|
+
"actions": {
|
|
605
|
+
"archive": "Archive",
|
|
606
|
+
"archiveAria": "Archive \"{{subject}}\"",
|
|
607
|
+
"reply": "Reply",
|
|
608
|
+
"replyAria": "Reply to \"{{subject}}\"",
|
|
609
|
+
"flag": "Flag",
|
|
610
|
+
"flagAria": "Star \"{{subject}}\"",
|
|
611
|
+
"open": "Open",
|
|
612
|
+
"openAria": "Open \"{{subject}}\""
|
|
613
|
+
}
|
|
614
|
+
}
|
|
580
615
|
}
|
|
581
616
|
}
|
|
@@ -104,7 +104,9 @@
|
|
|
104
104
|
"secureByDesign": "Sikkerhed indbygget fra start",
|
|
105
105
|
"fastIntegration": "Hurtig at komme i gang",
|
|
106
106
|
"scaleEffortlessly": "Skalér fra prototyper til store løsninger.",
|
|
107
|
-
"header": {
|
|
107
|
+
"header": {
|
|
108
|
+
"purchase": "Køb"
|
|
109
|
+
}
|
|
108
110
|
},
|
|
109
111
|
"actions": {
|
|
110
112
|
"create": "Opret",
|
|
@@ -152,7 +154,9 @@
|
|
|
152
154
|
"goBack": "Tilbage"
|
|
153
155
|
}
|
|
154
156
|
},
|
|
155
|
-
"nav": {
|
|
157
|
+
"nav": {
|
|
158
|
+
"signIn": "Log ind"
|
|
159
|
+
},
|
|
156
160
|
"pagination": {
|
|
157
161
|
"showing": "Viser {{from}}–{{to}} af {{total}}",
|
|
158
162
|
"previous": "Forrige",
|
|
@@ -188,7 +192,9 @@
|
|
|
188
192
|
}
|
|
189
193
|
},
|
|
190
194
|
"common": {
|
|
191
|
-
"app": {
|
|
195
|
+
"app": {
|
|
196
|
+
"name": "DoNotDev App"
|
|
197
|
+
},
|
|
192
198
|
"defaultTitle": "Side",
|
|
193
199
|
"defaultDescription": "Sidebeskrivelse",
|
|
194
200
|
"locale": "da_DK",
|
|
@@ -198,7 +204,9 @@
|
|
|
198
204
|
"tooltipWithCurrent": "Tema: {{current}}",
|
|
199
205
|
"tooltipWithNext": "Skift til {{next}}"
|
|
200
206
|
},
|
|
201
|
-
"languageSelector": {
|
|
207
|
+
"languageSelector": {
|
|
208
|
+
"changeLanguage": "Skift sprog"
|
|
209
|
+
}
|
|
202
210
|
},
|
|
203
211
|
"footer": {
|
|
204
212
|
"landing": {
|
|
@@ -239,8 +247,14 @@
|
|
|
239
247
|
"expand": "Åbn footer"
|
|
240
248
|
}
|
|
241
249
|
},
|
|
242
|
-
"search": {
|
|
243
|
-
|
|
250
|
+
"search": {
|
|
251
|
+
"ariaLabel": "Søg",
|
|
252
|
+
"label": "Søg"
|
|
253
|
+
},
|
|
254
|
+
"goTo": {
|
|
255
|
+
"ariaLabel": "Gå til side",
|
|
256
|
+
"label": "Gå til"
|
|
257
|
+
},
|
|
244
258
|
"globalGoTo": {
|
|
245
259
|
"placeholder": "Søg i sider eller gå til...",
|
|
246
260
|
"noResults": "Ingen sider fundet.",
|
|
@@ -278,7 +292,10 @@
|
|
|
278
292
|
"typeAndPressAdd": "Skriv og tryk Tilføj...",
|
|
279
293
|
"enterLocationData": "Indtast placering (JSON)"
|
|
280
294
|
},
|
|
281
|
-
"navigation": {
|
|
295
|
+
"navigation": {
|
|
296
|
+
"more": "Mere",
|
|
297
|
+
"home": "Forside"
|
|
298
|
+
},
|
|
282
299
|
"pwa": {
|
|
283
300
|
"update": {
|
|
284
301
|
"title": "Ny version klar",
|
|
@@ -321,7 +338,10 @@
|
|
|
321
338
|
"copied": "Kopieret!",
|
|
322
339
|
"copyCodeToClipboard": "Kopier kode"
|
|
323
340
|
},
|
|
324
|
-
"video": {
|
|
341
|
+
"video": {
|
|
342
|
+
"clickToWatch": "Klik for at se",
|
|
343
|
+
"watchVideo": "Se video"
|
|
344
|
+
},
|
|
325
345
|
"inspector": {
|
|
326
346
|
"pageSource": "Sidekilde",
|
|
327
347
|
"inspectPageSourceCode": "Se sidekoden"
|
|
@@ -557,5 +577,40 @@
|
|
|
557
577
|
},
|
|
558
578
|
"signOut": "Log ud"
|
|
559
579
|
}
|
|
580
|
+
},
|
|
581
|
+
"canvas": {
|
|
582
|
+
"checklist": {
|
|
583
|
+
"addItem": "Add item",
|
|
584
|
+
"noItems": "Ingen elementer endnu.",
|
|
585
|
+
"remove": "Fjern",
|
|
586
|
+
"toggleAria": "Slå \"{{text}}\" til/fra",
|
|
587
|
+
"removeAria": "Fjern {{text}}"
|
|
588
|
+
},
|
|
589
|
+
"brainSearch": {
|
|
590
|
+
"resultsFor": "Results for ",
|
|
591
|
+
"match": "match",
|
|
592
|
+
"matches": "matches",
|
|
593
|
+
"noMatches": "No matches.",
|
|
594
|
+
"tagFiltersLabel": "Tag filters"
|
|
595
|
+
},
|
|
596
|
+
"mailTriage": {
|
|
597
|
+
"noMessages": "No messages.",
|
|
598
|
+
"columns": {
|
|
599
|
+
"sender": "Sender",
|
|
600
|
+
"subject": "Subject",
|
|
601
|
+
"received": "Received",
|
|
602
|
+
"actions": "Actions"
|
|
603
|
+
},
|
|
604
|
+
"actions": {
|
|
605
|
+
"archive": "Archive",
|
|
606
|
+
"archiveAria": "Archive \"{{subject}}\"",
|
|
607
|
+
"reply": "Reply",
|
|
608
|
+
"replyAria": "Reply to \"{{subject}}\"",
|
|
609
|
+
"flag": "Flag",
|
|
610
|
+
"flagAria": "Star \"{{subject}}\"",
|
|
611
|
+
"open": "Open",
|
|
612
|
+
"openAria": "Open \"{{subject}}\""
|
|
613
|
+
}
|
|
614
|
+
}
|
|
560
615
|
}
|
|
561
616
|
}
|