@babylonjs/smart-filters 1.0.13 → 8.18.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 (258) hide show
  1. package/dist/blockFoundation/aggregateBlock.d.ts +3 -3
  2. package/dist/blockFoundation/aggregateBlock.d.ts.map +1 -1
  3. package/dist/blockFoundation/aggregateBlock.js +1 -2
  4. package/dist/blockFoundation/aggregateBlock.js.map +1 -1
  5. package/dist/blockFoundation/baseBlock.d.ts +2 -2
  6. package/dist/blockFoundation/baseBlock.d.ts.map +1 -1
  7. package/dist/blockFoundation/baseBlock.js +5 -6
  8. package/dist/blockFoundation/baseBlock.js.map +1 -1
  9. package/dist/blockFoundation/customAggregateBlock.d.ts.map +1 -1
  10. package/dist/blockFoundation/customAggregateBlock.js +2 -2
  11. package/dist/blockFoundation/customAggregateBlock.js.map +1 -1
  12. package/dist/blockFoundation/customShaderBlock.d.ts.map +1 -1
  13. package/dist/blockFoundation/customShaderBlock.js +4 -6
  14. package/dist/blockFoundation/customShaderBlock.js.map +1 -1
  15. package/dist/blockFoundation/disableableShaderBlock.d.ts.map +1 -1
  16. package/dist/blockFoundation/disableableShaderBlock.js +4 -4
  17. package/dist/blockFoundation/disableableShaderBlock.js.map +1 -1
  18. package/dist/blockFoundation/index.js +0 -2
  19. package/dist/blockFoundation/index.js.map +1 -1
  20. package/dist/blockFoundation/inputBlock.d.ts +8 -8
  21. package/dist/blockFoundation/inputBlock.d.ts.map +1 -1
  22. package/dist/blockFoundation/inputBlock.deserializer.d.ts +1 -1
  23. package/dist/blockFoundation/inputBlock.deserializer.d.ts.map +1 -1
  24. package/dist/blockFoundation/inputBlock.deserializer.js +1 -1
  25. package/dist/blockFoundation/inputBlock.deserializer.js.map +1 -1
  26. package/dist/blockFoundation/inputBlock.js +7 -7
  27. package/dist/blockFoundation/inputBlock.js.map +1 -1
  28. package/dist/blockFoundation/inputBlock.serialization.types.d.ts.map +1 -1
  29. package/dist/blockFoundation/inputBlock.serializer.d.ts +1 -1
  30. package/dist/blockFoundation/inputBlock.serializer.js +26 -28
  31. package/dist/blockFoundation/inputBlock.serializer.js.map +1 -1
  32. package/dist/blockFoundation/outputBlock.d.ts +4 -9
  33. package/dist/blockFoundation/outputBlock.d.ts.map +1 -1
  34. package/dist/blockFoundation/outputBlock.js +13 -14
  35. package/dist/blockFoundation/outputBlock.js.map +1 -1
  36. package/dist/blockFoundation/shaderBlock.d.ts +4 -4
  37. package/dist/blockFoundation/shaderBlock.d.ts.map +1 -1
  38. package/dist/blockFoundation/shaderBlock.js +13 -19
  39. package/dist/blockFoundation/shaderBlock.js.map +1 -1
  40. package/dist/blockFoundation/textureOptions.d.ts +1 -1
  41. package/dist/blockFoundation/textureOptions.js +1 -1
  42. package/dist/command/command.d.ts +1 -1
  43. package/dist/command/command.js +1 -1
  44. package/dist/command/commandBuffer.d.ts +1 -1
  45. package/dist/command/commandBuffer.d.ts.map +1 -1
  46. package/dist/command/commandBuffer.js +2 -2
  47. package/dist/command/commandBufferDebugger.d.ts +2 -2
  48. package/dist/command/commandBufferDebugger.d.ts.map +1 -1
  49. package/dist/command/commandBufferDebugger.js +1 -1
  50. package/dist/command/commandBufferDebugger.js.map +1 -1
  51. package/dist/command/index.d.ts +3 -1
  52. package/dist/command/index.d.ts.map +1 -1
  53. package/dist/command/index.js +5 -1
  54. package/dist/command/index.js.map +1 -1
  55. package/dist/connection/connectionPoint.d.ts +3 -3
  56. package/dist/connection/connectionPoint.d.ts.map +1 -1
  57. package/dist/connection/connectionPoint.js +2 -2
  58. package/dist/connection/connectionPoint.js.map +1 -1
  59. package/dist/connection/connectionPointCompatibilityState.d.ts +1 -1
  60. package/dist/connection/connectionPointCompatibilityState.js +1 -1
  61. package/dist/connection/connectionPointType.d.ts +3 -3
  62. package/dist/connection/connectionPointType.d.ts.map +1 -1
  63. package/dist/connection/connectionPointWithDefault.d.ts +3 -3
  64. package/dist/connection/connectionPointWithDefault.d.ts.map +1 -1
  65. package/dist/connection/connectionPointWithDefault.js.map +1 -1
  66. package/dist/connection/index.d.ts +2 -1
  67. package/dist/connection/index.d.ts.map +1 -1
  68. package/dist/connection/index.js +3 -3
  69. package/dist/connection/index.js.map +1 -1
  70. package/dist/editorUtils/editableInPropertyPage.d.ts +2 -2
  71. package/dist/editorUtils/editableInPropertyPage.d.ts.map +1 -1
  72. package/dist/editorUtils/editableInPropertyPage.js +2 -2
  73. package/dist/editorUtils/editableInPropertyPage.js.map +1 -1
  74. package/dist/editorUtils/index.d.ts +1 -0
  75. package/dist/editorUtils/index.d.ts.map +1 -1
  76. package/dist/editorUtils/index.js +2 -0
  77. package/dist/editorUtils/index.js.map +1 -1
  78. package/dist/index.d.ts.map +1 -1
  79. package/dist/index.js +1 -1
  80. package/dist/index.js.map +1 -1
  81. package/dist/optimization/dependencyGraph.js.map +1 -1
  82. package/dist/optimization/optimizedShaderBlock.d.ts +4 -4
  83. package/dist/optimization/optimizedShaderBlock.d.ts.map +1 -1
  84. package/dist/optimization/optimizedShaderBlock.js.map +1 -1
  85. package/dist/optimization/smartFilterOptimizer.d.ts +2 -2
  86. package/dist/optimization/smartFilterOptimizer.d.ts.map +1 -1
  87. package/dist/optimization/smartFilterOptimizer.js +34 -57
  88. package/dist/optimization/smartFilterOptimizer.js.map +1 -1
  89. package/dist/runtime/index.d.ts +2 -1
  90. package/dist/runtime/index.d.ts.map +1 -1
  91. package/dist/runtime/index.js +3 -3
  92. package/dist/runtime/index.js.map +1 -1
  93. package/dist/runtime/renderTargetGenerator.d.ts +1 -1
  94. package/dist/runtime/renderTargetGenerator.d.ts.map +1 -1
  95. package/dist/runtime/renderTargetGenerator.js +5 -7
  96. package/dist/runtime/renderTargetGenerator.js.map +1 -1
  97. package/dist/runtime/shaderRuntime.d.ts +7 -7
  98. package/dist/runtime/shaderRuntime.d.ts.map +1 -1
  99. package/dist/runtime/shaderRuntime.js +7 -8
  100. package/dist/runtime/shaderRuntime.js.map +1 -1
  101. package/dist/runtime/smartFilterRuntime.d.ts +3 -3
  102. package/dist/runtime/smartFilterRuntime.d.ts.map +1 -1
  103. package/dist/runtime/smartFilterRuntime.js.map +1 -1
  104. package/dist/runtime/strongRef.d.ts +1 -1
  105. package/dist/runtime/strongRef.js +1 -1
  106. package/dist/serialization/importCustomBlockDefinition.d.ts +1 -1
  107. package/dist/serialization/importCustomBlockDefinition.js +8 -9
  108. package/dist/serialization/importCustomBlockDefinition.js.map +1 -1
  109. package/dist/serialization/index.d.ts +1 -0
  110. package/dist/serialization/index.d.ts.map +1 -1
  111. package/dist/serialization/index.js +3 -0
  112. package/dist/serialization/index.js.map +1 -1
  113. package/dist/serialization/serializedBlockDefinition.d.ts +2 -2
  114. package/dist/serialization/serializedBlockDefinition.d.ts.map +1 -1
  115. package/dist/serialization/serializedShaderBlockDefinition.d.ts +1 -1
  116. package/dist/serialization/serializedShaderBlockDefinition.d.ts.map +1 -1
  117. package/dist/serialization/serializedSmartFilter.d.ts +1 -1
  118. package/dist/serialization/serializedSmartFilter.d.ts.map +1 -1
  119. package/dist/serialization/smartFilterDeserializer.d.ts +6 -6
  120. package/dist/serialization/smartFilterDeserializer.d.ts.map +1 -1
  121. package/dist/serialization/smartFilterDeserializer.js +9 -12
  122. package/dist/serialization/smartFilterDeserializer.js.map +1 -1
  123. package/dist/serialization/smartFilterSerializer.d.ts +2 -2
  124. package/dist/serialization/smartFilterSerializer.d.ts.map +1 -1
  125. package/dist/serialization/smartFilterSerializer.js +10 -13
  126. package/dist/serialization/smartFilterSerializer.js.map +1 -1
  127. package/dist/serialization/v1/defaultBlockSerializer.d.ts +2 -2
  128. package/dist/serialization/v1/defaultBlockSerializer.d.ts.map +1 -1
  129. package/dist/serialization/v1/defaultBlockSerializer.js +1 -1
  130. package/dist/serialization/v1/index.d.ts +1 -0
  131. package/dist/serialization/v1/index.d.ts.map +1 -1
  132. package/dist/serialization/v1/index.js +2 -0
  133. package/dist/serialization/v1/index.js.map +1 -1
  134. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts +3 -3
  135. package/dist/serialization/v1/shaderBlockSerialization.types.d.ts.map +1 -1
  136. package/dist/serialization/v1/smartFilterSerialization.types.d.ts +2 -2
  137. package/dist/serialization/v1/smartFilterSerialization.types.d.ts.map +1 -1
  138. package/dist/smartFilter.d.ts +8 -8
  139. package/dist/smartFilter.d.ts.map +1 -1
  140. package/dist/smartFilter.js +6 -7
  141. package/dist/smartFilter.js.map +1 -1
  142. package/dist/utils/buildTools/buildShaders.d.ts +3 -2
  143. package/dist/utils/buildTools/buildShaders.d.ts.map +1 -1
  144. package/dist/utils/buildTools/buildShaders.js +7 -6
  145. package/dist/utils/buildTools/buildShaders.js.map +1 -1
  146. package/dist/utils/buildTools/convertGlslIntoBlock.d.ts +4 -2
  147. package/dist/utils/buildTools/convertGlslIntoBlock.d.ts.map +1 -1
  148. package/dist/utils/buildTools/convertGlslIntoBlock.js +136 -141
  149. package/dist/utils/buildTools/convertGlslIntoBlock.js.map +1 -1
  150. package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts +4 -4
  151. package/dist/utils/buildTools/convertGlslIntoShaderProgram.d.ts.map +1 -1
  152. package/dist/utils/buildTools/convertGlslIntoShaderProgram.js +55 -48
  153. package/dist/utils/buildTools/convertGlslIntoShaderProgram.js.map +1 -1
  154. package/dist/utils/buildTools/convertShaders.d.ts +8 -5
  155. package/dist/utils/buildTools/convertShaders.d.ts.map +1 -1
  156. package/dist/utils/buildTools/convertShaders.js +38 -14
  157. package/dist/utils/buildTools/convertShaders.js.map +1 -1
  158. package/dist/utils/buildTools/shaderConverter.d.ts +4 -4
  159. package/dist/utils/buildTools/shaderConverter.d.ts.map +1 -1
  160. package/dist/utils/buildTools/shaderConverter.js +17 -21
  161. package/dist/utils/buildTools/shaderConverter.js.map +1 -1
  162. package/dist/utils/buildTools/watchShaders.d.ts +3 -2
  163. package/dist/utils/buildTools/watchShaders.d.ts.map +1 -1
  164. package/dist/utils/buildTools/watchShaders.js +10 -8
  165. package/dist/utils/buildTools/watchShaders.js.map +1 -1
  166. package/dist/utils/index.d.ts +1 -0
  167. package/dist/utils/index.d.ts.map +1 -1
  168. package/dist/utils/index.js +2 -1
  169. package/dist/utils/index.js.map +1 -1
  170. package/dist/utils/renderTargetUtils.d.ts +3 -3
  171. package/dist/utils/renderTargetUtils.d.ts.map +1 -1
  172. package/dist/utils/renderTargetUtils.js +4 -4
  173. package/dist/utils/renderTargetUtils.js.map +1 -1
  174. package/dist/utils/shaderCodeUtils.d.ts +8 -8
  175. package/dist/utils/shaderCodeUtils.d.ts.map +1 -1
  176. package/dist/utils/shaderCodeUtils.js +16 -28
  177. package/dist/utils/shaderCodeUtils.js.map +1 -1
  178. package/dist/utils/textureLoaders.d.ts +2 -2
  179. package/dist/utils/textureLoaders.d.ts.map +1 -1
  180. package/dist/utils/textureLoaders.js +2 -3
  181. package/dist/utils/textureLoaders.js.map +1 -1
  182. package/dist/utils/textureUtils.d.ts +5 -5
  183. package/dist/utils/textureUtils.d.ts.map +1 -1
  184. package/dist/utils/textureUtils.js +1 -1
  185. package/dist/utils/textureUtils.js.map +1 -1
  186. package/dist/version.d.ts +2 -2
  187. package/dist/version.js +2 -2
  188. package/license.md +21 -21
  189. package/package.json +13 -8
  190. package/src/blockFoundation/aggregateBlock.ts +148 -151
  191. package/src/blockFoundation/baseBlock.ts +339 -364
  192. package/src/blockFoundation/customAggregateBlock.ts +88 -104
  193. package/src/blockFoundation/customShaderBlock.ts +312 -326
  194. package/src/blockFoundation/disableableShaderBlock.ts +91 -100
  195. package/src/blockFoundation/index.ts +9 -9
  196. package/src/blockFoundation/inputBlock.deserializer.ts +72 -97
  197. package/src/blockFoundation/inputBlock.serialization.types.ts +126 -132
  198. package/src/blockFoundation/inputBlock.serializer.ts +150 -150
  199. package/src/blockFoundation/inputBlock.ts +181 -192
  200. package/src/blockFoundation/outputBlock.ts +144 -151
  201. package/src/blockFoundation/shaderBlock.ts +156 -163
  202. package/src/blockFoundation/textureOptions.ts +57 -57
  203. package/src/command/command.ts +59 -59
  204. package/src/command/commandBuffer.ts +71 -71
  205. package/src/command/commandBufferDebugger.ts +14 -14
  206. package/src/command/index.ts +7 -3
  207. package/src/connection/connectionPoint.ts +205 -214
  208. package/src/connection/connectionPointCompatibilityState.ts +31 -31
  209. package/src/connection/connectionPointType.ts +45 -45
  210. package/src/connection/connectionPointWithDefault.ts +27 -35
  211. package/src/connection/index.ts +8 -9
  212. package/src/editorUtils/editableInPropertyPage.ts +106 -106
  213. package/src/editorUtils/index.ts +3 -1
  214. package/src/index.ts +16 -15
  215. package/src/optimization/dependencyGraph.ts +96 -96
  216. package/src/optimization/index.ts +1 -1
  217. package/src/optimization/optimizedShaderBlock.ts +131 -134
  218. package/src/optimization/smartFilterOptimizer.ts +757 -825
  219. package/src/runtime/index.ts +8 -6
  220. package/src/runtime/renderTargetGenerator.ts +222 -248
  221. package/src/runtime/shaderRuntime.ts +174 -173
  222. package/src/runtime/smartFilterRuntime.ts +112 -112
  223. package/src/runtime/strongRef.ts +18 -18
  224. package/src/serialization/importCustomBlockDefinition.ts +86 -86
  225. package/src/serialization/index.ts +10 -7
  226. package/src/serialization/serializedBlockDefinition.ts +12 -12
  227. package/src/serialization/serializedShaderBlockDefinition.ts +7 -7
  228. package/src/serialization/serializedSmartFilter.ts +6 -6
  229. package/src/serialization/smartFilterDeserializer.ts +190 -220
  230. package/src/serialization/smartFilterSerializer.ts +110 -121
  231. package/src/serialization/v1/defaultBlockSerializer.ts +21 -21
  232. package/src/serialization/v1/index.ts +4 -2
  233. package/src/serialization/v1/shaderBlockSerialization.types.ts +85 -85
  234. package/src/serialization/v1/smartFilterSerialization.types.ts +129 -133
  235. package/src/smartFilter.ts +255 -260
  236. package/src/utils/buildTools/buildShaders.ts +14 -13
  237. package/src/utils/buildTools/convertGlslIntoBlock.ts +370 -385
  238. package/src/utils/buildTools/convertGlslIntoShaderProgram.ts +173 -172
  239. package/src/utils/buildTools/convertShaders.ts +65 -43
  240. package/src/utils/buildTools/recordVersionNumber.js +17 -0
  241. package/src/utils/buildTools/shaderConverter.ts +466 -478
  242. package/src/utils/buildTools/watchShaders.ts +44 -42
  243. package/src/utils/index.ts +4 -2
  244. package/src/utils/renderTargetUtils.ts +30 -35
  245. package/src/utils/shaderCodeUtils.ts +192 -207
  246. package/src/utils/textureLoaders.ts +31 -43
  247. package/src/utils/textureUtils.ts +28 -32
  248. package/src/version.ts +2 -2
  249. package/dist/utils/buildTools/determineVersion.d.ts +0 -36
  250. package/dist/utils/buildTools/determineVersion.d.ts.map +0 -1
  251. package/dist/utils/buildTools/determineVersion.js +0 -109
  252. package/dist/utils/buildTools/determineVersion.js.map +0 -1
  253. package/dist/utils/buildTools/versionUp.d.ts +0 -2
  254. package/dist/utils/buildTools/versionUp.d.ts.map +0 -1
  255. package/dist/utils/buildTools/versionUp.js +0 -53
  256. package/dist/utils/buildTools/versionUp.js.map +0 -1
  257. package/src/utils/buildTools/determineVersion.ts +0 -128
  258. package/src/utils/buildTools/versionUp.ts +0 -61
