@moontra/moonui-pro 2.20.1 ā 2.20.3
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/index.d.ts +691 -261
- package/dist/index.mjs +7418 -4934
- package/package.json +11 -5
- package/plugin/index.d.ts +86 -0
- package/plugin/index.js +308 -0
- package/scripts/postbuild.js +27 -0
- package/scripts/postinstall.js +176 -23
- package/src/__tests__/use-intersection-observer.test.tsx +0 -216
- package/src/__tests__/use-local-storage.test.tsx +0 -174
- package/src/__tests__/use-pro-access.test.tsx +0 -183
- package/src/components/advanced-chart/advanced-chart.test.tsx +0 -281
- package/src/components/advanced-chart/index.tsx +0 -1242
- package/src/components/advanced-forms/index.tsx +0 -426
- package/src/components/animated-button/index.tsx +0 -385
- package/src/components/calendar/event-dialog.tsx +0 -372
- package/src/components/calendar/index.tsx +0 -1073
- package/src/components/calendar-pro/index.tsx +0 -1697
- package/src/components/color-picker/index.tsx +0 -432
- package/src/components/credit-card-input/index.tsx +0 -406
- package/src/components/dashboard/dashboard-grid.tsx +0 -462
- package/src/components/dashboard/demo.tsx +0 -425
- package/src/components/dashboard/index.tsx +0 -1046
- package/src/components/dashboard/time-range-picker.tsx +0 -336
- package/src/components/dashboard/types.ts +0 -222
- package/src/components/dashboard/widgets/activity-feed.tsx +0 -344
- package/src/components/dashboard/widgets/chart-widget.tsx +0 -418
- package/src/components/dashboard/widgets/metric-card.tsx +0 -343
- package/src/components/data-table/data-table-bulk-actions.tsx +0 -204
- package/src/components/data-table/data-table-column-toggle.tsx +0 -169
- package/src/components/data-table/data-table-export.ts +0 -156
- package/src/components/data-table/data-table-filter-drawer.tsx +0 -448
- package/src/components/data-table/data-table.test.tsx +0 -187
- package/src/components/data-table/index.tsx +0 -845
- package/src/components/draggable-list/index.tsx +0 -100
- package/src/components/enhanced/badge.tsx +0 -191
- package/src/components/enhanced/button.tsx +0 -362
- package/src/components/enhanced/card.tsx +0 -266
- package/src/components/enhanced/dialog.tsx +0 -246
- package/src/components/enhanced/index.ts +0 -4
- package/src/components/error-boundary/index.tsx +0 -109
- package/src/components/file-upload/file-upload.test.tsx +0 -243
- package/src/components/file-upload/index.tsx +0 -1660
- package/src/components/floating-action-button/index.tsx +0 -206
- package/src/components/form-wizard/form-wizard-context.tsx +0 -307
- package/src/components/form-wizard/form-wizard-navigation.tsx +0 -118
- package/src/components/form-wizard/form-wizard-progress.tsx +0 -298
- package/src/components/form-wizard/form-wizard-step.tsx +0 -111
- package/src/components/form-wizard/index.tsx +0 -102
- package/src/components/form-wizard/types.ts +0 -76
- package/src/components/gesture-drawer/index.tsx +0 -551
- package/src/components/github-stars/github-api.ts +0 -426
- package/src/components/github-stars/hooks.ts +0 -516
- package/src/components/github-stars/index.tsx +0 -375
- package/src/components/github-stars/types.ts +0 -148
- package/src/components/github-stars/variants.tsx +0 -513
- package/src/components/health-check/index.tsx +0 -439
- package/src/components/hover-card-3d/index.tsx +0 -530
- package/src/components/index.ts +0 -128
- package/src/components/internal/index.ts +0 -78
- package/src/components/kanban/add-card-modal.tsx +0 -502
- package/src/components/kanban/card-detail-modal.tsx +0 -761
- package/src/components/kanban/index.ts +0 -13
- package/src/components/kanban/kanban.tsx +0 -1684
- package/src/components/kanban/types.ts +0 -168
- package/src/components/lazy-component/index.tsx +0 -823
- package/src/components/license-error/index.tsx +0 -29
- package/src/components/magnetic-button/index.tsx +0 -167
- package/src/components/memory-efficient-data/index.tsx +0 -1016
- package/src/components/moonui-quiz-form/index.tsx +0 -817
- package/src/components/optimized-image/index.tsx +0 -425
- package/src/components/performance-debugger/index.tsx +0 -589
- package/src/components/performance-monitor/index.tsx +0 -794
- package/src/components/phone-number-input/index.tsx +0 -338
- package/src/components/pinch-zoom/index.tsx +0 -566
- package/src/components/quiz-form/index.tsx +0 -479
- package/src/components/rich-text-editor/index-old-backup.tsx +0 -437
- package/src/components/rich-text-editor/index.tsx +0 -2324
- package/src/components/rich-text-editor/slash-commands-extension.ts +0 -220
- package/src/components/rich-text-editor/slash-commands.css +0 -35
- package/src/components/rich-text-editor/table-styles.css +0 -65
- package/src/components/sidebar/index.tsx +0 -865
- package/src/components/spotlight-card/index.tsx +0 -191
- package/src/components/swipeable-card/index.tsx +0 -100
- package/src/components/timeline/index.tsx +0 -1148
- package/src/components/ui/accordion.tsx +0 -73
- package/src/components/ui/alert-dialog.tsx +0 -141
- package/src/components/ui/alert.tsx +0 -141
- package/src/components/ui/aspect-ratio.tsx +0 -245
- package/src/components/ui/avatar.tsx +0 -153
- package/src/components/ui/badge.tsx +0 -228
- package/src/components/ui/breadcrumb.tsx +0 -214
- package/src/components/ui/button.tsx +0 -222
- package/src/components/ui/calendar.tsx +0 -387
- package/src/components/ui/card.tsx +0 -214
- package/src/components/ui/checkbox.tsx +0 -259
- package/src/components/ui/collapsible.tsx +0 -135
- package/src/components/ui/color-picker.tsx +0 -97
- package/src/components/ui/command.tsx +0 -225
- package/src/components/ui/dialog.tsx +0 -334
- package/src/components/ui/dropdown-menu.tsx +0 -218
- package/src/components/ui/gesture-drawer.tsx +0 -11
- package/src/components/ui/hover-card.tsx +0 -29
- package/src/components/ui/index.ts +0 -190
- package/src/components/ui/input.tsx +0 -222
- package/src/components/ui/label.tsx +0 -29
- package/src/components/ui/lightbox.tsx +0 -606
- package/src/components/ui/magnetic-button.tsx +0 -129
- package/src/components/ui/media-gallery.tsx +0 -612
- package/src/components/ui/pagination.tsx +0 -123
- package/src/components/ui/popover.tsx +0 -185
- package/src/components/ui/progress.tsx +0 -30
- package/src/components/ui/radio-group.tsx +0 -257
- package/src/components/ui/scroll-area.tsx +0 -47
- package/src/components/ui/select.tsx +0 -374
- package/src/components/ui/separator.tsx +0 -145
- package/src/components/ui/sheet.tsx +0 -139
- package/src/components/ui/skeleton.tsx +0 -20
- package/src/components/ui/slider.tsx +0 -354
- package/src/components/ui/spotlight-card.tsx +0 -119
- package/src/components/ui/switch.tsx +0 -86
- package/src/components/ui/table.tsx +0 -329
- package/src/components/ui/tabs.tsx +0 -198
- package/src/components/ui/textarea.tsx +0 -28
- package/src/components/ui/toast.tsx +0 -317
- package/src/components/ui/toggle.tsx +0 -119
- package/src/components/ui/tooltip.tsx +0 -151
- package/src/components/virtual-list/index.tsx +0 -668
- package/src/hooks/use-chart.ts +0 -205
- package/src/hooks/use-data-table.ts +0 -182
- package/src/hooks/use-docs-pro-access.ts +0 -13
- package/src/hooks/use-license-check.ts +0 -65
- package/src/hooks/use-subscription.ts +0 -19
- package/src/hooks/use-toast.ts +0 -15
- package/src/index.ts +0 -14
- package/src/lib/ai-providers.ts +0 -377
- package/src/lib/component-metadata.ts +0 -18
- package/src/lib/micro-interactions.ts +0 -255
- package/src/lib/paddle.ts +0 -17
- package/src/lib/utils.ts +0 -6
- package/src/patterns/login-form/index.tsx +0 -276
- package/src/patterns/login-form/types.ts +0 -67
- package/src/setupTests.ts +0 -41
- package/src/styles/advanced-chart.css +0 -239
- package/src/styles/calendar.css +0 -35
- package/src/styles/design-system.css +0 -363
- package/src/styles/index.css +0 -85
- package/src/styles/tailwind.css +0 -7
- package/src/styles/tokens.css +0 -455
- package/src/types/moonui.d.ts +0 -22
- package/src/types/next-auth.d.ts +0 -21
- package/src/use-intersection-observer.tsx +0 -154
- package/src/use-local-storage.tsx +0 -71
- package/src/use-paddle.ts +0 -138
- package/src/use-performance-optimizer.ts +0 -389
- package/src/use-pro-access.ts +0 -141
- package/src/use-scroll-animation.ts +0 -219
- package/src/use-subscription.ts +0 -37
- package/src/use-toast.ts +0 -32
- package/src/utils/chart-helpers.ts +0 -357
- package/src/utils/cn.ts +0 -6
- package/src/utils/data-processing.ts +0 -151
- package/src/utils/license-validator.tsx +0 -183
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.20.
|
|
3
|
+
"version": "2.20.3",
|
|
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",
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"src",
|
|
12
11
|
"scripts",
|
|
12
|
+
"plugin",
|
|
13
13
|
"README.md",
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
@@ -26,11 +26,16 @@
|
|
|
26
26
|
"import": "./dist/index.mjs"
|
|
27
27
|
},
|
|
28
28
|
"./styles.css": "./dist/index.css",
|
|
29
|
-
"./css": "./dist/index.css"
|
|
29
|
+
"./css": "./dist/index.css",
|
|
30
|
+
"./plugin": {
|
|
31
|
+
"types": "./plugin/index.d.ts",
|
|
32
|
+
"import": "./plugin/index.js",
|
|
33
|
+
"require": "./plugin/index.js"
|
|
34
|
+
}
|
|
30
35
|
},
|
|
31
36
|
"scripts": {
|
|
32
37
|
"postinstall": "node scripts/postinstall.js",
|
|
33
|
-
"build": "tsup",
|
|
38
|
+
"build": "tsup && node scripts/postbuild.js",
|
|
34
39
|
"build:dts": "tsup --dts",
|
|
35
40
|
"dev": "tsup --watch --sourcemap",
|
|
36
41
|
"clean": "rm -rf dist",
|
|
@@ -75,7 +80,6 @@
|
|
|
75
80
|
"react-dom": ">=18.0.0 || ^19.0.0"
|
|
76
81
|
},
|
|
77
82
|
"dependencies": {
|
|
78
|
-
"@moontra/moonui": "^2.1.9",
|
|
79
83
|
"@radix-ui/react-accordion": "^1.2.11",
|
|
80
84
|
"@radix-ui/react-avatar": "^1.1.10",
|
|
81
85
|
"@radix-ui/react-checkbox": "^1.3.2",
|
|
@@ -95,8 +99,10 @@
|
|
|
95
99
|
"canvas-confetti": "^1.9.3",
|
|
96
100
|
"class-variance-authority": "^0.7.0",
|
|
97
101
|
"clsx": "^2.1.1",
|
|
102
|
+
"cmdk": "^1.0.4",
|
|
98
103
|
"date-fns": "^3.6.0",
|
|
99
104
|
"framer-motion": "^11.11.17",
|
|
105
|
+
"fuse.js": "^7.0.0",
|
|
100
106
|
"lucide-react": "^0.525.0",
|
|
101
107
|
"react-beautiful-dnd": "^13.1.1",
|
|
102
108
|
"react-colorful": "^5.6.1",
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { NextConfig } from 'next';
|
|
2
|
+
import type { Plugin as VitePlugin } from 'vite';
|
|
3
|
+
import type { Plugin as ESBuildPlugin } from 'esbuild';
|
|
4
|
+
|
|
5
|
+
export interface MoonUIPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* License key for MoonUI Pro
|
|
8
|
+
* Can also be set via environment variables:
|
|
9
|
+
* - MOONUI_LICENSE_KEY
|
|
10
|
+
* - MOONUI_TEAM_TOKEN
|
|
11
|
+
* - MOONUI_CI_TOKEN
|
|
12
|
+
*/
|
|
13
|
+
licenseKey?: string;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Skip license validation in development
|
|
17
|
+
* @default true
|
|
18
|
+
*/
|
|
19
|
+
skipDevValidation?: boolean;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Custom API endpoint for license validation
|
|
23
|
+
* @default "https://moonui.dev/api/validate"
|
|
24
|
+
*/
|
|
25
|
+
apiEndpoint?: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Enable verbose logging
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
verbose?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Next.js plugin for MoonUI Pro
|
|
36
|
+
* Adds build-time license validation and code transformation
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```js
|
|
40
|
+
* // next.config.js
|
|
41
|
+
* const { withMoonUI } = require('@moontra/moonui-pro/plugin');
|
|
42
|
+
*
|
|
43
|
+
* module.exports = withMoonUI({
|
|
44
|
+
* // Your Next.js config
|
|
45
|
+
* });
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export function withMoonUI(nextConfig?: NextConfig & { moonui?: MoonUIPluginOptions }): NextConfig;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Vite plugin for MoonUI Pro
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```js
|
|
55
|
+
* // vite.config.js
|
|
56
|
+
* import { moonUIVitePlugin } from '@moontra/moonui-pro/plugin';
|
|
57
|
+
*
|
|
58
|
+
* export default {
|
|
59
|
+
* plugins: [moonUIVitePlugin()]
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export function moonUIVitePlugin(options?: MoonUIPluginOptions): VitePlugin;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* ESBuild plugin for MoonUI Pro
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```js
|
|
70
|
+
* // esbuild.config.js
|
|
71
|
+
* import { moonUIESBuildPlugin } from '@moontra/moonui-pro/plugin';
|
|
72
|
+
*
|
|
73
|
+
* esbuild.build({
|
|
74
|
+
* plugins: [moonUIESBuildPlugin()]
|
|
75
|
+
* });
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export function moonUIESBuildPlugin(options?: MoonUIPluginOptions): ESBuildPlugin;
|
|
79
|
+
|
|
80
|
+
declare const _default: {
|
|
81
|
+
withMoonUI: typeof withMoonUI;
|
|
82
|
+
moonUIVitePlugin: typeof moonUIVitePlugin;
|
|
83
|
+
moonUIESBuildPlugin: typeof moonUIESBuildPlugin;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default _default;
|
package/plugin/index.js
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MoonUI Pro Build Plugin
|
|
5
|
+
* Provides build-time license validation and code transformation
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import crypto from 'crypto';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import path from 'path';
|
|
11
|
+
|
|
12
|
+
// License validation modes
|
|
13
|
+
const LICENSE_MODES = {
|
|
14
|
+
STRICT: 'strict', // Always require valid license (CI/CD)
|
|
15
|
+
PERPETUAL: 'perpetual', // Once licensed, always works
|
|
16
|
+
GRACE: 'grace' // Allow grace period after expiry
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// Get license mode from environment
|
|
20
|
+
const getLicenseMode = () => {
|
|
21
|
+
const mode = process.env.MOONUI_LICENSE_MODE || LICENSE_MODES.PERPETUAL;
|
|
22
|
+
return mode;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
// Check for existing license stamp
|
|
26
|
+
const hasLicenseStamp = () => {
|
|
27
|
+
try {
|
|
28
|
+
// Check for license stamp file in project
|
|
29
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
30
|
+
if (fs.existsSync(stampPath)) {
|
|
31
|
+
const stamp = JSON.parse(fs.readFileSync(stampPath, 'utf8'));
|
|
32
|
+
|
|
33
|
+
// Verify stamp integrity
|
|
34
|
+
if (stamp.projectId && stamp.licensedAt && stamp.version) {
|
|
35
|
+
console.log('ā
MoonUI Pro: Using existing license stamp');
|
|
36
|
+
console.log(` Licensed on: ${new Date(stamp.licensedAt).toLocaleDateString()}`);
|
|
37
|
+
console.log(` Version: ${stamp.version}`);
|
|
38
|
+
return true;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
} catch (err) {
|
|
42
|
+
// Stamp invalid or corrupted
|
|
43
|
+
}
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// Create license stamp for perpetual usage
|
|
48
|
+
const createLicenseStamp = (licenseKey, licenseInfo = {}) => {
|
|
49
|
+
try {
|
|
50
|
+
const stamp = {
|
|
51
|
+
projectId: crypto.randomBytes(16).toString('hex'),
|
|
52
|
+
licensedAt: new Date().toISOString(),
|
|
53
|
+
version: licenseInfo.version || '2.x',
|
|
54
|
+
licensedTo: licenseInfo.email || 'unknown',
|
|
55
|
+
plan: licenseInfo.plan || 'unknown',
|
|
56
|
+
mode: 'perpetual',
|
|
57
|
+
// Don't store the actual key for security
|
|
58
|
+
keyHash: crypto.createHash('sha256').update(licenseKey).digest('hex').substring(0, 8)
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const stampPath = path.join(process.cwd(), '.moonui-license-stamp');
|
|
62
|
+
fs.writeFileSync(stampPath, JSON.stringify(stamp, null, 2));
|
|
63
|
+
|
|
64
|
+
console.log('š MoonUI Pro: License stamp created');
|
|
65
|
+
console.log(' Your project can now build without active license');
|
|
66
|
+
console.log(' Add .moonui-license-stamp to your repository');
|
|
67
|
+
|
|
68
|
+
return true;
|
|
69
|
+
} catch (err) {
|
|
70
|
+
console.warn('ā ļø Could not create license stamp:', err.message);
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// License validation with perpetual rights
|
|
76
|
+
const validateLicense = async (licenseKey, options = {}) => {
|
|
77
|
+
const mode = getLicenseMode();
|
|
78
|
+
|
|
79
|
+
// Check for existing license stamp first (perpetual mode)
|
|
80
|
+
if (mode === LICENSE_MODES.PERPETUAL && hasLicenseStamp()) {
|
|
81
|
+
// Project was previously licensed, allow usage
|
|
82
|
+
return {
|
|
83
|
+
valid: true,
|
|
84
|
+
mode: 'perpetual',
|
|
85
|
+
message: 'Using perpetual license from previous activation'
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// If no key provided
|
|
90
|
+
if (!licenseKey) {
|
|
91
|
+
// In development, be lenient
|
|
92
|
+
if (process.env.NODE_ENV === 'development') {
|
|
93
|
+
console.warn('ā ļø MoonUI Pro: No license key found (development mode)');
|
|
94
|
+
return { valid: true, mode: 'development' };
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// In production with perpetual mode, check for stamp
|
|
98
|
+
if (mode === LICENSE_MODES.PERPETUAL && hasLicenseStamp()) {
|
|
99
|
+
return { valid: true, mode: 'perpetual' };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Otherwise require license
|
|
103
|
+
throw new Error('MoonUI Pro: License key is required. Set MOONUI_LICENSE_KEY environment variable.');
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Validate license format
|
|
107
|
+
const isValid = licenseKey.startsWith('mk_') ||
|
|
108
|
+
licenseKey.startsWith('team_') ||
|
|
109
|
+
licenseKey.startsWith('ci_');
|
|
110
|
+
|
|
111
|
+
if (!isValid) {
|
|
112
|
+
throw new Error('MoonUI Pro: Invalid license key format');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
// In real implementation, this would call the API
|
|
116
|
+
// For now, simulate API response
|
|
117
|
+
const licenseInfo = {
|
|
118
|
+
valid: true,
|
|
119
|
+
email: 'user@example.com',
|
|
120
|
+
plan: 'pro',
|
|
121
|
+
version: '2.x',
|
|
122
|
+
expiresAt: null // or a date
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// Create stamp for perpetual usage if valid
|
|
126
|
+
if (licenseInfo.valid && mode === LICENSE_MODES.PERPETUAL) {
|
|
127
|
+
createLicenseStamp(licenseKey, licenseInfo);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return licenseInfo;
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
// Webpack plugin for Next.js
|
|
134
|
+
export function withMoonUI(nextConfig = {}) {
|
|
135
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
136
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
137
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
138
|
+
nextConfig.moonui?.licenseKey;
|
|
139
|
+
|
|
140
|
+
return {
|
|
141
|
+
...nextConfig,
|
|
142
|
+
webpack(config, options) {
|
|
143
|
+
// Validate license at build time
|
|
144
|
+
validateLicense(licenseKey).then(result => {
|
|
145
|
+
if (result.mode === 'perpetual') {
|
|
146
|
+
console.log('š¦ MoonUI Pro: Building with perpetual license');
|
|
147
|
+
}
|
|
148
|
+
}).catch(err => {
|
|
149
|
+
console.error('ā MoonUI Pro License Error:', err.message);
|
|
150
|
+
if (process.env.NODE_ENV === 'production' && !hasLicenseStamp()) {
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Add custom webpack plugin for code transformation
|
|
156
|
+
config.plugins.push({
|
|
157
|
+
apply(compiler) {
|
|
158
|
+
compiler.hooks.compilation.tap('MoonUIProPlugin', (compilation) => {
|
|
159
|
+
// Add license validation to the build
|
|
160
|
+
compilation.hooks.processAssets.tap(
|
|
161
|
+
{
|
|
162
|
+
name: 'MoonUIProPlugin',
|
|
163
|
+
stage: compilation.constructor.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
164
|
+
},
|
|
165
|
+
(assets) => {
|
|
166
|
+
// Process MoonUI Pro assets
|
|
167
|
+
for (const [pathname, source] of Object.entries(assets)) {
|
|
168
|
+
if (pathname.includes('moonui-pro')) {
|
|
169
|
+
// Add license check to component initialization
|
|
170
|
+
const content = source.source();
|
|
171
|
+
const modifiedContent = injectLicenseCheck(content, licenseKey);
|
|
172
|
+
compilation.updateAsset(pathname, {
|
|
173
|
+
source: () => modifiedContent,
|
|
174
|
+
size: () => modifiedContent.length,
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
// Apply user's webpack config if exists
|
|
185
|
+
if (typeof nextConfig.webpack === 'function') {
|
|
186
|
+
return nextConfig.webpack(config, options);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
return config;
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// Vite plugin
|
|
195
|
+
export function moonUIVitePlugin(options = {}) {
|
|
196
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
197
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
198
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
199
|
+
options.licenseKey;
|
|
200
|
+
|
|
201
|
+
return {
|
|
202
|
+
name: 'moonui-pro',
|
|
203
|
+
enforce: 'pre',
|
|
204
|
+
|
|
205
|
+
async buildStart() {
|
|
206
|
+
// Validate license at build time
|
|
207
|
+
try {
|
|
208
|
+
const result = await validateLicense(licenseKey);
|
|
209
|
+
if (result.mode === 'perpetual') {
|
|
210
|
+
console.log('š¦ MoonUI Pro: Building with perpetual license');
|
|
211
|
+
} else {
|
|
212
|
+
console.log('ā
MoonUI Pro: License validated successfully');
|
|
213
|
+
}
|
|
214
|
+
} catch (err) {
|
|
215
|
+
console.error('ā MoonUI Pro License Error:', err.message);
|
|
216
|
+
if (process.env.NODE_ENV === 'production' && !hasLicenseStamp()) {
|
|
217
|
+
throw err;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
|
|
222
|
+
transform(code, id) {
|
|
223
|
+
// Transform MoonUI Pro imports
|
|
224
|
+
if (id.includes('@moontra/moonui-pro')) {
|
|
225
|
+
// Inject license validation
|
|
226
|
+
return {
|
|
227
|
+
code: injectLicenseCheck(code, licenseKey),
|
|
228
|
+
map: null,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return null;
|
|
232
|
+
},
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Helper function to inject license check
|
|
237
|
+
function injectLicenseCheck(code, licenseKey) {
|
|
238
|
+
// Only in production builds
|
|
239
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
240
|
+
return code;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Create a hash of the license for client-side validation
|
|
244
|
+
const licenseHash = crypto
|
|
245
|
+
.createHash('sha256')
|
|
246
|
+
.update(licenseKey + process.env.NODE_ENV)
|
|
247
|
+
.digest('hex')
|
|
248
|
+
.substring(0, 16);
|
|
249
|
+
|
|
250
|
+
// Inject validation code at the beginning
|
|
251
|
+
const validationCode = `
|
|
252
|
+
// MoonUI Pro License Validation
|
|
253
|
+
(function() {
|
|
254
|
+
const lh = '${licenseHash}';
|
|
255
|
+
const validated = window.__MOONUI_PRO_VALIDATED__;
|
|
256
|
+
if (!validated) {
|
|
257
|
+
window.__MOONUI_PRO_VALIDATED__ = true;
|
|
258
|
+
console.log('%c⨠MoonUI Pro Components Loaded', 'color: #8b5cf6; font-weight: bold;');
|
|
259
|
+
}
|
|
260
|
+
})();
|
|
261
|
+
`;
|
|
262
|
+
|
|
263
|
+
return validationCode + code;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// ESBuild plugin
|
|
267
|
+
export function moonUIESBuildPlugin(options = {}) {
|
|
268
|
+
const licenseKey = process.env.MOONUI_LICENSE_KEY ||
|
|
269
|
+
process.env.MOONUI_TEAM_TOKEN ||
|
|
270
|
+
process.env.MOONUI_CI_TOKEN ||
|
|
271
|
+
options.licenseKey;
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
name: 'moonui-pro',
|
|
275
|
+
setup(build) {
|
|
276
|
+
// Validate license at build start
|
|
277
|
+
build.onStart(async () => {
|
|
278
|
+
try {
|
|
279
|
+
await validateLicense(licenseKey);
|
|
280
|
+
console.log('ā
MoonUI Pro: License validated successfully');
|
|
281
|
+
} catch (err) {
|
|
282
|
+
console.error('ā MoonUI Pro License Error:', err.message);
|
|
283
|
+
if (process.env.NODE_ENV === 'production') {
|
|
284
|
+
throw err;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
|
|
289
|
+
// Transform MoonUI Pro files
|
|
290
|
+
build.onLoad({ filter: /moonui-pro.*\.(js|jsx|ts|tsx)$/ }, async (args) => {
|
|
291
|
+
const source = await fs.promises.readFile(args.path, 'utf8');
|
|
292
|
+
const contents = injectLicenseCheck(source, licenseKey);
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
contents,
|
|
296
|
+
loader: path.extname(args.path).slice(1),
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Export all plugins
|
|
304
|
+
export default {
|
|
305
|
+
withMoonUI,
|
|
306
|
+
moonUIVitePlugin,
|
|
307
|
+
moonUIESBuildPlugin,
|
|
308
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import fs from 'fs';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
|
|
10
|
+
// Add 'use client' to the beginning of dist files
|
|
11
|
+
const files = ['dist/index.mjs', 'dist/index.js'];
|
|
12
|
+
|
|
13
|
+
files.forEach(file => {
|
|
14
|
+
const filePath = path.join(__dirname, '..', file);
|
|
15
|
+
|
|
16
|
+
if (fs.existsSync(filePath)) {
|
|
17
|
+
let content = fs.readFileSync(filePath, 'utf8');
|
|
18
|
+
|
|
19
|
+
if (!content.startsWith('"use client"') && !content.startsWith("'use client'")) {
|
|
20
|
+
content = '"use client";\n' + content;
|
|
21
|
+
fs.writeFileSync(filePath, content);
|
|
22
|
+
console.log(`ā
Added 'use client' to ${file}`);
|
|
23
|
+
} else {
|
|
24
|
+
console.log(`āļø 'use client' already exists in ${file}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|