@holoscript/core 2.0.1 → 2.0.2

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/LICENSE +21 -0
  2. package/dist/chunk-3N67RLQP.cjs +1298 -0
  3. package/dist/chunk-3N67RLQP.cjs.map +1 -0
  4. package/dist/chunk-3X2EGU7Z.cjs +52 -0
  5. package/dist/chunk-3X2EGU7Z.cjs.map +1 -0
  6. package/dist/chunk-4CV4JOE5.js +24 -0
  7. package/dist/chunk-4CV4JOE5.js.map +1 -0
  8. package/dist/chunk-4OHVW4XR.cjs +1027 -0
  9. package/dist/chunk-4OHVW4XR.cjs.map +1 -0
  10. package/dist/chunk-CZLDE2OZ.cjs +28 -0
  11. package/dist/chunk-CZLDE2OZ.cjs.map +1 -0
  12. package/{src/HoloScriptRuntime.ts → dist/chunk-EU6CZMGJ.js} +437 -794
  13. package/dist/chunk-EU6CZMGJ.js.map +1 -0
  14. package/dist/chunk-KWYIVRIH.js +344 -0
  15. package/dist/chunk-KWYIVRIH.js.map +1 -0
  16. package/dist/chunk-MCP6D4LT.js +1025 -0
  17. package/dist/chunk-MCP6D4LT.js.map +1 -0
  18. package/dist/chunk-SATNCODL.js +45 -0
  19. package/dist/chunk-SATNCODL.js.map +1 -0
  20. package/dist/chunk-VMZN4EVR.cjs +347 -0
  21. package/dist/chunk-VMZN4EVR.cjs.map +1 -0
  22. package/{src/HoloScriptDebugger.ts → dist/chunk-VYIDLUCV.js} +118 -257
  23. package/dist/chunk-VYIDLUCV.js.map +1 -0
  24. package/dist/chunk-WFI4T3XB.cjs +424 -0
  25. package/dist/chunk-WFI4T3XB.cjs.map +1 -0
  26. package/dist/debugger.cjs +20 -0
  27. package/dist/debugger.cjs.map +1 -0
  28. package/dist/debugger.d.cts +171 -0
  29. package/dist/debugger.d.ts +171 -0
  30. package/dist/debugger.js +7 -0
  31. package/dist/debugger.js.map +1 -0
  32. package/dist/index.cjs +6006 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +2482 -0
  35. package/dist/index.d.ts +2482 -0
  36. package/dist/index.js +5926 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/parser.cjs +14 -0
  39. package/dist/parser.cjs.map +1 -0
  40. package/dist/parser.d.cts +139 -0
  41. package/dist/parser.d.ts +139 -0
  42. package/dist/parser.js +5 -0
  43. package/dist/parser.js.map +1 -0
  44. package/dist/runtime.cjs +14 -0
  45. package/dist/runtime.cjs.map +1 -0
  46. package/dist/runtime.d.cts +180 -0
  47. package/dist/runtime.d.ts +180 -0
  48. package/dist/runtime.js +5 -0
  49. package/dist/runtime.js.map +1 -0
  50. package/dist/type-checker.cjs +17 -0
  51. package/dist/type-checker.cjs.map +1 -0
  52. package/dist/type-checker.d.cts +105 -0
  53. package/dist/type-checker.d.ts +105 -0
  54. package/dist/type-checker.js +4 -0
  55. package/dist/type-checker.js.map +1 -0
  56. package/dist/types-D6g4ACjP.d.cts +262 -0
  57. package/dist/types-D6g4ACjP.d.ts +262 -0
  58. package/package.json +11 -8
  59. package/src/HoloScript2DParser.js +0 -227
  60. package/src/HoloScript2DParser.ts +0 -261
  61. package/src/HoloScriptCodeParser.js +0 -1102
  62. package/src/HoloScriptCodeParser.ts +0 -1188
  63. package/src/HoloScriptDebugger.js +0 -458
  64. package/src/HoloScriptParser.js +0 -338
  65. package/src/HoloScriptParser.ts +0 -397
  66. package/src/HoloScriptPlusParser.js +0 -371
  67. package/src/HoloScriptPlusParser.ts +0 -543
  68. package/src/HoloScriptRuntime.js +0 -1399
  69. package/src/HoloScriptRuntime.test.js +0 -351
  70. package/src/HoloScriptRuntime.test.ts +0 -436
  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,205 +0,0 @@