@@ -1,32 +1,28 @@
1
- import type { TextureSize } from "@babylonjs/core/Materials/Textures/textureCreationOptions";
2
- import type { OutputTextureOptions } from "../blockFoundation/textureOptions";
3
- import type { SmartFilter } from "../smartFilter";
4
- import type { ThinEngine } from "@babylonjs/core/Engines/thinEngine";
5
-
6
- /**
7
- * Determines the output texture size for a given shader block
8
- * @param smartFilter - The smart filter to use
9
- * @param engine - The engine to use
10
- * @param textureOptions - The texture options to use
11
- * @returns - The output texture size
12
- */
13
- export function getBlockOutputTextureSize(
14
- smartFilter: SmartFilter,
15
- engine: ThinEngine,
16
- textureOptions: OutputTextureOptions
17
- ): TextureSize {
18
- let outputWidth: number;
19
- let outputHeight: number;
20
- const renderTargetWrapper = smartFilter.outputBlock.renderTargetWrapper;
21
- if (renderTargetWrapper) {
22
- outputWidth = renderTargetWrapper.width;
23
- outputHeight = renderTargetWrapper.height;
24
- } else {
25
- outputWidth = engine.getRenderWidth(true);
26
- outputHeight = engine.getRenderHeight(true);
27
- }
28
- return {
29
- width: Math.floor(outputWidth * textureOptions.ratio),
30
- height: Math.floor(outputHeight * textureOptions.ratio),
31
- };
32
- }
1
+ import type { TextureSize } from "core/Materials/Textures/textureCreationOptions.js";
2
+ import type { OutputTextureOptions } from "../blockFoundation/textureOptions.js";
3
+ import type { SmartFilter } from "../smartFilter.js";
4
+ import type { ThinEngine } from "core/Engines/thinEngine.js";
5
+
6
+ /**
7
+ * Determines the output texture size for a given shader block
8
+ * @param smartFilter - The smart filter to use
9
+ * @param engine - The engine to use
10
+ * @param textureOptions - The texture options to use
11
+ * @returns - The output texture size
12
+ */
13
+ export function GetBlockOutputTextureSize(smartFilter: SmartFilter, engine: ThinEngine, textureOptions: OutputTextureOptions): TextureSize {
14
+ let outputWidth: number;
15
+ let outputHeight: number;
16
+ const renderTargetWrapper = smartFilter.outputBlock.renderTargetWrapper;
17
+ if (renderTargetWrapper) {
18
+ outputWidth = renderTargetWrapper.width;
19
+ outputHeight = renderTargetWrapper.height;
20
+ } else {
21
+ outputWidth = engine.getRenderWidth(true);
22
+ outputHeight = engine.getRenderHeight(true);
23
+ }
24
+ return {
25
+ width: Math.floor(outputWidth * textureOptions.ratio),
26
+ height: Math.floor(outputHeight * textureOptions.ratio),
27
+ };
28
+ }
package/src/version.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  /**
2
- * The version of the SmartFilter core. During publish, this file is overwritten by versionUp.ts with the same version that is used for the NPM publish.
2
+ * The version of the SmartFilter core. During publish, this file is overwritten by recordVersionNumber.ts with the same version that is used for the NPM publish.
3
3
  */
