vivth 1.4.10 → 1.5.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 (379) hide show
  1. package/README.md +6060 -2037
  2. package/README.src.md +22 -14
  3. package/bun.lock +154 -194
  4. package/dev/auto/.src.ignore +28 -0
  5. package/dev/auto-doc.mjs +137 -0
  6. package/generated/types/generated/vivth/exports/all.d.mts +145 -0
  7. package/generated/types/generated/vivth/exports/neutral.d.mts +105 -0
  8. package/generated/types/generated/vivth/exports/node.d.mts +40 -0
  9. package/generated/types/src/bundler/CompileAS.d.mts +30 -0
  10. package/generated/types/src/bundler/CompileJS.d.mts +109 -0
  11. package/{types → generated/types}/src/bundler/CreateESPlugin.d.mts +1 -1
  12. package/{types → generated/types}/src/bundler/EsBundler.d.mts +9 -7
  13. package/generated/types/src/bundler/FSAnalyzer.d.mts +58 -0
  14. package/generated/types/src/bundler/FSasar.bundled.d.mts +28 -0
  15. package/generated/types/src/bundler/FSasar.d.mts +51 -0
  16. package/generated/types/src/bundler/FileSelfMapper.d.mts +137 -0
  17. package/generated/types/src/bundler/JSDirMapper.d.mts +128 -0
  18. package/generated/types/src/bundler/RunWatchThenCompileJSOnSafeExit.d.mts +63 -0
  19. package/generated/types/src/bundler/adds/BrowserExternals.d.mts +21 -0
  20. package/generated/types/src/bundler/adds/CreateTransform.d.mts +26 -0
  21. package/generated/types/src/bundler/adds/LastEditedUnix.d.mts +5 -0
  22. package/generated/types/src/bundler/adds/NodeModuleList.d.mts +15 -0
  23. package/generated/types/src/bundler/adds/PathFSBundles.bundled.d.mts +25 -0
  24. package/generated/types/src/bundler/adds/PathFSBundles.d.mts +48 -0
  25. package/generated/types/src/bundler/adds/PathFSDir.bundled.d.mts +30 -0
  26. package/generated/types/src/bundler/adds/PathFSDir.d.mts +48 -0
  27. package/generated/types/src/bundler/adds/PathFSFile.bundled.d.mts +25 -0
  28. package/generated/types/src/bundler/adds/PathFSFile.d.mts +40 -0
  29. package/{types → generated/types}/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -6
  30. package/generated/types/src/bundler/adds/autoExternalize.d.mts +2 -0
  31. package/generated/types/src/bundler/adds/emptyBufferValue.d.mts +1 -0
  32. package/generated/types/src/bundler/adds/isModuleTheBundledVersion.d.mts +1 -0
  33. package/generated/types/src/bundler/adds/onEndEsBuildErrorLogger.d.mts +1 -0
  34. package/generated/types/src/bundler/adds/resolveJSDependencyPath.d.mts +1 -0
  35. package/generated/types/src/class/AwaitSignal.d.mts +48 -0
  36. package/generated/types/src/class/Console.d.mts +82 -0
  37. package/generated/types/src/class/DataLog.d.mts +25 -0
  38. package/generated/types/src/class/Derived.d.mts +74 -0
  39. package/generated/types/src/class/Effect.d.mts +213 -0
  40. package/{types → generated/types}/src/class/EnvSignal.d.mts +6 -2
  41. package/generated/types/src/class/EsWatcher.d.mts +36 -0
  42. package/{types → generated/types}/src/class/EventSignal.d.mts +39 -39
  43. package/generated/types/src/class/FSDirArchWatcher.d.mts +110 -0
  44. package/{types → generated/types}/src/class/FileSafe.d.mts +32 -16
  45. package/generated/types/src/class/ForEach.d.mts +57 -0
  46. package/generated/types/src/class/ForSignal.d.mts +63 -0
  47. package/generated/types/src/class/GetterSetter.d.mts +38 -0
  48. package/generated/types/src/class/JSONFileHandler.d.mts +50 -0
  49. package/{types → generated/types}/src/class/ListSignal.d.mts +49 -15
  50. package/{types → generated/types}/src/class/LitExp.d.mts +18 -18
  51. package/generated/types/src/class/ObjectSignal.d.mts +267 -0
  52. package/generated/types/src/class/Paths.d.mts +95 -0
  53. package/generated/types/src/class/Prettivy.d.mts +26 -0
  54. package/{types → generated/types}/src/class/QChannel.d.mts +24 -16
  55. package/generated/types/src/class/SafeExit.d.mts +69 -0
  56. package/{types → generated/types}/src/class/Setup.d.mts +29 -16
  57. package/{types → generated/types}/src/class/Signal.d.mts +29 -15
  58. package/generated/types/src/class/SignalCollection.d.mts +96 -0
  59. package/{types → generated/types}/src/class/WalkThrough.d.mts +4 -19
  60. package/generated/types/src/class/WorkerMainThread.bundled.d.mts +83 -0
  61. package/{types → generated/types}/src/class/WorkerMainThread.d.mts +33 -39
  62. package/{types → generated/types}/src/class/WorkerThread.d.mts +11 -5
  63. package/{types → generated/types}/src/common/Base64URL.d.mts +2 -1
  64. package/generated/types/src/common/Base64URLFromFile.d.mts +20 -0
  65. package/generated/types/src/common/BundledV.bundled.d.mts +3 -0
  66. package/generated/types/src/common/BundledV.d.mts +36 -0
  67. package/{types → generated/types}/src/common/CreateStringID.d.mts +5 -4
  68. package/generated/types/src/common/EnvMode.d.mts +79 -0
  69. package/generated/types/src/common/FactoryKey.d.mts +9 -0
  70. package/generated/types/src/common/Preferrence.d.mts +25 -0
  71. package/{types → generated/types}/src/common/Trace.d.mts +1 -1
  72. package/{types → generated/types}/src/common/TracePath.d.mts +1 -1
  73. package/generated/types/src/common/VivthUnBundledCodeBlock.d.mts +6 -0
  74. package/generated/types/src/doc/JSautoDOC.d.mts +172 -0
  75. package/generated/types/src/doc/cleanPreserveTypedef.d.mts +1 -0
  76. package/{types/src/doc/parsedFile.d.mts → generated/types/src/doc/parsedFileForDOC.d.mts} +56 -27
  77. package/generated/types/src/function/ClearRequireCache.d.mts +1 -0
  78. package/{types → generated/types}/src/function/CreateImmutable.d.mts +5 -4
  79. package/{types → generated/types}/src/function/EventCheck.d.mts +3 -1
  80. package/{types → generated/types}/src/function/EventObject.d.mts +2 -6
  81. package/generated/types/src/function/ForInAsync.d.mts +36 -0
  82. package/generated/types/src/function/ForInSync.d.mts +36 -0
  83. package/generated/types/src/function/ForOfAsync.d.mts +25 -0
  84. package/generated/types/src/function/ForOfSync.d.mts +36 -0
  85. package/generated/types/src/function/GetBufferFromRelativePath.d.mts +15 -0
  86. package/generated/types/src/function/GetFilesFromDir.d.mts +14 -0
  87. package/generated/types/src/function/GetMaxFilenameLength.d.mts +9 -0
  88. package/generated/types/src/function/GetModuleEsbuildPlatform.d.mts +13 -0
  89. package/{types → generated/types}/src/function/GetNamedImportAlias.d.mts +1 -1
  90. package/generated/types/src/function/GetRuntime.d.mts +2 -0
  91. package/generated/types/src/function/InstantiateAssemblyScript.d.mts +15 -0
  92. package/{types → generated/types}/src/function/IsAsync.d.mts +1 -1
  93. package/generated/types/src/function/IsInstanceOf.d.mts +25 -0
  94. package/generated/types/src/function/IsSameFile.d.mts +16 -0
  95. package/generated/types/src/function/IsStringLooksLikeAPath.d.mts +16 -0
  96. package/generated/types/src/function/IsTypeOf.d.mts +25 -0
  97. package/{types → generated/types}/src/function/LazyFactory.d.mts +9 -10
  98. package/generated/types/src/function/MonkeyPatch.d.mts +33 -0
  99. package/generated/types/src/function/NewAnimationTimeline.d.mts +24 -0
  100. package/generated/types/src/function/NewChainable.d.mts +35 -0
  101. package/generated/types/src/function/NewDynamicsExport.d.mts +49 -0
  102. package/generated/types/src/function/NewObjectWrapper.d.mts +10 -0
  103. package/generated/types/src/function/ObjectRegistrar.d.mts +17 -0
  104. package/generated/types/src/function/ParseSQLFile.d.mts +25 -0
  105. package/generated/types/src/function/PipeAsync.d.mts +19 -0
  106. package/generated/types/src/function/PipeSync.d.mts +17 -0
  107. package/generated/types/src/function/SafeImport.d.mts +21 -0
  108. package/generated/types/src/function/TemplateLiteral.d.mts +23 -0
  109. package/{types → generated/types}/src/function/Timeout.d.mts +1 -1
  110. package/{types → generated/types}/src/function/Tries.d.mts +4 -4
  111. package/{types → generated/types}/src/function/TryAsync.d.mts +2 -2
  112. package/{types → generated/types}/src/function/TryNew.d.mts +1 -1
  113. package/generated/types/src/function/TsToMjs.d.mts +27 -0
  114. package/generated/types/src/function/UniqueFSTempName.d.mts +9 -0
  115. package/generated/types/src/function/errorToMessage.d.mts +5 -0
  116. package/generated/types/src/neinth/VivthyNeinth.d.mts +202 -0
  117. package/generated/types/src/typehints/ArrayToKeys.d.mts +23 -0
  118. package/generated/types/src/typehints/AssemblyScriptExportsType.d.mts +4 -0
  119. package/generated/types/src/typehints/AssemblyScriptLoaderInstantiate.d.mts +4 -0
  120. package/generated/types/src/typehints/AutoDocASOptions.d.mts +15 -0
  121. package/generated/types/src/typehints/ChainableType.d.mts +3 -0
  122. package/generated/types/src/typehints/ComponentDecorator_Constructor.d.mts +3 -0
  123. package/generated/types/src/typehints/ConsoleAdditionalSettingType.d.mts +3 -0
  124. package/generated/types/src/typehints/Decorator.d.mts +11 -0
  125. package/generated/types/src/typehints/DecoratorMonkeyPatch.d.mts +15 -0
  126. package/{types/src/types → generated/types/src/typehints}/DevTestCB.d.mts +2 -2
  127. package/generated/types/src/typehints/EnvModeType.d.mts +4 -0
  128. package/generated/types/src/typehints/ListArg.d.mts +4 -0
  129. package/generated/types/src/typehints/MonkeyPatchedType.d.mts +1 -0
  130. package/generated/types/src/typehints/ParametersFollowingN.d.mts +13 -0
  131. package/generated/types/src/typehints/PrefixedKeysOf.d.mts +1 -0
  132. package/generated/types/src/typehints/Runtime.d.mts +4 -0
  133. package/generated/types/src/typehints/SafeImportReturnType.d.mts +1 -0
  134. package/generated/types/src/typehints/StylePropRefType.d.mts +2 -0
  135. package/generated/types/src/typehints/TemplateLiteralValueHandler.d.mts +10 -0
  136. package/generated/types/src/typehints/VLifecycleCallbacks.d.mts +6 -0
  137. package/generated/types/src/typehints/VivthCleanup.d.mts +12 -0
  138. package/generated/types/src/web/BrowserDirMapper.d.mts +70 -0
  139. package/generated/types/src/web/EnsureValidTag.d.mts +7 -0
  140. package/generated/types/src/web/ViteAddDynamics.d.mts +28 -0
  141. package/generated/types/src/web/ViteGetAllHTMLFile.d.mts +9 -0
  142. package/generated/types/src/web/WC_extendsA.d.mts +135 -0
  143. package/generated/types/src/web/WC_extendsB.d.mts +135 -0
  144. package/generated/types/src/web/bindings/WC_StyleProp_bind.d.mts +42 -0
  145. package/generated/types/src/web/bindings/WC_createElement_bind.d.mts +51 -0
  146. package/generated/types/src/web/bindings/WC_createNamedSlot.d.mts +26 -0
  147. package/generated/types/src/web/bindings/WC_litRender_bind.d.mts +20 -0
  148. package/generated/types/src/web/bindings/WC_litStyleMap.d.mts +7 -0
  149. package/generated/types/src/web/common/CSS.d.mts +23 -0
  150. package/generated/types/src/web/common/E.d.mts +41 -0
  151. package/generated/types/src/web/common/NewStyleSheetAsync.d.mts +15 -0
  152. package/generated/types/src/web/common/NewStyleSheetSync.d.mts +15 -0
  153. package/generated/types/src/web/common/WC_TagName_type.d.mts +15 -0
  154. package/generated/types/src/web/signals/IsInViewPortSignal.d.mts +52 -0
  155. package/generated/types/src/web/signals/ObserverSignal.d.mts +32 -0
  156. package/generated/types/src/web/signals/WC_litRef.d.mts +26 -0
  157. package/generated/types/src/web/signals/WC_loopedSiblingsRef.d.mts +44 -0
  158. package/generated/vivth/exports/all.mjs +233 -0
  159. package/generated/vivth/exports/neutral.mjs +193 -0
  160. package/generated/vivth/exports/node.mjs +46 -0
  161. package/package.json +78 -42
  162. package/src/bundler/CompileAS.mjs +36 -0
  163. package/src/bundler/CompileJS.mjs +98 -171
  164. package/src/bundler/CreateESPlugin.mjs +1 -1
  165. package/src/bundler/EsBundler.mjs +38 -13
  166. package/src/bundler/FSAnalyzer.mjs +253 -0
  167. package/src/bundler/FSasar.bundled.mjs +128 -0
  168. package/src/bundler/FSasar.mjs +96 -0
  169. package/src/bundler/FileSelfMapper.mjs +491 -0
  170. package/src/bundler/JSDirMapper.mjs +528 -0
  171. package/src/bundler/RunWatchThenCompileJSOnSafeExit.mjs +129 -0
  172. package/src/bundler/adds/BrowserExternals.mjs +37 -0
  173. package/src/bundler/adds/CreateTransform.mjs +36 -0
  174. package/src/bundler/adds/LastEditedUnix.mjs +12 -0
  175. package/src/bundler/adds/NodeModuleList.mjs +33 -0
  176. package/src/bundler/adds/PathFSBundles.bundled.mjs +41 -0
  177. package/src/bundler/adds/PathFSBundles.mjs +91 -0
  178. package/src/bundler/adds/PathFSDir.bundled.mjs +53 -0
  179. package/src/bundler/adds/PathFSDir.mjs +100 -0
  180. package/src/bundler/adds/PathFSFile.bundled.mjs +40 -0
  181. package/src/bundler/adds/PathFSFile.mjs +85 -0
  182. package/src/bundler/adds/ToBundledJSPlugin.mjs +116 -55
  183. package/src/bundler/adds/autoExternalize.mjs +81 -0
  184. package/src/bundler/adds/emptyBufferValue.mjs +5 -0
  185. package/src/bundler/adds/isModuleTheBundledVersion.mjs +10 -0
  186. package/src/bundler/adds/onEndEsBuildErrorLogger.mjs +34 -0
  187. package/src/bundler/adds/resolveJSDependencyPath.mjs +17 -0
  188. package/src/class/AwaitSignal.mjs +119 -0
  189. package/src/class/Console.mjs +36 -14
  190. package/src/class/DataLog.mjs +29 -0
  191. package/src/class/Derived.mjs +67 -55
  192. package/src/class/Effect.mjs +270 -84
  193. package/src/class/EnvSignal.mjs +11 -8
  194. package/src/class/EsWatcher.mjs +60 -0
  195. package/src/class/EventSignal.mjs +46 -58
  196. package/src/class/FSDirArchWatcher.mjs +246 -0
  197. package/src/class/FileSafe.mjs +72 -24
  198. package/src/class/ForEach.mjs +78 -0
  199. package/src/class/ForSignal.mjs +115 -0
  200. package/src/class/GetterSetter.mjs +40 -0
  201. package/src/class/JSONFileHandler.mjs +90 -0
  202. package/src/class/ListSignal.mjs +68 -26
  203. package/src/class/LitExp.mjs +59 -36
  204. package/src/class/ObjectSignal.mjs +225 -0
  205. package/src/class/Paths.mjs +56 -20
  206. package/src/class/Prettivy.mjs +51 -0
  207. package/src/class/QChannel.mjs +48 -26
  208. package/src/class/SafeExit.mjs +156 -99
  209. package/src/class/Setup.mjs +28 -16
  210. package/src/class/Signal.mjs +50 -27
  211. package/src/class/SignalCollection.mjs +130 -0
  212. package/src/class/WalkThrough.mjs +6 -23
  213. package/src/class/{WorkerMainThreadBundled.mjs → WorkerMainThread.bundled.mjs} +56 -77
  214. package/src/class/WorkerMainThread.mjs +98 -94
  215. package/src/class/WorkerThread.mjs +24 -17
  216. package/src/common/Base64URL.mjs +6 -3
  217. package/src/common/Base64URLFromFile.mjs +17 -4
  218. package/src/common/BundledV.bundled.mjs +7 -0
  219. package/src/common/BundledV.mjs +45 -0
  220. package/src/common/CreateStringID.mjs +8 -7
  221. package/src/common/EnvMode.mjs +172 -0
  222. package/src/common/FactoryKey.mjs +11 -0
  223. package/src/common/Preferrence.mjs +27 -0
  224. package/src/common/Trace.mjs +1 -1
  225. package/src/common/TracePath.mjs +53 -3
  226. package/src/common/VivthUnBundledCodeBlock.mjs +8 -0
  227. package/src/doc/JSautoDOC.mjs +673 -284
  228. package/src/doc/cleanPreserveTypedef.mjs +27 -0
  229. package/src/doc/correctBeforeParse.mjs +57 -48
  230. package/src/doc/{parsedFile.mjs → parsedFileForDOC.mjs} +133 -120
  231. package/src/function/ClearRequireCache.mjs +33 -0
  232. package/src/function/CreateImmutable.mjs +40 -37
  233. package/src/function/EventCheck.mjs +5 -2
  234. package/src/function/EventObject.mjs +2 -6
  235. package/src/function/ForInAsync.mjs +76 -0
  236. package/src/function/ForInSync.mjs +87 -0
  237. package/src/function/ForOfAsync.mjs +61 -0
  238. package/src/function/ForOfSync.mjs +70 -0
  239. package/src/function/GetBufferFromRelativePath.mjs +25 -0
  240. package/src/function/GetFilesFromDir.mjs +49 -0
  241. package/src/function/GetMaxFilenameLength.mjs +32 -0
  242. package/src/function/GetModuleEsbuildPlatform.mjs +118 -0
  243. package/src/function/GetNamedImportAlias.mjs +2 -2
  244. package/src/function/GetRuntime.mjs +10 -14
  245. package/src/function/InstantiateAssemblyScript.mjs +22 -0
  246. package/src/function/IsAsync.mjs +1 -1
  247. package/src/function/IsInstanceOf.mjs +29 -0
  248. package/src/function/IsSameFile.mjs +41 -0
  249. package/src/function/IsStringLooksLikeAPath.mjs +20 -0
  250. package/src/function/IsTypeOf.mjs +27 -0
  251. package/src/function/IsTypeOf.mts +31 -0
  252. package/src/function/LazyFactory.mjs +25 -23
  253. package/src/function/MonkeyPatch.mjs +38 -0
  254. package/src/function/NewAnimationTimeline.mjs +55 -0
  255. package/src/function/NewChainable.mjs +69 -0
  256. package/src/function/NewDynamicsExport.mjs +312 -0
  257. package/src/function/NewObjectWrapper.mjs +14 -0
  258. package/src/function/ObjectRegistrar.mjs +23 -0
  259. package/src/function/ParseSQLFile.mjs +129 -0
  260. package/src/function/PipeAsync.mjs +30 -0
  261. package/src/function/PipeSync.mjs +28 -0
  262. package/src/function/SafeImport.mjs +77 -0
  263. package/src/function/TemplateLiteral.mjs +42 -23
  264. package/src/function/Timeout.mjs +4 -4
  265. package/src/function/Tries.mjs +22 -16
  266. package/src/function/TryAsync.mjs +3 -2
  267. package/src/function/TryNew.mjs +1 -1
  268. package/src/function/TsToMjs.mjs +184 -21
  269. package/src/function/UniqueFSTempName.mjs +33 -0
  270. package/src/function/errorToMessage.mjs +21 -0
  271. package/src/function/resolveErrorArray.mjs +15 -1
  272. package/src/neinth/VivthyNeinth.mjs +487 -0
  273. package/src/typehints/ArrayToKeys.mjs +17 -0
  274. package/src/typehints/ArrayToKeys.mts +31 -0
  275. package/src/typehints/AssemblyScriptExportsType.mjs +7 -0
  276. package/src/typehints/AssemblyScriptLoaderInstantiate.mjs +7 -0
  277. package/src/typehints/AutoDocASOptions.mjs +14 -0
  278. package/src/typehints/ChainableType.mjs +11 -0
  279. package/src/typehints/ComponentDecorator_Constructor.mjs +10 -0
  280. package/src/typehints/ConsoleAdditionalSettingType.mjs +6 -0
  281. package/src/typehints/Decorator.mjs +9 -0
  282. package/src/typehints/Decorator.mts +31 -0
  283. package/src/typehints/DecoratorMonkeyPatch.mjs +10 -0
  284. package/src/typehints/DecoratorMonkeyPatch.mts +43 -0
  285. package/src/{types → typehints}/DevTestCB.mjs +2 -2
  286. package/src/typehints/EnvModeType.mjs +6 -0
  287. package/src/{types → typehints}/ListArg.mjs +1 -1
  288. package/src/{types → typehints}/LitExpResultType.mjs +1 -1
  289. package/src/typehints/MonkeyPatchedType.mjs +13 -0
  290. package/src/typehints/ParametersFollowingN.mjs +8 -0
  291. package/src/typehints/ParametersFollowingN.mts +17 -0
  292. package/src/typehints/PrefixedKeysOf.mjs +9 -0
  293. package/src/typehints/Runtime.mjs +6 -0
  294. package/src/typehints/SafeImportReturnType.mjs +6 -0
  295. package/src/typehints/StylePropRefType.mjs +12 -0
  296. package/src/typehints/TemplateLiteralValueHandler.mjs +14 -0
  297. package/src/typehints/VLifecycleCallbacks.mjs +10 -0
  298. package/src/typehints/VivthCleanup.mjs +14 -0
  299. package/src/web/BrowserDirMapper.mjs +255 -0
  300. package/src/web/EnsureValidTag.mjs +5 -0
  301. package/src/web/EnsureValidTag.mts +10 -0
  302. package/src/web/ViteAddDynamics.mjs +34 -0
  303. package/src/web/ViteGetAllHTMLFile.mjs +97 -0
  304. package/src/web/WC_extendsA.mjs +330 -0
  305. package/src/web/WC_extendsB.mjs +332 -0
  306. package/src/web/bindings/WC_StyleProp_bind.mjs +70 -0
  307. package/src/web/bindings/WC_createElement_bind.mjs +95 -0
  308. package/src/web/bindings/WC_createNamedSlot.mjs +29 -0
  309. package/src/web/bindings/WC_litRender_bind.mjs +26 -0
  310. package/src/web/bindings/WC_litStyleMap.mjs +14 -0
  311. package/src/web/common/CSS.mjs +35 -0
  312. package/src/web/common/E.mjs +126 -0
  313. package/src/web/common/NewStyleSheetAsync.mjs +21 -0
  314. package/src/web/common/NewStyleSheetSync.mjs +21 -0
  315. package/src/web/common/WC_TagName_type.mjs +10 -0
  316. package/src/web/common/WC_TagName_type.mts +36 -0
  317. package/src/web/signals/IsInViewPortSignal.mjs +140 -0
  318. package/src/web/signals/ObserverSignal.mjs +93 -0
  319. package/src/web/signals/WC_litRef.mjs +61 -0
  320. package/src/web/signals/WC_loopedSiblingsRef.mjs +100 -0
  321. package/tsconfig.json +44 -41
  322. package/index.mjs +0 -91
  323. package/src/bundler/FSInline.mjs +0 -67
  324. package/src/bundler/FSInlineAnalyzer.mjs +0 -228
  325. package/src/bundler/FSInlineBundled.mjs +0 -38
  326. package/src/bundler/adds/externals.mjs +0 -8
  327. package/src/class/ListDerived.mjs +0 -42
  328. package/src/common/Dev.mjs +0 -142
  329. package/src/common/DevBundled.mjs +0 -5
  330. package/src/common/lazie.mjs +0 -3
  331. package/src/types/IsListSignal.mjs +0 -6
  332. package/src/types/Runtime.mjs +0 -6
  333. package/src/types/VivthDevCodeBlockStringType.mjs +0 -6
  334. package/types/index.d.mts +0 -58
  335. package/types/src/bundler/CompileJS.d.mts +0 -119
  336. package/types/src/bundler/FSInline.d.mts +0 -50
  337. package/types/src/bundler/FSInlineAnalyzer.d.mts +0 -37
  338. package/types/src/bundler/FSInlineBundled.d.mts +0 -22
  339. package/types/src/bundler/adds/externals.d.mts +0 -1
  340. package/types/src/class/Console.d.mts +0 -71
  341. package/types/src/class/Derived.d.mts +0 -98
  342. package/types/src/class/Effect.d.mts +0 -216
  343. package/types/src/class/ListDerived.d.mts +0 -38
  344. package/types/src/class/Paths.d.mts +0 -69
  345. package/types/src/class/SafeExit.d.mts +0 -103
  346. package/types/src/class/WorkerMainThreadBundled.d.mts +0 -83
  347. package/types/src/common/Base64URLFromFile.d.mts +0 -16
  348. package/types/src/common/Dev.d.mts +0 -68
  349. package/types/src/common/DevBundled.d.mts +0 -3
  350. package/types/src/common/lazie.d.mts +0 -1
  351. package/types/src/doc/JSautoDOC.d.mts +0 -83
  352. package/types/src/function/GetRuntime.d.mts +0 -2
  353. package/types/src/function/TemplateLiteral.d.mts +0 -22
  354. package/types/src/function/TsToMjs.d.mts +0 -23
  355. package/types/src/types/IsListSignal.d.mts +0 -4
  356. package/types/src/types/ListArg.d.mts +0 -4
  357. package/types/src/types/Runtime.d.mts +0 -4
  358. package/types/src/types/VivthDevCodeBlockStringType.d.mts +0 -4
  359. /package/{types → generated/types}/src/bundler/adds/pluginVivthBundle.d.mts +0 -0
  360. /package/{types → generated/types}/src/class/WorkerResult.d.mts +0 -0
  361. /package/{types → generated/types}/src/common/EventNameSpace.d.mts +0 -0
  362. /package/{types → generated/types}/src/common/eventObjects.d.mts +0 -0
  363. /package/{types → generated/types}/src/common/keys.d.mts +0 -0
  364. /package/{types → generated/types}/src/doc/correctBeforeParse.d.mts +0 -0
  365. /package/{types → generated/types}/src/function/TrySync.d.mts +0 -0
  366. /package/{types → generated/types}/src/function/resolveErrorArray.d.mts +0 -0
  367. /package/{types/src/types → generated/types/src/typehints}/AnyButUndefined.d.mts +0 -0
  368. /package/{types/src/types → generated/types/src/typehints}/ExtnameType.d.mts +0 -0
  369. /package/{types/src/types → generated/types/src/typehints}/LitExpKeyType.d.mts +0 -0
  370. /package/{types/src/types → generated/types/src/typehints}/LitExpResultType.d.mts +0 -0
  371. /package/{types/src/types → generated/types/src/typehints}/MutationType.d.mts +0 -0
  372. /package/{types/src/types → generated/types/src/typehints}/QCBFIFOReturn.d.mts +0 -0
  373. /package/{types/src/types → generated/types/src/typehints}/QCBReturn.d.mts +0 -0
  374. /package/src/{types → typehints}/AnyButUndefined.mjs +0 -0
  375. /package/src/{types → typehints}/ExtnameType.mjs +0 -0
  376. /package/src/{types → typehints}/LitExpKeyType.mjs +0 -0
  377. /package/src/{types → typehints}/MutationType.mjs +0 -0
  378. /package/src/{types → typehints}/QCBFIFOReturn.mjs +0 -0
  379. /package/src/{types → typehints}/QCBReturn.mjs +0 -0
