@holoscript/std 6.0.3 → 7.0.1

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 (128) hide show
  1. package/README.md +8 -0
  2. package/dist/chunk-DGUM43GV.js +11 -0
  3. package/dist/chunk-DGUM43GV.js.map +1 -0
  4. package/dist/{chunk-PFX2JM4X.js → chunk-FAMOLKH3.js} +2 -1
  5. package/dist/{chunk-PFX2JM4X.js.map → chunk-FAMOLKH3.js.map} +1 -1
  6. package/dist/{chunk-7HVUYGPS.js → chunk-SOKH6FJ7.js} +37 -5
  7. package/dist/chunk-SOKH6FJ7.js.map +1 -0
  8. package/dist/{chunk-W2Q3LUCM.js → chunk-XJIFG7G3.js} +3 -3
  9. package/dist/chunk-XJIFG7G3.js.map +1 -0
  10. package/dist/collections.cjs +1 -0
  11. package/dist/collections.cjs.map +1 -1
  12. package/dist/collections.js +2 -1
  13. package/dist/fs/fs.d.ts +288 -0
  14. package/dist/fs/fs.d.ts.map +1 -0
  15. package/dist/fs/index.cjs +1049 -0
  16. package/dist/fs/index.cjs.map +1 -0
  17. package/dist/fs/index.d.ts +51 -0
  18. package/dist/fs/index.d.ts.map +1 -0
  19. package/dist/fs/index.js +918 -0
  20. package/dist/fs/index.js.map +1 -0
  21. package/dist/fs/path.d.ts +135 -0
  22. package/dist/fs/path.d.ts.map +1 -0
  23. package/dist/fs/sandbox.d.ts +49 -0
  24. package/dist/fs/sandbox.d.ts.map +1 -0
  25. package/dist/fs/watch.d.ts +133 -0
  26. package/dist/fs/watch.d.ts.map +1 -0
  27. package/dist/index.cjs +54 -7
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.js +19 -4
  30. package/dist/index.js.map +1 -1
  31. package/dist/math.cjs +21 -2
  32. package/dist/math.cjs.map +1 -1
  33. package/dist/math.js +2 -1
  34. package/dist/string.cjs +2 -2
  35. package/dist/string.cjs.map +1 -1
  36. package/dist/string.js +2 -1
  37. package/dist/time.js +1 -0
  38. package/dist/traits/EconomicPrimitives.js +1 -0
  39. package/dist/traits/EconomicTraits.js +1 -0
  40. package/dist/traits/VRRTraits.d.ts +2 -2
  41. package/dist/types.d.ts.map +1 -1
  42. package/package.json +24 -9
  43. package/CHANGELOG.md +0 -7
  44. package/dist/__tests__/EconomicPrimitives.test.d.ts +0 -2
  45. package/dist/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
  46. package/dist/__tests__/EconomicTraits.test.d.ts +0 -2
  47. package/dist/__tests__/EconomicTraits.test.d.ts.map +0 -1
  48. package/dist/__tests__/SimulationLabPrimitives.test.d.ts +0 -2
  49. package/dist/__tests__/SimulationLabPrimitives.test.d.ts.map +0 -1
  50. package/dist/__tests__/collections.test.d.ts +0 -2
  51. package/dist/__tests__/collections.test.d.ts.map +0 -1
  52. package/dist/__tests__/events.test.d.ts +0 -2
  53. package/dist/__tests__/events.test.d.ts.map +0 -1
  54. package/dist/__tests__/index.test.d.ts +0 -2
  55. package/dist/__tests__/index.test.d.ts.map +0 -1
  56. package/dist/__tests__/materials.test.d.ts +0 -2
  57. package/dist/__tests__/materials.test.d.ts.map +0 -1
  58. package/dist/__tests__/math.test.d.ts +0 -2
  59. package/dist/__tests__/math.test.d.ts.map +0 -1
  60. package/dist/__tests__/physics.test.d.ts +0 -2
  61. package/dist/__tests__/physics.test.d.ts.map +0 -1
  62. package/dist/__tests__/spatial.test.d.ts +0 -2
  63. package/dist/__tests__/spatial.test.d.ts.map +0 -1
  64. package/dist/__tests__/standard-library-fundamentals.test.d.ts +0 -2
  65. package/dist/__tests__/standard-library-fundamentals.test.d.ts.map +0 -1
  66. package/dist/__tests__/string-and-time-utilities.test.d.ts +0 -2
  67. package/dist/__tests__/string-and-time-utilities.test.d.ts.map +0 -1
  68. package/dist/__tests__/string-decoupled.test.d.ts +0 -2
  69. package/dist/__tests__/string-decoupled.test.d.ts.map +0 -1
  70. package/dist/__tests__/string.test.d.ts +0 -2
  71. package/dist/__tests__/string.test.d.ts.map +0 -1
  72. package/dist/__tests__/time.test.d.ts +0 -2
  73. package/dist/__tests__/time.test.d.ts.map +0 -1
  74. package/dist/chunk-7HVUYGPS.js.map +0 -1
  75. package/dist/chunk-W2Q3LUCM.js.map +0 -1
  76. package/dist/string.basic.test.d.ts +0 -5
  77. package/dist/string.basic.test.d.ts.map +0 -1
  78. package/dist/string.test.d.ts +0 -5
  79. package/dist/string.test.d.ts.map +0 -1
  80. package/dist/traits/__tests__/ARTraits.test.d.ts +0 -2
  81. package/dist/traits/__tests__/ARTraits.test.d.ts.map +0 -1
  82. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts +0 -2
  83. package/dist/traits/__tests__/EconomicPrimitives.test.d.ts.map +0 -1
  84. package/dist/traits/__tests__/EconomicTraits.test.d.ts +0 -2
  85. package/dist/traits/__tests__/EconomicTraits.test.d.ts.map +0 -1
  86. package/error-utf8.log +0 -6
  87. package/error.log +0 -0
  88. package/src/__tests__/EconomicPrimitives.test.ts +0 -690
  89. package/src/__tests__/EconomicTraits.test.ts +0 -425
  90. package/src/__tests__/SimulationLabPrimitives.test.ts +0 -415
  91. package/src/__tests__/collections.test.ts +0 -182
  92. package/src/__tests__/events.test.ts +0 -135
  93. package/src/__tests__/index.test.ts +0 -14
  94. package/src/__tests__/materials.test.ts +0 -84
  95. package/src/__tests__/math.test.ts +0 -246
  96. package/src/__tests__/physics.test.ts +0 -83
  97. package/src/__tests__/spatial.test.ts +0 -333
  98. package/src/__tests__/standard-library-fundamentals.test.ts +0 -1301
  99. package/src/__tests__/string-and-time-utilities.test.ts +0 -1070
  100. package/src/__tests__/string-decoupled.test.ts +0 -14
  101. package/src/__tests__/string.test.ts +0 -164
  102. package/src/__tests__/time.test.ts +0 -110
  103. package/src/collections.ts +0 -850
  104. package/src/events.ts +0 -88
  105. package/src/index.ts +0 -474
  106. package/src/materials.ts +0 -109
  107. package/src/math.ts +0 -674
  108. package/src/physics.ts +0 -141
  109. package/src/spatial.ts +0 -320
  110. package/src/string.basic.test.ts +0 -14
  111. package/src/string.test.ts +0 -335
  112. package/src/string.ts +0 -531
  113. package/src/time.ts +0 -621
  114. package/src/traits/ARTraits.ts +0 -103
  115. package/src/traits/EconomicPrimitives.ts +0 -755
  116. package/src/traits/EconomicTraits.ts +0 -552
  117. package/src/traits/IoTTraits.ts +0 -102
  118. package/src/traits/SimulationLabPrimitives.ts +0 -650
  119. package/src/traits/SimulationLabTraits.ts +0 -191
  120. package/src/traits/VRRTraits.ts +0 -326
  121. package/src/traits/__tests__/ARTraits.test.ts +0 -14
  122. package/src/traits/__tests__/EconomicPrimitives.test.ts +0 -14
  123. package/src/traits/__tests__/EconomicTraits.test.ts +0 -14
  124. package/src/types.ts +0 -411
  125. package/std_error.log +0 -5
  126. package/tsconfig.json +0 -18
  127. package/tsup.config.ts +0 -17
  128. package/vitest.config.ts +0 -10
