@moontra/moonui-pro 3.4.41 → 3.4.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.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @moontra/moonui-pro v2.0.9
3
3
  * Premium UI components for MoonUI
4
- * (c) 2025 MoonUI. All rights reserved.
4
+ * (c) 2026 MoonUI. All rights reserved.
5
5
  * @license Commercial - https://moonui.dev/license
6
6
  */
7
7
 
@@ -4,7 +4,7 @@ import * as path from 'path';
4
4
  /**
5
5
  * @moontra/moonui-pro v2.0.9
6
6
  * Premium UI components for MoonUI
7
- * (c) 2025 MoonUI. All rights reserved.
7
+ * (c) 2026 MoonUI. All rights reserved.
8
8
  * @license Commercial - https://moonui.dev/license
9
9
  */
10
10
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moontra/moonui-pro",
3
- "version": "3.4.41",
3
+ "version": "3.4.42",
4
4
  "description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",
@@ -11,7 +11,7 @@ const crypto = require('crypto');
11
11
  const https = require('https');
12
12
 
13
13
  // Configuration
14
- const LICENSE_FILE = '.moonui-license';
14
+ const LICENSE_FILE = '.moonui-license-token'; // FIXED: Match next-config-plugin.mjs
15
15
  const API_URL = 'https://moonui.dev/api/v1/license/validate';
16
16
  const CACHE_DURATION = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds
17
17
 
