vivth 1.4.9 → 1.5.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.
- package/README.md +6060 -2037
- package/README.src.md +22 -14
- package/bun.lock +154 -194
- package/dev/auto/.src.ignore +25 -0
- package/dev/auto-doc.mjs +137 -0
- package/generated/types/generated/vivth/exports/all.d.mts +145 -0
- package/generated/types/generated/vivth/exports/neutral.d.mts +105 -0
- package/generated/types/generated/vivth/exports/node.d.mts +40 -0
- package/generated/types/src/bundler/CompileAS.d.mts +30 -0
- package/generated/types/src/bundler/CompileJS.d.mts +109 -0
- package/{types → generated/types}/src/bundler/CreateESPlugin.d.mts +1 -1
- package/{types → generated/types}/src/bundler/EsBundler.d.mts +9 -7
- package/generated/types/src/bundler/FSAnalyzer.d.mts +58 -0
- package/generated/types/src/bundler/FSasar.bundled.d.mts +28 -0
- package/generated/types/src/bundler/FSasar.d.mts +51 -0
- package/generated/types/src/bundler/FileSelfMapper.d.mts +137 -0
- package/generated/types/src/bundler/JSDirMapper.d.mts +128 -0
- package/generated/types/src/bundler/RunWatchThenCompileJSOnSafeExit.d.mts +63 -0
- package/generated/types/src/bundler/adds/BrowserExternals.d.mts +21 -0
- package/generated/types/src/bundler/adds/CreateTransform.d.mts +26 -0
- package/generated/types/src/bundler/adds/LastEditedUnix.d.mts +5 -0
- package/generated/types/src/bundler/adds/NodeModuleList.d.mts +15 -0
- package/generated/types/src/bundler/adds/PathFSBundles.bundled.d.mts +25 -0
- package/generated/types/src/bundler/adds/PathFSBundles.d.mts +48 -0
- package/generated/types/src/bundler/adds/PathFSDir.bundled.d.mts +30 -0
- package/generated/types/src/bundler/adds/PathFSDir.d.mts +48 -0
- package/generated/types/src/bundler/adds/PathFSFile.bundled.d.mts +25 -0
- package/generated/types/src/bundler/adds/PathFSFile.d.mts +40 -0
- package/{types → generated/types}/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -6
- package/generated/types/src/bundler/adds/autoExternalize.d.mts +2 -0
- package/generated/types/src/bundler/adds/emptyBufferValue.d.mts +1 -0
- package/generated/types/src/bundler/adds/isModuleTheBundledVersion.d.mts +1 -0
- package/generated/types/src/bundler/adds/onEndEsBuildErrorLogger.d.mts +1 -0
- package/generated/types/src/bundler/adds/resolveJSDependencyPath.d.mts +1 -0
- package/generated/types/src/class/AwaitSignal.d.mts +48 -0
- package/generated/types/src/class/Console.d.mts +82 -0
- package/generated/types/src/class/DataLog.d.mts +25 -0
- package/generated/types/src/class/Derived.d.mts +74 -0
- package/generated/types/src/class/Effect.d.mts +213 -0
- package/{types → generated/types}/src/class/EnvSignal.d.mts +6 -2
- package/generated/types/src/class/EsWatcher.d.mts +36 -0
- package/{types → generated/types}/src/class/EventSignal.d.mts +39 -39
- package/generated/types/src/class/FSDirArchWatcher.d.mts +110 -0
- package/{types → generated/types}/src/class/FileSafe.d.mts +32 -16
- package/generated/types/src/class/ForEach.d.mts +57 -0
- package/generated/types/src/class/ForSignal.d.mts +63 -0
- package/generated/types/src/class/GetterSetter.d.mts +38 -0
- package/generated/types/src/class/JSONFileHandler.d.mts +50 -0
- package/{types → generated/types}/src/class/ListSignal.d.mts +49 -15
- package/{types → generated/types}/src/class/LitExp.d.mts +18 -18
- package/generated/types/src/class/ObjectSignal.d.mts +267 -0
- package/generated/types/src/class/Paths.d.mts +95 -0
- package/generated/types/src/class/Prettivy.d.mts +26 -0
- package/{types → generated/types}/src/class/QChannel.d.mts +24 -16
- package/generated/types/src/class/SafeExit.d.mts +69 -0
- package/{types → generated/types}/src/class/Setup.d.mts +29 -16
- package/{types → generated/types}/src/class/Signal.d.mts +29 -15
- package/generated/types/src/class/SignalCollection.d.mts +96 -0
- package/{types → generated/types}/src/class/WalkThrough.d.mts +4 -19
- package/generated/types/src/class/WorkerMainThread.bundled.d.mts +83 -0
- package/{types → generated/types}/src/class/WorkerMainThread.d.mts +33 -39
- package/{types → generated/types}/src/class/WorkerThread.d.mts +11 -5
- package/{types → generated/types}/src/common/Base64URL.d.mts +2 -1
- package/generated/types/src/common/Base64URLFromFile.d.mts +20 -0
- package/generated/types/src/common/BundledV.bundled.d.mts +3 -0
- package/generated/types/src/common/BundledV.d.mts +36 -0
- package/{types → generated/types}/src/common/CreateStringID.d.mts +5 -4
- package/generated/types/src/common/EnvMode.d.mts +79 -0
- package/generated/types/src/common/FactoryKey.d.mts +9 -0
- package/generated/types/src/common/Preferrence.d.mts +25 -0
- package/{types → generated/types}/src/common/Trace.d.mts +1 -1
- package/{types → generated/types}/src/common/TracePath.d.mts +1 -1
- package/generated/types/src/common/VivthUnBundledCodeBlock.d.mts +6 -0
- package/generated/types/src/doc/JSautoDOC.d.mts +172 -0
- package/generated/types/src/doc/cleanPreserveTypedef.d.mts +1 -0
- package/{types/src/doc/parsedFile.d.mts → generated/types/src/doc/parsedFileForDOC.d.mts} +56 -27
- package/generated/types/src/function/ClearRequireCache.d.mts +1 -0
- package/{types → generated/types}/src/function/CreateImmutable.d.mts +5 -4
- package/{types → generated/types}/src/function/EventCheck.d.mts +3 -1
- package/{types → generated/types}/src/function/EventObject.d.mts +2 -6
- package/generated/types/src/function/ForInAsync.d.mts +36 -0
- package/generated/types/src/function/ForInSync.d.mts +36 -0
- package/generated/types/src/function/ForOfAsync.d.mts +25 -0
- package/generated/types/src/function/ForOfSync.d.mts +36 -0
- package/generated/types/src/function/GetBufferFromRelativePath.d.mts +15 -0
- package/generated/types/src/function/GetFilesFromDir.d.mts +14 -0
- package/generated/types/src/function/GetMaxFilenameLength.d.mts +9 -0
- package/generated/types/src/function/GetModuleEsbuildPlatform.d.mts +13 -0
- package/{types → generated/types}/src/function/GetNamedImportAlias.d.mts +1 -1
- package/generated/types/src/function/GetRuntime.d.mts +2 -0
- package/generated/types/src/function/InstantiateAssemblyScript.d.mts +15 -0
- package/{types → generated/types}/src/function/IsAsync.d.mts +1 -1
- package/generated/types/src/function/IsInstanceOf.d.mts +25 -0
- package/generated/types/src/function/IsSameFile.d.mts +16 -0
- package/generated/types/src/function/IsStringLooksLikeAPath.d.mts +16 -0
- package/generated/types/src/function/IsTypeOf.d.mts +25 -0
- package/{types → generated/types}/src/function/LazyFactory.d.mts +9 -10
- package/generated/types/src/function/MonkeyPatch.d.mts +33 -0
- package/generated/types/src/function/NewAnimationTimeline.d.mts +24 -0
- package/generated/types/src/function/NewChainable.d.mts +35 -0
- package/generated/types/src/function/NewDynamicsExport.d.mts +49 -0
- package/generated/types/src/function/NewObjectWrapper.d.mts +10 -0
- package/generated/types/src/function/ObjectRegistrar.d.mts +17 -0
- package/generated/types/src/function/ParseSQLFile.d.mts +25 -0
- package/generated/types/src/function/PipeAsync.d.mts +19 -0
- package/generated/types/src/function/PipeSync.d.mts +17 -0
- package/generated/types/src/function/SafeImport.d.mts +21 -0
- package/generated/types/src/function/TemplateLiteral.d.mts +23 -0
- package/{types → generated/types}/src/function/Timeout.d.mts +1 -1
- package/{types → generated/types}/src/function/Tries.d.mts +4 -4
- package/{types → generated/types}/src/function/TryAsync.d.mts +2 -2
- package/{types → generated/types}/src/function/TryNew.d.mts +1 -1
- package/generated/types/src/function/TsToMjs.d.mts +27 -0
- package/generated/types/src/function/UniqueFSTempName.d.mts +9 -0
- package/generated/types/src/function/errorToMessage.d.mts +5 -0
- package/generated/types/src/neinth/VivthyNeinth.d.mts +202 -0
- package/generated/types/src/typehints/ArrayToKeys.d.mts +23 -0
- package/generated/types/src/typehints/AssemblyScriptExportsType.d.mts +4 -0
- package/generated/types/src/typehints/AssemblyScriptLoaderInstantiate.d.mts +4 -0
- package/generated/types/src/typehints/AutoDocASOptions.d.mts +15 -0
- package/generated/types/src/typehints/ChainableType.d.mts +3 -0
- package/generated/types/src/typehints/ComponentDecorator_Constructor.d.mts +3 -0
- package/generated/types/src/typehints/ConsoleAdditionalSettingType.d.mts +3 -0
- package/generated/types/src/typehints/Decorator.d.mts +11 -0
- package/generated/types/src/typehints/DecoratorMonkeyPatch.d.mts +15 -0
- package/{types/src/types → generated/types/src/typehints}/DevTestCB.d.mts +2 -2
- package/generated/types/src/typehints/EnvModeType.d.mts +4 -0
- package/generated/types/src/typehints/ListArg.d.mts +4 -0
- package/generated/types/src/typehints/MonkeyPatchedType.d.mts +1 -0
- package/generated/types/src/typehints/ParametersFollowingN.d.mts +13 -0
- package/generated/types/src/typehints/PrefixedKeysOf.d.mts +1 -0
- package/generated/types/src/typehints/Runtime.d.mts +4 -0
- package/generated/types/src/typehints/SafeImportReturnType.d.mts +1 -0
- package/generated/types/src/typehints/StylePropRefType.d.mts +2 -0
- package/generated/types/src/typehints/TemplateLiteralValueHandler.d.mts +10 -0
- package/generated/types/src/typehints/VLifecycleCallbacks.d.mts +6 -0
- package/generated/types/src/typehints/VivthCleanup.d.mts +12 -0
- package/generated/types/src/web/BrowserDirMapper.d.mts +70 -0
- package/generated/types/src/web/EnsureValidTag.d.mts +7 -0
- package/generated/types/src/web/ViteAddDynamics.d.mts +28 -0
- package/generated/types/src/web/ViteGetAllHTMLFile.d.mts +9 -0
- package/generated/types/src/web/WC_extendsA.d.mts +135 -0
- package/generated/types/src/web/WC_extendsB.d.mts +135 -0
- package/generated/types/src/web/bindings/WC_StyleProp_bind.d.mts +42 -0
- package/generated/types/src/web/bindings/WC_createElement_bind.d.mts +51 -0
- package/generated/types/src/web/bindings/WC_createNamedSlot.d.mts +26 -0
- package/generated/types/src/web/bindings/WC_litRender_bind.d.mts +20 -0
- package/generated/types/src/web/bindings/WC_litStyleMap.d.mts +7 -0
- package/generated/types/src/web/common/CSS.d.mts +23 -0
- package/generated/types/src/web/common/E.d.mts +41 -0
- package/generated/types/src/web/common/NewStyleSheetAsync.d.mts +15 -0
- package/generated/types/src/web/common/NewStyleSheetSync.d.mts +15 -0
- package/generated/types/src/web/common/WC_TagName_type.d.mts +15 -0
- package/generated/types/src/web/signals/IsInViewPortSignal.d.mts +52 -0
- package/generated/types/src/web/signals/ObserverSignal.d.mts +32 -0
- package/generated/types/src/web/signals/WC_litRef.d.mts +26 -0
- package/generated/types/src/web/signals/WC_loopedSiblingsRef.d.mts +44 -0
- package/generated/vivth/exports/all.mjs +233 -0
- package/generated/vivth/exports/neutral.mjs +193 -0
- package/generated/vivth/exports/node.mjs +46 -0
- package/package.json +50 -14
- package/src/bundler/CompileAS.mjs +36 -0
- package/src/bundler/CompileJS.mjs +98 -171
- package/src/bundler/CreateESPlugin.mjs +1 -1
- package/src/bundler/EsBundler.mjs +38 -13
- package/src/bundler/FSAnalyzer.mjs +253 -0
- package/src/bundler/FSasar.bundled.mjs +128 -0
- package/src/bundler/FSasar.mjs +96 -0
- package/src/bundler/FileSelfMapper.mjs +491 -0
- package/src/bundler/JSDirMapper.mjs +528 -0
- package/src/bundler/RunWatchThenCompileJSOnSafeExit.mjs +129 -0
- package/src/bundler/adds/BrowserExternals.mjs +37 -0
- package/src/bundler/adds/CreateTransform.mjs +36 -0
- package/src/bundler/adds/LastEditedUnix.mjs +12 -0
- package/src/bundler/adds/NodeModuleList.mjs +33 -0
- package/src/bundler/adds/PathFSBundles.bundled.mjs +41 -0
- package/src/bundler/adds/PathFSBundles.mjs +91 -0
- package/src/bundler/adds/PathFSDir.bundled.mjs +53 -0
- package/src/bundler/adds/PathFSDir.mjs +100 -0
- package/src/bundler/adds/PathFSFile.bundled.mjs +40 -0
- package/src/bundler/adds/PathFSFile.mjs +85 -0
- package/src/bundler/adds/ToBundledJSPlugin.mjs +116 -55
- package/src/bundler/adds/autoExternalize.mjs +81 -0
- package/src/bundler/adds/emptyBufferValue.mjs +5 -0
- package/src/bundler/adds/isModuleTheBundledVersion.mjs +10 -0
- package/src/bundler/adds/onEndEsBuildErrorLogger.mjs +34 -0
- package/src/bundler/adds/resolveJSDependencyPath.mjs +17 -0
- package/src/class/AwaitSignal.mjs +119 -0
- package/src/class/Console.mjs +36 -14
- package/src/class/DataLog.mjs +29 -0
- package/src/class/Derived.mjs +67 -55
- package/src/class/Effect.mjs +270 -84
- package/src/class/EnvSignal.mjs +11 -8
- package/src/class/EsWatcher.mjs +60 -0
- package/src/class/EventSignal.mjs +46 -58
- package/src/class/FSDirArchWatcher.mjs +246 -0
- package/src/class/FileSafe.mjs +72 -24
- package/src/class/ForEach.mjs +78 -0
- package/src/class/ForSignal.mjs +115 -0
- package/src/class/GetterSetter.mjs +40 -0
- package/src/class/JSONFileHandler.mjs +90 -0
- package/src/class/ListSignal.mjs +68 -26
- package/src/class/LitExp.mjs +59 -36
- package/src/class/ObjectSignal.mjs +225 -0
- package/src/class/Paths.mjs +56 -20
- package/src/class/Prettivy.mjs +51 -0
- package/src/class/QChannel.mjs +48 -26
- package/src/class/SafeExit.mjs +156 -99
- package/src/class/Setup.mjs +28 -16
- package/src/class/Signal.mjs +50 -27
- package/src/class/SignalCollection.mjs +130 -0
- package/src/class/WalkThrough.mjs +6 -23
- package/src/class/{WorkerMainThreadBundled.mjs → WorkerMainThread.bundled.mjs} +61 -84
- package/src/class/WorkerMainThread.mjs +103 -102
- package/src/class/WorkerThread.mjs +24 -17
- package/src/common/Base64URL.mjs +6 -3
- package/src/common/Base64URLFromFile.mjs +17 -4
- package/src/common/BundledV.bundled.mjs +7 -0
- package/src/common/BundledV.mjs +45 -0
- package/src/common/CreateStringID.mjs +8 -7
- package/src/common/EnvMode.mjs +172 -0
- package/src/common/FactoryKey.mjs +11 -0
- package/src/common/Preferrence.mjs +27 -0
- package/src/common/Trace.mjs +1 -1
- package/src/common/TracePath.mjs +53 -3
- package/src/common/VivthUnBundledCodeBlock.mjs +8 -0
- package/src/doc/JSautoDOC.mjs +673 -284
- package/src/doc/cleanPreserveTypedef.mjs +27 -0
- package/src/doc/correctBeforeParse.mjs +57 -48
- package/src/doc/{parsedFile.mjs → parsedFileForDOC.mjs} +133 -120
- package/src/function/ClearRequireCache.mjs +33 -0
- package/src/function/CreateImmutable.mjs +40 -37
- package/src/function/EventCheck.mjs +5 -2
- package/src/function/EventObject.mjs +2 -6
- package/src/function/ForInAsync.mjs +76 -0
- package/src/function/ForInSync.mjs +87 -0
- package/src/function/ForOfAsync.mjs +61 -0
- package/src/function/ForOfSync.mjs +70 -0
- package/src/function/GetBufferFromRelativePath.mjs +25 -0
- package/src/function/GetFilesFromDir.mjs +49 -0
- package/src/function/GetMaxFilenameLength.mjs +32 -0
- package/src/function/GetModuleEsbuildPlatform.mjs +118 -0
- package/src/function/GetNamedImportAlias.mjs +2 -2
- package/src/function/GetRuntime.mjs +10 -14
- package/src/function/InstantiateAssemblyScript.mjs +22 -0
- package/src/function/IsAsync.mjs +1 -1
- package/src/function/IsInstanceOf.mjs +29 -0
- package/src/function/IsSameFile.mjs +41 -0
- package/src/function/IsStringLooksLikeAPath.mjs +20 -0
- package/src/function/IsTypeOf.mjs +27 -0
- package/src/function/IsTypeOf.mts +31 -0
- package/src/function/LazyFactory.mjs +25 -23
- package/src/function/MonkeyPatch.mjs +38 -0
- package/src/function/NewAnimationTimeline.mjs +55 -0
- package/src/function/NewChainable.mjs +69 -0
- package/src/function/NewDynamicsExport.mjs +312 -0
- package/src/function/NewObjectWrapper.mjs +14 -0
- package/src/function/ObjectRegistrar.mjs +23 -0
- package/src/function/ParseSQLFile.mjs +129 -0
- package/src/function/PipeAsync.mjs +30 -0
- package/src/function/PipeSync.mjs +28 -0
- package/src/function/SafeImport.mjs +77 -0
- package/src/function/TemplateLiteral.mjs +42 -23
- package/src/function/Timeout.mjs +4 -4
- package/src/function/Tries.mjs +22 -16
- package/src/function/TryAsync.mjs +3 -2
- package/src/function/TryNew.mjs +1 -1
- package/src/function/TsToMjs.mjs +184 -21
- package/src/function/UniqueFSTempName.mjs +33 -0
- package/src/function/errorToMessage.mjs +21 -0
- package/src/function/resolveErrorArray.mjs +15 -1
- package/src/neinth/VivthyNeinth.mjs +487 -0
- package/src/typehints/ArrayToKeys.mjs +17 -0
- package/src/typehints/ArrayToKeys.mts +31 -0
- package/src/typehints/AssemblyScriptExportsType.mjs +7 -0
- package/src/typehints/AssemblyScriptLoaderInstantiate.mjs +7 -0
- package/src/typehints/AutoDocASOptions.mjs +14 -0
- package/src/typehints/ChainableType.mjs +11 -0
- package/src/typehints/ComponentDecorator_Constructor.mjs +10 -0
- package/src/typehints/ConsoleAdditionalSettingType.mjs +6 -0
- package/src/typehints/Decorator.mjs +9 -0
- package/src/typehints/Decorator.mts +31 -0
- package/src/typehints/DecoratorMonkeyPatch.mjs +10 -0
- package/src/typehints/DecoratorMonkeyPatch.mts +43 -0
- package/src/{types → typehints}/DevTestCB.mjs +2 -2
- package/src/typehints/EnvModeType.mjs +6 -0
- package/src/{types → typehints}/ListArg.mjs +1 -1
- package/src/{types → typehints}/LitExpResultType.mjs +1 -1
- package/src/typehints/MonkeyPatchedType.mjs +13 -0
- package/src/typehints/ParametersFollowingN.mjs +8 -0
- package/src/typehints/ParametersFollowingN.mts +17 -0
- package/src/typehints/PrefixedKeysOf.mjs +9 -0
- package/src/typehints/Runtime.mjs +6 -0
- package/src/typehints/SafeImportReturnType.mjs +6 -0
- package/src/typehints/StylePropRefType.mjs +12 -0
- package/src/typehints/TemplateLiteralValueHandler.mjs +14 -0
- package/src/typehints/VLifecycleCallbacks.mjs +10 -0
- package/src/typehints/VivthCleanup.mjs +14 -0
- package/src/web/BrowserDirMapper.mjs +255 -0
- package/src/web/EnsureValidTag.mjs +5 -0
- package/src/web/EnsureValidTag.mts +10 -0
- package/src/web/ViteAddDynamics.mjs +34 -0
- package/src/web/ViteGetAllHTMLFile.mjs +97 -0
- package/src/web/WC_extendsA.mjs +330 -0
- package/src/web/WC_extendsB.mjs +332 -0
- package/src/web/bindings/WC_StyleProp_bind.mjs +70 -0
- package/src/web/bindings/WC_createElement_bind.mjs +95 -0
- package/src/web/bindings/WC_createNamedSlot.mjs +29 -0
- package/src/web/bindings/WC_litRender_bind.mjs +26 -0
- package/src/web/bindings/WC_litStyleMap.mjs +14 -0
- package/src/web/common/CSS.mjs +35 -0
- package/src/web/common/E.mjs +126 -0
- package/src/web/common/NewStyleSheetAsync.mjs +21 -0
- package/src/web/common/NewStyleSheetSync.mjs +21 -0
- package/src/web/common/WC_TagName_type.mjs +10 -0
- package/src/web/common/WC_TagName_type.mts +36 -0
- package/src/web/signals/IsInViewPortSignal.mjs +140 -0
- package/src/web/signals/ObserverSignal.mjs +93 -0
- package/src/web/signals/WC_litRef.mjs +61 -0
- package/src/web/signals/WC_loopedSiblingsRef.mjs +100 -0
- package/tsconfig.json +44 -41
- package/index.mjs +0 -91
- package/src/bundler/FSInline.mjs +0 -67
- package/src/bundler/FSInlineAnalyzer.mjs +0 -228
- package/src/bundler/FSInlineBundled.mjs +0 -38
- package/src/bundler/adds/externals.mjs +0 -8
- package/src/class/ListDerived.mjs +0 -42
- package/src/common/Dev.mjs +0 -134
- package/src/common/DevBundled.mjs +0 -5
- package/src/common/lazie.mjs +0 -3
- package/src/types/IsListSignal.mjs +0 -6
- package/src/types/Runtime.mjs +0 -6
- package/src/types/VivthDevCodeBlockStringType.mjs +0 -6
- package/types/index.d.mts +0 -58
- package/types/src/bundler/CompileJS.d.mts +0 -119
- package/types/src/bundler/FSInline.d.mts +0 -50
- package/types/src/bundler/FSInlineAnalyzer.d.mts +0 -37
- package/types/src/bundler/FSInlineBundled.d.mts +0 -22
- package/types/src/bundler/adds/externals.d.mts +0 -1
- package/types/src/class/Console.d.mts +0 -71
- package/types/src/class/Derived.d.mts +0 -98
- package/types/src/class/Effect.d.mts +0 -216
- package/types/src/class/ListDerived.d.mts +0 -38
- package/types/src/class/Paths.d.mts +0 -69
- package/types/src/class/SafeExit.d.mts +0 -103
- package/types/src/class/WorkerMainThreadBundled.d.mts +0 -83
- package/types/src/common/Base64URLFromFile.d.mts +0 -16
- package/types/src/common/Dev.d.mts +0 -68
- package/types/src/common/DevBundled.d.mts +0 -3
- package/types/src/common/lazie.d.mts +0 -1
- package/types/src/doc/JSautoDOC.d.mts +0 -83
- package/types/src/function/GetRuntime.d.mts +0 -2
- package/types/src/function/TemplateLiteral.d.mts +0 -22
- package/types/src/function/TsToMjs.d.mts +0 -23
- package/types/src/types/IsListSignal.d.mts +0 -4
- package/types/src/types/ListArg.d.mts +0 -4
- package/types/src/types/Runtime.d.mts +0 -4
- package/types/src/types/VivthDevCodeBlockStringType.d.mts +0 -4
- /package/{types → generated/types}/src/bundler/adds/pluginVivthBundle.d.mts +0 -0
- /package/{types → generated/types}/src/class/WorkerResult.d.mts +0 -0
- /package/{types → generated/types}/src/common/EventNameSpace.d.mts +0 -0
- /package/{types → generated/types}/src/common/eventObjects.d.mts +0 -0
- /package/{types → generated/types}/src/common/keys.d.mts +0 -0
- /package/{types → generated/types}/src/doc/correctBeforeParse.d.mts +0 -0
- /package/{types → generated/types}/src/function/TrySync.d.mts +0 -0
- /package/{types → generated/types}/src/function/resolveErrorArray.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/AnyButUndefined.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/ExtnameType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/LitExpKeyType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/LitExpResultType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/MutationType.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/QCBFIFOReturn.d.mts +0 -0
- /package/{types/src/types → generated/types/src/typehints}/QCBReturn.d.mts +0 -0
- /package/src/{types → typehints}/AnyButUndefined.mjs +0 -0
- /package/src/{types → typehints}/ExtnameType.mjs +0 -0
- /package/src/{types → typehints}/LitExpKeyType.mjs +0 -0
- /package/src/{types → typehints}/MutationType.mjs +0 -0
- /package/src/{types → typehints}/QCBFIFOReturn.mjs +0 -0
- /package/src/{types → typehints}/QCBReturn.mjs +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* A type-safe `instanceof` helper.
|
|
4
|
+
* @template OBJ
|
|
5
|
+
* @param {unknown} obj - The object to test
|
|
6
|
+
* @param {new (...args: any[]) => OBJ} classRef - A constructor reference for T
|
|
7
|
+
* @returns {obj is OBJ}
|
|
8
|
+
* @example
|
|
9
|
+
* import { IsInstanceOf, Signal, Effect } from 'vivth/neutral';
|
|
10
|
+
*
|
|
11
|
+
* const a = new Signal(0);
|
|
12
|
+
* IsInstanceOf(a, Signal); // true
|
|
13
|
+
* IsInstanceOf(a, Effect); // false
|
|
14
|
+
*
|
|
15
|
+
* // but why not
|
|
16
|
+
* if(!(a instanceof Signal)){
|
|
17
|
+
* //
|
|
18
|
+
* };
|
|
19
|
+
*
|
|
20
|
+
* // here's why
|
|
21
|
+
* if(!IsInstanceOf(a, Signal)){
|
|
22
|
+
* //
|
|
23
|
+
* };
|
|
24
|
+
*/
|
|
25
|
+
export function IsInstanceOf<OBJ>(obj: unknown, classRef: new (...args: any[]) => OBJ): obj is OBJ;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - check if two path is the same file;
|
|
4
|
+
* @param {string} pathA
|
|
5
|
+
* @param {string} pathB
|
|
6
|
+
* @returns {boolean}
|
|
7
|
+
* @example
|
|
8
|
+
* // `D://myFile.mjs` cwd at `D://`
|
|
9
|
+
* import { IsSameFile } from "vivth/node";
|
|
10
|
+
*
|
|
11
|
+
* IsSameFile('D:\\mFile.mjs', 'D://mFile.mjs') // true;
|
|
12
|
+
* IsSameFile('//mFile.mjs', 'D://mFile.mjs') // true;
|
|
13
|
+
* // both path are auto resolved to Paths.root;
|
|
14
|
+
* IsSameFile('D:\\mFile.mjs', 'D:\\notmfile.mjs') // false;
|
|
15
|
+
*/
|
|
16
|
+
export function IsSameFile(pathA: string, pathB: string): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - check if string lookslike a path;
|
|
4
|
+
* @param {string} spec
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
* @example
|
|
7
|
+
* import { IsStringLooksLikeAPath } from 'vivth/neutral';
|
|
8
|
+
*
|
|
9
|
+
* looksLikePath("./foo.mjs"); // true
|
|
10
|
+
* looksLikePath("../bar.ts"); // true
|
|
11
|
+
* looksLikePath("/usr/lib.js"); // true
|
|
12
|
+
* looksLikePath("C:\\lib\\mod"); // true
|
|
13
|
+
* looksLikePath("react"); // false
|
|
14
|
+
* looksLikePath("node:path"); // false
|
|
15
|
+
*/
|
|
16
|
+
export function IsStringLooksLikeAPath(spec: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map of 'typeof' string results to their actual TypeScript types.
|
|
3
|
+
* Using a constant object allows for type-safe extraction without
|
|
4
|
+
* manual conditional mapping.
|
|
5
|
+
*/
|
|
6
|
+
export declare const TypeMap: {
|
|
7
|
+
string: string;
|
|
8
|
+
number: number;
|
|
9
|
+
boolean: boolean;
|
|
10
|
+
object: {};
|
|
11
|
+
function: () => void;
|
|
12
|
+
undefined: undefined;
|
|
13
|
+
symbol: symbol;
|
|
14
|
+
bigint: bigint;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* @preserve
|
|
18
|
+
* @description
|
|
19
|
+
* A type-safe `typeof` helper.
|
|
20
|
+
* @template {keyof typeof TypeMap} K
|
|
21
|
+
* @param {unknown} object - The value to check.
|
|
22
|
+
* @param {K} type - The type string to compare against.
|
|
23
|
+
* @returns {object is typeof TypeMap[K]} - Returns true if the type matches, narrowing the type.
|
|
24
|
+
*/
|
|
25
|
+
export declare function IsTypeOf<K extends keyof typeof TypeMap>(object: unknown, type: K): object is (typeof TypeMap)[K];
|
|
@@ -4,12 +4,14 @@
|
|
|
4
4
|
* >- usefull for lazily instantiating an object, since instance naturally have props/methods;
|
|
5
5
|
* @template FACTORY
|
|
6
6
|
* @param {() => FACTORY} factory
|
|
7
|
-
* @returns {FACTORY & {[
|
|
8
|
-
* - the
|
|
9
|
-
*
|
|
10
|
-
* >-
|
|
7
|
+
* @returns {FACTORY & {[FactoryKey]: FACTORY}}
|
|
8
|
+
* - the FactoryKey prop can be accessed to force instatiation/call;
|
|
9
|
+
* - usefull for Object that has different accessor behaviour when being get via Proxy, including but not limited too:
|
|
10
|
+
* >- `Set<any>`;
|
|
11
|
+
* >- `Map<any, any>`;
|
|
12
|
+
* >- non referenced object, like `Effect`;
|
|
11
13
|
* @example
|
|
12
|
-
* import { LazyFactory } from
|
|
14
|
+
* import { LazyFactory, FactoryKey } from 'vivth/neutral';
|
|
13
15
|
*
|
|
14
16
|
* class MyClass{
|
|
15
17
|
* constructor() {
|
|
@@ -29,9 +31,6 @@
|
|
|
29
31
|
* const a = myInstance; // not yet initiated;
|
|
30
32
|
* const b = a.myProp // imediately initiated;
|
|
31
33
|
* // OR
|
|
32
|
-
* myInstance[
|
|
34
|
+
* myInstance[FactoryKey] // forcefully call factory generator;
|
|
33
35
|
*/
|
|
34
|
-
export function LazyFactory<FACTORY>(factory: () => FACTORY): FACTORY & {
|
|
35
|
-
[unwrapLazy]: () => FACTORY;
|
|
36
|
-
};
|
|
37
|
-
import { unwrapLazy } from '../common/lazie.mjs';
|
|
36
|
+
export function LazyFactory<FACTORY>(factory: () => FACTORY): FACTORY & {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import {MonkeyPatchedType} from '../typehints/MonkeyPatchedType.mjs'
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Monkey‑patch an environmental API by replacing a property on a parent object
|
|
6
|
+
* with a new function or class. This allows you to intercept or override
|
|
7
|
+
* browser/Node globals (e.g. `XMLHttpRequest`, `Worker`, `fetch`) without
|
|
8
|
+
* modifying the rest of your application code.
|
|
9
|
+
*
|
|
10
|
+
* ## Notes
|
|
11
|
+
* - Run this before other code that consumes the patched API.
|
|
12
|
+
* - Existing instances created before patching are unaffected.
|
|
13
|
+
* - If the property is non‑writable, assignment will throw.
|
|
14
|
+
* - For classes, always call `super(...args)` in your constructor.
|
|
15
|
+
* - For functions, preserve the call signature to avoid type errors.
|
|
16
|
+
*
|
|
17
|
+
* @template {Object} PAR
|
|
18
|
+
* @template {keyof PAR} KEY
|
|
19
|
+
* @param {PAR} parent - The parent object holding the property (e.g. `window`).
|
|
20
|
+
* @param {KEY} key - The property name on the parent to replace.
|
|
21
|
+
* @param {(
|
|
22
|
+
* arg0:{originalObject:PAR[KEY]}
|
|
23
|
+
* ) => MonkeyPatchedType<PAR[KEY]>
|
|
24
|
+
* } newObjectGenerator
|
|
25
|
+
* - Function that receives the original object and returns the patched version.
|
|
26
|
+
* - For classes: extend `originalObject` and override methods.
|
|
27
|
+
* - For functions: spread arguments(and when necessary, delegate to `originalObject`).
|
|
28
|
+
* @returns {void}
|
|
29
|
+
*/
|
|
30
|
+
export function MonkeyPatch<PAR extends Object, KEY extends keyof PAR>(parent: PAR, key: KEY, newObjectGenerator: (arg0: {
|
|
31
|
+
originalObject: PAR[KEY];
|
|
32
|
+
}) => MonkeyPatchedType<PAR[KEY]>): void;
|
|
33
|
+
import type { MonkeyPatchedType } from '../typehints/MonkeyPatchedType.mjs';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - create animation timeline helper;
|
|
4
|
+
* @param {Object} options
|
|
5
|
+
* @param {number} options.fps
|
|
6
|
+
* - frame per second;
|
|
7
|
+
* @param {{seconds:number}|{frames:number}} options.duration
|
|
8
|
+
* @param {(frame:{index:number, total:number, percentage:number})=>void} callback
|
|
9
|
+
* - called every frame until duration ends;
|
|
10
|
+
* @returns {()=>void}
|
|
11
|
+
* - early clearInterval callback;
|
|
12
|
+
*/
|
|
13
|
+
export function NewAnimationTimeline({ fps, duration }: {
|
|
14
|
+
fps: number;
|
|
15
|
+
duration: {
|
|
16
|
+
seconds: number;
|
|
17
|
+
} | {
|
|
18
|
+
frames: number;
|
|
19
|
+
};
|
|
20
|
+
}, callback: (frame: {
|
|
21
|
+
index: number;
|
|
22
|
+
total: number;
|
|
23
|
+
percentage: number;
|
|
24
|
+
}) => void): () => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - Wraps a target object in a chainable;
|
|
4
|
+
* - example:
|
|
5
|
+
* ```html
|
|
6
|
+
* <canvas id="myCanvas" width="400" height="400"></canvas>
|
|
7
|
+
* ```
|
|
8
|
+
* - chain call are synchronous without awaiting;
|
|
9
|
+
* >- if the method are async, it could cause race condition;
|
|
10
|
+
* @template {object} OBJ
|
|
11
|
+
* @param {OBJ} ctx
|
|
12
|
+
* @returns {import("../typehints/ChainableType.mjs").ChainableType<OBJ>}
|
|
13
|
+
* @example
|
|
14
|
+
* import { NewChainable, TrySync } from 'vivth/neutral';
|
|
15
|
+
*
|
|
16
|
+
* TrySync(()=>{
|
|
17
|
+
* const canvas = document.getElementById('myCanvas');
|
|
18
|
+
* if (!canvas) {
|
|
19
|
+
* return;
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* const ctx2D = canvas.getContext('2d');
|
|
23
|
+
*
|
|
24
|
+
* // instead of repeating call method from `ctx2D`, you can:
|
|
25
|
+
* NewChainable(ctx2D)
|
|
26
|
+
* .beginPath()
|
|
27
|
+
* .moveTo(50, 50)
|
|
28
|
+
* .lineTo(200, 50)
|
|
29
|
+
* .lineTo(200, 200)
|
|
30
|
+
* .closePath()
|
|
31
|
+
* .stroke();
|
|
32
|
+
* // .this to get ctx2D reference;
|
|
33
|
+
* })
|
|
34
|
+
*/
|
|
35
|
+
export function NewChainable<OBJ extends object>(ctx: OBJ): import("../typehints/ChainableType.mjs").ChainableType<OBJ>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* generate generator watcher to `Dynamics`;
|
|
4
|
+
* 1) `./dynamics`: directory;
|
|
5
|
+
* 2) `./dynamics/**[blank]/*`(except 3)): watched source for 3);
|
|
6
|
+
* 3) `./dynamics/Dynamics.mjs`: collection of `modules`|`css`|`commonFile`(with `mimeTypes`);
|
|
7
|
+
* - this module assumes [Paths](#paths) to be already instantiated;
|
|
8
|
+
* @param {Object} options
|
|
9
|
+
* @param {string} options.rootPath
|
|
10
|
+
* - relative path to pseudo root;
|
|
11
|
+
* @param {number} [options.debounce]
|
|
12
|
+
* @param {boolean} [options.useFetchForAssets]
|
|
13
|
+
* - default: `true`;
|
|
14
|
+
* >- non js file will be `fetch`ed;
|
|
15
|
+
* - `false`;
|
|
16
|
+
* >- will use `import` instead;
|
|
17
|
+
* >- useful for vite Plugin;
|
|
18
|
+
* @param {import('chokidar').ChokidarOptions} [options.chokidarOptions]
|
|
19
|
+
* @param {(normalizedPath:string)=>boolean} [options.eachFilter]
|
|
20
|
+
* @returns {ReturnType<typeof TryAsync<FSDirArchWatcher<{ handler: string; mime: string | false; lastEditedUnixValue: number; }>>>}
|
|
21
|
+
*/
|
|
22
|
+
export function NewDynamicsExport({ rootPath, useFetchForAssets, debounce, chokidarOptions, eachFilter }: {
|
|
23
|
+
rootPath: string;
|
|
24
|
+
debounce?: number | undefined;
|
|
25
|
+
useFetchForAssets?: boolean | undefined;
|
|
26
|
+
chokidarOptions?: Partial<{
|
|
27
|
+
persistent: boolean;
|
|
28
|
+
ignoreInitial: boolean;
|
|
29
|
+
followSymlinks: boolean;
|
|
30
|
+
cwd?: string;
|
|
31
|
+
usePolling: boolean;
|
|
32
|
+
interval: number;
|
|
33
|
+
binaryInterval: number;
|
|
34
|
+
alwaysStat?: boolean;
|
|
35
|
+
depth?: number;
|
|
36
|
+
ignorePermissionErrors: boolean;
|
|
37
|
+
atomic: boolean | number;
|
|
38
|
+
} & {
|
|
39
|
+
ignored: import("chokidar").Matcher | import("chokidar").Matcher[];
|
|
40
|
+
awaitWriteFinish: boolean | Partial<import("chokidar").AWF>;
|
|
41
|
+
}> | undefined;
|
|
42
|
+
eachFilter?: ((normalizedPath: string) => boolean) | undefined;
|
|
43
|
+
}): ReturnType<typeof TryAsync<FSDirArchWatcher<{
|
|
44
|
+
handler: string;
|
|
45
|
+
mime: string | false;
|
|
46
|
+
lastEditedUnixValue: number;
|
|
47
|
+
}>>>;
|
|
48
|
+
import { TryAsync } from './TryAsync.mjs';
|
|
49
|
+
import { FSDirArchWatcher } from '../class/FSDirArchWatcher.mjs';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - object creation mapper;
|
|
4
|
+
* @template {Object} OBJ
|
|
5
|
+
* @template {any} MODIFIED
|
|
6
|
+
* @param {OBJ} object
|
|
7
|
+
* @param {(obj:OBJ)=>MODIFIED} callback
|
|
8
|
+
* @returns {MODIFIED}
|
|
9
|
+
*/
|
|
10
|
+
export function NewObjectWrapper<OBJ extends Object, MODIFIED extends unknown>(object: OBJ, callback: (obj: OBJ) => MODIFIED): MODIFIED;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - function helper to object registrar;
|
|
4
|
+
* @template {any[]} ARGS
|
|
5
|
+
* @template {any} OBJ
|
|
6
|
+
* @param {(...args:ARGS)=>OBJ} registrarCallback
|
|
7
|
+
* @returns {Parameters<typeof ObjectRegistrar<ARGS, OBJ>>[0]}
|
|
8
|
+
* @example
|
|
9
|
+
* import { ObjectRegistrar, Signal, ForOfSync } from 'vivth/neutral';
|
|
10
|
+
*
|
|
11
|
+
* const autoCleanedUpSignal = ObjectRegistrar(()=>{
|
|
12
|
+
*
|
|
13
|
+
* })
|
|
14
|
+
*
|
|
15
|
+
* const mySignal = autoCleanedUpSignal(1);
|
|
16
|
+
*/
|
|
17
|
+
export function ObjectRegistrar<ARGS extends any[], OBJ extends unknown>(registrarCallback: (...args: ARGS) => OBJ): Parameters<typeof ObjectRegistrar<ARGS, OBJ>>[0];
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - parse then generate file right next to said sql file;
|
|
4
|
+
* - this function assume `Paths` already instantiated;s
|
|
5
|
+
* @param {string} path
|
|
6
|
+
* @param {(
|
|
7
|
+
* arg0:{input:Record<string, string>,output:Record<string, string>, sqlString:string}
|
|
8
|
+
* )=>
|
|
9
|
+
* {ext:string, content:string}
|
|
10
|
+
* } [fileGenerator]
|
|
11
|
+
* - file string generator;
|
|
12
|
+
* - the default will generate mjs callback type, and sql string;
|
|
13
|
+
* >- `callback` type: basename + 'CBType';
|
|
14
|
+
* >- `sql` string: basename + 'SQL';
|
|
15
|
+
* @returns {ReturnType<typeof TryAsync<boolean>>}
|
|
16
|
+
*/
|
|
17
|
+
export function ParseSQLFile(path: string, fileGenerator?: (arg0: {
|
|
18
|
+
input: Record<string, string>;
|
|
19
|
+
output: Record<string, string>;
|
|
20
|
+
sqlString: string;
|
|
21
|
+
}) => {
|
|
22
|
+
ext: string;
|
|
23
|
+
content: string;
|
|
24
|
+
}): ReturnType<typeof TryAsync<boolean>>;
|
|
25
|
+
import { TryAsync } from './TryAsync.mjs';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - create an async pipeline starting from an initial value;
|
|
4
|
+
* - every step must return the same type (VALUE), but may be sync or async.
|
|
5
|
+
* @template {any} VALUE
|
|
6
|
+
* @param {VALUE} intialValue
|
|
7
|
+
* @param {...((currentvalue:VALUE)=>VALUE|Promise<VALUE>)} pipeFunctions
|
|
8
|
+
* @returns {Promise<VALUE>}
|
|
9
|
+
* @example
|
|
10
|
+
* import { PipeAsync } from 'vivth/neutral';
|
|
11
|
+
*
|
|
12
|
+
* const res = await PipeAsync(
|
|
13
|
+
* 'intialValue', // res: Promise<"intialValue">
|
|
14
|
+
* (val) => `${val}:1`, // res: Promise<"intialValue:1">
|
|
15
|
+
* async (val) => `${val}:2`, // res: Promise<"intialValue:1:2">
|
|
16
|
+
* (val) => `${val}:3` // res: Promise<"intialValue:1:2:3">
|
|
17
|
+
* );
|
|
18
|
+
*/
|
|
19
|
+
export function PipeAsync<VALUE extends unknown>(intialValue: VALUE, ...pipeFunctions: ((currentvalue: VALUE) => VALUE | Promise<VALUE>)[]): Promise<VALUE>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* @template {any} VALUE
|
|
4
|
+
* @param {VALUE} intialValue
|
|
5
|
+
* @param {...((currentvalue:VALUE)=>VALUE)} pipeFunctions
|
|
6
|
+
* @returns {VALUE}
|
|
7
|
+
* @example
|
|
8
|
+
* import { PipeSync } from 'vivth/neutral';
|
|
9
|
+
*
|
|
10
|
+
* const res = PipeSync(
|
|
11
|
+
* 'intialValue', // res: "intialValue"
|
|
12
|
+
* (val) => `${val}:1`, // res: "intialValue:1"
|
|
13
|
+
* (val) => `${val}:2`, // res: "intialValue:1:2"
|
|
14
|
+
* (val) => `${val}:3` // res: "intialValue:1:2:3"
|
|
15
|
+
* );
|
|
16
|
+
*/
|
|
17
|
+
export function PipeSync<VALUE extends unknown>(intialValue: VALUE, ...pipeFunctions: ((currentvalue: VALUE) => VALUE)[]): VALUE;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - import while imediately call clearing require caches;
|
|
4
|
+
* - `usecases`:
|
|
5
|
+
* >- long running process that need to prevent memory leak from uncleanable `cached import`;
|
|
6
|
+
* >- to simply import fresh everytime;
|
|
7
|
+
* - the imported module can then just be treated like any other variable, to only lived and tracked by variable reference only;
|
|
8
|
+
* - due to how `vivth/node.ClearRequireCache` works, parallel await (like using Promise.all, or not awaited until later) will be done squentially(if targetting the same path);
|
|
9
|
+
* @template { any } T
|
|
10
|
+
* - put the type
|
|
11
|
+
* @param {string} path
|
|
12
|
+
* - either absolute `diskAbsolutepath` or from `Paths.root`;
|
|
13
|
+
* @returns {ReturnType<typeof import('./TryAsync.mjs').TryAsync<T>>}
|
|
14
|
+
* @example
|
|
15
|
+
* // Paths.root/myscript.mjs
|
|
16
|
+
* import { SafeImport } from 'vivth/node';
|
|
17
|
+
*
|
|
18
|
+
* // add type with: import('vivth/neutral').SafeImportReturnType<import('./something.mjs')>
|
|
19
|
+
* const [importedModule, errorSafeImport] = await SafeImport('/absolute/path/from/Paths.root/something.mjs');
|
|
20
|
+
*/
|
|
21
|
+
export function SafeImport<T extends unknown>(path: string): ReturnType<typeof import("./TryAsync.mjs").TryAsync<T>>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - function helper to create template literal with valueHandler to handle each values;
|
|
4
|
+
* @template {any} INPUTTYPE
|
|
5
|
+
* @template {string|Promise<string>} RET
|
|
6
|
+
* @param {import('../typehints/TemplateLiteralValueHandler.mjs').TemplateLiteralValueHandler<INPUTTYPE>} valueHandler
|
|
7
|
+
* @param {(result:string)=>(RET)} [postProcess]
|
|
8
|
+
* @returns {(strings:TemplateStringsArray,
|
|
9
|
+
* ...values:(INPUTTYPE)[])=>
|
|
10
|
+
* RET}
|
|
11
|
+
* @example
|
|
12
|
+
* import { TemplateLiteral } from 'vivth/neutral';
|
|
13
|
+
*
|
|
14
|
+
* export const html = TemplateLiteral(
|
|
15
|
+
* ({ ...datas }) => `my string`,
|
|
16
|
+
* // optional
|
|
17
|
+
* (res) => return window.body.innerHTML = res
|
|
18
|
+
* );
|
|
19
|
+
*
|
|
20
|
+
* html`<div>${`<button>innerButton</button>`}</div>`;
|
|
21
|
+
* // this will set innerHTML of body to '<div><button>innerButton</button></div>'
|
|
22
|
+
*/
|
|
23
|
+
export function TemplateLiteral<INPUTTYPE extends unknown, RET extends string | Promise<string>>(valueHandler: import("../typehints/TemplateLiteralValueHandler.mjs").TemplateLiteralValueHandler<INPUTTYPE>, postProcess?: (result: string) => (RET)): (strings: TemplateStringsArray, ...values: (INPUTTYPE)[]) => RET;
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
* @param {RecordTryType} tryRecord
|
|
15
15
|
* @returns {Promise<
|
|
16
16
|
* [[keyof RecordTryType, RETURNTYPE], undefined]
|
|
17
|
-
* | [[undefined, undefined], Error
|
|
17
|
+
* | [[undefined, undefined], Set<Error>]
|
|
18
18
|
* >}
|
|
19
19
|
* @example
|
|
20
|
-
* import { Tries } from 'vivth';
|
|
20
|
+
* import { Tries } from 'vivth/neutral';
|
|
21
21
|
*
|
|
22
|
-
* const [[key, result],
|
|
22
|
+
* const [[key, result], setOfError] = await Tries({
|
|
23
23
|
* someRuntime: async ({ prevError }) => {
|
|
24
24
|
* // asuming on this one doesn't naturally throw error,
|
|
25
25
|
* // yet you need to continue to next key,
|
|
@@ -49,4 +49,4 @@
|
|
|
49
49
|
*/
|
|
50
50
|
export function Tries<KEY extends string, RETURNTYPE, RecordTryType extends Record<KEY, (err: {
|
|
51
51
|
prevError: undefined | Error;
|
|
52
|
-
}) => Promise<RETURNTYPE>>>(tryRecord: RecordTryType): Promise<[[keyof RecordTryType, RETURNTYPE], undefined] | [[undefined, undefined], Error
|
|
52
|
+
}) => Promise<RETURNTYPE>>>(tryRecord: RecordTryType): Promise<[[keyof RecordTryType, RETURNTYPE], undefined] | [[undefined, undefined], Set<Error>]>;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param {()=>Promise<RESULT>} asyncFunction_
|
|
7
7
|
* @returns {Promise<[RESULT,undefined]|[undefined,Error]>}
|
|
8
8
|
* @example
|
|
9
|
-
* import { TryAsync } from 'vivth';
|
|
9
|
+
* import { TryAsync } from 'vivth/neutral';
|
|
10
10
|
*
|
|
11
11
|
* let [res, error] = await TryAsync(async () => {
|
|
12
12
|
* return await fetch('./someAPI/Path');
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*
|
|
15
15
|
* [res, error] = await TryAsync(async () => {
|
|
16
16
|
* if(!res.ok) {
|
|
17
|
-
* throw
|
|
17
|
+
* throw 404;
|
|
18
18
|
* }
|
|
19
19
|
* return await res.json();
|
|
20
20
|
* })
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @returns {[InstanceType<CLASSREF>, undefined]|
|
|
9
9
|
* [undefined, Error]}
|
|
10
10
|
* @example
|
|
11
|
-
* import { TryNew } from 'vivth';
|
|
11
|
+
* import { TryNew } from 'vivth/neutral';
|
|
12
12
|
*
|
|
13
13
|
* const [instance, error] = TryNew(ClassReference, ...classConstructorParameters)
|
|
14
14
|
* if(!error) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - turn `.mts`||`.ts` file into `.mjs`, no bundling, just traspilation;
|
|
4
|
+
* - on certain circumstance where `.mjs` result needed to be typed, you need to manually add `jsdoc`;
|
|
5
|
+
* >- uses `"at"preserve` to register `jsdoc`;
|
|
6
|
+
* >- at [at]\[blank\]typedef, import itself.mts pointing to the same exported object to fully type it in mjs(which `vivth` used to generate exports);
|
|
7
|
+
* - auto compile and typehint `.as.ts` to `.wasm`;
|
|
8
|
+
* @param {string} path
|
|
9
|
+
* - `relative`(to `Paths.root`) OR `absolute`, both are accepted;
|
|
10
|
+
* @param {Object} [options]
|
|
11
|
+
* @param {string} [options.overrideOutputDir]
|
|
12
|
+
* - default: write conversion to same directory;
|
|
13
|
+
* - path are relative to project root;
|
|
14
|
+
* @param {BufferEncoding} [options.encoding]
|
|
15
|
+
* - default: `utf-8`;
|
|
16
|
+
* @param {import('../typehints/AutoDocASOptions.mjs').AutoDocASOptions} [options.assemblyScriptOptions]
|
|
17
|
+
* @returns {Promise<void>}
|
|
18
|
+
* @example
|
|
19
|
+
* import { TsToMjs } from 'vivth/node';
|
|
20
|
+
*
|
|
21
|
+
* await TsToMjs('./myFile.mts', { encoding: 'utf-8', overrideOutputDir: './other/dir' });
|
|
22
|
+
*/
|
|
23
|
+
export function TsToMjs(path: string, { overrideOutputDir, encoding, assemblyScriptOptions, }?: {
|
|
24
|
+
overrideOutputDir?: string | undefined;
|
|
25
|
+
encoding?: BufferEncoding | undefined;
|
|
26
|
+
assemblyScriptOptions?: import("../typehints/AutoDocASOptions.mjs").AutoDocASOptions | undefined;
|
|
27
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description
|
|
3
|
+
* - generate unique full path name to temp directory + 'vivth/${uniqueName}.tmp';
|
|
4
|
+
* - filename length already calibrated for each os;
|
|
5
|
+
* @param {string} path
|
|
6
|
+
* @param {string} [fileExtention]
|
|
7
|
+
* @returns {string}
|
|
8
|
+
*/
|
|
9
|
+
export function UniqueFSTempName(path: string, fileExtention?: string): string;
|