@holoscript/core 2.0.1 → 2.1.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.
Files changed (137) hide show
  1. package/dist/chunk-2XXE34KS.js +344 -0
  2. package/dist/chunk-2XXE34KS.js.map +1 -0
  3. package/dist/chunk-3X2EGU7Z.cjs +52 -0
  4. package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
  5. package/dist/chunk-AFFVFO4D.js +1689 -0
  6. package/dist/chunk-AFFVFO4D.js.map +1 -0
  7. package/dist/chunk-DGUM43GV.js +10 -0
  8. package/dist/chunk-DGUM43GV.js.map +1 -0
  9. package/{src/HoloScriptDebugger.ts → dist/chunk-DOY73HDH.js} +118 -257
  10. package/dist/chunk-DOY73HDH.js.map +1 -0
  11. package/dist/chunk-JEQ2X3Z6.cjs +12 -0
  12. package/dist/chunk-JEQ2X3Z6.cjs.map +1 -0
  13. package/dist/chunk-L6VLNVKP.cjs +1691 -0
  14. package/dist/chunk-L6VLNVKP.cjs.map +1 -0
  15. package/dist/chunk-MFNO57XL.cjs +347 -0
  16. package/dist/chunk-MFNO57XL.cjs.map +1 -0
  17. package/dist/chunk-R75MREOS.cjs +424 -0
  18. package/dist/chunk-R75MREOS.cjs.map +1 -0
  19. package/dist/chunk-SATNCODL.js +45 -0
  20. package/dist/chunk-SATNCODL.js.map +1 -0
  21. package/dist/chunk-T57ZL7KR.cjs +1281 -0
  22. package/dist/chunk-T57ZL7KR.cjs.map +1 -0
  23. package/dist/chunk-U72GEJZT.js +1279 -0
  24. package/dist/chunk-U72GEJZT.js.map +1 -0
  25. package/dist/debugger.cjs +20 -0
  26. package/dist/debugger.cjs.map +1 -0
  27. package/dist/debugger.d.cts +171 -0
  28. package/dist/debugger.d.ts +171 -0
  29. package/dist/debugger.js +7 -0
  30. package/dist/debugger.js.map +1 -0
  31. package/dist/index.cjs +6803 -0
  32. package/dist/index.cjs.map +1 -0
  33. package/dist/index.d.cts +4093 -0
  34. package/dist/index.d.ts +4093 -0
  35. package/dist/index.js +6715 -0
  36. package/dist/index.js.map +1 -0
  37. package/dist/parser.cjs +14 -0
  38. package/dist/parser.cjs.map +1 -0
  39. package/dist/parser.d.cts +172 -0
  40. package/dist/parser.d.ts +172 -0
  41. package/dist/parser.js +5 -0
  42. package/dist/parser.js.map +1 -0
  43. package/dist/runtime.cjs +14 -0
  44. package/dist/runtime.cjs.map +1 -0
  45. package/dist/runtime.d.cts +200 -0
  46. package/dist/runtime.d.ts +200 -0
  47. package/dist/runtime.js +5 -0
  48. package/dist/runtime.js.map +1 -0
  49. package/dist/type-checker.cjs +17 -0
  50. package/dist/type-checker.cjs.map +1 -0
  51. package/dist/type-checker.d.cts +105 -0
  52. package/dist/type-checker.d.ts +105 -0
  53. package/dist/type-checker.js +4 -0
  54. package/dist/type-checker.js.map +1 -0
  55. package/dist/types-4h8cbtF_.d.cts +329 -0
  56. package/dist/types-4h8cbtF_.d.ts +329 -0
  57. package/package.json +17 -13
  58. package/src/HoloScript2DParser.js +0 -227
  59. package/src/HoloScript2DParser.ts +0 -261
  60. package/src/HoloScriptCodeParser.js +0 -1102
  61. package/src/HoloScriptCodeParser.ts +0 -1188
  62. package/src/HoloScriptDebugger.js +0 -458
  63. package/src/HoloScriptParser.js +0 -338
  64. package/src/HoloScriptParser.ts +0 -397
  65. package/src/HoloScriptPlusParser.js +0 -371
  66. package/src/HoloScriptPlusParser.ts +0 -543
  67. package/src/HoloScriptRuntime.js +0 -1399
  68. package/src/HoloScriptRuntime.test.js +0 -351
  69. package/src/HoloScriptRuntime.test.ts +0 -436
  70. package/src/HoloScriptRuntime.ts +0 -1653
  71. package/src/HoloScriptTypeChecker.js +0 -356
  72. package/src/HoloScriptTypeChecker.ts +0 -475
  73. package/src/__tests__/GraphicsServices.test.js +0 -357
  74. package/src/__tests__/GraphicsServices.test.ts +0 -427
  75. package/src/__tests__/HoloScriptPlusParser.test.js +0 -317
  76. package/src/__tests__/HoloScriptPlusParser.test.ts +0 -392
  77. package/src/__tests__/integration.test.js +0 -336
  78. package/src/__tests__/integration.test.ts +0 -416
  79. package/src/__tests__/performance.bench.js +0 -218
  80. package/src/__tests__/performance.bench.ts +0 -262
  81. package/src/__tests__/type-checker.test.js +0 -60
  82. package/src/__tests__/type-checker.test.ts +0 -73
  83. package/src/index.js +0 -217
  84. package/src/index.ts +0 -426
  85. package/src/interop/Interoperability.js +0 -413
  86. package/src/interop/Interoperability.ts +0 -494
  87. package/src/logger.js +0 -42
  88. package/src/logger.ts +0 -57
  89. package/src/parser/EnhancedParser.js +0 -205
  90. package/src/parser/EnhancedParser.ts +0 -251
  91. package/src/parser/HoloScriptPlusParser.js +0 -928
  92. package/src/parser/HoloScriptPlusParser.ts +0 -1089
  93. package/src/runtime/HoloScriptPlusRuntime.js +0 -674
  94. package/src/runtime/HoloScriptPlusRuntime.ts +0 -861
  95. package/src/runtime/PerformanceTelemetry.js +0 -323
  96. package/src/runtime/PerformanceTelemetry.ts +0 -467
  97. package/src/runtime/RuntimeOptimization.js +0 -361
  98. package/src/runtime/RuntimeOptimization.ts +0 -416
  99. package/src/services/HololandGraphicsPipelineService.js +0 -506
  100. package/src/services/HololandGraphicsPipelineService.ts +0 -662
  101. package/src/services/PlatformPerformanceOptimizer.js +0 -356
  102. package/src/services/PlatformPerformanceOptimizer.ts +0 -503
  103. package/src/state/ReactiveState.js +0 -427
  104. package/src/state/ReactiveState.ts +0 -572
  105. package/src/tools/DeveloperExperience.js +0 -376
  106. package/src/tools/DeveloperExperience.ts +0 -438
  107. package/src/traits/AIDriverTrait.js +0 -322
  108. package/src/traits/AIDriverTrait.test.js +0 -329
  109. package/src/traits/AIDriverTrait.test.ts +0 -357
  110. package/src/traits/AIDriverTrait.ts +0 -474
  111. package/src/traits/LightingTrait.js +0 -313
  112. package/src/traits/LightingTrait.test.js +0 -410
  113. package/src/traits/LightingTrait.test.ts +0 -462
  114. package/src/traits/LightingTrait.ts +0 -505
  115. package/src/traits/MaterialTrait.js +0 -194
  116. package/src/traits/MaterialTrait.test.js +0 -286
  117. package/src/traits/MaterialTrait.test.ts +0 -329
  118. package/src/traits/MaterialTrait.ts +0 -324
  119. package/src/traits/RenderingTrait.js +0 -356
  120. package/src/traits/RenderingTrait.test.js +0 -363
  121. package/src/traits/RenderingTrait.test.ts +0 -427
  122. package/src/traits/RenderingTrait.ts +0 -555
  123. package/src/traits/VRTraitSystem.js +0 -740
  124. package/src/traits/VRTraitSystem.ts +0 -1040
  125. package/src/traits/VoiceInputTrait.js +0 -284
  126. package/src/traits/VoiceInputTrait.test.js +0 -226
  127. package/src/traits/VoiceInputTrait.test.ts +0 -252
  128. package/src/traits/VoiceInputTrait.ts +0 -401
  129. package/src/types/AdvancedTypeSystem.js +0 -226
  130. package/src/types/AdvancedTypeSystem.ts +0 -494
  131. package/src/types/HoloScriptPlus.d.ts +0 -853
  132. package/src/types.js +0 -6
  133. package/src/types.ts +0 -369
  134. package/tsconfig.json +0 -23
  135. package/tsup.config.d.ts +0 -2
  136. package/tsup.config.js +0 -18
  137. package/tsup.config.ts +0 -19
