mastercontroller 1.2.13 → 1.3.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/.claude/settings.local.json +12 -0
- package/MasterAction.js +7 -7
- package/MasterControl.js +192 -122
- package/MasterCors.js +29 -0
- package/MasterHtml.js +5 -5
- package/MasterPipeline.js +344 -0
- package/MasterRouter.js +59 -29
- package/MasterSession.js +19 -0
- package/MasterTemplate.js +3 -3
- package/MasterTimeout.js +332 -0
- package/README.md +1496 -36
- package/docs/timeout-and-error-handling.md +712 -0
- package/{MasterError.js → error/MasterError.js} +2 -2
- package/{MasterErrorLogger.js → error/MasterErrorLogger.js} +1 -1
- package/{MasterErrorMiddleware.js → error/MasterErrorMiddleware.js} +2 -2
- package/error/MasterErrorRenderer.js +529 -0
- package/{ssr → error}/SSRErrorHandler.js +2 -2
- package/{MasterCache.js → monitoring/MasterCache.js} +2 -2
- package/{MasterMemoryMonitor.js → monitoring/MasterMemoryMonitor.js} +2 -2
- package/{MasterProfiler.js → monitoring/MasterProfiler.js} +2 -2
- package/{ssr → monitoring}/PerformanceMonitor.js +2 -2
- package/package.json +5 -5
- package/{EventHandlerValidator.js → security/EventHandlerValidator.js} +3 -3
- package/{MasterSanitizer.js → security/MasterSanitizer.js} +2 -2
- package/{MasterValidator.js → security/MasterValidator.js} +2 -2
- package/{SecurityMiddleware.js → security/SecurityMiddleware.js} +75 -3
- package/{SessionSecurity.js → security/SessionSecurity.js} +2 -2
- package/ssr/hydration-client.js +3 -3
- package/ssr/runtime-ssr.cjs +9 -9
- package/MasterBenchmark.js +0 -89
- package/MasterBuildOptimizer.js +0 -376
- package/MasterBundleAnalyzer.js +0 -108
- package/ssr/HTMLUtils.js +0 -15
- /package/{ssr → error}/ErrorBoundary.js +0 -0
- /package/{ssr → error}/HydrationMismatch.js +0 -0
- /package/{MasterBackendErrorHandler.js → error/MasterBackendErrorHandler.js} +0 -0
- /package/{MasterErrorHandler.js → error/MasterErrorHandler.js} +0 -0
- /package/{CSPConfig.js → security/CSPConfig.js} +0 -0
package/MasterBundleAnalyzer.js
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
// version 1.0.0
|
|
2
|
-
// MasterController Bundle Analyzer - Bundle Size Analysis
|
|
3
|
-
|
|
4
|
-
const fs = require('fs');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const { logger } = require('./MasterErrorLogger');
|
|
7
|
-
|
|
8
|
-
class MasterBundleAnalyzer {
|
|
9
|
-
constructor(options = {}) {
|
|
10
|
-
this.rootDir = options.rootDir || process.cwd();
|
|
11
|
-
this.outputDir = options.outputDir || path.join(this.rootDir, 'public', '__compiled__');
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Analyze bundles
|
|
16
|
-
*/
|
|
17
|
-
analyze() {
|
|
18
|
-
const bundles = this.getBundles();
|
|
19
|
-
const report = this.generateReport(bundles);
|
|
20
|
-
|
|
21
|
-
this.printReport(report);
|
|
22
|
-
|
|
23
|
-
return report;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get all bundles
|
|
28
|
-
*/
|
|
29
|
-
getBundles() {
|
|
30
|
-
const bundles = [];
|
|
31
|
-
|
|
32
|
-
if (!fs.existsSync(this.outputDir)) {
|
|
33
|
-
return bundles;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const files = fs.readdirSync(this.outputDir);
|
|
37
|
-
|
|
38
|
-
for (const file of files) {
|
|
39
|
-
const filePath = path.join(this.outputDir, file);
|
|
40
|
-
const stats = fs.statSync(filePath);
|
|
41
|
-
|
|
42
|
-
if (stats.isFile() && file.endsWith('.js')) {
|
|
43
|
-
bundles.push({
|
|
44
|
-
name: file,
|
|
45
|
-
size: stats.size,
|
|
46
|
-
gzipSize: Math.round(stats.size * 0.3) // Estimate
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return bundles.sort((a, b) => b.size - a.size);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Generate report
|
|
56
|
-
*/
|
|
57
|
-
generateReport(bundles) {
|
|
58
|
-
const totalSize = bundles.reduce((sum, b) => sum + b.size, 0);
|
|
59
|
-
const totalGzip = bundles.reduce((sum, b) => sum + b.gzipSize, 0);
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
bundles,
|
|
63
|
-
totalSize,
|
|
64
|
-
totalGzip,
|
|
65
|
-
bundleCount: bundles.length,
|
|
66
|
-
averageSize: bundles.length > 0 ? totalSize / bundles.length : 0
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Print report
|
|
72
|
-
*/
|
|
73
|
-
printReport(report) {
|
|
74
|
-
console.log('\n═══════════════════════════════════════════════════');
|
|
75
|
-
console.log('📦 MasterController Bundle Analysis');
|
|
76
|
-
console.log('═══════════════════════════════════════════════════');
|
|
77
|
-
|
|
78
|
-
console.log(`\nTotal Bundles: ${report.bundleCount}`);
|
|
79
|
-
console.log(`Total Size: ${(report.totalSize / 1024).toFixed(2)} KB`);
|
|
80
|
-
console.log(`Total Size (Gzip): ${(report.totalGzip / 1024).toFixed(2)} KB`);
|
|
81
|
-
console.log(`Average Bundle Size: ${(report.averageSize / 1024).toFixed(2)} KB`);
|
|
82
|
-
|
|
83
|
-
console.log('\nLargest Bundles:');
|
|
84
|
-
report.bundles.slice(0, 10).forEach((bundle, i) => {
|
|
85
|
-
console.log(` ${i + 1}. ${bundle.name}`);
|
|
86
|
-
console.log(` Size: ${(bundle.size / 1024).toFixed(2)} KB | Gzip: ${(bundle.gzipSize / 1024).toFixed(2)} KB`);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
console.log('\n💡 Recommendations:');
|
|
90
|
-
if (report.totalSize > 500000) {
|
|
91
|
-
console.log(' ⚠️ Large total bundle size (>500KB)');
|
|
92
|
-
console.log(' - Enable code splitting');
|
|
93
|
-
console.log(' - Use dynamic imports');
|
|
94
|
-
console.log(' - Tree shake unused code');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
const largeBundles = report.bundles.filter(b => b.size > 100000);
|
|
98
|
-
if (largeBundles.length > 0) {
|
|
99
|
-
console.log(` ⚠️ ${largeBundles.length} bundles exceed 100KB`);
|
|
100
|
-
console.log(' - Break into smaller chunks');
|
|
101
|
-
console.log(' - Lazy load large components');
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
console.log('═══════════════════════════════════════════════════\n');
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
module.exports = { MasterBundleAnalyzer };
|
package/ssr/HTMLUtils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deprecated: HTMLUtils.js
|
|
3
|
-
* Enhance SSR now compiles native web components directly to HTML.
|
|
4
|
-
* This file remains as a no-op compatibility stub so any legacy references do not break.
|
|
5
|
-
*/
|
|
6
|
-
class HTMLUtils {
|
|
7
|
-
static escapeAttr(v) { return String(v ?? ''); }
|
|
8
|
-
static unescapeAttr(v) { return v; }
|
|
9
|
-
static encodeData(v) { return this.escapeAttr(v); }
|
|
10
|
-
static decodeData(v) { return this.unescapeAttr(v); }
|
|
11
|
-
static dataAttr(name, value) { return `${name}="${this.escapeAttr(value)}"`; }
|
|
12
|
-
}
|
|
13
|
-
if (typeof module !== 'undefined' && module.exports) module.exports = HTMLUtils;
|
|
14
|
-
if (typeof window !== 'undefined') window.HTMLUtils = HTMLUtils;
|
|
15
|
-
if (typeof exports !== 'undefined') exports.HTMLUtils = HTMLUtils;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|