@al8b/runtime 0.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 (185) hide show
  1. package/README.md +87 -0
  2. package/dist/assets/constructors.d.mts +6 -0
  3. package/dist/assets/constructors.d.ts +6 -0
  4. package/dist/assets/constructors.js +40 -0
  5. package/dist/assets/constructors.js.map +1 -0
  6. package/dist/assets/constructors.mjs +12 -0
  7. package/dist/assets/constructors.mjs.map +1 -0
  8. package/dist/assets/index.d.mts +11 -0
  9. package/dist/assets/index.d.ts +11 -0
  10. package/dist/assets/index.js +276 -0
  11. package/dist/assets/index.js.map +1 -0
  12. package/dist/assets/index.mjs +247 -0
  13. package/dist/assets/index.mjs.map +1 -0
  14. package/dist/assets/loader.d.mts +83 -0
  15. package/dist/assets/loader.d.ts +83 -0
  16. package/dist/assets/loader.js +260 -0
  17. package/dist/assets/loader.js.map +1 -0
  18. package/dist/assets/loader.mjs +237 -0
  19. package/dist/assets/loader.mjs.map +1 -0
  20. package/dist/browser/index.js +16599 -0
  21. package/dist/browser/index.js.map +1 -0
  22. package/dist/browser/index.min.js +171 -0
  23. package/dist/constants.d.mts +16 -0
  24. package/dist/constants.d.ts +16 -0
  25. package/dist/constants.js +49 -0
  26. package/dist/constants.js.map +1 -0
  27. package/dist/constants.mjs +18 -0
  28. package/dist/constants.mjs.map +1 -0
  29. package/dist/core/api-factory.d.mts +63 -0
  30. package/dist/core/api-factory.d.ts +63 -0
  31. package/dist/core/api-factory.js +239 -0
  32. package/dist/core/api-factory.js.map +1 -0
  33. package/dist/core/api-factory.mjs +214 -0
  34. package/dist/core/api-factory.mjs.map +1 -0
  35. package/dist/core/assets-registry.d.mts +14 -0
  36. package/dist/core/assets-registry.d.ts +14 -0
  37. package/dist/core/assets-registry.js +64 -0
  38. package/dist/core/assets-registry.js.map +1 -0
  39. package/dist/core/assets-registry.mjs +41 -0
  40. package/dist/core/assets-registry.mjs.map +1 -0
  41. package/dist/core/controller.d.mts +109 -0
  42. package/dist/core/controller.d.ts +109 -0
  43. package/dist/core/controller.js +1782 -0
  44. package/dist/core/controller.js.map +1 -0
  45. package/dist/core/controller.mjs +1758 -0
  46. package/dist/core/controller.mjs.map +1 -0
  47. package/dist/core/debug-logger.d.mts +35 -0
  48. package/dist/core/debug-logger.d.ts +35 -0
  49. package/dist/core/debug-logger.js +177 -0
  50. package/dist/core/debug-logger.js.map +1 -0
  51. package/dist/core/debug-logger.mjs +154 -0
  52. package/dist/core/debug-logger.mjs.map +1 -0
  53. package/dist/core/error-handler.d.mts +25 -0
  54. package/dist/core/error-handler.d.ts +25 -0
  55. package/dist/core/error-handler.js +106 -0
  56. package/dist/core/error-handler.js.map +1 -0
  57. package/dist/core/error-handler.mjs +81 -0
  58. package/dist/core/error-handler.mjs.map +1 -0
  59. package/dist/core/index.d.mts +14 -0
  60. package/dist/core/index.d.ts +14 -0
  61. package/dist/core/index.js +1782 -0
  62. package/dist/core/index.js.map +1 -0
  63. package/dist/core/index.mjs +1757 -0
  64. package/dist/core/index.mjs.map +1 -0
  65. package/dist/hot-reload/index.d.mts +7 -0
  66. package/dist/hot-reload/index.d.ts +7 -0
  67. package/dist/hot-reload/index.js +103 -0
  68. package/dist/hot-reload/index.js.map +1 -0
  69. package/dist/hot-reload/index.mjs +78 -0
  70. package/dist/hot-reload/index.mjs.map +1 -0
  71. package/dist/hot-reload/updater.d.mts +33 -0
  72. package/dist/hot-reload/updater.d.ts +33 -0
  73. package/dist/hot-reload/updater.js +101 -0
  74. package/dist/hot-reload/updater.js.map +1 -0
  75. package/dist/hot-reload/updater.mjs +78 -0
  76. package/dist/hot-reload/updater.mjs.map +1 -0
  77. package/dist/index.d.mts +24 -0
  78. package/dist/index.d.ts +24 -0
  79. package/dist/index.js +1859 -0
  80. package/dist/index.js.map +1 -0
  81. package/dist/index.mjs +1817 -0
  82. package/dist/index.mjs.map +1 -0
  83. package/dist/input/index.d.mts +2 -0
  84. package/dist/input/index.d.ts +2 -0
  85. package/dist/input/index.js +79 -0
  86. package/dist/input/index.js.map +1 -0
  87. package/dist/input/index.mjs +54 -0
  88. package/dist/input/index.mjs.map +1 -0
  89. package/dist/input/manager.d.mts +37 -0
  90. package/dist/input/manager.d.ts +37 -0
  91. package/dist/input/manager.js +77 -0
  92. package/dist/input/manager.js.map +1 -0
  93. package/dist/input/manager.mjs +54 -0
  94. package/dist/input/manager.mjs.map +1 -0
  95. package/dist/loop/game-loop.d.mts +63 -0
  96. package/dist/loop/game-loop.d.ts +63 -0
  97. package/dist/loop/game-loop.js +156 -0
  98. package/dist/loop/game-loop.js.map +1 -0
  99. package/dist/loop/game-loop.mjs +131 -0
  100. package/dist/loop/game-loop.mjs.map +1 -0
  101. package/dist/loop/index.d.mts +1 -0
  102. package/dist/loop/index.d.ts +1 -0
  103. package/dist/loop/index.js +156 -0
  104. package/dist/loop/index.js.map +1 -0
  105. package/dist/loop/index.mjs +131 -0
  106. package/dist/loop/index.mjs.map +1 -0
  107. package/dist/storage/index.d.mts +1 -0
  108. package/dist/storage/index.d.ts +1 -0
  109. package/dist/storage/index.js +31 -0
  110. package/dist/storage/index.js.map +1 -0
  111. package/dist/storage/index.mjs +6 -0
  112. package/dist/storage/index.mjs.map +1 -0
  113. package/dist/system/api.d.mts +28 -0
  114. package/dist/system/api.d.ts +28 -0
  115. package/dist/system/api.js +126 -0
  116. package/dist/system/api.js.map +1 -0
  117. package/dist/system/api.mjs +101 -0
  118. package/dist/system/api.mjs.map +1 -0
  119. package/dist/system/index.d.mts +2 -0
  120. package/dist/system/index.d.ts +2 -0
  121. package/dist/system/index.js +126 -0
  122. package/dist/system/index.js.map +1 -0
  123. package/dist/system/index.mjs +101 -0
  124. package/dist/system/index.mjs.map +1 -0
  125. package/dist/types/assets.d.mts +43 -0
  126. package/dist/types/assets.d.ts +43 -0
  127. package/dist/types/assets.js +19 -0
  128. package/dist/types/assets.js.map +1 -0
  129. package/dist/types/assets.mjs +1 -0
  130. package/dist/types/assets.mjs.map +1 -0
  131. package/dist/types/bridge.d.mts +66 -0
  132. package/dist/types/bridge.d.ts +66 -0
  133. package/dist/types/bridge.js +19 -0
  134. package/dist/types/bridge.js.map +1 -0
  135. package/dist/types/bridge.mjs +1 -0
  136. package/dist/types/bridge.mjs.map +1 -0
  137. package/dist/types/index.d.mts +6 -0
  138. package/dist/types/index.d.ts +6 -0
  139. package/dist/types/index.js +19 -0
  140. package/dist/types/index.js.map +1 -0
  141. package/dist/types/index.mjs +1 -0
  142. package/dist/types/index.mjs.map +1 -0
  143. package/dist/types/runtime.d.mts +71 -0
  144. package/dist/types/runtime.d.ts +71 -0
  145. package/dist/types/runtime.js +19 -0
  146. package/dist/types/runtime.js.map +1 -0
  147. package/dist/types/runtime.mjs +1 -0
  148. package/dist/types/runtime.mjs.map +1 -0
  149. package/dist/types/vm.d.mts +1 -0
  150. package/dist/types/vm.d.ts +1 -0
  151. package/dist/types/vm.js +19 -0
  152. package/dist/types/vm.js.map +1 -0
  153. package/dist/types/vm.mjs +1 -0
  154. package/dist/types/vm.mjs.map +1 -0
  155. package/dist/utils/deep-clone.d.mts +14 -0
  156. package/dist/utils/deep-clone.d.ts +14 -0
  157. package/dist/utils/deep-clone.js +42 -0
  158. package/dist/utils/deep-clone.js.map +1 -0
  159. package/dist/utils/deep-clone.mjs +19 -0
  160. package/dist/utils/deep-clone.mjs.map +1 -0
  161. package/dist/utils/index.d.mts +3 -0
  162. package/dist/utils/index.d.ts +3 -0
  163. package/dist/utils/index.js +156 -0
  164. package/dist/utils/index.js.map +1 -0
  165. package/dist/utils/index.mjs +129 -0
  166. package/dist/utils/index.mjs.map +1 -0
  167. package/dist/utils/object-pool.d.mts +66 -0
  168. package/dist/utils/object-pool.d.ts +66 -0
  169. package/dist/utils/object-pool.js +113 -0
  170. package/dist/utils/object-pool.js.map +1 -0
  171. package/dist/utils/object-pool.mjs +90 -0
  172. package/dist/utils/object-pool.mjs.map +1 -0
  173. package/dist/utils/shallow-equal.d.mts +15 -0
  174. package/dist/utils/shallow-equal.d.ts +15 -0
  175. package/dist/utils/shallow-equal.js +53 -0
  176. package/dist/utils/shallow-equal.js.map +1 -0
  177. package/dist/utils/shallow-equal.mjs +30 -0
  178. package/dist/utils/shallow-equal.mjs.map +1 -0
  179. package/dist/vm/index.d.mts +1 -0
  180. package/dist/vm/index.d.ts +1 -0
  181. package/dist/vm/index.js +37 -0
  182. package/dist/vm/index.js.map +1 -0
  183. package/dist/vm/index.mjs +9 -0
  184. package/dist/vm/index.mjs.map +1 -0
  185. package/package.json +52 -0
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types/vm.ts
17
+ var vm_exports = {};
18
+ module.exports = __toCommonJS(vm_exports);
19
+ //# sourceMappingURL=vm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/vm.ts"],"sourcesContent":["// VM types are re-exported from ../vm/index.ts — import from there or directly from \"@al8b/vm\".\nexport type {\n\tErrorInfo,\n\tGlobalAPI,\n\tMetaFunctions,\n\tSystemAPI,\n\tVMContext,\n\tVMWarnings,\n\tWarningInfo,\n} from \"@al8b/vm\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=vm.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Deep clone utility using structuredClone
3
+ */
4
+ /**
5
+ * Deep clone a value using the native structuredClone API
6
+ * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.
7
+ * Does NOT support: Functions, Symbols, DOM nodes
8
+ *
9
+ * @param value The value to deep clone
10
+ * @returns A deep clone of the value
11
+ */
12
+ declare function deepClone(value: unknown): unknown;
13
+
14
+ export { deepClone };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Deep clone utility using structuredClone
3
+ */
4
+ /**
5
+ * Deep clone a value using the native structuredClone API
6
+ * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.
7
+ * Does NOT support: Functions, Symbols, DOM nodes
8
+ *
9
+ * @param value The value to deep clone
10
+ * @returns A deep clone of the value
11
+ */
12
+ declare function deepClone(value: unknown): unknown;
13
+
14
+ export { deepClone };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/utils/deep-clone.ts
22
+ var deep_clone_exports = {};
23
+ __export(deep_clone_exports, {
24
+ deepClone: () => deepClone
25
+ });
26
+ module.exports = __toCommonJS(deep_clone_exports);
27
+ function deepClone(value) {
28
+ if (typeof structuredClone !== "undefined") {
29
+ return structuredClone(value);
30
+ }
31
+ try {
32
+ return JSON.parse(JSON.stringify(value));
33
+ } catch {
34
+ return value;
35
+ }
36
+ }
37
+ __name(deepClone, "deepClone");
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ deepClone
41
+ });
42
+ //# sourceMappingURL=deep-clone.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/deep-clone.ts"],"sourcesContent":["/**\n * Deep clone utility using structuredClone\n */\n\n/**\n * Deep clone a value using the native structuredClone API\n * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.\n * Does NOT support: Functions, Symbols, DOM nodes\n *\n * @param value The value to deep clone\n * @returns A deep clone of the value\n */\nexport function deepClone(value: unknown): unknown {\n\t// Use native structuredClone if available (Node 17.5+, modern browsers)\n\tif (typeof structuredClone !== \"undefined\") {\n\t\treturn structuredClone(value);\n\t}\n\n\t// Fallback for older environments: JSON round-trip\n\t// WARNING: This loses Date, Map, Set, undefined, Function, Symbol values\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\t// If JSON fails (circular reference, etc.), return the original\n\t\t// This is safe but means mutations will affect the original\n\t\treturn value;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAYO,SAASA,UAAUC,OAAc;AAEvC,MAAI,OAAOC,oBAAoB,aAAa;AAC3C,WAAOA,gBAAgBD,KAAAA;EACxB;AAIA,MAAI;AACH,WAAOE,KAAKC,MAAMD,KAAKE,UAAUJ,KAAAA,CAAAA;EAClC,QAAQ;AAGP,WAAOA;EACR;AACD;AAfgBD;","names":["deepClone","value","structuredClone","JSON","parse","stringify"]}
@@ -0,0 +1,19 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/utils/deep-clone.ts
5
+ function deepClone(value) {
6
+ if (typeof structuredClone !== "undefined") {
7
+ return structuredClone(value);
8
+ }
9
+ try {
10
+ return JSON.parse(JSON.stringify(value));
11
+ } catch {
12
+ return value;
13
+ }
14
+ }
15
+ __name(deepClone, "deepClone");
16
+ export {
17
+ deepClone
18
+ };
19
+ //# sourceMappingURL=deep-clone.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/deep-clone.ts"],"sourcesContent":["/**\n * Deep clone utility using structuredClone\n */\n\n/**\n * Deep clone a value using the native structuredClone API\n * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.\n * Does NOT support: Functions, Symbols, DOM nodes\n *\n * @param value The value to deep clone\n * @returns A deep clone of the value\n */\nexport function deepClone(value: unknown): unknown {\n\t// Use native structuredClone if available (Node 17.5+, modern browsers)\n\tif (typeof structuredClone !== \"undefined\") {\n\t\treturn structuredClone(value);\n\t}\n\n\t// Fallback for older environments: JSON round-trip\n\t// WARNING: This loses Date, Map, Set, undefined, Function, Symbol values\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\t// If JSON fails (circular reference, etc.), return the original\n\t\t// This is safe but means mutations will affect the original\n\t\treturn value;\n\t}\n}\n"],"mappings":";;;;AAYO,SAASA,UAAUC,OAAc;AAEvC,MAAI,OAAOC,oBAAoB,aAAa;AAC3C,WAAOA,gBAAgBD,KAAAA;EACxB;AAIA,MAAI;AACH,WAAOE,KAAKC,MAAMD,KAAKE,UAAUJ,KAAAA,CAAAA;EAClC,QAAQ;AAGP,WAAOA;EACR;AACD;AAfgBD;","names":["deepClone","value","structuredClone","JSON","parse","stringify"]}
@@ -0,0 +1,3 @@
1
+ export { deepClone } from './deep-clone.mjs';
2
+ export { ObjectPool } from './object-pool.mjs';
3
+ export { shallowEqual } from './shallow-equal.mjs';
@@ -0,0 +1,3 @@
1
+ export { deepClone } from './deep-clone.js';
2
+ export { ObjectPool } from './object-pool.js';
3
+ export { shallowEqual } from './shallow-equal.js';
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/utils/index.ts
22
+ var utils_exports = {};
23
+ __export(utils_exports, {
24
+ ObjectPool: () => ObjectPool,
25
+ deepClone: () => deepClone,
26
+ shallowEqual: () => shallowEqual
27
+ });
28
+ module.exports = __toCommonJS(utils_exports);
29
+
30
+ // src/utils/deep-clone.ts
31
+ function deepClone(value) {
32
+ if (typeof structuredClone !== "undefined") {
33
+ return structuredClone(value);
34
+ }
35
+ try {
36
+ return JSON.parse(JSON.stringify(value));
37
+ } catch {
38
+ return value;
39
+ }
40
+ }
41
+ __name(deepClone, "deepClone");
42
+
43
+ // src/utils/object-pool.ts
44
+ var ObjectPool = class {
45
+ static {
46
+ __name(this, "ObjectPool");
47
+ }
48
+ pool = [];
49
+ factory;
50
+ reset;
51
+ maxSize;
52
+ /**
53
+ * Create a new object pool
54
+ *
55
+ * @param factory - Function to create new objects
56
+ * @param reset - Function to reset object state for reuse
57
+ * @param maxSize - Maximum pool size (default: 100)
58
+ */
59
+ constructor(factory, reset, maxSize = 100) {
60
+ this.factory = factory;
61
+ this.reset = reset;
62
+ this.maxSize = maxSize;
63
+ }
64
+ /**
65
+ * Acquire an object from the pool
66
+ *
67
+ * Returns a new object if pool is empty, otherwise reuses a pooled object.
68
+ *
69
+ * @returns Object from pool or newly created
70
+ */
71
+ acquire() {
72
+ if (this.pool.length > 0) {
73
+ return this.pool.pop();
74
+ }
75
+ return this.factory();
76
+ }
77
+ /**
78
+ * Release an object back to the pool
79
+ *
80
+ * Resets the object and adds it back to the pool for reuse.
81
+ * If pool is at max size, the object is discarded.
82
+ *
83
+ * @param obj - Object to release
84
+ */
85
+ release(obj) {
86
+ if (this.pool.length >= this.maxSize) {
87
+ return;
88
+ }
89
+ this.reset(obj);
90
+ this.pool.push(obj);
91
+ }
92
+ /**
93
+ * Clear all objects from the pool
94
+ */
95
+ clear() {
96
+ this.pool = [];
97
+ }
98
+ /**
99
+ * Get current pool size
100
+ *
101
+ * @returns Number of objects in pool
102
+ */
103
+ size() {
104
+ return this.pool.length;
105
+ }
106
+ /**
107
+ * Get maximum pool size
108
+ *
109
+ * @returns Maximum pool size
110
+ */
111
+ getMaxSize() {
112
+ return this.maxSize;
113
+ }
114
+ /**
115
+ * Set maximum pool size
116
+ *
117
+ * @param maxSize - New maximum pool size
118
+ */
119
+ setMaxSize(maxSize) {
120
+ this.maxSize = maxSize;
121
+ if (this.pool.length > maxSize) {
122
+ this.pool = this.pool.slice(0, maxSize);
123
+ }
124
+ }
125
+ };
126
+
127
+ // src/utils/shallow-equal.ts
128
+ function shallowEqual(a, b) {
129
+ if (a === b) {
130
+ return true;
131
+ }
132
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
133
+ return false;
134
+ }
135
+ const aObj = a;
136
+ const bObj = b;
137
+ const aKeys = Object.keys(aObj);
138
+ const bKeys = Object.keys(bObj);
139
+ if (aKeys.length !== bKeys.length) {
140
+ return false;
141
+ }
142
+ for (const key of aKeys) {
143
+ if (!(key in bObj) || aObj[key] !== bObj[key]) {
144
+ return false;
145
+ }
146
+ }
147
+ return true;
148
+ }
149
+ __name(shallowEqual, "shallowEqual");
150
+ // Annotate the CommonJS export names for ESM import in node:
151
+ 0 && (module.exports = {
152
+ ObjectPool,
153
+ deepClone,
154
+ shallowEqual
155
+ });
156
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/index.ts","../../src/utils/deep-clone.ts","../../src/utils/object-pool.ts","../../src/utils/shallow-equal.ts"],"sourcesContent":["/**\n * Runtime utilities\n */\n\nexport * from \"./deep-clone\";\nexport * from \"./object-pool\";\nexport * from \"./shallow-equal\";\n","/**\n * Deep clone utility using structuredClone\n */\n\n/**\n * Deep clone a value using the native structuredClone API\n * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.\n * Does NOT support: Functions, Symbols, DOM nodes\n *\n * @param value The value to deep clone\n * @returns A deep clone of the value\n */\nexport function deepClone(value: unknown): unknown {\n\t// Use native structuredClone if available (Node 17.5+, modern browsers)\n\tif (typeof structuredClone !== \"undefined\") {\n\t\treturn structuredClone(value);\n\t}\n\n\t// Fallback for older environments: JSON round-trip\n\t// WARNING: This loses Date, Map, Set, undefined, Function, Symbol values\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\t// If JSON fails (circular reference, etc.), return the original\n\t\t// This is safe but means mutations will affect the original\n\t\treturn value;\n\t}\n}\n","/**\n * Object Pool utility for game entities\n *\n * Provides object pooling to reduce GC pressure and improve performance\n * for frequently created/destroyed game objects.\n */\n\n/**\n * Object pool for reusing objects\n *\n * @template T - Type of objects in the pool\n */\nexport class ObjectPool<T> {\n\tprivate pool: T[] = [];\n\tprivate factory: () => T;\n\tprivate reset: (obj: T) => void;\n\tprivate maxSize: number;\n\n\t/**\n\t * Create a new object pool\n\t *\n\t * @param factory - Function to create new objects\n\t * @param reset - Function to reset object state for reuse\n\t * @param maxSize - Maximum pool size (default: 100)\n\t */\n\tconstructor(factory: () => T, reset: (obj: T) => void, maxSize: number = 100) {\n\t\tthis.factory = factory;\n\t\tthis.reset = reset;\n\t\tthis.maxSize = maxSize;\n\t}\n\n\t/**\n\t * Acquire an object from the pool\n\t *\n\t * Returns a new object if pool is empty, otherwise reuses a pooled object.\n\t *\n\t * @returns Object from pool or newly created\n\t */\n\tacquire(): T {\n\t\tif (this.pool.length > 0) {\n\t\t\treturn this.pool.pop()!;\n\t\t}\n\t\treturn this.factory();\n\t}\n\n\t/**\n\t * Release an object back to the pool\n\t *\n\t * Resets the object and adds it back to the pool for reuse.\n\t * If pool is at max size, the object is discarded.\n\t *\n\t * @param obj - Object to release\n\t */\n\trelease(obj: T): void {\n\t\tif (this.pool.length >= this.maxSize) {\n\t\t\t// Pool is full, discard object\n\t\t\treturn;\n\t\t}\n\n\t\tthis.reset(obj);\n\t\tthis.pool.push(obj);\n\t}\n\n\t/**\n\t * Clear all objects from the pool\n\t */\n\tclear(): void {\n\t\tthis.pool = [];\n\t}\n\n\t/**\n\t * Get current pool size\n\t *\n\t * @returns Number of objects in pool\n\t */\n\tsize(): number {\n\t\treturn this.pool.length;\n\t}\n\n\t/**\n\t * Get maximum pool size\n\t *\n\t * @returns Maximum pool size\n\t */\n\tgetMaxSize(): number {\n\t\treturn this.maxSize;\n\t}\n\n\t/**\n\t * Set maximum pool size\n\t *\n\t * @param maxSize - New maximum pool size\n\t */\n\tsetMaxSize(maxSize: number): void {\n\t\tthis.maxSize = maxSize;\n\t\t// Trim pool if it exceeds new max size\n\t\tif (this.pool.length > maxSize) {\n\t\t\tthis.pool = this.pool.slice(0, maxSize);\n\t\t}\n\t}\n}\n","/**\n * Shallow equality comparison for objects and arrays\n */\n\n/**\n * Compare two values for shallow equality\n * For objects and arrays, only checks if top-level properties have the same references\n * For primitives, uses === comparison\n *\n * @param a First value\n * @param b Second value\n * @returns true if values are shallowly equal\n */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n\t// Same reference\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\t// Different types\n\tif (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) {\n\t\treturn false;\n\t}\n\n\tconst aObj = a as Record<string, unknown>;\n\tconst bObj = b as Record<string, unknown>;\n\n\t// Get keys\n\tconst aKeys = Object.keys(aObj);\n\tconst bKeys = Object.keys(bObj);\n\n\t// Different number of keys\n\tif (aKeys.length !== bKeys.length) {\n\t\treturn false;\n\t}\n\n\t// Check all keys have same reference values\n\tfor (const key of aKeys) {\n\t\tif (!(key in bObj) || aObj[key] !== bObj[key]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACYO,SAASA,UAAUC,OAAc;AAEvC,MAAI,OAAOC,oBAAoB,aAAa;AAC3C,WAAOA,gBAAgBD,KAAAA;EACxB;AAIA,MAAI;AACH,WAAOE,KAAKC,MAAMD,KAAKE,UAAUJ,KAAAA,CAAAA;EAClC,QAAQ;AAGP,WAAOA;EACR;AACD;AAfgBD;;;ACAT,IAAMM,aAAN,MAAMA;EAZb,OAYaA;;;EACJC,OAAY,CAAA;EACZC;EACAC;EACAC;;;;;;;;EASR,YAAYF,SAAkBC,OAAyBC,UAAkB,KAAK;AAC7E,SAAKF,UAAUA;AACf,SAAKC,QAAQA;AACb,SAAKC,UAAUA;EAChB;;;;;;;;EASAC,UAAa;AACZ,QAAI,KAAKJ,KAAKK,SAAS,GAAG;AACzB,aAAO,KAAKL,KAAKM,IAAG;IACrB;AACA,WAAO,KAAKL,QAAO;EACpB;;;;;;;;;EAUAM,QAAQC,KAAc;AACrB,QAAI,KAAKR,KAAKK,UAAU,KAAKF,SAAS;AAErC;IACD;AAEA,SAAKD,MAAMM,GAAAA;AACX,SAAKR,KAAKS,KAAKD,GAAAA;EAChB;;;;EAKAE,QAAc;AACb,SAAKV,OAAO,CAAA;EACb;;;;;;EAOAW,OAAe;AACd,WAAO,KAAKX,KAAKK;EAClB;;;;;;EAOAO,aAAqB;AACpB,WAAO,KAAKT;EACb;;;;;;EAOAU,WAAWV,SAAuB;AACjC,SAAKA,UAAUA;AAEf,QAAI,KAAKH,KAAKK,SAASF,SAAS;AAC/B,WAAKH,OAAO,KAAKA,KAAKc,MAAM,GAAGX,OAAAA;IAChC;EACD;AACD;;;ACvFO,SAASY,aAAaC,GAAYC,GAAU;AAElD,MAAID,MAAMC,GAAG;AACZ,WAAO;EACR;AAGA,MAAI,OAAOD,MAAM,YAAY,OAAOC,MAAM,YAAYD,MAAM,QAAQC,MAAM,MAAM;AAC/E,WAAO;EACR;AAEA,QAAMC,OAAOF;AACb,QAAMG,OAAOF;AAGb,QAAMG,QAAQC,OAAOC,KAAKJ,IAAAA;AAC1B,QAAMK,QAAQF,OAAOC,KAAKH,IAAAA;AAG1B,MAAIC,MAAMI,WAAWD,MAAMC,QAAQ;AAClC,WAAO;EACR;AAGA,aAAWC,OAAOL,OAAO;AACxB,QAAI,EAAEK,OAAON,SAASD,KAAKO,GAAAA,MAASN,KAAKM,GAAAA,GAAM;AAC9C,aAAO;IACR;EACD;AAEA,SAAO;AACR;AA/BgBV;","names":["deepClone","value","structuredClone","JSON","parse","stringify","ObjectPool","pool","factory","reset","maxSize","acquire","length","pop","release","obj","push","clear","size","getMaxSize","setMaxSize","slice","shallowEqual","a","b","aObj","bObj","aKeys","Object","keys","bKeys","length","key"]}
@@ -0,0 +1,129 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/utils/deep-clone.ts
5
+ function deepClone(value) {
6
+ if (typeof structuredClone !== "undefined") {
7
+ return structuredClone(value);
8
+ }
9
+ try {
10
+ return JSON.parse(JSON.stringify(value));
11
+ } catch {
12
+ return value;
13
+ }
14
+ }
15
+ __name(deepClone, "deepClone");
16
+
17
+ // src/utils/object-pool.ts
18
+ var ObjectPool = class {
19
+ static {
20
+ __name(this, "ObjectPool");
21
+ }
22
+ pool = [];
23
+ factory;
24
+ reset;
25
+ maxSize;
26
+ /**
27
+ * Create a new object pool
28
+ *
29
+ * @param factory - Function to create new objects
30
+ * @param reset - Function to reset object state for reuse
31
+ * @param maxSize - Maximum pool size (default: 100)
32
+ */
33
+ constructor(factory, reset, maxSize = 100) {
34
+ this.factory = factory;
35
+ this.reset = reset;
36
+ this.maxSize = maxSize;
37
+ }
38
+ /**
39
+ * Acquire an object from the pool
40
+ *
41
+ * Returns a new object if pool is empty, otherwise reuses a pooled object.
42
+ *
43
+ * @returns Object from pool or newly created
44
+ */
45
+ acquire() {
46
+ if (this.pool.length > 0) {
47
+ return this.pool.pop();
48
+ }
49
+ return this.factory();
50
+ }
51
+ /**
52
+ * Release an object back to the pool
53
+ *
54
+ * Resets the object and adds it back to the pool for reuse.
55
+ * If pool is at max size, the object is discarded.
56
+ *
57
+ * @param obj - Object to release
58
+ */
59
+ release(obj) {
60
+ if (this.pool.length >= this.maxSize) {
61
+ return;
62
+ }
63
+ this.reset(obj);
64
+ this.pool.push(obj);
65
+ }
66
+ /**
67
+ * Clear all objects from the pool
68
+ */
69
+ clear() {
70
+ this.pool = [];
71
+ }
72
+ /**
73
+ * Get current pool size
74
+ *
75
+ * @returns Number of objects in pool
76
+ */
77
+ size() {
78
+ return this.pool.length;
79
+ }
80
+ /**
81
+ * Get maximum pool size
82
+ *
83
+ * @returns Maximum pool size
84
+ */
85
+ getMaxSize() {
86
+ return this.maxSize;
87
+ }
88
+ /**
89
+ * Set maximum pool size
90
+ *
91
+ * @param maxSize - New maximum pool size
92
+ */
93
+ setMaxSize(maxSize) {
94
+ this.maxSize = maxSize;
95
+ if (this.pool.length > maxSize) {
96
+ this.pool = this.pool.slice(0, maxSize);
97
+ }
98
+ }
99
+ };
100
+
101
+ // src/utils/shallow-equal.ts
102
+ function shallowEqual(a, b) {
103
+ if (a === b) {
104
+ return true;
105
+ }
106
+ if (typeof a !== "object" || typeof b !== "object" || a === null || b === null) {
107
+ return false;
108
+ }
109
+ const aObj = a;
110
+ const bObj = b;
111
+ const aKeys = Object.keys(aObj);
112
+ const bKeys = Object.keys(bObj);
113
+ if (aKeys.length !== bKeys.length) {
114
+ return false;
115
+ }
116
+ for (const key of aKeys) {
117
+ if (!(key in bObj) || aObj[key] !== bObj[key]) {
118
+ return false;
119
+ }
120
+ }
121
+ return true;
122
+ }
123
+ __name(shallowEqual, "shallowEqual");
124
+ export {
125
+ ObjectPool,
126
+ deepClone,
127
+ shallowEqual
128
+ };
129
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/deep-clone.ts","../../src/utils/object-pool.ts","../../src/utils/shallow-equal.ts"],"sourcesContent":["/**\n * Deep clone utility using structuredClone\n */\n\n/**\n * Deep clone a value using the native structuredClone API\n * Supports all structured-cloneable types: objects, arrays, primitives, Date, Set, Map, etc.\n * Does NOT support: Functions, Symbols, DOM nodes\n *\n * @param value The value to deep clone\n * @returns A deep clone of the value\n */\nexport function deepClone(value: unknown): unknown {\n\t// Use native structuredClone if available (Node 17.5+, modern browsers)\n\tif (typeof structuredClone !== \"undefined\") {\n\t\treturn structuredClone(value);\n\t}\n\n\t// Fallback for older environments: JSON round-trip\n\t// WARNING: This loses Date, Map, Set, undefined, Function, Symbol values\n\ttry {\n\t\treturn JSON.parse(JSON.stringify(value));\n\t} catch {\n\t\t// If JSON fails (circular reference, etc.), return the original\n\t\t// This is safe but means mutations will affect the original\n\t\treturn value;\n\t}\n}\n","/**\n * Object Pool utility for game entities\n *\n * Provides object pooling to reduce GC pressure and improve performance\n * for frequently created/destroyed game objects.\n */\n\n/**\n * Object pool for reusing objects\n *\n * @template T - Type of objects in the pool\n */\nexport class ObjectPool<T> {\n\tprivate pool: T[] = [];\n\tprivate factory: () => T;\n\tprivate reset: (obj: T) => void;\n\tprivate maxSize: number;\n\n\t/**\n\t * Create a new object pool\n\t *\n\t * @param factory - Function to create new objects\n\t * @param reset - Function to reset object state for reuse\n\t * @param maxSize - Maximum pool size (default: 100)\n\t */\n\tconstructor(factory: () => T, reset: (obj: T) => void, maxSize: number = 100) {\n\t\tthis.factory = factory;\n\t\tthis.reset = reset;\n\t\tthis.maxSize = maxSize;\n\t}\n\n\t/**\n\t * Acquire an object from the pool\n\t *\n\t * Returns a new object if pool is empty, otherwise reuses a pooled object.\n\t *\n\t * @returns Object from pool or newly created\n\t */\n\tacquire(): T {\n\t\tif (this.pool.length > 0) {\n\t\t\treturn this.pool.pop()!;\n\t\t}\n\t\treturn this.factory();\n\t}\n\n\t/**\n\t * Release an object back to the pool\n\t *\n\t * Resets the object and adds it back to the pool for reuse.\n\t * If pool is at max size, the object is discarded.\n\t *\n\t * @param obj - Object to release\n\t */\n\trelease(obj: T): void {\n\t\tif (this.pool.length >= this.maxSize) {\n\t\t\t// Pool is full, discard object\n\t\t\treturn;\n\t\t}\n\n\t\tthis.reset(obj);\n\t\tthis.pool.push(obj);\n\t}\n\n\t/**\n\t * Clear all objects from the pool\n\t */\n\tclear(): void {\n\t\tthis.pool = [];\n\t}\n\n\t/**\n\t * Get current pool size\n\t *\n\t * @returns Number of objects in pool\n\t */\n\tsize(): number {\n\t\treturn this.pool.length;\n\t}\n\n\t/**\n\t * Get maximum pool size\n\t *\n\t * @returns Maximum pool size\n\t */\n\tgetMaxSize(): number {\n\t\treturn this.maxSize;\n\t}\n\n\t/**\n\t * Set maximum pool size\n\t *\n\t * @param maxSize - New maximum pool size\n\t */\n\tsetMaxSize(maxSize: number): void {\n\t\tthis.maxSize = maxSize;\n\t\t// Trim pool if it exceeds new max size\n\t\tif (this.pool.length > maxSize) {\n\t\t\tthis.pool = this.pool.slice(0, maxSize);\n\t\t}\n\t}\n}\n","/**\n * Shallow equality comparison for objects and arrays\n */\n\n/**\n * Compare two values for shallow equality\n * For objects and arrays, only checks if top-level properties have the same references\n * For primitives, uses === comparison\n *\n * @param a First value\n * @param b Second value\n * @returns true if values are shallowly equal\n */\nexport function shallowEqual(a: unknown, b: unknown): boolean {\n\t// Same reference\n\tif (a === b) {\n\t\treturn true;\n\t}\n\n\t// Different types\n\tif (typeof a !== \"object\" || typeof b !== \"object\" || a === null || b === null) {\n\t\treturn false;\n\t}\n\n\tconst aObj = a as Record<string, unknown>;\n\tconst bObj = b as Record<string, unknown>;\n\n\t// Get keys\n\tconst aKeys = Object.keys(aObj);\n\tconst bKeys = Object.keys(bObj);\n\n\t// Different number of keys\n\tif (aKeys.length !== bKeys.length) {\n\t\treturn false;\n\t}\n\n\t// Check all keys have same reference values\n\tfor (const key of aKeys) {\n\t\tif (!(key in bObj) || aObj[key] !== bObj[key]) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\n"],"mappings":";;;;AAYO,SAASA,UAAUC,OAAc;AAEvC,MAAI,OAAOC,oBAAoB,aAAa;AAC3C,WAAOA,gBAAgBD,KAAAA;EACxB;AAIA,MAAI;AACH,WAAOE,KAAKC,MAAMD,KAAKE,UAAUJ,KAAAA,CAAAA;EAClC,QAAQ;AAGP,WAAOA;EACR;AACD;AAfgBD;;;ACAT,IAAMM,aAAN,MAAMA;EAZb,OAYaA;;;EACJC,OAAY,CAAA;EACZC;EACAC;EACAC;;;;;;;;EASR,YAAYF,SAAkBC,OAAyBC,UAAkB,KAAK;AAC7E,SAAKF,UAAUA;AACf,SAAKC,QAAQA;AACb,SAAKC,UAAUA;EAChB;;;;;;;;EASAC,UAAa;AACZ,QAAI,KAAKJ,KAAKK,SAAS,GAAG;AACzB,aAAO,KAAKL,KAAKM,IAAG;IACrB;AACA,WAAO,KAAKL,QAAO;EACpB;;;;;;;;;EAUAM,QAAQC,KAAc;AACrB,QAAI,KAAKR,KAAKK,UAAU,KAAKF,SAAS;AAErC;IACD;AAEA,SAAKD,MAAMM,GAAAA;AACX,SAAKR,KAAKS,KAAKD,GAAAA;EAChB;;;;EAKAE,QAAc;AACb,SAAKV,OAAO,CAAA;EACb;;;;;;EAOAW,OAAe;AACd,WAAO,KAAKX,KAAKK;EAClB;;;;;;EAOAO,aAAqB;AACpB,WAAO,KAAKT;EACb;;;;;;EAOAU,WAAWV,SAAuB;AACjC,SAAKA,UAAUA;AAEf,QAAI,KAAKH,KAAKK,SAASF,SAAS;AAC/B,WAAKH,OAAO,KAAKA,KAAKc,MAAM,GAAGX,OAAAA;IAChC;EACD;AACD;;;ACvFO,SAASY,aAAaC,GAAYC,GAAU;AAElD,MAAID,MAAMC,GAAG;AACZ,WAAO;EACR;AAGA,MAAI,OAAOD,MAAM,YAAY,OAAOC,MAAM,YAAYD,MAAM,QAAQC,MAAM,MAAM;AAC/E,WAAO;EACR;AAEA,QAAMC,OAAOF;AACb,QAAMG,OAAOF;AAGb,QAAMG,QAAQC,OAAOC,KAAKJ,IAAAA;AAC1B,QAAMK,QAAQF,OAAOC,KAAKH,IAAAA;AAG1B,MAAIC,MAAMI,WAAWD,MAAMC,QAAQ;AAClC,WAAO;EACR;AAGA,aAAWC,OAAOL,OAAO;AACxB,QAAI,EAAEK,OAAON,SAASD,KAAKO,GAAAA,MAASN,KAAKM,GAAAA,GAAM;AAC9C,aAAO;IACR;EACD;AAEA,SAAO;AACR;AA/BgBV;","names":["deepClone","value","structuredClone","JSON","parse","stringify","ObjectPool","pool","factory","reset","maxSize","acquire","length","pop","release","obj","push","clear","size","getMaxSize","setMaxSize","slice","shallowEqual","a","b","aObj","bObj","aKeys","Object","keys","bKeys","length","key"]}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Object Pool utility for game entities
3
+ *
4
+ * Provides object pooling to reduce GC pressure and improve performance
5
+ * for frequently created/destroyed game objects.
6
+ */
7
+ /**
8
+ * Object pool for reusing objects
9
+ *
10
+ * @template T - Type of objects in the pool
11
+ */
12
+ declare class ObjectPool<T> {
13
+ private pool;
14
+ private factory;
15
+ private reset;
16
+ private maxSize;
17
+ /**
18
+ * Create a new object pool
19
+ *
20
+ * @param factory - Function to create new objects
21
+ * @param reset - Function to reset object state for reuse
22
+ * @param maxSize - Maximum pool size (default: 100)
23
+ */
24
+ constructor(factory: () => T, reset: (obj: T) => void, maxSize?: number);
25
+ /**
26
+ * Acquire an object from the pool
27
+ *
28
+ * Returns a new object if pool is empty, otherwise reuses a pooled object.
29
+ *
30
+ * @returns Object from pool or newly created
31
+ */
32
+ acquire(): T;
33
+ /**
34
+ * Release an object back to the pool
35
+ *
36
+ * Resets the object and adds it back to the pool for reuse.
37
+ * If pool is at max size, the object is discarded.
38
+ *
39
+ * @param obj - Object to release
40
+ */
41
+ release(obj: T): void;
42
+ /**
43
+ * Clear all objects from the pool
44
+ */
45
+ clear(): void;
46
+ /**
47
+ * Get current pool size
48
+ *
49
+ * @returns Number of objects in pool
50
+ */
51
+ size(): number;
52
+ /**
53
+ * Get maximum pool size
54
+ *
55
+ * @returns Maximum pool size
56
+ */
57
+ getMaxSize(): number;
58
+ /**
59
+ * Set maximum pool size
60
+ *
61
+ * @param maxSize - New maximum pool size
62
+ */
63
+ setMaxSize(maxSize: number): void;
64
+ }
65
+
66
+ export { ObjectPool };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Object Pool utility for game entities
3
+ *
4
+ * Provides object pooling to reduce GC pressure and improve performance
5
+ * for frequently created/destroyed game objects.
6
+ */
7
+ /**
8
+ * Object pool for reusing objects
9
+ *
10
+ * @template T - Type of objects in the pool
11
+ */
12
+ declare class ObjectPool<T> {
13
+ private pool;
14
+ private factory;
15
+ private reset;
16
+ private maxSize;
17
+ /**
18
+ * Create a new object pool
19
+ *
20
+ * @param factory - Function to create new objects
21
+ * @param reset - Function to reset object state for reuse
22
+ * @param maxSize - Maximum pool size (default: 100)
23
+ */
24
+ constructor(factory: () => T, reset: (obj: T) => void, maxSize?: number);
25
+ /**
26
+ * Acquire an object from the pool
27
+ *
28
+ * Returns a new object if pool is empty, otherwise reuses a pooled object.
29
+ *
30
+ * @returns Object from pool or newly created
31
+ */
32
+ acquire(): T;
33
+ /**
34
+ * Release an object back to the pool
35
+ *
36
+ * Resets the object and adds it back to the pool for reuse.
37
+ * If pool is at max size, the object is discarded.
38
+ *
39
+ * @param obj - Object to release
40
+ */
41
+ release(obj: T): void;
42
+ /**
43
+ * Clear all objects from the pool
44
+ */
45
+ clear(): void;
46
+ /**
47
+ * Get current pool size
48
+ *
49
+ * @returns Number of objects in pool
50
+ */
51
+ size(): number;
52
+ /**
53
+ * Get maximum pool size
54
+ *
55
+ * @returns Maximum pool size
56
+ */
57
+ getMaxSize(): number;
58
+ /**
59
+ * Set maximum pool size
60
+ *
61
+ * @param maxSize - New maximum pool size
62
+ */
63
+ setMaxSize(maxSize: number): void;
64
+ }
65
+
66
+ export { ObjectPool };