4
- export const SmartFilterCoreVersion = "1.0.13";
4
+ export const SmartFilterCoreVersion = "8.18.0";
@@ -1,36 +0,0 @@
1
- import type { Nullable } from "@babylonjs/core/types";
2
- import type { ExecException } from "child_process";
3
- /**
4
- * Takes in a semver string (e.g. "0.1.0" or "0.1.0-alpha") and removes any prerelease flag.
5
- * @param version - The semver string to operate on
6
- * @returns The version string with the prerelease flag removed
7
- */
8
- export declare function removePrereleaseFlags(version: string): string;
9
- /**
10
- * Given the npmVersion, packageJSONVersion, and alpha flag, determines the version to use
11
- * @param npmVersion - The version from the NPM registry
12
- * @param packageJSONVersion - The version from the package.json file
13
- * @param alpha - A flag to indicate if the version should have an alpha prerelease flag
14
- * @returns The version to use
15
- */
16
- export declare function determineVersion(npmVersion: Nullable<string>, packageJSONVersion: string, alpha: boolean): string;
17
- /**
18
- * The supported version types
19
- */
20
- export type VersionType = "preview" | "latest";
21
- /**
22
- * Handles error cases and returns the JSON of the package versions
23
- * @param versionType - The type of version to get
24
- * @param err - The error object
25
- * @param stdout - The stdout string
26
- * @returns The JSON of the package versions
27
- */
28
- export declare function getNpmVersion(versionType: VersionType, err: Nullable<ExecException>, stdout: string): Nullable<string>;
29
- /**
30
- * Compares two semver strings, returning -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
31
- * @param version1 - The first semver string
32
- * @param version2 - The second semver string
33
- * @returns -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
34
- */
35
- export declare function compareVersions(version1: string, version2: string): number;
36
- //# sourceMappingURL=determineVersion.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"determineVersion.d.ts","sourceRoot":"","sources":["../../../src/utils/buildTools/determineVersion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA6BnD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,kBAAkB,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAmBjH;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/C;;;;;;GAMG;AACH,wBAAgB,aAAa,CACzB,WAAW,EAAE,WAAW,EACxB,GAAG,EAAE,QAAQ,CAAC,aAAa,CAAC,EAC5B,MAAM,EAAE,MAAM,GACf,QAAQ,CAAC,MAAM,CAAC,CAWlB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAmB1E"}
@@ -1,109 +0,0 @@
1
- /**
2
- * Determines if the major and minor versions of two semver strings match
3
- * @param version1 - The first semver string
4
- * @param version2 - The second semver string
5
- * @returns True if the major and minor versions match, false otherwise
6
- */
7
- function majorAndMinorVersionsMatch(version1, version2) {
8
- const version1split = version1.split(".");
9
- const version2split = version2.split(".");
10
- return version1split[0] === version2split[0] && version1split[1] === version2split[1];
11
- }
12
- /**
13
- * Takes in a semver string (e.g. "0.1.0") and increments the patch version.
14
- * Note: it does not preserve any prerelease flags in the patch version.
15
- * @param version - The semver string to operate on
16
- * @returns The incremented version string
17
- */
18
- function incrementPatchVersion(version) {
19
- const spl = version.split(".");
20
- if (spl.length < 3) {
21
- throw new Error("version string must have at least 3 parts");
22
- }
23
- spl[spl.length - 1] = (Number.parseInt(spl[spl.length - 1]) + 1).toString();
24
- return spl.join(".");
25
- }
26
- /**
27
- * Takes in a semver string (e.g. "0.1.0" or "0.1.0-alpha") and removes any prerelease flag.
28
- * @param version - The semver string to operate on
29
- * @returns The version string with the prerelease flag removed
30
- */
31
- export function removePrereleaseFlags(version) {
32
- const spl = version.split(".");
33
- if (spl.length < 3) {
34
- throw new Error("version string must have at least 3 parts");
35
- }
36
- spl[spl.length - 1] = Number.parseInt(spl[spl.length - 1]).toString();
37
- return spl.join(".");
38
- }
39
- /**
40
- * Given the npmVersion, packageJSONVersion, and alpha flag, determines the version to use
41
- * @param npmVersion - The version from the NPM registry
42
- * @param packageJSONVersion - The version from the package.json file
43
- * @param alpha - A flag to indicate if the version should have an alpha prerelease flag
44
- * @returns The version to use
45
- */
46
- export function determineVersion(npmVersion, packageJSONVersion, alpha) {
47
- packageJSONVersion = removePrereleaseFlags(packageJSONVersion);
48
- npmVersion = npmVersion === null ? null : removePrereleaseFlags(npmVersion);
49
- let versionToUse;
50
- if (npmVersion === null || !majorAndMinorVersionsMatch(npmVersion, packageJSONVersion)) {
51
- console.log("Major & minor versions do not match: using the current package.json version");
52
- versionToUse = packageJSONVersion;
53
- }
54
- else {
55
- console.log("Major & minor versions match: using the NPM registry version with an incremented patch version.");
56
- versionToUse = incrementPatchVersion(npmVersion);
57
- }
58
- if (alpha) {
59
- console.log("Ensuring -alpha prerelease flag is present");
60
- versionToUse += "-alpha";
61
- }
62
- return versionToUse;
63
- }
64
- /**
65
- * Handles error cases and returns the JSON of the package versions
66
- * @param versionType - The type of version to get
67
- * @param err - The error object
68
- * @param stdout - The stdout string
69
- * @returns The JSON of the package versions
70
- */
71
- export function getNpmVersion(versionType, err, stdout) {
72
- let npmVersion = null;
73
- if ((err === null || err === void 0 ? void 0 : err.message) && err.message.indexOf("E404") !== -1) {
74
- console.warn(`NPM registry does not have any ${versionType} version`);
75
- }
76
- else if (err) {
77
- console.error(err);
78
- throw err;
79
- }
80
- else {
81
- npmVersion = stdout;
82
- }
83
- return npmVersion;
84
- }
85
- /**
86
- * Compares two semver strings, returning -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
87
- * @param version1 - The first semver string
88
- * @param version2 - The second semver string
89
- * @returns -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
90
- */
91
- export function compareVersions(version1, version2) {
92
- const version1split = removePrereleaseFlags(version1).split(".");
93
- const version2split = removePrereleaseFlags(version2).split(".");
94
- if (version1split.length !== 3 || version2split.length !== 3) {
95
- throw new Error("version strings must have 3 parts");
96
- }
97
- for (let i = 0; i < 3; i++) {
98
- const v1 = Number.parseInt(version1split[i]);
99
- const v2 = Number.parseInt(version2split[i]);
100
- if (v1 < v2) {
101
- return -1;
102
- }
103
- else if (v1 > v2) {
104
- return 1;
105
- }
106
- }
107
- return 0;
108
- }
109
- //# sourceMappingURL=determineVersion.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"determineVersion.js","sourceRoot":"","sources":["../../../src/utils/buildTools/determineVersion.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,SAAS,0BAA0B,CAAC,QAAgB,EAAE,QAAgB;IAClE,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC1C,OAAO,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC;AAC1F,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,OAAe;IAC1C,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACjE,CAAC;IACD,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7E,OAAO,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAe;IACjD,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC/B,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IACjE,CAAC;IACD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":3,"file":"versionUp.d.ts","sourceRoot":"","sources":["../../../src/utils/buildTools/versionUp.ts"],"names":[],"mappings":""}
@@ -1,53 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as fs from "fs";
3
- import { exec } from "child_process";
4
- import { compareVersions, determineVersion, getNpmVersion } from "./determineVersion.js";
5
- const alpha = process.argv.includes("--alpha");
6
- const packageText = fs.readFileSync("package.json");
7
- const packageJSON = JSON.parse(packageText.toString());
8
- const packageName = packageJSON.name;
9
- console.log("Processing package:", packageName);
10
- console.log("Alpha flag:", alpha);
11
- console.log("Current package.json version:", packageJSON.version);
12
- /**
13
- * Queries the NPM registry for the specified version type
14
- * @param versionType - The type of version to query
15
- * @param callback - The callback to call with the NPM version
16
- */
17
- function queryNpmFeed(versionType, callback) {
18
- exec(`npm view ${packageName} dist-tags.${versionType}`, (err, stdout) => {
19
- let npmVersion = getNpmVersion(versionType, err, stdout);
20
- if (npmVersion !== null) {
21
- npmVersion = npmVersion.trim();
22
- console.log(`NPM Registry ${versionType} version:`, npmVersion);
23
- }
24
- callback(npmVersion);
25
- });
26
- }
27
- queryNpmFeed("preview", (npmPreviewVersion) => {
28
- queryNpmFeed("latest", (npmLatestVersion) => {
29
- let highestNpmVersion = npmLatestVersion;
30
- if (npmPreviewVersion && (!highestNpmVersion || compareVersions(npmPreviewVersion, highestNpmVersion) === 1)) {
31
- highestNpmVersion = npmPreviewVersion;
32
- }
33
- console.log("Highest NPM Registry version:", highestNpmVersion);
34
- const versionToUse = determineVersion(highestNpmVersion, packageJSON.version, alpha);
35
- console.log("Version to use:", versionToUse);
36
- // Update package.json if needed
37
- if (packageJSON.version !== versionToUse) {
38
- packageJSON.version = versionToUse;
39
- fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 4));
40
- console.log("Version updated in package.json");
41
- }
42
- else {
43
- console.log("No need to update package.json");
44
- }
45
- // Write out to version.ts
46
- const versionTsText = `/**
47
- * The version of the SmartFilter core. During publish, this file is overwritten by versionUp.ts with the same version that is used for the NPM publish.
48
- */
49
- export const SmartFilterCoreVersion = "${versionToUse}";\n`;
50
- fs.writeFileSync("src/version.ts", versionTsText);
51
- });
52
- });
53
- //# sourceMappingURL=versionUp.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"versionUp.js","sourceRoot":"","sources":["../../../src/utils/buildTools/versionUp.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,IAAI,EAAsB,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAoB,MAAM,uBAAuB,CAAC;AAG3G,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AAC/C,MAAM,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEvD,MAAM,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC;AACrC,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,WAAW,CAAC,CAAC;AAChD,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,+BAA+B,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;AAElE;;;;GAIG;AACH,SAAS,YAAY,CAAC,WAAwB,EAAE,QAAgD;IAC5F,IAAI,CAAC,YAAY,WAAW,cAAc,WAAW,EAAE,EAAE,CAAC,GAA4B,EAAE,MAAM,EAAE,EAAE;QAC9F,IAAI,UAAU,GAAG,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;QACzD,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;YACtB,UAAU,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;YAC/B,OAAO,CAAC,G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
@@ -1,128 +0,0 @@
1
- /* eslint-disable no-console */
2
- import type { Nullable } from "@babylonjs/core/types";
3
- import type { ExecException } from "child_process";
4
-
5
- /**
6
- * Determines if the major and minor versions of two semver strings match
7
- * @param version1 - The first semver string
8
- * @param version2 - The second semver string
9
- * @returns True if the major and minor versions match, false otherwise
10
- */
11
- function majorAndMinorVersionsMatch(version1: string, version2: string): boolean {
12
- const version1split = version1.split(".");
13
- const version2split = version2.split(".");
14
- return version1split[0] === version2split[0] && version1split[1] === version2split[1];
15
- }
16
-
17
- /**
18
- * Takes in a semver string (e.g. "0.1.0") and increments the patch version.
19
- * Note: it does not preserve any prerelease flags in the patch version.
20
- * @param version - The semver string to operate on
21
- * @returns The incremented version string
22
- */
23
- function incrementPatchVersion(version: string): string {
24
- const spl = version.split(".");
25
- if (spl.length < 3) {
26
- throw new Error("version string must have at least 3 parts");
27
- }
28
- spl[spl.length - 1] = (Number.parseInt(spl[spl.length - 1]!) + 1).toString();
29
- return spl.join(".");
30
- }
31
-
32
- /**
33
- * Takes in a semver string (e.g. "0.1.0" or "0.1.0-alpha") and removes any prerelease flag.
34
- * @param version - The semver string to operate on
35
- * @returns The version string with the prerelease flag removed
36
- */
37
- export function removePrereleaseFlags(version: string): string {
38
- const spl = version.split(".");
39
- if (spl.length < 3) {
40
- throw new Error("version string must have at least 3 parts");
41
- }
42
- spl[spl.length - 1] = Number.parseInt(spl[spl.length - 1]!).toString();
43
- return spl.join(".");
44
- }
45
-
46
- /**
47
- * Given the npmVersion, packageJSONVersion, and alpha flag, determines the version to use
48
- * @param npmVersion - The version from the NPM registry
49
- * @param packageJSONVersion - The version from the package.json file
50
- * @param alpha - A flag to indicate if the version should have an alpha prerelease flag
51
- * @returns The version to use
52
- */
53
- export function determineVersion(npmVersion: Nullable<string>, packageJSONVersion: string, alpha: boolean): string {
54
- packageJSONVersion = removePrereleaseFlags(packageJSONVersion);
55
- npmVersion = npmVersion === null ? null : removePrereleaseFlags(npmVersion);
56
-
57
- let versionToUse;
58
- if (npmVersion === null || !majorAndMinorVersionsMatch(npmVersion, packageJSONVersion)) {
59
- console.log("Major & minor versions do not match: using the current package.json version");
60
- versionToUse = packageJSONVersion;
61
- } else {
62
- console.log("Major & minor versions match: using the NPM registry version with an incremented patch version.");
63
- versionToUse = incrementPatchVersion(npmVersion);
64
- }
65
-
66
- if (alpha) {
67
- console.log("Ensuring -alpha prerelease flag is present");
68
- versionToUse += "-alpha";
69
- }
70
-
71
- return versionToUse;
72
- }
73
-
74
- /**
75
- * The supported version types
76
- */
77
- export type VersionType = "preview" | "latest";
78
-
79
- /**
80
- * Handles error cases and returns the JSON of the package versions
81
- * @param versionType - The type of version to get
82
- * @param err - The error object
83
- * @param stdout - The stdout string
84
- * @returns The JSON of the package versions
85
- */
86
- export function getNpmVersion(
87
- versionType: VersionType,
88
- err: Nullable<ExecException>,
89
- stdout: string
90
- ): Nullable<string> {
91
- let npmVersion = null;
92
- if (err?.message && err.message.indexOf("E404") !== -1) {
93
- console.warn(`NPM registry does not have any ${versionType} version`);
94
- } else if (err) {
95
- console.error(err);
96
- throw err;
97
- } else {
98
- npmVersion = stdout;
99
- }
100
- return npmVersion;
101
- }
102
-
103
- /**
104
- * Compares two semver strings, returning -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
105
- * @param version1 - The first semver string
106
- * @param version2 - The second semver string
107
- * @returns -1 if version1 is less than version2, 1 if version1 is greater than version2, and 0 if they are equal
108
- */
109
- export function compareVersions(version1: string, version2: string): number {
110
- const version1split = removePrereleaseFlags(version1).split(".");
111
- const version2split = removePrereleaseFlags(version2).split(".");
112
-
113
- if (version1split.length !== 3 || version2split.length !== 3) {
114
- throw new Error("version strings must have 3 parts");
115
- }
116
-
117
- for (let i = 0; i < 3; i++) {
118
- const v1 = Number.parseInt(version1split[i]!);
119
- const v2 = Number.parseInt(version2split[i]!);
120
-
121
- if (v1 < v2) {
122
- return -1;
123
- } else if (v1 > v2) {
124
- return 1;
125
- }
126
- }
127
- return 0;
128
- }
@@ -1,61 +0,0 @@
1
- /* eslint-disable no-console */
2
- import * as fs from "fs";
3
- import { exec, type ExecException } from "child_process";
4
- import { compareVersions, determineVersion, getNpmVersion, type VersionType } from "./determineVersion.js";
5
- import type { Nullable } from "@babylonjs/core/types.js";
6
-
7
- const alpha = process.argv.includes("--alpha");
8
- const packageText = fs.readFileSync("package.json");
9
- const packageJSON = JSON.parse(packageText.toString());
10
-
11
- const packageName = packageJSON.name;
12
- console.log("Processing package:", packageName);
13
- console.log("Alpha flag:", alpha);
14
- console.log("Current package.json version:", packageJSON.version);
15
-
16
- /**
17
- * Queries the NPM registry for the specified version type
18
- * @param versionType - The type of version to query
19
- * @param callback - The callback to call with the NPM version
20
- */
21
- function queryNpmFeed(versionType: VersionType, callback: (npmVersion: Nullable<string>) => void) {
22
- exec(`npm view ${packageName} dist-tags.${versionType}`, (err: Nullable<ExecException>, stdout) => {
23
- let npmVersion = getNpmVersion(versionType, err, stdout);
24
- if (npmVersion !== null) {
25
- npmVersion = npmVersion.trim();
26
- console.log(`NPM Registry ${versionType} version:`, npmVersion);
27
- }
28
- callback(npmVersion);
29
- });
30
- }
31
-
32
- queryNpmFeed("preview", (npmPreviewVersion) => {
33
- queryNpmFeed("latest", (npmLatestVersion) => {
34
- let highestNpmVersion: Nullable<string> = npmLatestVersion;
35
- if (npmPreviewVersion && (!highestNpmVersion || compareVersions(npmPreviewVersion, highestNpmVersion) === 1)) {
36
- highestNpmVersion = npmPreviewVersion;
37
- }
38
-
39
- console.log("Highest NPM Registry version:", highestNpmVersion);
40
-
41
- const versionToUse = determineVersion(highestNpmVersion, packageJSON.version, alpha);
42
-
43
- console.log("Version to use:", versionToUse);
44
-
45
- // Update package.json if needed
46
- if (packageJSON.version !== versionToUse) {
47
- packageJSON.version = versionToUse;
48
- fs.writeFileSync("package.json", JSON.stringify(packageJSON, null, 4));
49
- console.log("Version updated in package.json");
50
- } else {
51
- console.log("No need to update package.json");
52
- }
53
-
54
- // Write out to version.ts
55
- const versionTsText = `/**
56
- * The version of the SmartFilter core. During publish, this file is overwritten by versionUp.ts with the same version that is used for the NPM publish.
57
- */
58
- export const SmartFilterCoreVersion = "${versionToUse}";\n`;
59
- fs.writeFileSync("src/version.ts", versionTsText);
60
- });
61
- });