@@ -1,14 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
-
3
- // Auto-generated test for string-decoupled
4
- // Source: packages/std/src/string.ts
5
-
6
- describe('string-decoupled', () => {
7
- it('should be defined', () => {
8
- // TODO: Import and test string-decoupled
9
- });
10
-
11
- it('should have basic functionality', () => {
12
- // TODO: Add meaningful tests for string-decoupled
13
- });
14
- });
@@ -1,164 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import {
3
- isBlank,
4
- isNotBlank,
5
- capitalize,
6
- titleCase,
7
- camelCase,
8
- pascalCase,
9
- snakeCase,
10
- kebabCase,
11
- constantCase,
12
- } from '../string.js';
13
-
14
- describe('isBlank', () => {
15
- it('should return true for empty string', () => {
16
- expect(isBlank('')).toBe(true);
17
- });
18
-
19
- it('should return true for whitespace only', () => {
20
- expect(isBlank(' ')).toBe(true);
21
- expect(isBlank('\t\n')).toBe(true);
22
- });
23
-
24
- it('should return false for non-empty string', () => {
25
- expect(isBlank('hello')).toBe(false);
26
- expect(isBlank(' hello ')).toBe(false);
27
- });
28
- });
29
-
30
- describe('isNotBlank', () => {
31
- it('should return false for empty string', () => {
32
- expect(isNotBlank('')).toBe(false);
33
- });
34
-
35
- it('should return false for whitespace only', () => {
36
- expect(isNotBlank(' ')).toBe(false);
37
- });
38
-
39
- it('should return true for non-empty string', () => {
40
- expect(isNotBlank('hello')).toBe(true);
41
- });
42
- });
43
-
44
- describe('capitalize', () => {
45
- it('should capitalize first letter', () => {
46
- expect(capitalize('hello')).toBe('Hello');
47
- });
48
-
49
- it('should handle empty string', () => {
50
- expect(capitalize('')).toBe('');
51
- });
52
-
53
- it('should handle already capitalized', () => {
54
- expect(capitalize('Hello')).toBe('Hello');
55
- });
56
-
57
- it('should handle single character', () => {
58
- expect(capitalize('a')).toBe('A');
59
- });
60
- });
61
-
62
- describe('titleCase', () => {
63
- it('should capitalize each word', () => {
64
- expect(titleCase('hello world')).toBe('Hello World');
65
- });
66
-
67
- it('should handle multiple spaces', () => {
68
- expect(titleCase('hello world')).toBe('Hello World');
69
- });
70
-
71
- it('should handle single word', () => {
72
- expect(titleCase('hello')).toBe('Hello');
73
- });
74
- });
75
-
76
- describe('camelCase', () => {
77
- it('should convert space-separated to camelCase', () => {
78
- expect(camelCase('hello world')).toBe('helloWorld');
79
- });
80
-
81
- it('should convert kebab-case to camelCase', () => {
82
- expect(camelCase('hello-world')).toBe('helloWorld');
83
- });
84
-
85
- it('should convert snake_case to camelCase', () => {
86
- expect(camelCase('hello_world')).toBe('helloWorld');
87
- });
88
-
89
- it('should lowercase first letter of PascalCase', () => {
90
- expect(camelCase('HelloWorld')).toBe('helloWorld');
91
- });
92
-
93
- it('should handle empty string', () => {
94
- expect(camelCase('')).toBe('');
95
- });
96
- });
97
-
98
- describe('pascalCase', () => {
99
- it('should convert space-separated to PascalCase', () => {
100
- expect(pascalCase('hello world')).toBe('HelloWorld');
101
- });
102
-
103
- it('should convert kebab-case to PascalCase', () => {
104
- expect(pascalCase('hello-world')).toBe('HelloWorld');
105
- });
106
-
107
- it('should convert snake_case to PascalCase', () => {
108
- expect(pascalCase('hello_world')).toBe('HelloWorld');
109
- });
110
-
111
- it('should handle empty string', () => {
112
- expect(pascalCase('')).toBe('');
113
- });
114
- });
115
-
116
- describe('snakeCase', () => {
117
- it('should convert space-separated to snake_case', () => {
118
- expect(snakeCase('hello world')).toBe('hello_world');
119
- });
120
-
121
- it('should convert camelCase to snake_case', () => {
122
- expect(snakeCase('helloWorld')).toBe('hello_world');
123
- });
124
-
125
- it('should convert PascalCase to snake_case', () => {
126
- expect(snakeCase('HelloWorld')).toBe('hello_world');
127
- });
128
-
129
- it('should convert kebab-case to snake_case', () => {
130
- expect(snakeCase('hello-world')).toBe('hello_world');
131
- });
132
- });
133
-
134
- describe('kebabCase', () => {
135
- it('should convert space-separated to kebab-case', () => {
136
- expect(kebabCase('hello world')).toBe('hello-world');
137
- });
138
-
139
- it('should convert camelCase to kebab-case', () => {
140
- expect(kebabCase('helloWorld')).toBe('hello-world');
141
- });
142
-
143
- it('should convert PascalCase to kebab-case', () => {
144
- expect(kebabCase('HelloWorld')).toBe('hello-world');
145
- });
146
-
147
- it('should convert snake_case to kebab-case', () => {
148
- expect(kebabCase('hello_world')).toBe('hello-world');
149
- });
150
- });
151
-
152
- describe('constantCase', () => {
153
- it('should convert to SCREAMING_SNAKE_CASE', () => {
154
- expect(constantCase('hello world')).toBe('HELLO_WORLD');
155
- });
156
-
157
- it('should convert camelCase to SCREAMING_SNAKE_CASE', () => {
158
- expect(constantCase('helloWorld')).toBe('HELLO_WORLD');
159
- });
160
-
161
- it('should convert kebab-case to SCREAMING_SNAKE_CASE', () => {
162
- expect(constantCase('hello-world')).toBe('HELLO_WORLD');
163
- });
164
- });
@@ -1,110 +0,0 @@
1
- import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
2
- import { now, hrTime, sleep, withTimeout } from '../time.js';
3
-
4
- describe('now', () => {
5
- it('should return current timestamp in milliseconds', () => {
6
- const before = Date.now();
7
- const result = now();
8
- const after = Date.now();
9
-
10
- expect(result).toBeGreaterThanOrEqual(before);
11
- expect(result).toBeLessThanOrEqual(after);
12
- });
13
-
14
- it('should return a number', () => {
15
- expect(typeof now()).toBe('number');
16
- });
17
- });
18
-
19
- describe('hrTime', () => {
20
- it('should return high-resolution timestamp', () => {
21
- const result = hrTime();
22
- expect(typeof result).toBe('number');
23
- expect(result).toBeGreaterThanOrEqual(0);
24
- });
25
-
26
- it('should increase over time', async () => {
27
- const t1 = hrTime();
28
- await sleep(10);
29
- const t2 = hrTime();
30
- expect(t2).toBeGreaterThan(t1);
31
- });
32
- });
33
-
34
- describe('sleep', () => {
35
- beforeEach(() => {
36
- vi.useFakeTimers();
37
- });
38
-
39
- afterEach(() => {
40
- vi.useRealTimers();
41
- });
42
-
43
- it('should return a promise', () => {
44
- const result = sleep(100);
45
- expect(result).toBeInstanceOf(Promise);
46
- vi.runAllTimers();
47
- });
48
-
49
- it('should resolve after specified time', async () => {
50
- let resolved = false;
51
- const promise = sleep(1000).then(() => {
52
- resolved = true;
53
- });
54
-
55
- expect(resolved).toBe(false);
56
-
57
- vi.advanceTimersByTime(500);
58
- await Promise.resolve();
59
- expect(resolved).toBe(false);
60
-
61
- vi.advanceTimersByTime(500);
62
- await promise;
63
- expect(resolved).toBe(true);
64
- });
65
- });
66
-
67
- describe('withTimeout', () => {
68
- beforeEach(() => {
69
- vi.useFakeTimers();
70
- });
71
-
72
- afterEach(() => {
73
- vi.useRealTimers();
74
- });
75
-
76
- it('should resolve if function completes before timeout', async () => {
77
- const fn = async () => {
78
- await sleep(50);
79
- return 'success';
80
- };
81
-
82
- const promise = withTimeout(fn, 1000);
83
- vi.advanceTimersByTime(50);
84
- await vi.runAllTimersAsync();
85
-
86
- const result = await promise;
87
- expect(result).toBe('success');
88
- });
89
-
90
- it('should reject with Timeout error if function takes too long', async () => {
91
- const fn = async () => {
92
- await sleep(2000);
93
- return 'success';
94
- };
95
-
96
- const promise = withTimeout(fn, 100);
97
- vi.advanceTimersByTime(100);
98
-
99
- await expect(promise).rejects.toThrow('Timeout');
100
- });
101
- });
102
-
103
- describe('time utilities - real timers', () => {
104
- it('sleep should actually wait (short duration)', async () => {
105
- const start = Date.now();
106
- await sleep(50);
107
- const elapsed = Date.now() - start;
108
- expect(elapsed).toBeGreaterThanOrEqual(40); // Allow some tolerance
109
- });
110
- });