@moontra/moonui-pro 3.4.41 → 3.4.43

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.43",
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",
@@ -7,11 +7,10 @@
7
7
 
8
8
  const fs = require('fs');
9
9
  const path = require('path');
10
- const crypto = require('crypto');
11
10
  const https = require('https');
12
11
 
13
12
  // Configuration
14
- const LICENSE_FILE = '.moonui-license';
13
+ const LICENSE_FILE = '.moonui-license-token'; // FIXED: Match next-config-plugin.mjs
15
14
  const API_URL = 'https://moonui.dev/api/v1/license/validate';
16
15
  const CACHE_DURATION = 30 * 24 * 60 * 60 * 1000; // 30 days in milliseconds
17
16
 
@@ -41,27 +40,6 @@ function isProduction() {
41
40
  );
42
41
  }
43
42
 
44
- // Encrypt token for storage
45
- function encryptToken(token, key) {
46
- const algorithm = 'aes-256-gcm';
47
- const salt = crypto.randomBytes(16);
48
- const derivedKey = crypto.pbkdf2Sync(key, salt, 100000, 32, 'sha256');
49
- const iv = crypto.randomBytes(16);
50
- const cipher = crypto.createCipheriv(algorithm, derivedKey, iv);
51
-
52
- let encrypted = cipher.update(JSON.stringify(token), 'utf8', 'hex');
53
- encrypted += cipher.final('hex');
54
-
55
- const authTag = cipher.getAuthTag();
56
-
57
- return {
58
- encrypted,
59
- salt: salt.toString('hex'),
60
- iv: iv.toString('hex'),
61
- authTag: authTag.toString('hex')
62
- };
63
- }
64
-
65
43
  // Validate license with MoonUI API
66
44
  async function validateLicense(licenseKey) {
67
45
  return new Promise((resolve, reject) => {
@@ -121,6 +99,12 @@ async function validateLicense(licenseKey) {
121
99
  reject(error);
122
100
  });
123
101
 
102
+ // npm install'ı asmamak için sıkı timeout: API erişilemez/yavaşsa (down, ağ
103
+ // sorunu) isteği iptal et → main() catch'i Free plan ile devam eder, hang YOK.
104
+ req.setTimeout(15000, () => {
105
+ req.destroy(new Error('License validation request timed out after 15s'));
106
+ });
107
+
124
108
  req.write(postData);
125
109
  req.end();
126
110
  });
@@ -131,116 +115,71 @@ function saveLicenseToken(token) {
131
115
  try {
132
116
  console.log('[MoonUI Pro] Starting to save license token...');
133
117
 
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);
118
+ // MoonUI Pro token'ı build plugin (next-config-plugin) ve client tarafından
119
+ // `.moonui-license-token` dosyasından BASE64 olarak okunur. Bu yüzden token
120
+ // HER production ortamında (Vercel, Netlify, Docker, Kubernetes, Dokploy, bare
121
+ // Ubuntu, CI) daima base64 formatında yazılmalı — platform algılamaya GEREK YOK.
122
+ // Eski AES kolu, build plugin'in okuyamadığı bir dosya üretip non-Vercel
123
+ // ortamlarda Pro'yu sessizce kilitliyordu (token format/dosya uyuşmazlığı).
124
+ const buildEnv =
125
+ process.env.VERCEL === '1' ? 'Vercel' :
126
+ process.env.NETLIFY === 'true' ? 'Netlify' :
127
+ 'generic (Docker/K8s/Dokploy/bare/CI)';
128
+ console.log('[MoonUI Pro] Build environment:', buildEnv);
129
+
130
+ const tokenString = JSON.stringify(token);
131
+ const base64Token = Buffer.from(tokenString).toString('base64');
132
+
133
+ // 1. Geçici environment variable (yalnız bu PostInstall process'i için)
134
+ process.env.MOONUI_PRO_TOKEN = base64Token;
135
+
136
+ // 2. Proje kökünü bul. Her iki çağrı biçimini de destekle:
137
+ // a) `npm install` sırasında: cwd node_modules içindedir köke kadar sıyır
138
+ // b) `prebuild`/manuel çağrı: cwd zaten proje köküdür → package.json'a kadar çık
139
+ let projectRoot = process.cwd();
140
+ if (projectRoot.includes('node_modules')) {
141
+ const parts = projectRoot.split(path.sep);
142
+ const nodeModulesIndex = parts.lastIndexOf('node_modules');
143
+ if (nodeModulesIndex > 0) {
144
+ projectRoot = parts.slice(0, nodeModulesIndex).join(path.sep);
184
145
  }
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)');
146
+ } else {
147
+ let attempts = 0;
148
+ let dir = projectRoot;
149
+ while (attempts < 10) {
150
+ if (fs.existsSync(path.join(dir, 'package.json'))) {
151
+ projectRoot = dir;
152
+ break;
153
+ }
154
+ dir = path.dirname(dir);
155
+ attempts++;
195
156
  }
196
-
197
- console.log('[MoonUI Pro] ✓ License token stored for build environment');
198
- return true;
199
157
  }
