@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,376 +0,0 @@
1
- /**
2
- * @holoscript/core Developer Experience
3
- *
4
- * REPL, better error formatting, interactive mode
5
- */
6
- import * as readline from 'readline';
7
- /**
8
- * Enhanced error formatter
9
- */
10
- export class ErrorFormatter {
11
- /**
12
- * Format error with source context
13
- */
14
- static formatError(error, sourceCode) {
15
- const { message, location, suggestion, token } = error;
16
- let formatted = `\n❌ Error: ${message}\n`;
17
- if (location) {
18
- formatted += ` at line ${location.line}, column ${location.column}\n`;
19
- if (sourceCode) {
20
- const lines = sourceCode.split('\n');
21
- const errorLine = lines[location.line - 1];
22
- if (errorLine) {
23
- formatted += `\n ${location.line} | ${errorLine}\n`;
24
- formatted += ` | ${' '.repeat(location.column - 1)}^\n`;
25
- }
26
- }
27
- }
28
- if (suggestion) {
29
- formatted += `\n💡 Suggestion: ${suggestion}\n`;
30
- }
31
- return formatted;
32
- }
33
- /**
34
- * Format multiple errors
35
- */
36
- static formatErrors(errors) {
37
- if (errors.length === 0)
38
- return '';
39
- let formatted = `\n❌ Found ${errors.length} error${errors.length !== 1 ? 's' : ''}:\n`;
40
- for (let i = 0; i < Math.min(errors.length, 5); i++) {
41
- formatted += this.formatError(errors[i]);
42
- }
43
- if (errors.length > 5) {
44
- formatted += `\n... and ${errors.length - 5} more error${errors.length - 5 !== 1 ? 's' : ''}\n`;
45
- }
46
- return formatted;
47
- }
48
- /**
49
- * Format success message
50
- */
51
- static formatSuccess(message, details) {
52
- let formatted = `\n✅ ${message}\n`;
53
- if (details) {
54
- if (typeof details === 'object') {
55
- formatted += JSON.stringify(details, null, 2) + '\n';
56
- }
57
- else {
58
- formatted += `${details}\n`;
59
- }
60
- }
61
- return formatted;
62
- }
63
- /**
64
- * Format help text
65
- */
66
- static formatHelp() {
67
- return `
68
- HoloScript+ REPL v1.0.0
69
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
70
-
71
- Commands:
72
- help - Show this help message
73
- clear - Clear the screen
74
- vars - List all variables
75
- types - List all types
76
- profile - Show performance profile
77
- exit - Exit REPL
78
-
79
- Shortcuts:
80
- .create orb#name - Create orb
81
- .position x y z - Set position
82
- .property key val - Set property
83
-
84
- Examples:
85
- > orb#myOrb { position: [0, 0, 0] }
86
- > myOrb.position = [1, 1, 1]
87
- > match state { "idle" => { ... } }
88
-
89
- For more info, visit: https://github.com/brianonbased-dev/holoscript
90
- `.trim();
91
- }
92
- }
93
- /**
94
- * Interactive REPL
95
- */
96
- export class HoloScriptREPL {
97
- constructor(parser, runtime) {
98
- this.variables = new Map();
99
- this.types = new Map();
100
- this.history = [];
101
- this.parser = parser;
102
- this.runtime = runtime;
103
- this.rl = readline.createInterface({
104
- input: process.stdin,
105
- output: process.stdout,
106
- history: this.history,
107
- historySize: 100,
108
- });
109
- }
110
- /**
111
- * Start REPL
112
- */
113
- async start() {
114
- console.log('\n🥽 HoloScript+ REPL v1.0.0');
115
- console.log('Type "help" for commands, "exit" to quit\n');
116
- await this.repl();
117
- }
118
- /**
119
- * Main REPL loop
120
- */
121
- async repl() {
122
- const prompt = () => {
123
- this.rl.question('> ', async (input) => {
124
- try {
125
- const trimmed = input.trim();
126
- if (!trimmed) {
127
- prompt();
128
- return;
129
- }
130
- // Handle commands
131
- if (trimmed.startsWith('.')) {
132
- this.handleCommand(trimmed);
133
- prompt();
134
- return;
135
- }
136
- // Handle built-in commands
137
- switch (trimmed.toLowerCase()) {
138
- case 'help':
139
- console.log(ErrorFormatter.formatHelp());
140
- prompt();
141
- return;
142
- case 'clear':
143
- console.clear();
144
- prompt();
145
- return;
146
- case 'vars':
147
- this.showVariables();
148
- prompt();
149
- return;
150
- case 'types':
151
- this.showTypes();
152
- prompt();
153
- return;
154
- case 'profile':
155
- this.showProfile();
156
- prompt();
157
- return;
158
- case 'exit':
159
- this.rl.close();
160
- console.log('\n👋 Goodbye!\n');
161
- return;
162
- }
163
- // Parse and execute
164
- const result = await this.evaluate(trimmed);
165
- if (result !== undefined && result !== null) {
166
- this.displayResult(result);
167
- }
168
- }
169
- catch (error) {
170
- console.error(ErrorFormatter.formatError(error));
171
- }
172
- prompt();
173
- });
174
- };
175
- prompt();
176
- }
177
- /**
178
- * Handle dot commands
179
- */
180
- handleCommand(command) {
181
- const parts = command.slice(1).split(' ');
182
- const cmd = parts[0];
183
- switch (cmd) {
184
- case 'create':
185
- console.log(`Creating: ${parts.slice(1).join(' ')}`);
186
- break;
187
- case 'position':
188
- console.log(`Position: x=${parts[1]}, y=${parts[2]}, z=${parts[3]}`);
189
- break;
190
- case 'property':
191
- console.log(`Property: ${parts[1]} = ${parts[2]}`);
192
- break;
193
- default:
194
- console.log(`Unknown command: .${cmd}`);
195
- }
196
- }
197
- /**
198
- * Evaluate HoloScript code
199
- */
200
- async evaluate(code) {
201
- try {
202
- const parseResult = this.parser.parse(code);
203
- if (parseResult.errors && parseResult.errors.length > 0) {
204
- throw {
205
- message: 'Parse error',
206
- errors: parseResult.errors,
207
- };
208
- }
209
- const result = await this.runtime.execute(parseResult.ast);
210
- return result;
211
- }
212
- catch (error) {
213
- throw error;
214
- }
215
- }
216
- /**
217
- * Show variables
218
- */
219
- showVariables() {
220
- if (this.variables.size === 0) {
221
- console.log('No variables defined');
222
- return;
223
- }
224
- console.log('\n📦 Variables:');
225
- for (const [name, value] of this.variables) {
226
- console.log(` ${name}: ${this.formatValue(value)}`);
227
- }
228
- console.log();
229
- }
230
- /**
231
- * Show types
232
- */
233
- showTypes() {
234
- if (this.types.size === 0) {
235
- console.log('No custom types defined');
236
- return;
237
- }
238
- console.log('\n🏷️ Types:');
239
- for (const [name, type] of this.types) {
240
- console.log(` ${name}: ${JSON.stringify(type)}`);
241
- }
242
- console.log();
243
- }
244
- /**
245
- * Show performance profile
246
- */
247
- showProfile() {
248
- console.log('\n⏱️ Performance Profile:');
249
- console.log(' (Profiling data would be displayed here)');
250
- console.log();
251
- }
252
- /**
253
- * Display result
254
- */
255
- displayResult(result) {
256
- const formatted = this.formatValue(result);
257
- console.log(`=> ${formatted}`);
258
- }
259
- /**
260
- * Format value for display
261
- */
262
- formatValue(value) {
263
- if (value === null)
264
- return 'null';
265
- if (value === undefined)
266
- return 'undefined';
267
- if (typeof value === 'string')
268
- return `"${value}"`;
269
- if (typeof value === 'number')
270
- return `${value}`;
271
- if (typeof value === 'boolean')
272
- return `${value}`;
273
- if (Array.isArray(value)) {
274
- return `[ ${value.map((v) => this.formatValue(v)).join(', ')} ]`;
275
- }
276
- if (typeof value === 'object') {
277
- const pairs = Object.entries(value)
278
- .map(([k, v]) => `${k}: ${this.formatValue(v)}`)
279
- .join(', ');
280
- return `{ ${pairs} }`;
281
- }
282
- return String(value);
283
- }
284
- }
285
- /**
286
- * Create and start REPL
287
- */
288
- export async function startREPL(parser, runtime) {
289
- const repl = new HoloScriptREPL(parser, runtime);
290
- await repl.start();
291
- }
292
- /**
293
- * Hot reload watcher for development
294
- */
295
- export class HotReloadWatcher {
296
- constructor() {
297
- this.watchers = new Map();
298
- }
299
- /**
300
- * Watch file for changes
301
- */
302
- watch(filePath, callback) {
303
- // Using basic fs.watch (production would use chokidar)
304
- const fs = require('fs');
305
- fs.watchFile(filePath, { interval: 1000 }, async () => {
306
- try {
307
- console.log(`\n🔄 Reloading: ${filePath}`);
308
- await callback();
309
- console.log('✅ Reload complete\n');
310
- }
311
- catch (error) {
312
- console.error(ErrorFormatter.formatError(error));
313
- }
314
- });
315
- this.watchers.set(filePath, true);
316
- }
317
- /**
318
- * Stop watching
319
- */
320
- unwatch(filePath) {
321
- const fs = require('fs');
322
- fs.unwatchFile(filePath);
323
- this.watchers.delete(filePath);
324
- }
325
- /**
326
- * Stop all watchers
327
- */
328
- clear() {
329
- const fs = require('fs');
330
- for (const filePath of this.watchers.keys()) {
331
- fs.unwatchFile(filePath);
332
- }
333
- this.watchers.clear();
334
- }
335
- }
336
- /**
337
- * Source map generator
338
- */
339
- export class SourceMapGenerator {
340
- constructor() {
341
- this.mappings = [];
342
- }
343
- /**
344
- * Add mapping
345
- */
346
- addMapping(generatedLine, generatedColumn, sourceLine, sourceColumn, name) {
347
- this.mappings.push({
348
- generatedLine,
349
- generatedColumn,
350
- sourceLine,
351
- sourceColumn,
352
- name,
353
- });
354
- }
355
- /**
356
- * Generate source map
357
- */
358
- generate(sourceFile, generatedFile) {
359
- return {
360
- version: 3,
361
- file: generatedFile,
362
- sourceRoot: '',
363
- sources: [sourceFile],
364
- sourcesContent: [],
365
- mappings: this.encodeMappings(),
366
- names: [],
367
- };
368
- }
369
- /**
370
- * Encode mappings in VLQ format
371
- */
372
- encodeMappings() {
373
- // Simplified VLQ encoding
374
- return this.mappings.map((m) => `${m.generatedLine}:${m.generatedColumn}->${m.sourceLine}:${m.sourceColumn}`).join(';');
375
- }
376
- }