@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,361 +0,0 @@
1
- /**
2
- * @holoscript/core Runtime Optimization
3
- *
4
- * Object pooling, lazy evaluation, memoization, caching
5
- */
6
- /**
7
- * Generic object pool for efficient memory reuse
8
- */
9
- export class ObjectPool {
10
- constructor(factory, reset, capacity = 100) {
11
- this.factory = factory;
12
- this.reset = reset;
13
- this.capacity = capacity;
14
- this.available = [];
15
- this.inUse = new Set();
16
- this.peakUsage = 0;
17
- this.preallocate(capacity);
18
- }
19
- /**
20
- * Pre-allocate objects
21
- */
22
- preallocate(count) {
23
- for (let i = 0; i < count; i++) {
24
- this.available.push(this.factory());
25
- }
26
- }
27
- /**
28
- * Acquire object from pool
29
- */
30
- acquire() {
31
- let obj = this.available.pop();
32
- if (!obj) {
33
- obj = this.factory();
34
- }
35
- this.inUse.add(obj);
36
- this.peakUsage = Math.max(this.peakUsage, this.inUse.size);
37
- return obj;
38
- }
39
- /**
40
- * Release object back to pool
41
- */
42
- release(obj) {
43
- if (!this.inUse.has(obj)) {
44
- console.warn('Releasing object not from this pool');
45
- return;
46
- }
47
- this.inUse.delete(obj);
48
- this.reset(obj);
49
- this.available.push(obj);
50
- }
51
- /**
52
- * Batch acquire
53
- */
54
- acquireBatch(count) {
55
- const batch = [];
56
- for (let i = 0; i < count; i++) {
57
- batch.push(this.acquire());
58
- }
59
- return batch;
60
- }
61
- /**
62
- * Batch release
63
- */
64
- releaseBatch(objects) {
65
- for (const obj of objects) {
66
- this.release(obj);
67
- }
68
- }
69
- /**
70
- * Get pool statistics
71
- */
72
- getStats() {
73
- return {
74
- available: this.available.length,
75
- inUse: this.inUse.size,
76
- peakUsage: this.peakUsage,
77
- utilization: this.inUse.size / (this.inUse.size + this.available.length),
78
- };
79
- }
80
- /**
81
- * Clear pool
82
- */
83
- clear() {
84
- this.available = [];
85
- this.inUse.clear();
86
- this.peakUsage = 0;
87
- }
88
- }
89
- /**
90
- * Lazy evaluated value
91
- */
92
- export class Lazy {
93
- constructor(compute) {
94
- this.compute = compute;
95
- this.computed = false;
96
- }
97
- /**
98
- * Get value (compute if needed)
99
- */
100
- get() {
101
- if (!this.computed) {
102
- this.value = this.compute();
103
- this.computed = true;
104
- }
105
- return this.value;
106
- }
107
- /**
108
- * Force re-computation
109
- */
110
- reset() {
111
- this.computed = false;
112
- this.value = undefined;
113
- }
114
- /**
115
- * Check if computed
116
- */
117
- isComputed() {
118
- return this.computed;
119
- }
120
- }
121
- /**
122
- * Memoization decorator
123
- */
124
- export function memoize(fn, maxSize = 100) {
125
- const cache = new Map();
126
- return ((...args) => {
127
- const key = JSON.stringify(args);
128
- if (cache.has(key)) {
129
- return cache.get(key);
130
- }
131
- const result = fn(...args);
132
- if (cache.size >= maxSize) {
133
- const firstKey = cache.keys().next().value;
134
- cache.delete(firstKey);
135
- }
136
- cache.set(key, result);
137
- return result;
138
- });
139
- }
140
- /**
141
- * Memoized property decorator
142
- */
143
- export function MemoizedProperty() {
144
- return function (target, propertyKey, descriptor) {
145
- const originalGetter = descriptor.get;
146
- const cache = new Map();
147
- descriptor.get = function () {
148
- if (!cache.has(this)) {
149
- cache.set(this, originalGetter.call(this));
150
- }
151
- return cache.get(this);
152
- };
153
- return descriptor;
154
- };
155
- }
156
- /**
157
- * LRU Cache with maximum size
158
- */
159
- export class LRUCache {
160
- constructor(maxSize = 100) {
161
- this.maxSize = maxSize;
162
- this.cache = new Map();
163
- this.accessOrder = [];
164
- }
165
- /**
166
- * Get value from cache
167
- */
168
- get(key) {
169
- if (this.cache.has(key)) {
170
- // Move to end (most recently used)
171
- const index = this.accessOrder.indexOf(key);
172
- if (index > -1) {
173
- this.accessOrder.splice(index, 1);
174
- }
175
- this.accessOrder.push(key);
176
- return this.cache.get(key);
177
- }
178
- return undefined;
179
- }
180
- /**
181
- * Set value in cache
182
- */
183
- set(key, value) {
184
- if (this.cache.has(key)) {
185
- // Update existing
186
- const index = this.accessOrder.indexOf(key);
187
- if (index > -1) {
188
- this.accessOrder.splice(index, 1);
189
- }
190
- }
191
- else if (this.cache.size >= this.maxSize) {
192
- // Evict LRU
193
- const lruKey = this.accessOrder.shift();
194
- this.cache.delete(lruKey);
195
- }
196
- this.cache.set(key, value);
197
- this.accessOrder.push(key);
198
- }
199
- /**
200
- * Clear cache
201
- */
202
- clear() {
203
- this.cache.clear();
204
- this.accessOrder = [];
205
- }
206
- /**
207
- * Get cache stats
208
- */
209
- getStats() {
210
- return {
211
- size: this.cache.size,
212
- maxSize: this.maxSize,
213
- utilization: this.cache.size / this.maxSize,
214
- };
215
- }
216
- }
217
- /**
218
- * Batch processing for efficient bulk operations
219
- */
220
- export class Batcher {
221
- constructor(processor, batchSize = 100, flushIntervalMs = 16 // ~1 frame at 60fps
222
- ) {
223
- this.processor = processor;
224
- this.batchSize = batchSize;
225
- this.flushIntervalMs = flushIntervalMs;
226
- this.queue = [];
227
- this.processingTimeout = null;
228
- }
229
- /**
230
- * Add item to batch
231
- */
232
- async add(item) {
233
- return new Promise((resolve) => {
234
- this.queue.push(item);
235
- if (this.queue.length >= this.batchSize) {
236
- this.flush().then((results) => {
237
- resolve(results[results.length - 1]);
238
- });
239
- }
240
- else if (!this.processingTimeout) {
241
- this.processingTimeout = setTimeout(() => {
242
- this.flush();
243
- }, this.flushIntervalMs);
244
- }
245
- });
246
- }
247
- /**
248
- * Flush batch
249
- */
250
- async flush() {
251
- if (this.processingTimeout) {
252
- clearTimeout(this.processingTimeout);
253
- this.processingTimeout = null;
254
- }
255
- if (this.queue.length === 0) {
256
- return [];
257
- }
258
- const batch = this.queue.splice(0, this.batchSize);
259
- return await this.processor(batch);
260
- }
261
- /**
262
- * Manually flush remaining items
263
- */
264
- async flushAll() {
265
- const results = [];
266
- while (this.queue.length > 0) {
267
- const batchResults = await this.flush();
268
- results.push(...batchResults);
269
- }
270
- return results;
271
- }
272
- }
273
- /**
274
- * Performance profiler with hot path tracking
275
- */
276
- export class PerformanceProfiler {
277
- constructor() {
278
- this.measurements = new Map();
279
- this.activeTimers = new Map();
280
- }
281
- /**
282
- * Start timing a function
283
- */
284
- startTimer(label) {
285
- this.activeTimers.set(label, performance.now());
286
- }
287
- /**
288
- * End timing
289
- */
290
- endTimer(label) {
291
- const startTime = this.activeTimers.get(label);
292
- if (!startTime) {
293
- console.warn(`No timer started for ${label}`);
294
- return 0;
295
- }
296
- const duration = performance.now() - startTime;
297
- this.activeTimers.delete(label);
298
- // Update statistics
299
- const stats = this.measurements.get(label) || { count: 0, totalTime: 0, minTime: Infinity, maxTime: -Infinity };
300
- stats.count++;
301
- stats.totalTime += duration;
302
- stats.minTime = Math.min(stats.minTime, duration);
303
- stats.maxTime = Math.max(stats.maxTime, duration);
304
- this.measurements.set(label, stats);
305
- return duration;
306
- }
307
- /**
308
- * Measure function execution
309
- */
310
- async measure(label, fn) {
311
- this.startTimer(label);
312
- try {
313
- return await fn();
314
- }
315
- finally {
316
- this.endTimer(label);
317
- }
318
- }
319
- /**
320
- * Get profiling report
321
- */
322
- getReport() {
323
- let report = '=== Performance Profile ===\n\n';
324
- const sorted = Array.from(this.measurements.entries()).sort((a, b) => b[1].totalTime - a[1].totalTime);
325
- for (const [label, stats] of sorted) {
326
- const avgTime = stats.totalTime / stats.count;
327
- report += `${label}:\n`;
328
- report += ` Calls: ${stats.count}\n`;
329
- report += ` Total: ${stats.totalTime.toFixed(2)}ms\n`;
330
- report += ` Avg: ${avgTime.toFixed(2)}ms\n`;
331
- report += ` Min/Max: ${stats.minTime.toFixed(2)}ms / ${stats.maxTime.toFixed(2)}ms\n\n`;
332
- }
333
- return report;
334
- }
335
- /**
336
- * Reset measurements
337
- */
338
- reset() {
339
- this.measurements.clear();
340
- this.activeTimers.clear();
341
- }
342
- /**
343
- * Get hottest paths
344
- */
345
- getHotPaths(topN = 5) {
346
- return Array.from(this.measurements.entries())
347
- .sort((a, b) => b[1].totalTime - a[1].totalTime)
348
- .slice(0, topN)
349
- .map(([label, stats]) => [label, stats.totalTime]);
350
- }
351
- }
352
- /**
353
- * Global optimizer instance
354
- */
355
- let globalProfiler = null;
356
- export function getGlobalProfiler() {
357
- if (!globalProfiler) {
358
- globalProfiler = new PerformanceProfiler();
359
- }
360
- return globalProfiler;
361
- }