@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,317 +0,0 @@
1
- /**
2
- * HoloScriptPlus Parser Tests
3
- *
4
- * Tests for trait annotation parsing and validation
5
- */
6
- import { describe, it, expect, beforeEach } from 'vitest';
7
- import { HoloScriptPlusParser } from '../HoloScriptPlusParser';
8
- describe('HoloScriptPlusParser', () => {
9
- let parser;
10
- beforeEach(() => {
11
- parser = new HoloScriptPlusParser();
12
- });
13
- // ========================================================================
14
- // Material Trait Tests
15
- // ========================================================================
16
- describe('Material Trait Annotations', () => {
17
- it('should parse material trait annotation', () => {
18
- const code = `
19
- orb#sphere {
20
- @material { type: pbr }
21
- }
22
- `;
23
- const traits = parser.extractTraitAnnotations(code);
24
- expect(traits).toHaveLength(1);
25
- expect(traits[0].type).toBe('material');
26
- });
27
- it('should parse material with basic properties', () => {
28
- const code = `@material { type: pbr }`;
29
- const traits = parser.extractTraitAnnotations(code);
30
- expect(traits[0].config.type).toBe('pbr');
31
- });
32
- it('should parse material with textures', () => {
33
- const code = `@material { textures: [{ path: diffuse.jpg, channel: baseColor }] }`;
34
- const traits = parser.extractTraitAnnotations(code);
35
- expect(traits[0].config.textures).toBeDefined();
36
- });
37
- it('should parse material compression option', () => {
38
- const code = `@material { compression: basis }`;
39
- const traits = parser.extractTraitAnnotations(code);
40
- expect(traits[0].config.compression).toBe('basis');
41
- });
42
- it('should validate material trait', () => {
43
- const trait = {
44
- type: 'material',
45
- config: { pbr: { metallic: 0.5, roughness: 0.3 } },
46
- };
47
- const validation = parser.validateTraitAnnotation(trait);
48
- expect(validation.valid).toBe(true);
49
- });
50
- it('should reject invalid metallic value', () => {
51
- const trait = {
52
- type: 'material',
53
- config: { pbr: { metallic: 1.5 } },
54
- };
55
- const validation = parser.validateTraitAnnotation(trait);
56
- expect(validation.valid).toBe(false);
57
- expect(validation.errors.length).toBeGreaterThan(0);
58
- });
59
- it('should reject invalid compression format', () => {
60
- const trait = {
61
- type: 'material',
62
- config: { compression: 'invalid' },
63
- };
64
- const validation = parser.validateTraitAnnotation(trait);
65
- expect(validation.valid).toBe(false);
66
- });
67
- });
68
- // ========================================================================
69
- // Lighting Trait Tests
70
- // ========================================================================
71
- describe('Lighting Trait Annotations', () => {
72
- it('should parse lighting trait annotation', () => {
73
- const code = `
74
- @lighting { preset: studio, shadows: true }
75
- `;
76
- const traits = parser.extractTraitAnnotations(code);
77
- expect(traits).toHaveLength(1);
78
- expect(traits[0].type).toBe('lighting');
79
- });
80
- it('should parse lighting with preset', () => {
81
- const code = `@lighting { preset: outdoor }`;
82
- const traits = parser.extractTraitAnnotations(code);
83
- expect(traits[0].config.preset).toBe('outdoor');
84
- });
85
- it('should parse lighting with lights', () => {
86
- const code = `@lighting { lights: [{ type: directional, intensity: 1.2 }] }`;
87
- const traits = parser.extractTraitAnnotations(code);
88
- expect(traits[0].config.lights).toBeDefined();
89
- });
90
- it('should validate lighting trait', () => {
91
- const trait = {
92
- type: 'lighting',
93
- config: { preset: 'studio' },
94
- };
95
- const validation = parser.validateTraitAnnotation(trait);
96
- expect(validation.valid).toBe(true);
97
- });
98
- it('should reject invalid preset', () => {
99
- const trait = {
100
- type: 'lighting',
101
- config: { preset: 'invalid' },
102
- };
103
- const validation = parser.validateTraitAnnotation(trait);
104
- expect(validation.valid).toBe(false);
105
- });
106
- it('should reject light with negative intensity', () => {
107
- const trait = {
108
- type: 'lighting',
109
- config: { lights: [{ type: 'point', intensity: -0.5 }] },
110
- };
111
- const validation = parser.validateTraitAnnotation(trait);
112
- expect(validation.valid).toBe(false);
113
- });
114
- });
115
- // ========================================================================
116
- // Rendering Trait Tests
117
- // ========================================================================
118
- describe('Rendering Trait Annotations', () => {
119
- it('should parse rendering trait annotation', () => {
120
- const code = `
121
- @rendering { quality: high, lod: true, culling: true }
122
- `;
123
- const traits = parser.extractTraitAnnotations(code);
124
- expect(traits).toHaveLength(1);
125
- expect(traits[0].type).toBe('rendering');
126
- });
127
- it('should parse rendering with quality preset', () => {
128
- const code = `@rendering { quality: ultra }`;
129
- const traits = parser.extractTraitAnnotations(code);
130
- expect(traits[0].config.quality).toBe('ultra');
131
- });
132
- it('should parse rendering with platform optimization', () => {
133
- const code = `@rendering { platform: mobile, quality: low }`;
134
- const traits = parser.extractTraitAnnotations(code);
135
- expect(traits[0].config.platform).toBe('mobile');
136
- });
137
- it('should validate rendering trait', () => {
138
- const trait = {
139
- type: 'rendering',
140
- config: { quality: 'high', platform: 'desktop' },
141
- };
142
- const validation = parser.validateTraitAnnotation(trait);
143
- expect(validation.valid).toBe(true);
144
- });
145
- it('should reject invalid quality preset', () => {
146
- const trait = {
147
- type: 'rendering',
148
- config: { quality: 'invalid' },
149
- };
150
- const validation = parser.validateTraitAnnotation(trait);
151
- expect(validation.valid).toBe(false);
152
- });
153
- it('should reject invalid platform', () => {
154
- const trait = {
155
- type: 'rendering',
156
- config: { platform: 'console' },
157
- };
158
- const validation = parser.validateTraitAnnotation(trait);
159
- expect(validation.valid).toBe(false);
160
- });
161
- it('should reject invalid FPS target', () => {
162
- const trait = {
163
- type: 'rendering',
164
- config: { targetFPS: 500 },
165
- };
166
- const validation = parser.validateTraitAnnotation(trait);
167
- expect(validation.valid).toBe(false);
168
- });
169
- });
170
- // ========================================================================
171
- // Combined Trait Tests
172
- // ========================================================================
173
- describe('Combined Trait Annotations', () => {
174
- it('should parse multiple traits on single orb', () => {
175
- const code = `
176
- orb#sphere {
177
- @material { type: pbr, metallic: 0.5 }
178
- @lighting { preset: studio }
179
- @rendering { quality: high }
180
- }
181
- `;
182
- const traits = parser.extractTraitAnnotations(code);
183
- expect(traits).toHaveLength(3);
184
- expect(traits.map((t) => t.type).sort()).toEqual(['lighting', 'material', 'rendering']);
185
- });
186
- it('should build graphics configuration from traits', () => {
187
- const traits = [
188
- {
189
- type: 'material',
190
- config: { type: 'pbr', pbr: { metallic: 0.5 } },
191
- },
192
- {
193
- type: 'lighting',
194
- config: { preset: 'studio' },
195
- },
196
- {
197
- type: 'rendering',
198
- config: { quality: 'high' },
199
- },
200
- ];
201
- const config = parser.buildGraphicsConfig(traits);
202
- expect(config.material).toBeDefined();
203
- expect(config.lighting).toBeDefined();
204
- expect(config.rendering).toBeDefined();
205
- });
206
- });
207
- // ========================================================================
208
- // Object Literal Parsing Tests
209
- // ========================================================================
210
- describe('Object Literal Parsing', () => {
211
- it.skip('should parse simple key-value pairs', () => {
212
- const result = parser.parseObjectLiteral('type: pbr');
213
- expect(result.type).toBe('pbr');
214
- });
215
- it.skip('should parse boolean values', () => {
216
- const result = parser.parseObjectLiteral('shadows: true');
217
- expect(result.shadows).toBe(true);
218
- });
219
- it.skip('should parse numeric values', () => {
220
- const result = parser.parseObjectLiteral('targetFPS: 120');
221
- expect(result.targetFPS).toBe(120);
222
- });
223
- it.skip('should parse string values', () => {
224
- const result = parser.parseObjectLiteral('compression: basis');
225
- expect(result.compression).toBe('basis');
226
- });
227
- });
228
- // ========================================================================
229
- // Value Parsing Tests
230
- // ========================================================================
231
- describe('Value Parsing', () => {
232
- it('should parse boolean true', () => {
233
- const value = parser.parseValue('true');
234
- expect(value).toBe(true);
235
- });
236
- it('should parse boolean false', () => {
237
- const value = parser.parseValue('false');
238
- expect(value).toBe(false);
239
- });
240
- it('should parse positive integer', () => {
241
- const value = parser.parseValue('120');
242
- expect(value).toBe(120);
243
- });
244
- it('should parse decimal number', () => {
245
- const value = parser.parseValue('0.5');
246
- expect(value).toBe(0.5);
247
- });
248
- it('should parse negative number', () => {
249
- const value = parser.parseValue('-5.5');
250
- expect(value).toBe(-5.5);
251
- });
252
- it('should parse quoted string', () => {
253
- const value = parser.parseValue('"pbr"');
254
- expect(value).toBe('pbr');
255
- });
256
- it('should parse single-quoted string', () => {
257
- const value = parser.parseValue("'studio'");
258
- expect(value).toBe('studio');
259
- });
260
- });
261
- ;
262
- // ========================================================================
263
- // Enhanced Orb Node Tests
264
- // ========================================================================
265
- describe('Enhanced OrbNode with Graphics Traits', () => {
266
- it('should extract graphics traits from code', () => {
267
- const code = `
268
- orb#sphere {
269
- @material { type: pbr, metallic: 0.5 }
270
- @lighting { preset: studio }
271
- }
272
- `;
273
- const traits = parser.extractTraitAnnotations(code);
274
- expect(traits).toHaveLength(2);
275
- expect(traits[0].type).toBe('material');
276
- expect(traits[1].type).toBe('lighting');
277
- });
278
- it('should create material trait from config', () => {
279
- const code = `@material { type: pbr, metallic: 0.5, compression: basis }`;
280
- const traits = parser.extractTraitAnnotations(code);
281
- expect(traits).toHaveLength(1);
282
- expect(traits[0].config.type).toBe('pbr');
283
- });
284
- });
285
- // ========================================================================
286
- // Edge Cases and Error Handling
287
- // ========================================================================
288
- describe('Edge Cases and Error Handling', () => {
289
- it('should handle empty trait annotation gracefully', () => {
290
- const code = `@material {}`;
291
- const traits = parser.extractTraitAnnotations(code);
292
- expect(traits).toHaveLength(1);
293
- expect(traits[0].config).toBeDefined();
294
- });
295
- it('should handle malformed JSON gracefully', () => {
296
- const code = `@material { invalid json }`;
297
- const traits = parser.extractTraitAnnotations(code);
298
- // Parser should attempt to parse and return best effort result
299
- expect(traits.length).toBeGreaterThanOrEqual(0);
300
- });
301
- it('should ignore invalid trait types', () => {
302
- const code = `@invalid { type: something }`;
303
- const traits = parser.extractTraitAnnotations(code);
304
- // Should not include invalid trait type
305
- expect(traits.every((t) => ['material', 'lighting', 'rendering'].includes(t.type))).toBe(true);
306
- });
307
- it('should handle multiple orbs with different traits', () => {
308
- const code = `
309
- orb#sphere1 { @material { metallic: 0.5 } }
310
- orb#sphere2 { @lighting { preset: studio } }
311
- orb#sphere3 { @rendering { quality: high } }
312
- `;
313
- const traits = parser.extractTraitAnnotations(code);
314
- expect(traits).toHaveLength(3);
315
- });
316
- });
317
- });