@moontra/moonui-pro 3.4.44 → 3.5.0
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/dist/cdn/index.global.js +134 -134
- package/dist/cdn/index.global.js.map +1 -1
- package/dist/index.d.ts +76 -13
- package/dist/index.mjs +29 -257
- package/dist/next-config-plugin.cjs +228 -0
- package/dist/next-config-plugin.d.cts +30 -0
- package/dist/next-config-plugin.mjs +1 -1
- package/dist/server.mjs +1 -1
- package/dist/styles/nprogress.mjs +1 -1
- package/dist/vite-plugin.cjs +246 -0
- package/dist/vite-plugin.d.cts +38 -0
- package/dist/vite-plugin.mjs +1 -1
- package/package.json +30 -14
- package/plugin/{index.js → index.cjs} +8 -8
- package/scripts/postbuild.js +16 -2
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
27
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @moontra/moonui-pro v3.5.0 - CommonJS build (next-config + vite plugins)
|
|
31
|
+
* (c) 2026 MoonUI. All rights reserved.
|
|
32
|
+
* @license Commercial - https://moonui.dev/license
|
|
33
|
+
*/
|
|
34
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
35
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
36
|
+
}) : x)(function(x) {
|
|
37
|
+
if (typeof require !== "undefined")
|
|
38
|
+
return require.apply(this, arguments);
|
|
39
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
40
|
+
});
|
|
41
|
+
function findExistingToken() {
|
|
42
|
+
if (typeof window !== "undefined") {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const possiblePaths = [
|
|
46
|
+
path__namespace.join(process.cwd(), ".moonui-license-token"),
|
|
47
|
+
path__namespace.join(process.cwd(), "..", ".moonui-license-token"),
|
|
48
|
+
path__namespace.join(process.cwd(), "..", "..", ".moonui-license-token")
|
|
49
|
+
];
|
|
50
|
+
if (process.env.VERCEL_ARTIFACTS_PATH) {
|
|
51
|
+
possiblePaths.push(path__namespace.join(process.env.VERCEL_ARTIFACTS_PATH, ".moonui-license-token"));
|
|
52
|
+
}
|
|
53
|
+
if (process.env.NETLIFY_BUILD_BASE) {
|
|
54
|
+
possiblePaths.push(path__namespace.join(process.env.NETLIFY_BUILD_BASE, ".moonui-license-token"));
|
|
55
|
+
}
|
|
56
|
+
possiblePaths.push("/tmp/.moonui-license-token");
|
|
57
|
+
for (const filePath of possiblePaths) {
|
|
58
|
+
if (fs__namespace.existsSync(filePath)) {
|
|
59
|
+
try {
|
|
60
|
+
return fs__namespace.readFileSync(filePath, "utf8");
|
|
61
|
+
} catch (err) {
|
|
62
|
+
console.error(`[MoonUI Token Generator] Failed to read token from ${filePath}:`, err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
async function generateTokenIfMissing(options = {}) {
|
|
69
|
+
const { silent = false, forceRegenerate = false } = options;
|
|
70
|
+
try {
|
|
71
|
+
if (!forceRegenerate && process.env.MOONUI_PRO_TOKEN) {
|
|
72
|
+
if (!silent) {
|
|
73
|
+
console.log("[MoonUI Token Generator] Token found in environment variable");
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
token: JSON.parse(Buffer.from(process.env.MOONUI_PRO_TOKEN, "base64").toString("utf8")),
|
|
78
|
+
cached: true
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (!forceRegenerate) {
|
|
82
|
+
const existingToken = findExistingToken();
|
|
83
|
+
if (existingToken) {
|
|
84
|
+
if (!silent) {
|
|
85
|
+
console.log("[MoonUI Token Generator] Token file already exists");
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
token: JSON.parse(Buffer.from(existingToken, "base64").toString("utf8")),
|
|
90
|
+
cached: true
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY || process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY;
|
|
95
|
+
if (!licenseKey) {
|
|
96
|
+
if (!silent) {
|
|
97
|
+
console.log("[MoonUI Token Generator] No license key found in environment variables");
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: "No license key found"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const postInstallPath = path__namespace.join(__dirname, "../../scripts/postinstall.cjs");
|
|
105
|
+
if (!fs__namespace.existsSync(postInstallPath)) {
|
|
106
|
+
if (!silent) {
|
|
107
|
+
console.error("[MoonUI Token Generator] PostInstall script not found at:", postInstallPath);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
error: "PostInstall script not found"
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const postInstall = __require(postInstallPath);
|
|
115
|
+
if (!silent) {
|
|
116
|
+
console.log("[MoonUI Token Generator] Validating license key and generating token...");
|
|
117
|
+
}
|
|
118
|
+
const result = await postInstall.validateAndCreateToken(licenseKey, { silent });
|
|
119
|
+
if (result.success && result.token) {
|
|
120
|
+
const saveSuccess = postInstall.saveLicenseToken(result.token);
|
|
121
|
+
if (saveSuccess) {
|
|
122
|
+
if (!silent) {
|
|
123
|
+
console.log("[MoonUI Token Generator] \u2713 Token generated and saved successfully");
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
success: true,
|
|
127
|
+
token: result.token
|
|
128
|
+
};
|
|
129
|
+
} else {
|
|
130
|
+
if (!silent) {
|
|
131
|
+
console.log("[MoonUI Token Generator] \u26A0 Token generated but failed to save");
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: "Failed to save token"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
if (!silent) {
|
|
140
|
+
console.log("[MoonUI Token Generator] \u2717 License validation failed:", result.error);
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: result.error || "License validation failed"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (!silent) {
|
|
149
|
+
console.error("[MoonUI Token Generator] Error:", error.message);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
error: error.message
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function resolveTokenSync() {
|
|
158
|
+
try {
|
|
159
|
+
if (process.env.MOONUI_PRO_TOKEN) {
|
|
160
|
+
return process.env.MOONUI_PRO_TOKEN;
|
|
161
|
+
}
|
|
162
|
+
const existingToken = findExistingToken();
|
|
163
|
+
if (existingToken) {
|
|
164
|
+
return existingToken;
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error("[MoonUI Token Generator] Error resolving token:", error);
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function getLicenseKeyFromEnv() {
|
|
173
|
+
return process.env.MOONUI_LICENSE_KEY || process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY || null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/next-config-plugin.ts
|
|
177
|
+
function withMoonUIProToken(nextConfig = {}) {
|
|
178
|
+
console.log("[MoonUI Next.js Plugin] === INITIALIZING ===");
|
|
179
|
+
let token = resolveTokenSync();
|
|
180
|
+
if (token) {
|
|
181
|
+
console.log("[MoonUI Next.js Plugin] \u2713 Existing token found");
|
|
182
|
+
} else {
|
|
183
|
+
const licenseKey = getLicenseKeyFromEnv();
|
|
184
|
+
if (licenseKey) {
|
|
185
|
+
console.log("[MoonUI Next.js Plugin] License key found, will attempt runtime generation...");
|
|
186
|
+
console.log("[MoonUI Next.js Plugin] \u2139 Token will be generated on first use (runtime fallback)");
|
|
187
|
+
} else {
|
|
188
|
+
console.log("[MoonUI Next.js Plugin] No license key found in environment");
|
|
189
|
+
console.log("[MoonUI Next.js Plugin] Set MOONUI_LICENSE_KEY to enable Pro features");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const enhancedConfig = {
|
|
193
|
+
...nextConfig,
|
|
194
|
+
env: {
|
|
195
|
+
...nextConfig.env,
|
|
196
|
+
NEXT_PUBLIC_MOONUI_PRO_TOKEN: token || ""
|
|
197
|
+
}
|
|
198
|
+
};
|
|
199
|
+
if (token) {
|
|
200
|
+
console.log("[MoonUI Next.js Plugin] \u2713 Token injected into NEXT_PUBLIC_MOONUI_PRO_TOKEN");
|
|
201
|
+
} else {
|
|
202
|
+
console.log("[MoonUI Next.js Plugin] Running without Pro token (will use runtime fallback)");
|
|
203
|
+
}
|
|
204
|
+
console.log("[MoonUI Next.js Plugin] === INITIALIZATION COMPLETE ===");
|
|
205
|
+
return enhancedConfig;
|
|
206
|
+
}
|
|
207
|
+
async function resolveTokenAsync() {
|
|
208
|
+
const syncToken = resolveTokenSync();
|
|
209
|
+
if (syncToken) {
|
|
210
|
+
return syncToken;
|
|
211
|
+
}
|
|
212
|
+
const licenseKey = getLicenseKeyFromEnv();
|
|
213
|
+
if (!licenseKey) {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
console.log("[MoonUI Next.js Plugin] Generating token asynchronously...");
|
|
217
|
+
const result = await generateTokenIfMissing({ silent: false });
|
|
218
|
+
if (result.success && result.token) {
|
|
219
|
+
const tokenString = JSON.stringify(result.token);
|
|
220
|
+
return Buffer.from(tokenString).toString("base64");
|
|
221
|
+
}
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
var next_config_plugin_default = withMoonUIProToken;
|
|
225
|
+
|
|
226
|
+
exports.default = next_config_plugin_default;
|
|
227
|
+
exports.resolveTokenAsync = resolveTokenAsync;
|
|
228
|
+
exports.withMoonUIProToken = withMoonUIProToken;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Next.js Config Plugin for MoonUI Pro
|
|
3
|
+
* Automatically resolves and injects license token at build time
|
|
4
|
+
*
|
|
5
|
+
* Usage in next.config.js:
|
|
6
|
+
*
|
|
7
|
+
* ```js
|
|
8
|
+
* const { withMoonUIProToken } = require('@moontra/moonui-pro/next-config');
|
|
9
|
+
*
|
|
10
|
+
* const nextConfig = {
|
|
11
|
+
* // your config
|
|
12
|
+
* };
|
|
13
|
+
*
|
|
14
|
+
* module.exports = withMoonUIProToken(nextConfig);
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
interface NextConfig {
|
|
18
|
+
env?: Record<string, string>;
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Next.js config wrapper that auto-resolves MoonUI Pro token
|
|
23
|
+
*/
|
|
24
|
+
declare function withMoonUIProToken(nextConfig?: NextConfig): NextConfig;
|
|
25
|
+
/**
|
|
26
|
+
* Async version for webpack plugins (advanced usage)
|
|
27
|
+
*/
|
|
28
|
+
declare function resolveTokenAsync(): Promise<string | null>;
|
|
29
|
+
|
|
30
|
+
export { withMoonUIProToken as default, resolveTokenAsync, withMoonUIProToken };
|
package/dist/server.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import * as crypto from 'crypto';
|
|
|
4
4
|
import crypto__default from 'crypto';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
|
-
* @moontra/moonui-pro v3.
|
|
7
|
+
* @moontra/moonui-pro v3.5.0
|
|
8
8
|
* Premium UI components for MoonUI
|
|
9
9
|
* (c) 2026 MoonUI. All rights reserved.
|
|
10
10
|
* @license Commercial - https://moonui.dev/license
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var fs = require('fs');
|
|
6
|
+
var path = require('path');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
27
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @moontra/moonui-pro v3.5.0 - CommonJS build (next-config + vite plugins)
|
|
31
|
+
* (c) 2026 MoonUI. All rights reserved.
|
|
32
|
+
* @license Commercial - https://moonui.dev/license
|
|
33
|
+
*/
|
|
34
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
35
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
36
|
+
}) : x)(function(x) {
|
|
37
|
+
if (typeof require !== "undefined")
|
|
38
|
+
return require.apply(this, arguments);
|
|
39
|
+
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
40
|
+
});
|
|
41
|
+
function findExistingToken() {
|
|
42
|
+
if (typeof window !== "undefined") {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const possiblePaths = [
|
|
46
|
+
path__namespace.join(process.cwd(), ".moonui-license-token"),
|
|
47
|
+
path__namespace.join(process.cwd(), "..", ".moonui-license-token"),
|
|
48
|
+
path__namespace.join(process.cwd(), "..", "..", ".moonui-license-token")
|
|
49
|
+
];
|
|
50
|
+
if (process.env.VERCEL_ARTIFACTS_PATH) {
|
|
51
|
+
possiblePaths.push(path__namespace.join(process.env.VERCEL_ARTIFACTS_PATH, ".moonui-license-token"));
|
|
52
|
+
}
|
|
53
|
+
if (process.env.NETLIFY_BUILD_BASE) {
|
|
54
|
+
possiblePaths.push(path__namespace.join(process.env.NETLIFY_BUILD_BASE, ".moonui-license-token"));
|
|
55
|
+
}
|
|
56
|
+
possiblePaths.push("/tmp/.moonui-license-token");
|
|
57
|
+
for (const filePath of possiblePaths) {
|
|
58
|
+
if (fs__namespace.existsSync(filePath)) {
|
|
59
|
+
try {
|
|
60
|
+
return fs__namespace.readFileSync(filePath, "utf8");
|
|
61
|
+
} catch (err) {
|
|
62
|
+
console.error(`[MoonUI Token Generator] Failed to read token from ${filePath}:`, err);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
async function generateTokenIfMissing(options = {}) {
|
|
69
|
+
const { silent = false, forceRegenerate = false } = options;
|
|
70
|
+
try {
|
|
71
|
+
if (!forceRegenerate && process.env.MOONUI_PRO_TOKEN) {
|
|
72
|
+
if (!silent) {
|
|
73
|
+
console.log("[MoonUI Token Generator] Token found in environment variable");
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
success: true,
|
|
77
|
+
token: JSON.parse(Buffer.from(process.env.MOONUI_PRO_TOKEN, "base64").toString("utf8")),
|
|
78
|
+
cached: true
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (!forceRegenerate) {
|
|
82
|
+
const existingToken = findExistingToken();
|
|
83
|
+
if (existingToken) {
|
|
84
|
+
if (!silent) {
|
|
85
|
+
console.log("[MoonUI Token Generator] Token file already exists");
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
token: JSON.parse(Buffer.from(existingToken, "base64").toString("utf8")),
|
|
90
|
+
cached: true
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY || process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY;
|
|
95
|
+
if (!licenseKey) {
|
|
96
|
+
if (!silent) {
|
|
97
|
+
console.log("[MoonUI Token Generator] No license key found in environment variables");
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: "No license key found"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
const postInstallPath = path__namespace.join(__dirname, "../../scripts/postinstall.cjs");
|
|
105
|
+
if (!fs__namespace.existsSync(postInstallPath)) {
|
|
106
|
+
if (!silent) {
|
|
107
|
+
console.error("[MoonUI Token Generator] PostInstall script not found at:", postInstallPath);
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
error: "PostInstall script not found"
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
const postInstall = __require(postInstallPath);
|
|
115
|
+
if (!silent) {
|
|
116
|
+
console.log("[MoonUI Token Generator] Validating license key and generating token...");
|
|
117
|
+
}
|
|
118
|
+
const result = await postInstall.validateAndCreateToken(licenseKey, { silent });
|
|
119
|
+
if (result.success && result.token) {
|
|
120
|
+
const saveSuccess = postInstall.saveLicenseToken(result.token);
|
|
121
|
+
if (saveSuccess) {
|
|
122
|
+
if (!silent) {
|
|
123
|
+
console.log("[MoonUI Token Generator] \u2713 Token generated and saved successfully");
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
success: true,
|
|
127
|
+
token: result.token
|
|
128
|
+
};
|
|
129
|
+
} else {
|
|
130
|
+
if (!silent) {
|
|
131
|
+
console.log("[MoonUI Token Generator] \u26A0 Token generated but failed to save");
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
success: false,
|
|
135
|
+
error: "Failed to save token"
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
} else {
|
|
139
|
+
if (!silent) {
|
|
140
|
+
console.log("[MoonUI Token Generator] \u2717 License validation failed:", result.error);
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
success: false,
|
|
144
|
+
error: result.error || "License validation failed"
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (!silent) {
|
|
149
|
+
console.error("[MoonUI Token Generator] Error:", error.message);
|
|
150
|
+
}
|
|
151
|
+
return {
|
|
152
|
+
success: false,
|
|
153
|
+
error: error.message
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function resolveTokenSync() {
|
|
158
|
+
try {
|
|
159
|
+
if (process.env.MOONUI_PRO_TOKEN) {
|
|
160
|
+
return process.env.MOONUI_PRO_TOKEN;
|
|
161
|
+
}
|
|
162
|
+
const existingToken = findExistingToken();
|
|
163
|
+
if (existingToken) {
|
|
164
|
+
return existingToken;
|
|
165
|
+
}
|
|
166
|
+
return null;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.error("[MoonUI Token Generator] Error resolving token:", error);
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function getLicenseKeyFromEnv() {
|
|
173
|
+
return process.env.MOONUI_LICENSE_KEY || process.env.NEXT_PUBLIC_MOONUI_LICENSE_KEY || process.env.VITE_MOONUI_LICENSE_KEY || process.env.REACT_APP_MOONUI_LICENSE_KEY || null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// src/vite-plugin.ts
|
|
177
|
+
function moonUIProPlugin(options = {}) {
|
|
178
|
+
const { silent = false, forceRegenerate = false } = options;
|
|
179
|
+
let token = null;
|
|
180
|
+
let tokenResolved = false;
|
|
181
|
+
return {
|
|
182
|
+
name: "moonui-pro-license",
|
|
183
|
+
enforce: "pre",
|
|
184
|
+
async buildStart() {
|
|
185
|
+
if (tokenResolved && !forceRegenerate) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (!silent) {
|
|
189
|
+
console.log("[MoonUI Vite Plugin] === INITIALIZING ===");
|
|
190
|
+
}
|
|
191
|
+
token = resolveTokenSync();
|
|
192
|
+
if (token) {
|
|
193
|
+
if (!silent) {
|
|
194
|
+
console.log("[MoonUI Vite Plugin] \u2713 Existing token found");
|
|
195
|
+
}
|
|
196
|
+
tokenResolved = true;
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
const licenseKey = getLicenseKeyFromEnv();
|
|
200
|
+
if (licenseKey) {
|
|
201
|
+
if (!silent) {
|
|
202
|
+
console.log("[MoonUI Vite Plugin] License key found, generating token...");
|
|
203
|
+
}
|
|
204
|
+
const result = await generateTokenIfMissing({ silent, forceRegenerate });
|
|
205
|
+
if (result.success && result.token) {
|
|
206
|
+
const tokenString = JSON.stringify(result.token);
|
|
207
|
+
token = Buffer.from(tokenString).toString("base64");
|
|
208
|
+
if (!silent) {
|
|
209
|
+
console.log("[MoonUI Vite Plugin] \u2713 Token generated successfully");
|
|
210
|
+
}
|
|
211
|
+
} else {
|
|
212
|
+
if (!silent) {
|
|
213
|
+
console.log("[MoonUI Vite Plugin] \u26A0 Token generation failed:", result.error);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
if (!silent) {
|
|
218
|
+
console.log("[MoonUI Vite Plugin] No license key found in environment");
|
|
219
|
+
console.log("[MoonUI Vite Plugin] Set MOONUI_LICENSE_KEY to enable Pro features");
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
tokenResolved = true;
|
|
223
|
+
if (!silent) {
|
|
224
|
+
if (token) {
|
|
225
|
+
console.log("[MoonUI Vite Plugin] \u2713 Token will be injected into environment");
|
|
226
|
+
} else {
|
|
227
|
+
console.log("[MoonUI Vite Plugin] Running without Pro features");
|
|
228
|
+
}
|
|
229
|
+
console.log("[MoonUI Vite Plugin] === INITIALIZATION COMPLETE ===");
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
config(config) {
|
|
233
|
+
return {
|
|
234
|
+
define: {
|
|
235
|
+
...config.define,
|
|
236
|
+
"import.meta.env.VITE_MOONUI_PRO_TOKEN": JSON.stringify(token || ""),
|
|
237
|
+
"process.env.VITE_MOONUI_PRO_TOKEN": JSON.stringify(token || "")
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
var vite_plugin_default = moonUIProPlugin;
|
|
244
|
+
|
|
245
|
+
exports.default = vite_plugin_default;
|
|
246
|
+
exports.moonUIProPlugin = moonUIProPlugin;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Plugin } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vite Plugin for MoonUI Pro
|
|
5
|
+
* Automatically resolves and injects license token at build time
|
|
6
|
+
*
|
|
7
|
+
* Usage in vite.config.ts:
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* import { moonUIProPlugin } from '@moontra/moonui-pro/vite';
|
|
11
|
+
* import { defineConfig } from 'vite';
|
|
12
|
+
*
|
|
13
|
+
* export default defineConfig({
|
|
14
|
+
* plugins: [
|
|
15
|
+
* moonUIProPlugin(),
|
|
16
|
+
* ],
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
interface MoonUIProPluginOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Suppress console logs
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
silent?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Force token regeneration even if exists
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
forceRegenerate?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Vite plugin for MoonUI Pro license token management
|
|
35
|
+
*/
|
|
36
|
+
declare function moonUIProPlugin(options?: MoonUIProPluginOptions): Plugin;
|
|
37
|
+
|
|
38
|
+
export { moonUIProPlugin as default, moonUIProPlugin };
|
package/dist/vite-plugin.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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",
|
|
@@ -21,32 +21,45 @@
|
|
|
21
21
|
"src/**/*.css"
|
|
22
22
|
],
|
|
23
23
|
"exports": {
|
|
24
|
+
"./package.json": "./package.json",
|
|
24
25
|
".": {
|
|
25
26
|
"types": "./dist/index.d.ts",
|
|
26
27
|
"import": "./dist/index.mjs",
|
|
27
|
-
"require":
|
|
28
|
+
"require": null,
|
|
28
29
|
"default": "./dist/index.mjs"
|
|
29
30
|
},
|
|
30
31
|
"./server": {
|
|
31
32
|
"types": "./dist/server.d.ts",
|
|
32
33
|
"import": "./dist/server.mjs",
|
|
33
|
-
"require":
|
|
34
|
+
"require": null,
|
|
35
|
+
"default": "./dist/server.mjs"
|
|
34
36
|
},
|
|
35
37
|
"./plugin": {
|
|
36
38
|
"types": "./plugin/index.d.ts",
|
|
37
|
-
"import": "./plugin/index.
|
|
38
|
-
"require": "./plugin/index.
|
|
39
|
+
"import": "./plugin/index.cjs",
|
|
40
|
+
"require": "./plugin/index.cjs",
|
|
41
|
+
"default": "./plugin/index.cjs"
|
|
39
42
|
},
|
|
40
43
|
"./next-config": {
|
|
41
|
-
"
|
|
42
|
-
|
|
43
|
-
|
|
44
|
+
"import": {
|
|
45
|
+
"types": "./dist/next-config-plugin.d.ts",
|
|
46
|
+
"default": "./dist/next-config-plugin.mjs"
|
|
47
|
+
},
|
|
48
|
+
"require": {
|
|
49
|
+
"types": "./dist/next-config-plugin.d.cts",
|
|
50
|
+
"default": "./dist/next-config-plugin.cjs"
|
|
51
|
+
},
|
|
44
52
|
"default": "./dist/next-config-plugin.mjs"
|
|
45
53
|
},
|
|
46
54
|
"./vite": {
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
55
|
+
"import": {
|
|
56
|
+
"types": "./dist/vite-plugin.d.ts",
|
|
57
|
+
"default": "./dist/vite-plugin.mjs"
|
|
58
|
+
},
|
|
59
|
+
"require": {
|
|
60
|
+
"types": "./dist/vite-plugin.d.cts",
|
|
61
|
+
"default": "./dist/vite-plugin.cjs"
|
|
62
|
+
},
|
|
50
63
|
"default": "./dist/vite-plugin.mjs"
|
|
51
64
|
},
|
|
52
65
|
"./scripts/postinstall": {
|
|
@@ -96,9 +109,9 @@
|
|
|
96
109
|
},
|
|
97
110
|
"homepage": "https://moonui.dev",
|
|
98
111
|
"peerDependencies": {
|
|
112
|
+
"next-themes": ">=0.2.0",
|
|
99
113
|
"react": ">=18.0.0 || ^19.0.0",
|
|
100
|
-
"react-dom": ">=18.0.0 || ^19.0.0"
|
|
101
|
-
"next-themes": ">=0.2.0"
|
|
114
|
+
"react-dom": ">=18.0.0 || ^19.0.0"
|
|
102
115
|
},
|
|
103
116
|
"dependencies": {
|
|
104
117
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
@@ -155,8 +168,11 @@
|
|
|
155
168
|
"@types/react-dom": "^19.0.0",
|
|
156
169
|
"@types/react-grid-layout": "^1.3.5",
|
|
157
170
|
"@types/react-window": "^1.8.8",
|
|
171
|
+
"@typescript-eslint/eslint-plugin": "^8.63.0",
|
|
172
|
+
"@typescript-eslint/parser": "^8.63.0",
|
|
158
173
|
"autoprefixer": "^10.4.21",
|
|
159
|
-
"eslint": "^
|
|
174
|
+
"eslint": "^9.39.4",
|
|
175
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
160
176
|
"jest": "^29.5.0",
|
|
161
177
|
"jest-environment-jsdom": "^29.5.0",
|
|
162
178
|
"postcss": "^8.5.6",
|