200
158
 
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;
159
+ // 3. Kalıcı base64 dosya (build plugin build-time'da bunu okur)
160
+ const tokenFile = path.join(projectRoot, LICENSE_FILE);
161
+ console.log('[MoonUI Pro] Current working directory:', process.cwd());
162
+ console.log('[MoonUI Pro] Calculated project root:', projectRoot);
163
+ console.log('[MoonUI Pro] Saving token (base64) to:', tokenFile);
207
164
 
208
- while (attempts < 10) {
209
- const packageJsonPath = path.join(projectRoot, 'package.json');
210
- console.log(`[MoonUI Pro] Checking for package.json at: ${packageJsonPath}`);
165
+ fs.writeFileSync(tokenFile, base64Token, 'utf8');
211
166
 
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++;
167
+ if (!fs.existsSync(tokenFile)) {
168
+ console.error('[MoonUI Pro] Error: Token file was not created!');
169
+ return false;
218
170
  }
171
+ console.log('[MoonUI Pro] ✓ Token saved to project root');
219
172
 
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;
173
+ // 4. Temp konum (Vercel/Netlify cache senaryoları için ek güvence)
174
+ try {
175
+ const tempPath = process.env.VERCEL_ARTIFACTS_PATH || process.env.NETLIFY_BUILD_BASE || '/tmp';
176
+ fs.writeFileSync(path.join(tempPath, LICENSE_FILE), base64Token, 'utf8');
177
+ } catch (tempError) {
178
+ // Bazı ortamlarda temp'e yazılamaz kritik değil, sessiz geç
243
179
  }
180
+
181
+ console.log('[MoonUI Pro] ✓ License token stored (base64 — universal, tüm platformlar)');
182
+ return true;
244
183
  } catch (error) {
245
184
  console.error('[MoonUI Pro] Failed to save license token:', error.message);
246
185
  console.error('[MoonUI Pro] Full error:', error);
@@ -333,26 +272,24 @@ async function main() {
333
272
  });
334
273
 
335
274
  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
275
+ // Token'ı yalnızca bir lisans anahtarı mevcutsa üret. Anahtarın varlığı,
276
+ // kullanıcının bu build'de Pro istediğinin EN güvenilir sinyalidir.
277
+ // NODE_ENV/CI/VERCEL gibi platform bayraklarına GÜVENME: bare Ubuntu veya
278
+ // özel CI'da bunlar olmayabilir ve postinstall atlanınca Pro sessizce kilitlenir.
279
+ // Anahtar yoksa bu bir geliştirme akışıdır (CLI `moonui dev`) → atla.
345
280
  const licenseKey = process.env.MOONUI_LICENSE_KEY ||
346
281
  process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY ||
347
282
  process.env.VITE_MOONUI_LICENSE_KEY ||
348
283
  process.env.REACT_APP_MOONUI_LICENSE_KEY;
349
284
 
350
285
  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');
286
+ console.log('[MoonUI Pro] No license key found skipping (development/CLI flow)');
287
+ console.log('[MoonUI Pro] Set MOONUI_LICENSE_KEY to enable Pro features in production builds');
353
288
  return;
354
289
  }
355
290
 
291
+ console.log('[MoonUI Pro] License key detected, validating and generating token...');
292
+
356
293
  // Use the new validateAndCreateToken function
357
294
  const result = await validateAndCreateToken(licenseKey);
358
295