1
- /**
2
- * @holoscript/core Enhanced Parser
3
- *
4
- * Improved error recovery, line/column tracking, better diagnostics
5
- */
6
- /**
7
- * Enhanced parser with better error handling
8
- */
9
- export class EnhancedHoloScriptParser {
10
- constructor(sourceCode) {
11
- this.position = 0;
12
- this.line = 1;
13
- this.column = 0;
14
- this.lineOffsets = [0];
15
- this.errors = [];
16
- this.tokens = this.tokenizeWithLocation(sourceCode);
17
- }
18
- /**
19
- * Tokenize with line/column tracking
20
- */
21
- tokenizeWithLocation(source) {
22
- const tokens = [];
23
- let pos = 0;
24
- let line = 1;
25
- let column = 0;
26
- for (let i = 0; i < source.length; i++) {
27
- if (source[i] === '\n') {
28
- line++;
29
- column = 0;
30
- this.lineOffsets.push(i + 1);
31
- }
32
- else {
33
- column++;
34
- }
35
- // Simple tokenization (enhanced version would be more comprehensive)
36
- if (/\s/.test(source[i]))
37
- continue;
38
- // Capture token with location
39
- const token = {
40
- type: this.getTokenType(source[i]),
41
- value: source[i],
42
- location: { line, column, offset: i },
43
- };
44
- tokens.push(token);
45
- }
46
- return tokens;
47
- }
48
- getTokenType(char) {
49
- const typeMap = {
50
- '{': 'lbrace',
51
- '}': 'rbrace',
52
- '[': 'lbracket',
53
- ']': 'rbracket',
54
- '(': 'lparen',
55
- ')': 'rparen',
56
- '@': 'at',
57
- '#': 'hash',
58
- ':': 'colon',
59
- ',': 'comma',
60
- '=': 'equals',
61
- '.': 'dot',
62
- };
63
- return typeMap[char] || 'identifier';
64
- }
65
- /**
66
- * Better error with suggestions
67
- */
68
- error(message, suggestion) {
69
- const token = this.currentToken();
70
- const location = token?.location || { line: this.line, column: this.column, offset: this.position };
71
- const error = {
72
- message,
73
- location,
74
- token,
75
- suggestion: suggestion || this.suggestFix(message),
76
- context: this.getErrorContext(location),
77
- };
78
- this.errors.push(error);
79
- return error;
80
- }
81
- /**
82
- * Suggest fixes based on error pattern
83
- */
84
- suggestFix(error) {
85
- if (error.includes('Expected }')) {
86
- return 'Check that all braces are balanced. Missing closing brace?';
87
- }
88
- if (error.includes('Expected identifier')) {
89
- return 'Expected a name or identifier here (e.g., myOrb, myVariable)';
90
- }
91
- if (error.includes('Unexpected token')) {
92
- const token = this.currentToken();
93
- return `Remove or fix the '${token?.value}' token on this line`;
94
- }
95
- if (error.includes('Expected @')) {
96
- return 'Traits must start with @ symbol (e.g., @grabbable, @voice_input)';
97
- }
98
- return 'Check syntax in this area';
99
- }
100
- /**
101
- * Get error context from source
102
- */
103
- getErrorContext(location) {
104
- const startLine = Math.max(0, location.line - 2);
105
- const endLine = location.line + 1;
106
- const lineNum = location.line;
107
- let context = '';
108
- for (let i = startLine; i < endLine; i++) {
109
- const prefix = i === lineNum ? '→' : ' ';
110
- context += `${prefix} ${i + 1} | <source line>\n`;
111
- }
112
- // Add pointer
113
- context += ` | ${' '.repeat(location.column - 1)}^`;
114
- return context;
115
- }
116
- /**
117
- * Error recovery: skip to next statement
118
- */
119
- synchronize() {
120
- this.advance();
121
- while (!this.isAtEnd()) {
122
- if (this.previous()?.type === 'newline')
123
- return;
124
- const current = this.currentToken();
125
- if (current?.type === 'identifier' ||
126
- current?.type === 'at' ||
127
- current?.type === 'rbrace') {
128
- return;
129
- }
130
- this.advance();
131
- }
132
- }
133
- /**
134
- * Get all collected errors
135
- */
136
- getErrors() {
137
- return this.errors;
138
- }
139
- /**
140
- * Check if any errors occurred
141
- */
142
- hasErrors() {
143
- return this.errors.length > 0;
144
- }
145
- // Utility methods
146
- currentToken() {
147
- return this.tokens[this.position];
148
- }
149
- previous() {
150
- return this.tokens[this.position - 1];
151
- }
152
- advance() {
153
- if (!this.isAtEnd())
154
- this.position++;
155
- return this.previous();
156
- }
157
- isAtEnd() {
158
- return this.position >= this.tokens.length;
159
- }
160
- match(...types) {
161
- for (const type of types) {
162
- if (this.check(type)) {
163
- this.advance();
164
- return true;
165
- }
166
- }
167
- return false;
168
- }
169
- check(type) {
170
- if (this.isAtEnd())
171
- return false;
172
- return this.currentToken()?.type === type;
173
- }
174
- expect(type, message) {
175
- if (this.check(type))
176
- return this.advance();
177
- return this.error(message);
178
- }
179
- }
180
- /**
181
- * Format parser error for display
182
- */
183
- export function formatParseError(error) {
184
- const { message, location, suggestion, context } = error;
185
- return `
186
- ❌ Parse Error: ${message}
187
- at line ${location.line}, column ${location.column}
188
-
189
- ${context}
190
-
191
- 💡 Suggestion: ${suggestion || 'Check the syntax'}
192
- `.trim();
193
- }
194
- /**
195
- * Format all errors
196
- */
197
- export function formatParseErrors(errors) {
198
- if (errors.length === 0)
199
- return '';
200
- let output = `\n❌ Found ${errors.length} parse error${errors.length !== 1 ? 's' : ''}:\n\n`;
201
- for (let i = 0; i < errors.length; i++) {
202
- output += `[${i + 1}/${errors.length}] ${formatParseError(errors[i])}\n\n`;
203
- }
204
- return output;
205
- }
@@ -1,251 +0,0 @@
1
- /**
2
- * @holoscript/core Enhanced Parser
3
- *
4
- * Improved error recovery, line/column tracking, better diagnostics
5
- */
6
-
7
- export interface SourceLocation {
8
- line: number;
9
- column: number;
10
- offset: number;
11
- }
12
-
13
- export interface ParseError {
14
- message: string;
15
- location: SourceLocation;
16
- token: any;
17
- suggestion?: string;
18
- context?: string;
19
- }
20
-
21
- /**
22
- * Enhanced parser with better error handling
23
- */
24
- export class EnhancedHoloScriptParser {
25
- private tokens: any[];
26
- private position: number = 0;
27
- private line: number = 1;
28
- private column: number = 0;
29
- private lineOffsets: number[] = [0];
30
- private errors: ParseError[] = [];
31
-
32
- constructor(sourceCode: string) {
33
- this.tokens = this.tokenizeWithLocation(sourceCode);
34
- }
35
-
36
- /**
37
- * Tokenize with line/column tracking
38
- */
39
- private tokenizeWithLocation(source: string): any[] {
40
- const tokens: any[] = [];
41
- let pos = 0;
42
- let line = 1;
43
- let column = 0;
44
-
45
- for (let i = 0; i < source.length; i++) {
46
- if (source[i] === '\n') {
47
- line++;
48
- column = 0;
49
- this.lineOffsets.push(i + 1);
50
- } else {
51
- column++;
52
- }
53
-
54
- // Simple tokenization (enhanced version would be more comprehensive)
55
- if (/\s/.test(source[i])) continue;
56
-
57
- // Capture token with location
58
- const token = {
59
- type: this.getTokenType(source[i]),
60
- value: source[i],
61
- location: { line, column, offset: i },
62
- };
63
-
64
- tokens.push(token);
65
- }
66
-
67
- return tokens;
68
- }
69
-
70
- private getTokenType(char: string): string {
71
- const typeMap: Record<string, string> = {
72
- '{': 'lbrace',
73
- '}': 'rbrace',
74
- '[': 'lbracket',
75
- ']': 'rbracket',
76
- '(': 'lparen',
77
- ')': 'rparen',
78
- '@': 'at',
79
- '#': 'hash',
80
- ':': 'colon',
81
- ',': 'comma',
82
- '=': 'equals',
83
- '.': 'dot',
84
- };
85
- return typeMap[char] || 'identifier';
86
- }
87
-
88
- /**
89
- * Better error with suggestions
90
- */
91
- error(message: string, suggestion?: string): ParseError {
92
- const token = this.currentToken();
93
- const location = token?.location || { line: this.line, column: this.column, offset: this.position };
94
-
95
- const error: ParseError = {
96
- message,
97
- location,
98
- token,
99
- suggestion: suggestion || this.suggestFix(message),
100
- context: this.getErrorContext(location),
101
- };
102
-
103
- this.errors.push(error);
104
- return error;
105
- }
106
-
107
- /**
108
- * Suggest fixes based on error pattern
109
- */
110
- private suggestFix(error: string): string {
111
- if (error.includes('Expected }')) {
112
- return 'Check that all braces are balanced. Missing closing brace?';
113
- }
114
- if (error.includes('Expected identifier')) {
115
- return 'Expected a name or identifier here (e.g., myOrb, myVariable)';
116
- }
117
- if (error.includes('Unexpected token')) {
118
- const token = this.currentToken();
119
- return `Remove or fix the '${token?.value}' token on this line`;
120
- }
121
- if (error.includes('Expected @')) {
122
- return 'Traits must start with @ symbol (e.g., @grabbable, @voice_input)';
123
- }
124
- return 'Check syntax in this area';
125
- }
126
-
127
- /**
128
- * Get error context from source
129
- */
130
- private getErrorContext(location: SourceLocation): string {
131
- const startLine = Math.max(0, location.line - 2);
132
- const endLine = location.line + 1;
133
- const lineNum = location.line;
134
-
135
- let context = '';
136
- for (let i = startLine; i < endLine; i++) {
137
- const prefix = i === lineNum ? '→' : ' ';
138
- context += `${prefix} ${i + 1} | <source line>\n`;
139
- }
140
-
141
- // Add pointer
142
- context += ` | ${' '.repeat(location.column - 1)}^`;
143
-
144
- return context;
145
- }
146
-
147
- /**
148
- * Error recovery: skip to next statement
149
- */
150
- private synchronize(): void {
151
- this.advance();
152
-
153
- while (!this.isAtEnd()) {
154
- if (this.previous()?.type === 'newline') return;
155
-
156
- const current = this.currentToken();
157
- if (
158
- current?.type === 'identifier' ||
159
- current?.type === 'at' ||
160
- current?.type === 'rbrace'
161
- ) {
162
- return;
163
- }
164
-
165
- this.advance();
166
- }
167
- }
168
-
169
- /**
170
- * Get all collected errors
171
- */
172
- getErrors(): ParseError[] {
173
- return this.errors;
174
- }
175
-
176
- /**
177
- * Check if any errors occurred
178
- */
179
- hasErrors(): boolean {
180
- return this.errors.length > 0;
181
- }
182
-
183
- // Utility methods
184
- currentToken() {
185
- return this.tokens[this.position];
186
- }
187
-
188
- private previous() {
189
- return this.tokens[this.position - 1];
190
- }
191
-
192
- private advance() {
193
- if (!this.isAtEnd()) this.position++;
194
- return this.previous();
195
- }
196
-
197
- private isAtEnd(): boolean {
198
- return this.position >= this.tokens.length;
199
- }
200
-
201
- private match(...types: string[]): boolean {
202
- for (const type of types) {
203
- if (this.check(type)) {
204
- this.advance();
205
- return true;
206
- }
207
- }
208
- return false;
209
- }
210
-
211
- private check(type: string): boolean {
212
- if (this.isAtEnd()) return false;
213
- return this.currentToken()?.type === type;
214
- }
215
-
216
- private expect(type: string, message: string) {
217
- if (this.check(type)) return this.advance();
218
- return this.error(message);
219
- }
220
- }
221
-
222
- /**
223
- * Format parser error for display
224
- */
225
- export function formatParseError(error: ParseError): string {
226
- const { message, location, suggestion, context } = error;
227
-
228
- return `
229
- ❌ Parse Error: ${message}
230
- at line ${location.line}, column ${location.column}
231
-
232
- ${context}
233
-
234
- 💡 Suggestion: ${suggestion || 'Check the syntax'}
235
- `.trim();
236
- }
237
-
238
- /**
239
- * Format all errors
240
- */
241
- export function formatParseErrors(errors: ParseError[]): string {
242
- if (errors.length === 0) return '';
243
-
244
- let output = `\n❌ Found ${errors.length} parse error${errors.length !== 1 ? 's' : ''}:\n\n`;
245
-
246
- for (let i = 0; i < errors.length; i++) {
247
- output += `[${i + 1}/${errors.length}] ${formatParseError(errors[i])}\n\n`;
248
- }
249
-
250
- return output;
251
- }