@@ -131,116 +131,71 @@ function saveLicenseToken(token) {
131
131
  try {
132
132
  console.log('[MoonUI Pro] Starting to save license token...');
133
133
 
134
- // Check if we're in Vercel build environment
135
- const isVercelBuild = process.env.VERCEL === '1';
136
- const isNetlifyBuild = process.env.NETLIFY === 'true';
137
-
138
- if (isVercelBuild || isNetlifyBuild) {
139
- console.log('[MoonUI Pro] Detected build environment:', isVercelBuild ? 'Vercel' : 'Netlify');
140
-
141
- // Token'ı hem environment variable'a hem de dosyaya kaydet
142
- const tokenString = JSON.stringify(token);
143
- const base64Token = Buffer.from(tokenString).toString('base64');
144
-
145
- // 1. Environment variable (geçici - sadece PostInstall process'i için)
146
- console.log('[MoonUI Pro] Setting MOONUI_PRO_TOKEN environment variable for build...');
147
- process.env.MOONUI_PRO_TOKEN = base64Token;
148
-
149
- // 2. Project root'a kalıcı dosya (next.config.ts build time'da okuyacak)
150
- try {
151
- // Find project root (where package.json is, 3 levels up from script in node_modules)
152
- // Script location: /path/to/project/node_modules/@moontra/moonui-pro/scripts/postinstall.cjs
153
- // Go up: scripts -> moonui-pro -> @moontra -> node_modules -> PROJECT ROOT
154
- let projectRoot = process.cwd();
155
-
156
- // If we're inside node_modules, go up to project root
157
- if (projectRoot.includes('node_modules')) {
158
- // From: /vercel/path0/node_modules/@moontra/moonui-pro
159
- // To: /vercel/path0
160
- const parts = projectRoot.split(path.sep);
161
- const nodeModulesIndex = parts.lastIndexOf('node_modules');
162
- if (nodeModulesIndex > 0) {
163
- projectRoot = parts.slice(0, nodeModulesIndex).join(path.sep);
164
- }
165
- }
166
-
167
- const tokenFile = path.join(projectRoot, '.moonui-license-token');
168
-
169
- console.log('[MoonUI Pro] Current working directory:', process.cwd());
170
- console.log('[MoonUI Pro] Calculated project root:', projectRoot);
171
- console.log('[MoonUI Pro] Saving token to:', tokenFile);
172
-
173
- fs.writeFileSync(tokenFile, base64Token, 'utf8');
174
- console.log('[MoonUI Pro] ✓ Token saved to project root');
175
-
176
- // Verify file was created
177
- if (fs.existsSync(tokenFile)) {
178
- console.log('[MoonUI Pro] ✓ Verified: Token file exists');
179
- } else {
180
- console.error('[MoonUI Pro] ❌ Error: Token file was not created!');
181
- }
182
- } catch (fileError) {
183
- console.error('[MoonUI Pro] Failed to save token file:', fileError.message);
134
+ // MoonUI Pro token'ı build plugin (next-config-plugin) ve client tarafından
135
+ // `.moonui-license-token` dosyasından BASE64 olarak okunur. Bu yüzden token
136
+ // HER production ortamında (Vercel, Netlify, Docker, Kubernetes, Dokploy, bare
137
+ // Ubuntu, CI) daima base64 formatında yazılmalı — platform algılamaya GEREK YOK.
138
+ // Eski AES kolu, build plugin'in okuyamadığı bir dosya üretip non-Vercel
139
+ // ortamlarda Pro'yu sessizce kilitliyordu (token format/dosya uyuşmazlığı).
140
+ const buildEnv =
141
+ process.env.VERCEL === '1' ? 'Vercel' :
142
+ process.env.NETLIFY === 'true' ? 'Netlify' :
143
+ 'generic (Docker/K8s/Dokploy/bare/CI)';
144
+ console.log('[MoonUI Pro] Build environment:', buildEnv);
145
+
146
+ const tokenString = JSON.stringify(token);
147
+ const base64Token = Buffer.from(tokenString).toString('base64');
148
+
149
+ // 1. Geçici environment variable (yalnız bu PostInstall process'i için)
150
+ process.env.MOONUI_PRO_TOKEN = base64Token;
151
+
152
+ // 2. Proje kökünü bul. Her iki çağrı biçimini de destekle:
153
+ // a) `npm install` sırasında: cwd node_modules içindedir köke kadar sıyır
154
+ // b) `prebuild`/manuel çağrı: cwd zaten proje köküdür → package.json'a kadar çık
155
+ let projectRoot = process.cwd();
156
+ if (projectRoot.includes('node_modules')) {
157
+ const parts = projectRoot.split(path.sep);
158
+ const nodeModulesIndex = parts.lastIndexOf('node_modules');
159
+ if (nodeModulesIndex > 0) {
160
+ projectRoot = parts.slice(0, nodeModulesIndex).join(path.sep);
184
161
  }
185
-
186
- // 3. Temp location (fallback)
187
- try {
188
- const tempPath = process.env.VERCEL_ARTIFACTS_PATH || process.env.NETLIFY_BUILD_BASE || '/tmp';
189
- const tempLicenseFile = path.join(tempPath, '.moonui-license-token');
190
-
191
- fs.writeFileSync(tempLicenseFile, base64Token, 'utf8');
192
- console.log('[MoonUI Pro] Token also saved to temp location:', tempLicenseFile);
193
- } catch (tempError) {
194
- console.log('[MoonUI Pro] Could not write to temp location (expected in some environments)');
162
+ } else {
163
+ let attempts = 0;
164
+ let dir = projectRoot;
165
+ while (attempts < 10) {
166
+ if (fs.existsSync(path.join(dir, 'package.json'))) {
167
+ projectRoot = dir;
168
+ break;
169
+ }
170
+ dir = path.dirname(dir);
171
+ attempts++;
195
172
  }
196
-
197
- console.log('[MoonUI Pro] ✓ License token stored for build environment');
198
- return true;
199
173
  }
200
174
 
201
- // Standard file system approach for local development
202
- // Find the project root (where package.json is)
203
- let projectRoot = process.cwd();
204
- console.log('[MoonUI Pro] Initial working directory:', projectRoot);
205
-
206
- let attempts = 0;
175
+ // 3. Kalıcı base64 dosya (build plugin build-time'da bunu okur)
176
+ const tokenFile = path.join(projectRoot, LICENSE_FILE);
177
+ console.log('[MoonUI Pro] Current working directory:', process.cwd());
178
+ console.log('[MoonUI Pro] Calculated project root:', projectRoot);
179
+ console.log('[MoonUI Pro] Saving token (base64) to:', tokenFile);
207
180
 
208
- while (attempts < 10) {
209
- const packageJsonPath = path.join(projectRoot, 'package.json');
210
- console.log(`[MoonUI Pro] Checking for package.json at: ${packageJsonPath}`);
181
+ fs.writeFileSync(tokenFile, base64Token, 'utf8');
211
182
 
212
- if (fs.existsSync(packageJsonPath)) {
213
- console.log('[MoonUI Pro] Found package.json at:', projectRoot);
214
- break;
215
- }
216
- projectRoot = path.dirname(projectRoot);
217
- attempts++;
183
+ if (!fs.existsSync(tokenFile)) {
184
+ console.error('[MoonUI Pro] Error: Token file was not created!');
185
+ return false;
218
186
  }
187
+ console.log('[MoonUI Pro] ✓ Token saved to project root');
219
188
 
220
- const licenseFilePath = path.join(projectRoot, LICENSE_FILE);
221
- console.log('[MoonUI Pro] License file path:', licenseFilePath);
222
-
223
- // Encrypt token with a deterministic key based on environment
224
- const encryptionKey = process.env.MOONUI_LICENSE_KEY || 'default-key';
225
- console.log('[MoonUI Pro] Using encryption key:', encryptionKey.substring(0, 10) + '...');
226
-
227
- const encryptedData = encryptToken(token, encryptionKey);
228
- console.log('[MoonUI Pro] Token encrypted successfully');
229
-
230
- // Save to file
231
- console.log('[MoonUI Pro] Writing to file:', licenseFilePath);
232
- fs.writeFileSync(licenseFilePath, JSON.stringify(encryptedData, null, 2));
233
-
234
- // Verify file was created
235
- if (fs.existsSync(licenseFilePath)) {
236
- const stats = fs.statSync(licenseFilePath);
237
- console.log('[MoonUI Pro] ✓ License token saved successfully');
238
- console.log('[MoonUI Pro] File size:', stats.size, 'bytes');
239
- return true;
240
- } else {
241
- console.error('[MoonUI Pro] File was not created despite no errors');
242
- return false;
189
+ // 4. Temp konum (Vercel/Netlify cache senaryoları için ek güvence)
190
+ try {
191
+ const tempPath = process.env.VERCEL_ARTIFACTS_PATH || process.env.NETLIFY_BUILD_BASE || '/tmp';
192
+ fs.writeFileSync(path.join(tempPath, LICENSE_FILE), base64Token, 'utf8');
193
+ } catch (tempError) {
194
+ // Bazı ortamlarda temp'e yazılamaz kritik değil, sessiz geç
243
195
  }
196
+
197
+ console.log('[MoonUI Pro] ✓ License token stored (base64 — universal, tüm platformlar)');
198
+ return true;
244
199
  } catch (error) {
245
200
  console.error('[MoonUI Pro] Failed to save license token:', error.message);
246
201
  console.error('[MoonUI Pro] Full error:', error);
@@ -333,26 +288,24 @@ async function main() {
333
288
  });
334
289
 
335
290
  try {
336
- // Only run in production environments
337
- if (!isProduction()) {
338
- console.log('[MoonUI Pro] Development environment detected, skipping license validation');
339
- return;
340
- }
341
-
342
- console.log('[MoonUI Pro] Production environment detected, checking license...');
343
-
344
- // Check for license key in environment variables
291
+ // Token'ı yalnızca bir lisans anahtarı mevcutsa üret. Anahtarın varlığı,
292
+ // kullanıcının bu build'de Pro istediğinin EN güvenilir sinyalidir.
293
+ // NODE_ENV/CI/VERCEL gibi platform bayraklarına GÜVENME: bare Ubuntu veya
294
+ // özel CI'da bunlar olmayabilir ve postinstall atlanınca Pro sessizce kilitlenir.
295
+ // Anahtar yoksa bu bir geliştirme akışıdır (CLI `moonui dev`) → atla.
345
296
  const licenseKey = process.env.MOONUI_LICENSE_KEY ||
346
297
  process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY ||
347
298
  process.env.VITE_MOONUI_LICENSE_KEY ||
348
299
  process.env.REACT_APP_MOONUI_LICENSE_KEY;
349
300
 
350
301
  if (!licenseKey) {
351
- console.log('[MoonUI Pro] No license key found in environment variables');
352
- console.log('[MoonUI Pro] Set MOONUI_LICENSE_KEY to enable Pro features');
302
+ console.log('[MoonUI Pro] No license key found skipping (development/CLI flow)');
303
+ console.log('[MoonUI Pro] Set MOONUI_LICENSE_KEY to enable Pro features in production builds');
353
304
  return;
354
305
  }
355
306
 
307
+ console.log('[MoonUI Pro] License key detected, validating and generating token...');
308
+
356
309
  // Use the new validateAndCreateToken function
357
310
  const result = await validateAndCreateToken(licenseKey);
358
311