@@ -1,228 +0,0 @@
1
- // @ts-check
2
-
3
- import { dirname, extname, join, relative } from 'node:path';
4
- import { readFile, readdir } from 'node:fs/promises';
5
-
6
- import { Paths } from '../class/Paths.mjs';
7
- import { LitExp } from '../class/LitExp.mjs';
8
- import { TryAsync } from '../function/TryAsync.mjs';
9
- import { FSInline } from './FSInline.mjs';
10
- import { EsBundler } from './EsBundler.mjs';
11
- import { removeVivthDevCodeBlock } from './adds/ToBundledJSPlugin.mjs';
12
-
13
- /**
14
- * @param {string} str
15
- * @returns {RegExp}
16
- */
17
- const hydrateRegex = (str) => {
18
- const match = str.match(/^\/(.*)\/([a-z]*)$/);
19
- if (match === null) {
20
- throw new Error('Invalid regex string format');
21
- }
22
- const [, pattern = '', flags] = match;
23
- return new RegExp(pattern, flags);
24
- };
25
-
26
- /**
27
- * @description
28
- * - collections of static method to analyze content for `FSInline`;
29
- * - mostly used internally;
30
- */
31
- export class FSInlineAnalyzer {
32
- /**
33
- * @description
34
- * - to be used on bundled content;
35
- * @param {string} content
36
- * @param {'cjs'|'esm'} format
37
- * @returns {ReturnType<typeof TryAsync<string>>}
38
- * @example
39
- * import { readFile } from 'node:fs/promises';
40
- *
41
- * import { FSInlineAnalyzer } from 'vivth';
42
- *
43
- * const [resultFinalContent, errorFinalContent] = await FSInlineAnalyzer.finalContent(
44
- * await readFile('./resultESBunlded.mjs', {encoding: 'utf-8'}),
45
- * 'esm'
46
- * );
47
- */
48
- static finalContent = async (content, format) => {
49
- return await TryAsync(async () => {
50
- content = removeVivthDevCodeBlock(content);
51
- const [literalFile, errorPrepareFile] = LitExp.prepare({
52
- FSInline: /[\w][\w\d]*/,
53
- method: /\.vivthFSInlineFile\s*?\(\s*?['"]/,
54
- path: false,
55
- closing: /['"]\s*?\)/,
56
- });
57
- const [literalWorker, errorPreparWorker] = LitExp.prepare({
58
- ref: /[\w][\w\d]*/,
59
- method: /\.newVivthWorker\s*?\(\s*?['"]/,
60
- path: false,
61
- closing: /['"]\s*\)/,
62
- });
63
- const [literalDir, errorPrepareDir] = LitExp.prepare({
64
- FSInline: /[\w][\w\d]*/,
65
- method: /\.vivthFSInlineDir\s*?\(\s*?['"]/,
66
- path: false,
67
- methodClosing: /['"]\s*?,\s*/,
68
- rule: false,
69
- functionClosing: /\s*?\)/,
70
- });
71
- if (errorPrepareFile || errorPrepareDir || errorPreparWorker) {
72
- throw { errorPrepareFile, errorPrepareDir, errorPreparWorker };
73
- }
74
- const templateFile = literalFile`${'FSInline'}${'method'}${'path'}${'closing'}`;
75
- const templateWorker = literalWorker`${'ref'}${'method'}${'path'}${'closing'}`;
76
- const templateDir = literalDir`${'FSInline'}${'method'}${'path'}${'methodClosing'}${'rule'}${'functionClosing'}`;
77
- const [resultMatchingFile, errorMatchingFile] = templateFile.evaluate.matchedAllAndGrouped(
78
- content,
79
- {
80
- flags: 'gm',
81
- whiteSpaceSensitive: false,
82
- }
83
- );
84
- const [resultMatchingWorker, errorMatchingWorker] =
85
- templateWorker.evaluate.matchedAllAndGrouped(content, {
86
- flags: 'gm',
87
- whiteSpaceSensitive: false,
88
- });
89
- const [resultMatchingDir, errorMatchingDir] = templateDir.evaluate.matchedAllAndGrouped(
90
- content,
91
- {
92
- flags: 'gm',
93
- whiteSpaceSensitive: false,
94
- }
95
- );
96
- if (errorMatchingFile || errorMatchingDir || errorMatchingWorker) {
97
- throw { errorMatchingFile, errorMatchingDir, errorMatchingWorker };
98
- }
99
- if (Paths.root === undefined) {
100
- throw new Error('Path.root undefined');
101
- }
102
- const {
103
- result: { named: namedFile },
104
- } = resultMatchingFile;
105
- for (let i = 0; i < namedFile.length; i++) {
106
- const res = namedFile[i];
107
- if (res === undefined) {
108
- continue;
109
- }
110
- const { path } = res;
111
- if ('path' in FSInline.vivthFSInlinelists) {
112
- continue;
113
- }
114
- FSInline.vivthFSInlinelists[path] = Buffer.from(
115
- removeVivthDevCodeBlock(await readFile(join(Paths.root, path), { encoding: 'utf-8' }))
116
- );
117
- }
118
- const {
119
- result: { named: namedDir },
120
- } = resultMatchingDir;
121
- for (let i = 0; i < namedDir.length; i++) {
122
- const res = namedDir[i];
123
- if (res === undefined) {
124
- continue;
125
- }
126
- let { path, rule } = res;
127
- rule = rule.trim();
128
- const results = await FSInlineAnalyzer.#dir(join(Paths.root, path), hydrateRegex(rule));
129
- for (let j = 0; j < results.length; j++) {
130
- const res = results[j];
131
- if (res === undefined) {
132
- continue;
133
- }
134
- const { path, buffer } = res;
135
- if (path in FSInline.vivthFSInlinelists) {
136
- continue;
137
- }
138
- FSInline.vivthFSInlinelists[path] = buffer;
139
- }
140
- }
141
- const {
142
- result: { named: namedWorker },
143
- } = resultMatchingWorker;
144
- for (let i = 0; i < namedWorker.length; i++) {
145
- const res = namedWorker[i];
146
- if (res === undefined) {
147
- continue;
148
- }
149
- const { path } = res;
150
- const fullPath = join(Paths.root, path);
151
- const content = removeVivthDevCodeBlock(await readFile(fullPath, { encoding: 'utf-8' }));
152
- const [contentBundled, errorBundled] = await EsBundler(
153
- {
154
- content,
155
- // @ts-expect-error
156
- extension: extname(fullPath),
157
- root: dirname(fullPath),
158
- },
159
- {
160
- minify: true,
161
- format,
162
- }
163
- );
164
- if (errorBundled) {
165
- continue;
166
- }
167
- const [trueContent, errorFinal] = await FSInlineAnalyzer.finalContent(
168
- contentBundled,
169
- format
170
- );
171
- if (errorFinal) {
172
- continue;
173
- }
174
- FSInline.vivthFSInlinelists[path] = Buffer.from(trueContent);
175
- }
176
- return content.replace(
177
- /static\s*vivthFSInlinelists(?:;|)/,
178
- `static vivthFSInlinelists=${JSON.stringify(FSInline.vivthFSInlinelists)}`
179
- );
180
- });
181
- };
182
- /**
183
- * @typedef {{path:string, buffer:Buffer<ArrayBuffer>}[]} _dirReturn
184
- */
185
- /**
186
- * @param {string} dirName
187
- * @param {RegExp} ruleForFileFullPath
188
- * @returns {Promise<_dirReturn>}
189
- */
190
- static #dir = async (dirName, ruleForFileFullPath) => {
191
- /**
192
- * @type {_dirReturn}
193
- */
194
- const result = [];
195
- /**
196
- * @param {string} current
197
- * @returns {Promise<void>}
198
- */
199
- const walk = async (current) => {
200
- if (Paths.root === undefined) {
201
- return;
202
- }
203
- const entries = await readdir(current, {
204
- recursive: false,
205
- withFileTypes: true,
206
- encoding: 'utf-8',
207
- });
208
- for (const entry of entries) {
209
- const fullPath = Paths.normalize(join(current, entry.name));
210
- const relativePath = Paths.normalizesForRoot(relative(Paths.root, fullPath));
211
- if (entry.isDirectory()) {
212
- await walk(fullPath);
213
- continue;
214
- }
215
- if (entry.isFile() && ruleForFileFullPath.test(fullPath)) {
216
- result.push({
217
- path: relativePath,
218
- buffer: Buffer.from(
219
- removeVivthDevCodeBlock(await readFile(fullPath, { encoding: 'utf-8' }))
220
- ),
221
- });
222
- }
223
- }
224
- };
225
- await walk(dirName);
226
- return result;
227
- };
228
- }
@@ -1,38 +0,0 @@
1
- // @ts-check
2
-
3
- import { join } from 'node:path';
4
-
5
- import { Paths } from '../class/Paths.mjs';
6
-
7
- export class FSInline {
8
- static prefix = '';
9
- /**
10
- * @param {string} filePathFromProject
11
- * @returns {Promise<Buffer<ArrayBuffer>>}
12
- */
13
- static vivthFSInlineFile = async (filePathFromProject) => {
14
- filePathFromProject = Paths.normalizesForRoot(filePathFromProject);
15
- const bufferStored = FSInline.vivthFSInlinelists[filePathFromProject];
16
- if (bufferStored === undefined) {
17
- return Buffer.from([]);
18
- }
19
- return Buffer.from(bufferStored);
20
- };
21
- /**
22
- * @param {string} dirPathFromProject
23
- * @param {Object} regexRule
24
- * @param {RegExp} regexRule.dir
25
- * @param {RegExp} regexRule.file
26
- * @returns {Promise<typeof FSInline["vivthFSInlineFile"]>}
27
- * - relative to the `dirPathFromProject`
28
- */
29
- static vivthFSInlineDir = async (dirPathFromProject) => {
30
- dirPathFromProject = Paths.normalizesForRoot(dirPathFromProject);
31
- return (path_) => FSInline.vivthFSInlineFile(join(dirPathFromProject, path_));
32
- };
33
- /**
34
- * - to be used as embed placeholder on `bundled` and `compiled`;
35
- * @type {Record<string, Buffer<ArrayBufferLike>>}
36
- */
37
- static vivthFSInlinelists;
38
- }
@@ -1,8 +0,0 @@
1
- // @ts-check
2
-
3
- export const externals = [
4
- 'esbuild',
5
- '../prelude/bootstrap.js',
6
- './common',
7
- '../prelude/diagnostic.js',
8
- ];
@@ -1,42 +0,0 @@
1
- // @ts-check
2
-
3
- import { Derived } from './Derived.mjs';
4
- import { Effect } from './Effect.mjs';
5
- /**
6
- * @description
7
- * - class to create `dervivedList` that satisfy `Array<Record<string, string>>`;
8
- * - usefull for `derivedLoops`, e.g. temporary search values;
9
- * - is a `Derived` instance;
10
- * @template {ListArg} LISTARG
11
- * @extends {Derived<LISTARG[]>}
12
- */
13
- export class ListDerived extends Derived {
14
- /**
15
- * @typedef {import('../types/ListArg.mjs').ListArg} ListArg
16
- * @typedef {import('../common/lazie.mjs').unwrapLazy} unwrapLazy
17
- */
18
- /**
19
- * @description
20
- * @param {(effectInstanceOptions:Omit<Effect["options"],
21
- * unwrapLazy>)=>
22
- * Promise<LISTARG[]>} derivedFunction
23
- * @example
24
- * import { ListSignal, ListDerived } from 'vivth';
25
- *
26
- * const listExample = new ListSignal([
27
- * {key1: "test1"},
28
- * {key1: "test2"},
29
- * ]);
30
- *
31
- * export const listDerivedExample = new ListDerived(async({ subscribe }) => {
32
- * // becarefull to not mutate the reference value
33
- * return subscribe(listExample).value.filter((val) => {
34
- * // subscribe(listExample).structuredClone can be used as alternative
35
- * // filter logic
36
- * })
37
- * });
38
- */
39
- constructor(derivedFunction) {
40
- super(derivedFunction);
41
- }
42
- }
@@ -1,142 +0,0 @@
1
- // @ts-check
2
-
3
- import { Console } from '../class/Console.mjs';
4
- import { Effect } from '../class/Effect.mjs';
5
- import { Signal } from '../class/Signal.mjs';
6
- import { LazyFactory } from '../function/LazyFactory.mjs';
7
- import { TryAsync } from '../function/TryAsync.mjs';
8
- import { Trace } from './Trace.mjs';
9
-
10
- /**
11
- * @typedef {import("../types/VivthDevCodeBlockStringType.mjs").VivthDevCodeBlockStringType} VivthDevCodeBlockStringType
12
- * @typedef {import('../types/DevTestCB.mjs').DevTestCB} DevTestCB
13
- */
14
-
15
- /**
16
- * @description
17
- * - class helper for `devTime` only code block;
18
- */
19
- export class Dev {
20
- /**
21
- * @description
22
- * - persistent variable(during `devTime` and `bundled`);
23
- * - can be used as `condition` for checking whether it is in `devTime` or `bundled`;
24
- * @type {boolean}
25
- * @example
26
- * import { Dev } from 'vivth';
27
- *
28
- * if (Dev.isDev) {
29
- * // this code block will presist even on `bundled`;
30
- * }
31
- */
32
- static isDev = true;
33
- /**
34
- * @type {Signal<Map<string,Awaited<ReturnType<typeof TryAsync<boolean>>>>>}
35
- */
36
- static #notifications = LazyFactory(() => new Signal(new Map()));
37
- /**
38
- * @type {DevTestCB}
39
- */
40
- static #test = async (testName, testCallback) => {
41
- testName = `${testName}:'${Trace(4)}'`;
42
- Dev.#notifications.subscribers.notify(async ({ signalInstance }) => {
43
- signalInstance.value.set(
44
- testName,
45
- await TryAsync(async () => {
46
- return await testCallback();
47
- })
48
- );
49
- });
50
- Dev.#effectForCheck['vivth:unwrapLazy;']();
51
- return {
52
- removeId: () => {
53
- Dev.#notifications.subscribers.notify(async ({ signalInstance }) => {
54
- signalInstance.value.delete(testName);
55
- });
56
- },
57
- };
58
- };
59
- static #effectForCheck = LazyFactory(
60
- () =>
61
- new Effect(async ({ isLastCalled, subscribe }) => {
62
- const notifications = subscribe(Dev.#notifications).value;
63
- if (!(await isLastCalled(100)) || !notifications.size) {
64
- return;
65
- }
66
- /**
67
- * @type {string[]}
68
- */
69
- const succeedTest = [];
70
- /**
71
- * @type {string[]}
72
- */
73
- const failedTest = [];
74
- for (const [notificationID, [isCorrect, error]] of notifications) {
75
- if (error || !isCorrect) {
76
- failedTest.push(notificationID);
77
- continue;
78
- }
79
- succeedTest.push(notificationID);
80
- }
81
- const size = notifications.size;
82
- /**
83
- * @type {{
84
- * testCount:number,
85
- * succeed?: {count:string, testID:string[]},
86
- * failed?: {count:string, testID:string[]},
87
- * }}
88
- */
89
- let warn = { testCount: size };
90
- if (succeedTest.length) {
91
- warn.succeed = {
92
- count: `${succeedTest.length} of ${size}`,
93
- testID: succeedTest,
94
- };
95
- }
96
- if (failedTest.length) {
97
- warn.failed = {
98
- count: `${failedTest.length} of ${size}`,
99
- testID: failedTest,
100
- };
101
- }
102
- Console.warn(warn);
103
- })
104
- );
105
- /**
106
- * @description
107
- * - to wrap `devTime` only code block;
108
- * - when bundled uses `EsBundler` or esbuild with `ToBundledJSPlugin` plugin, the code block will be removed on the bundled version;
109
- * @param {(options:{test:DevTestCB})=>Promise<void>} callback
110
- * - also provide `test` method for inline testing:
111
- * >- which is wrapped in `TryAsync`, throwed errors will automatically return `false`;
112
- * @param {VivthDevCodeBlockStringType} _closing
113
- * - it is needed to detect the code block closing;
114
- * - should use single or double quote and not back tick;
115
- * @returns {Promise<void>}
116
- * @example
117
- * import { Dev, Signal } from 'vivth';
118
- *
119
- * Dev.vivthDevCodeBlock(async function () {
120
- * // this code block will be removed on `bundled` version;
121
- * }, 'vivthDevCodeBlock');
122
- *
123
- * const numberSignal = new Signal(0);
124
- * Dev.vivthDevCodeBlock(async ({ test }) => {
125
- * // this code block will be removed on `bundled` version;
126
- * const [{ removeId: removeTest }] = await Promise.all([
127
- * test(async () => numberSignal.value === 0)
128
- * ])
129
- * }, 'vivthDevCodeBlock');
130
- */
131
- static vivthDevCodeBlock = async (callback, _closing) => {
132
- if (
133
- /**
134
- * just in case Bundler doesn't properly clearup `vivthDevCodeBlock`
135
- */
136
- !Dev.isDev
137
- ) {
138
- return;
139
- }
140
- await callback({ test: Dev.#test });
141
- };
142
- }
@@ -1,5 +0,0 @@
1
- // @ts-check
2
-
3
- export class Dev {
4
- static isDev = false;
5
- }
@@ -1,3 +0,0 @@
1
- // @ts-check
2
-
3
- export const unwrapLazy = 'vivth:unwrapLazy;';
@@ -1,6 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * - `EnvSignal.get` argument whether signal need to be a list or not;
5
- * @typedef {boolean} IsListSignal
6
- */
@@ -1,6 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * - for popular runtimes check;
5
- * @typedef {'node' | 'bun' | 'deno' | 'browser' | 'unknown'} Runtime
6
- */
@@ -1,6 +0,0 @@
1
- // @ts-check
2
-
3
- /**
4
- * - closing helper for `Dev.vivthDevCodeBlock`;
5
- * @typedef {'vivthDevCodeBlock'} VivthDevCodeBlockStringType
6
- */
package/types/index.d.mts DELETED
@@ -1,58 +0,0 @@
1
- export { ToBundledJSPlugin } from "./src/bundler/adds/ToBundledJSPlugin.mjs";
2
- export { CompileJS } from "./src/bundler/CompileJS.mjs";
3
- export { CreateESPlugin } from "./src/bundler/CreateESPlugin.mjs";
4
- export { EsBundler } from "./src/bundler/EsBundler.mjs";
5
- export { FSInline } from "./src/bundler/FSInline.mjs";
6
- export { FSInlineAnalyzer } from "./src/bundler/FSInlineAnalyzer.mjs";
7
- export { Console } from "./src/class/Console.mjs";
8
- export { Derived } from "./src/class/Derived.mjs";
9
- export { Effect } from "./src/class/Effect.mjs";
10
- export { EnvSignal } from "./src/class/EnvSignal.mjs";
11
- export { EventSignal } from "./src/class/EventSignal.mjs";
12
- export { FileSafe } from "./src/class/FileSafe.mjs";
13
- export { ListDerived } from "./src/class/ListDerived.mjs";
14
- export { ListSignal } from "./src/class/ListSignal.mjs";
15
- export { LitExp } from "./src/class/LitExp.mjs";
16
- export { Paths } from "./src/class/Paths.mjs";
17
- export { QChannel } from "./src/class/QChannel.mjs";
18
- export { SafeExit } from "./src/class/SafeExit.mjs";
19
- export { Setup } from "./src/class/Setup.mjs";
20
- export { Signal } from "./src/class/Signal.mjs";
21
- export { WalkThrough } from "./src/class/WalkThrough.mjs";
22
- export { WorkerMainThread } from "./src/class/WorkerMainThread.mjs";
23
- export { WorkerResult } from "./src/class/WorkerResult.mjs";
24
- export { WorkerThread } from "./src/class/WorkerThread.mjs";
25
- export { Base64URL } from "./src/common/Base64URL.mjs";
26
- export { Base64URLFromFile } from "./src/common/Base64URLFromFile.mjs";
27
- export { CreateStringID } from "./src/common/CreateStringID.mjs";
28
- export { Dev } from "./src/common/Dev.mjs";
29
- export { EventNameSpace } from "./src/common/EventNameSpace.mjs";
30
- export { Trace } from "./src/common/Trace.mjs";
31
- export { TracePath } from "./src/common/TracePath.mjs";
32
- export { JSautoDOC } from "./src/doc/JSautoDOC.mjs";
33
- export { CreateImmutable } from "./src/function/CreateImmutable.mjs";
34
- export { EventCheck } from "./src/function/EventCheck.mjs";
35
- export { EventObject } from "./src/function/EventObject.mjs";
36
- export { GetNamedImportAlias } from "./src/function/GetNamedImportAlias.mjs";
37
- export { GetRuntime } from "./src/function/GetRuntime.mjs";
38
- export { IsAsync } from "./src/function/IsAsync.mjs";
39
- export { LazyFactory } from "./src/function/LazyFactory.mjs";
40
- export { TemplateLiteral } from "./src/function/TemplateLiteral.mjs";
41
- export { Timeout } from "./src/function/Timeout.mjs";
42
- export { Tries } from "./src/function/Tries.mjs";
43
- export { TryAsync } from "./src/function/TryAsync.mjs";
44
- export { TryNew } from "./src/function/TryNew.mjs";
45
- export { TrySync } from "./src/function/TrySync.mjs";
46
- export { TsToMjs } from "./src/function/TsToMjs.mjs";
47
- export type AnyButUndefined = import("./src/types/AnyButUndefined.mjs").AnyButUndefined;
48
- export type DevTestCB = import("./src/types/DevTestCB.mjs").DevTestCB;
49
- export type ExtnameType = import("./src/types/ExtnameType.mjs").ExtnameType;
50
- export type IsListSignal = import("./src/types/IsListSignal.mjs").IsListSignal;
51
- export type ListArg = import("./src/types/ListArg.mjs").ListArg;
52
- export type LitExpKeyType = import("./src/types/LitExpKeyType.mjs").LitExpKeyType;
53
- export type LitExpResultType<KEYS extends import("./src/types/LitExpKeyType.mjs").LitExpKeyType> = import("./src/types/LitExpResultType.mjs").LitExpResultType<KEYS>;
54
- export type MutationType = import("./src/types/MutationType.mjs").MutationType;
55
- export type QCBFIFOReturn = import("./src/types/QCBFIFOReturn.mjs").QCBFIFOReturn;
56
- export type QCBReturn = import("./src/types/QCBReturn.mjs").QCBReturn;
57
- export type Runtime = import("./src/types/Runtime.mjs").Runtime;
58
- export type VivthDevCodeBlockStringType = import("./src/types/VivthDevCodeBlockStringType.mjs").VivthDevCodeBlockStringType;
@@ -1,119 +0,0 @@
1
- /**
2
- * @description
3
- * - function to compile `.ts`|`.mts`|`.mjs` file, into a single executable;
4
- * - also generate js representation of the `bundled` version of the target;
5
- * - uses [pkg](https://www.npmjs.com/package/pkg), [bun](https://bun.com/docs/bundler/executables), and [deno](https://docs.deno.com/runtime/reference/cli/compile/) compiler under the hood;
6
- * >- they are used only as packaging/compiler agent, and doesn't necessarily supports their advanced feature, such as, assets bundling(use [`FSInline`](#fsinline) instead);
7
- * >- `WorkerThread` will be converted to inline using `FSInline` too;
8
- *
9
- * !!!WARNING!!!
10
- * !!!WARNING!!!
11
- * !!!WARNING!!!
12
- *
13
- * - This function does not obfuscate and will not prevent decompilation. Do not embed environment variables or sensitive information inside `options.entryPoint`;
14
- * - It is designed for quick binarization, allowing execution on machines without `Node.js`, `Bun`, or `Deno` installed;
15
- * - The resulting binary will contain `FSInline` and `WorkerMainThread` target paths Buffers, which are loaded into memory at runtime. If your logic depends on the file system, use `node:fs` or `node:fs/promises` APIs and ship external files alongside the binary (not compiled);
16
- *
17
- * !!!WARNING!!!
18
- * !!!WARNING!!!
19
- * !!!WARNING!!!
20
- *
21
- * @param {Object} options
22
- * @param {string} options.entryPoint
23
- * - need to be manually prefixed;
24
- * @param {BufferEncoding} [options.encoding]
25
- * - read and write encoding for the sources;
26
- * - default: `utf-8`;
27
- * @param {(entryPointContent:string)=>string} [options.preprocessEntryPoint]
28
- * - to modify entry point before bundling;
29
- * - `entryPointContent` is the original string of the entry point;
30
- * - returned value then passed to `ESBundler`;
31
- * @param {boolean} options.minifyFirst
32
- * - minify the bundle before compilation;
33
- * @param {string} options.outDir
34
- * - need manual prefix;
35
- * @param {'pkg'|'bun'|'deno'} [options.compiler]
36
- * - default: no comilation, just bundling;
37
- * - `bun` and `pkg` is checked, if there's bug on `deno`, please report on github for issues;
38
- * @param {Record<string, string>} [options.compilerArguments]
39
- * - `key` are to used as `--keyName`;
40
- * - value are the following value of the key;
41
- * - no need to add the output/outdir, as it use the `options.outDir`;
42
- * @param {ReturnType<CreateESPlugin>[]} [options.esBundlerPlugins]
43
- * - plugins for `EsBundler`;
44
- * @return {ReturnType<typeof TryAsync<{compileResult:Promise<any>|undefined,
45
- * commandCalled: string|undefined;
46
- * compiledBinFile: string|undefined;
47
- * bundledJSFile:string|undefined
48
- * }>>}
49
- * @example
50
- * import process from 'node:process';
51
- * import { join } from 'node:path';
52
- *
53
- * import { CompileJS, Console, Paths, Setup } from 'vivth';
54
- *
55
- * const { paths, safeExit } = Setup;
56
- * new paths({
57
- * root: process.env.INIT_CWD ?? process.cwd(),
58
- * });
59
- * new safeExit({
60
- * eventNames: ['SIGINT', 'SIGTERM'],
61
- * terminator: () => process.exit(0),
62
- * listener: (eventName) => {
63
- * process.once(eventName, function () {
64
- * if (!safeExit.instance) {
65
- * return;
66
- * }
67
- * safeExit.instance.exiting.correction(true);
68
- * Console.log(`safe exit via "${eventName}"`);
69
- * });
70
- * },
71
- * });
72
- * const pathRoot = Paths.root;
73
- * if (pathRoot) {
74
- * const [[, error], [, errorbun]] = await Promise.all([
75
- * CompileJS({
76
- * entryPoint: join(pathRoot, '/dev/myEntryPoint.mjs'),
77
- * minifyFirst: true,
78
- * outDir: join(pathRoot, '/dev-pkg/'),
79
- * compiler: 'pkg',
80
- * compilerArguments: {
81
- * target: 'node18-win-x64',
82
- * },
83
- * encoding: 'utf-8',
84
- * }),
85
- * await CompileJS({
86
- * entryPoint: join(pathRoot, '/dev/myEntryPoint.mjs'),
87
- * minifyFirst: true,
88
- * outDir: join(pathRoot, '/dev-bun/'),
89
- * compiler: 'bun',
90
- * compilerArguments: {
91
- * target: 'bun-win-x64',
92
- * },
93
- * encoding: 'utf-8',
94
- * }),
95
- * ]);
96
- * if (error || errorbun) {
97
- * Console.error({ error, errorbun });
98
- * }
99
- * }
100
- *
101
- */
102
- export function CompileJS({ entryPoint, minifyFirst, encoding, outDir, preprocessEntryPoint, compiler, compilerArguments, esBundlerPlugins, }: {
103
- entryPoint: string;
104
- encoding?: BufferEncoding | undefined;
105
- preprocessEntryPoint?: ((entryPointContent: string) => string) | undefined;
106
- minifyFirst: boolean;
107
- outDir: string;
108
- compiler?: "pkg" | "bun" | "deno" | undefined;
109
- compilerArguments?: Record<string, string> | undefined;
110
- esBundlerPlugins?: import("esbuild").Plugin[] | undefined;
111
- }): ReturnType<typeof TryAsync<{
112
- compileResult: Promise<any> | undefined;
113
- commandCalled: string | undefined;
114
- compiledBinFile: string | undefined;
115
- bundledJSFile: string | undefined;
116
- }>>;
117
- export type PlatformKey = "win32" | "linux" | "darwin" | string;
118
- export type CreateESPlugin = typeof import("./CreateESPlugin.mjs")["CreateESPlugin"];
119
- import { TryAsync } from '../function/TryAsync.mjs';