@@ -1,323 +0,0 @@
1
- /**
2
- * @holoscript/core Performance Telemetry
3
- *
4
- * Real-time performance monitoring, profiling, and metrics collection
5
- * Exports metrics to analytics platforms and provides performance budgets
6
- */
7
- /**
8
- * PerformanceTelemetry - Monitor and analyze runtime performance
9
- */
10
- export class PerformanceTelemetry {
11
- constructor() {
12
- this.metrics = [];
13
- this.budgets = new Map();
14
- this.frameTimings = [];
15
- this.memorySnapshots = [];
16
- this.exporters = [];
17
- this.frameCounter = 0;
18
- this.lastFrameTime = Date.now();
19
- this.frameTimes = [];
20
- this.maxFrameHistory = 300; // ~5s at 60fps
21
- this.monitoringEnabled = false;
22
- this.exportInterval = null;
23
- this.exportIntervalMs = 10000; // Export every 10s
24
- this.initializeDefaultBudgets();
25
- }
26
- /**
27
- * Initialize default performance budgets
28
- */
29
- initializeDefaultBudgets() {
30
- // Frame budget: 16.67ms target (60fps)
31
- this.setBudget({
32
- metricName: 'frame_duration',
33
- maxValue: 16.67,
34
- severity: 'warning',
35
- enabled: true,
36
- });
37
- // Memory budget: 100MB
38
- this.setBudget({
39
- metricName: 'heap_used',
40
- maxValue: 100 * 1024 * 1024,
41
- severity: 'warning',
42
- enabled: true,
43
- });
44
- // Render time budget: 10ms
45
- this.setBudget({
46
- metricName: 'render_time',
47
- maxValue: 10,
48
- severity: 'warning',
49
- enabled: true,
50
- });
51
- }
52
- /**
53
- * Start performance monitoring
54
- */
55
- startMonitoring() {
56
- if (this.monitoringEnabled)
57
- return;
58
- this.monitoringEnabled = true;
59
- this.lastFrameTime = performance.now();
60
- // Setup auto-export
61
- if (this.exporters.length > 0) {
62
- this.exportInterval = setInterval(() => {
63
- this.exportMetrics();
64
- }, this.exportIntervalMs);
65
- }
66
- console.log('Performance monitoring started');
67
- }
68
- /**
69
- * Stop performance monitoring
70
- */
71
- stopMonitoring() {
72
- if (!this.monitoringEnabled)
73
- return;
74
- this.monitoringEnabled = false;
75
- if (this.exportInterval) {
76
- clearInterval(this.exportInterval);
77
- this.exportInterval = null;
78
- }
79
- console.log('Performance monitoring stopped');
80
- }
81
- /**
82
- * Record frame timing
83
- */
84
- recordFrame(cpuTime, gpuTime, renderTime, logicTime) {
85
- if (!this.monitoringEnabled)
86
- return;
87
- const now = performance.now();
88
- const frameDuration = now - this.lastFrameTime;
89
- const fps = Math.round(1000 / frameDuration);
90
- this.frameTimes.push(frameDuration);
91
- if (this.frameTimes.length > this.maxFrameHistory) {
92
- this.frameTimes.shift();
93
- }
94
- const timing = {
95
- frameNumber: this.frameCounter++,
96
- fps,
97
- frameDuration,
98
- cpuTime,
99
- gpuTime,
100
- renderTime,
101
- logicTime,
102
- timestamp: now,
103
- };
104
- this.frameTimings.push(timing);
105
- // Record metrics
106
- this.recordMetric({
107
- name: 'frame_duration',
108
- type: 'gauge',
109
- value: frameDuration,
110
- unit: 'ms',
111
- timestamp: now,
112
- });
113
- this.recordMetric({
114
- name: 'fps',
115
- type: 'gauge',
116
- value: fps,
117
- timestamp: now,
118
- });
119
- this.recordMetric({
120
- name: 'render_time',
121
- type: 'gauge',
122
- value: renderTime,
123
- unit: 'ms',
124
- timestamp: now,
125
- });
126
- this.checkBudgets(timing);
127
- this.lastFrameTime = now;
128
- }
129
- /**
130
- * Record custom metric
131
- */
132
- recordMetric(metric) {
133
- this.metrics.push({
134
- ...metric,
135
- timestamp: Date.now(),
136
- });
137
- }
138
- /**
139
- * Record memory snapshot
140
- */
141
- recordMemorySnapshot() {
142
- if (!this.monitoringEnabled)
143
- return;
144
- const perf = performance.memory;
145
- if (!perf) {
146
- console.warn('Memory profiling not available');
147
- return;
148
- }
149
- const snapshot = {
150
- usedJSHeapSize: perf.usedJSHeapSize,
151
- totalJSHeapSize: perf.totalJSHeapSize,
152
- jsHeapSizeLimit: perf.jsHeapSizeLimit,
153
- objectCount: 0, // Would require additional instrumentation
154
- gcEventsSinceLastSnapshot: 0,
155
- timestamp: Date.now(),
156
- };
157
- this.memorySnapshots.push(snapshot);
158
- // Record as metrics
159
- this.recordMetric({
160
- name: 'heap_used',
161
- type: 'gauge',
162
- value: snapshot.usedJSHeapSize,
163
- unit: 'bytes',
164
- timestamp: snapshot.timestamp,
165
- });
166
- this.recordMetric({
167
- name: 'heap_total',
168
- type: 'gauge',
169
- value: snapshot.totalJSHeapSize,
170
- unit: 'bytes',
171
- timestamp: snapshot.timestamp,
172
- });
173
- // Check memory budget
174
- const budget = this.budgets.get('heap_used');
175
- if (budget && budget.enabled && snapshot.usedJSHeapSize > budget.maxValue) {
176
- this.emitBudgetViolation('heap_used', snapshot.usedJSHeapSize, budget.maxValue, budget.severity);
177
- }
178
- }
179
- /**
180
- * Check frame metrics against budgets
181
- */
182
- checkBudgets(timing) {
183
- // Check frame duration budget
184
- const frameBudget = this.budgets.get('frame_duration');
185
- if (frameBudget &&
186
- frameBudget.enabled &&
187
- timing.frameDuration > frameBudget.maxValue) {
188
- this.emitBudgetViolation('frame_duration', timing.frameDuration, frameBudget.maxValue, frameBudget.severity);
189
- }
190
- // Check render time budget
191
- const renderBudget = this.budgets.get('render_time');
192
- if (renderBudget &&
193
- renderBudget.enabled &&
194
- timing.renderTime > renderBudget.maxValue) {
195
- this.emitBudgetViolation('render_time', timing.renderTime, renderBudget.maxValue, renderBudget.severity);
196
- }
197
- }
198
- /**
199
- * Emit budget violation warning
200
- */
201
- emitBudgetViolation(metric, actual, budget, severity) {
202
- const message = `Budget violation: ${metric} = ${actual.toFixed(2)} (budget: ${budget.toFixed(2)})`;
203
- if (severity === 'critical') {
204
- console.error(`❌ ${message}`);
205
- }
206
- else if (severity === 'warning') {
207
- console.warn(`⚠️ ${message}`);
208
- }
209
- else {
210
- console.log(`ℹ️ ${message}`);
211
- }
212
- }
213
- /**
214
- * Set or update performance budget
215
- */
216
- setBudget(budget) {
217
- this.budgets.set(budget.metricName, budget);
218
- }
219
- /**
220
- * Get average FPS over recent frames
221
- */
222
- getAverageFPS() {
223
- if (this.frameTimes.length === 0)
224
- return 0;
225
- const avgFrameTime = this.frameTimes.reduce((a, b) => a + b, 0) / this.frameTimes.length;
226
- return Math.round(1000 / avgFrameTime);
227
- }
228
- /**
229
- * Get memory usage stats
230
- */
231
- getMemoryStats() {
232
- if (this.memorySnapshots.length === 0) {
233
- return { used: 0, total: 0, limit: 0, percentage: 0 };
234
- }
235
- const latest = this.memorySnapshots[this.memorySnapshots.length - 1];
236
- return {
237
- used: latest.usedJSHeapSize,
238
- total: latest.totalJSHeapSize,
239
- limit: latest.jsHeapSizeLimit,
240
- percentage: (latest.usedJSHeapSize / latest.jsHeapSizeLimit) * 100,
241
- };
242
- }
243
- /**
244
- * Get recent frame timings
245
- */
246
- getRecentFrameTimings(count = 60) {
247
- return this.frameTimings.slice(-count);
248
- }
249
- /**
250
- * Add analytics exporter
251
- */
252
- addExporter(exporter) {
253
- this.exporters.push(exporter);
254
- }
255
- /**
256
- * Export all metrics to registered exporters
257
- */
258
- async exportMetrics() {
259
- if (this.metrics.length === 0)
260
- return;
261
- const metricsToExport = [...this.metrics];
262
- this.metrics = []; // Clear after export
263
- for (const exporter of this.exporters) {
264
- try {
265
- await exporter.export(metricsToExport);
266
- }
267
- catch (error) {
268
- console.error('Failed to export metrics:', error);
269
- }
270
- }
271
- }
272
- /**
273
- * Generate performance report
274
- */
275
- generateReport() {
276
- const avgFps = this.getAverageFPS();
277
- const memStats = this.getMemoryStats();
278
- const recentFrames = this.getRecentFrameTimings(60);
279
- let report = '=== Performance Report ===\n\n';
280
- report += `Average FPS: ${avgFps}\n`;
281
- report += `Recent Frame Count: ${recentFrames.length}\n`;
282
- if (recentFrames.length > 0) {
283
- const avgFrameTime = recentFrames.reduce((sum, f) => sum + f.frameDuration, 0) /
284
- recentFrames.length;
285
- const maxFrameTime = Math.max(...recentFrames.map((f) => f.frameDuration));
286
- const minFrameTime = Math.min(...recentFrames.map((f) => f.frameDuration));
287
- report += `Frame Time: min=${minFrameTime.toFixed(2)}ms, avg=${avgFrameTime.toFixed(2)}ms, max=${maxFrameTime.toFixed(2)}ms\n`;
288
- }
289
- report += `\nMemory Usage:\n`;
290
- report += ` Used: ${(memStats.used / 1024 / 1024).toFixed(2)} MB\n`;
291
- report += ` Total: ${(memStats.total / 1024 / 1024).toFixed(2)} MB\n`;
292
- report += ` Limit: ${(memStats.limit / 1024 / 1024).toFixed(2)} MB\n`;
293
- report += ` Percentage: ${memStats.percentage.toFixed(1)}%\n`;
294
- report += `\nMetrics Recorded: ${this.metrics.length}\n`;
295
- report += `Memory Snapshots: ${this.memorySnapshots.length}\n`;
296
- return report;
297
- }
298
- /**
299
- * Dispose and cleanup
300
- */
301
- dispose() {
302
- this.stopMonitoring();
303
- this.metrics = [];
304
- this.frameTimings = [];
305
- this.memorySnapshots = [];
306
- this.frameTimes = [];
307
- this.budgets.clear();
308
- this.exporters = [];
309
- }
310
- }
311
- /**
312
- * Singleton instance
313
- */
314
- let telemetryInstance = null;
315
- /**
316
- * Get or create telemetry instance
317
- */
318
- export function getPerformanceTelemetry() {
319
- if (!telemetryInstance) {
320
- telemetryInstance = new PerformanceTelemetry();
321
- }
322
- return telemetryInstance;
323
- }