vivth 0.11.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/.vivth/dist/init.mjs +24 -0
  2. package/README.md +2157 -69
  3. package/README.src.md +35 -0
  4. package/bun.lock +57 -3
  5. package/dev/index.mjs +24 -25
  6. package/index.mjs +51 -29
  7. package/package.json +11 -7
  8. package/src/bundler/CompileMJS.mjs +110 -0
  9. package/src/bundler/EsBundler.mjs +79 -0
  10. package/src/class/Console.mjs +62 -0
  11. package/src/class/Derived.mjs +36 -25
  12. package/src/class/Effect.mjs +106 -0
  13. package/src/class/EnvSignal.mjs +88 -0
  14. package/src/class/EventSignal.mjs +200 -0
  15. package/src/class/ListDerived.mjs +39 -0
  16. package/src/class/ListSignal.mjs +256 -0
  17. package/src/class/Paths.mjs +70 -0
  18. package/src/class/QChannel.mjs +184 -0
  19. package/src/class/SafeExit.mjs +131 -0
  20. package/src/class/Setup.mjs +73 -0
  21. package/src/class/Signal.mjs +152 -54
  22. package/src/class/WorkerMainThread.mjs +328 -0
  23. package/src/class/WorkerResult.mjs +30 -0
  24. package/src/class/WorkerThread.mjs +151 -0
  25. package/src/common/Base64URL.mjs +26 -0
  26. package/src/common/EventNameSpace.mjs +8 -0
  27. package/src/common/eventObjects.mjs +5 -0
  28. package/src/common/lazie.mjs +3 -0
  29. package/src/doc/JSautoDOC.mjs +386 -0
  30. package/src/doc/parsedFile.mjs +537 -0
  31. package/src/function/CreateImmutable.mjs +64 -0
  32. package/src/function/EventCheck.mjs +27 -0
  33. package/src/function/EventObject.mjs +21 -0
  34. package/src/function/IsAsync.mjs +23 -0
  35. package/src/function/LazyFactory.mjs +71 -0
  36. package/src/function/Timeout.mjs +23 -0
  37. package/src/function/Try.mjs +64 -0
  38. package/src/function/TryAsync.mjs +15 -4
  39. package/src/function/TrySync.mjs +9 -4
  40. package/src/function/TsToMjs.mjs +67 -0
  41. package/src/function/WriteFileSafe.mjs +37 -0
  42. package/src/types/{AnyButUndefined.type.mjs → AnyButUndefined.mjs} +1 -0
  43. package/src/types/ExtnameType.mjs +6 -0
  44. package/src/types/IsListSignal.mjs +6 -0
  45. package/src/types/ListArg.mjs +6 -0
  46. package/src/types/MutationType.mjs +8 -0
  47. package/src/types/QCBFIFOReturn.mjs +6 -0
  48. package/src/types/QCBReturn.mjs +6 -0
  49. package/tsconfig.json +3 -3
  50. package/types/dev/index.d.mts +1 -0
  51. package/types/index.d.mts +34 -8
  52. package/types/src/bundler/A.d.mts +1 -0
  53. package/types/src/bundler/CompileMJS.d.mts +8 -0
  54. package/types/src/bundler/EsBundler.d.mts +7 -0
  55. package/types/src/class/Console.d.mts +40 -0
  56. package/types/src/class/Derived.d.mts +21 -9
  57. package/types/src/class/Effect.d.mts +77 -0
  58. package/types/src/class/EnvSignal.d.mts +47 -0
  59. package/types/src/class/EventSignal.d.mts +145 -0
  60. package/types/src/class/ListDerived.d.mts +35 -0
  61. package/types/src/class/ListSignal.d.mts +150 -0
  62. package/types/src/class/Paths.d.mts +50 -0
  63. package/types/src/class/QChannel.d.mts +115 -0
  64. package/types/src/class/SafeExit.d.mts +76 -0
  65. package/types/src/class/Setup.d.mts +76 -0
  66. package/types/src/class/Signal.d.mts +105 -26
  67. package/types/src/class/WorkerMainThread.d.mts +149 -0
  68. package/types/src/class/WorkerResult.d.mts +25 -0
  69. package/types/src/class/WorkerThread.d.mts +70 -0
  70. package/types/src/common/Base64URL.d.mts +1 -0
  71. package/types/src/common/EventNameSpace.d.mts +6 -0
  72. package/types/src/common/eventObjects.d.mts +3 -0
  73. package/types/src/common/lazie.d.mts +1 -0
  74. package/types/src/doc/JSautoDOC.d.mts +76 -0
  75. package/types/src/doc/parsedFile.d.mts +154 -0
  76. package/types/src/function/CreateImmutable.d.mts +3 -0
  77. package/types/src/function/EventCheck.d.mts +2 -0
  78. package/types/src/function/EventObject.d.mts +4 -0
  79. package/types/src/function/IsAsync.d.mts +1 -0
  80. package/types/src/function/LazyFactory.d.mts +4 -0
  81. package/types/src/function/Timeout.d.mts +1 -0
  82. package/types/src/function/Try.d.mts +1 -0
  83. package/types/src/function/TsToMjs.d.mts +4 -0
  84. package/types/src/function/WriteFileSafe.d.mts +2 -0
  85. package/types/src/types/{AnyButUndefined.type.d.mts → AnyButUndefined.d.mts} +3 -0
  86. package/types/src/types/ExtnameType.d.mts +4 -0
  87. package/types/src/types/IsListSignal.d.mts +4 -0
  88. package/types/src/types/ListArg.d.mts +4 -0
  89. package/types/src/types/MutationType.d.mts +5 -0
  90. package/types/src/types/QCBFIFOReturn.d.mts +4 -0
  91. package/types/src/types/QCBReturn.d.mts +7 -0
  92. package/src/class/$.mjs +0 -68
  93. package/src/class/PingFIFO.mjs +0 -78
  94. package/src/class/PingUnique.mjs +0 -84
  95. package/src/class/Q.mjs +0 -98
  96. package/src/class/QFIFO.mjs +0 -66
  97. package/src/class/QUnique.mjs +0 -75
  98. package/src/common.mjs +0 -16
  99. package/src/function/NewQBlock.mjs +0 -39
  100. package/types/src/class/$.d.mts +0 -40
  101. package/types/src/class/PingFIFO.d.mts +0 -57
  102. package/types/src/class/PingUnique.d.mts +0 -48
  103. package/types/src/class/Q.d.mts +0 -63
  104. package/types/src/class/QFIFO.d.mts +0 -47
  105. package/types/src/class/QUnique.d.mts +0 -46
  106. package/types/src/common.d.mts +0 -2
  107. package/types/src/function/NewQBlock.d.mts +0 -1
@@ -1,48 +0,0 @@
1
- /**
2
- * @description
3
- * - a class for Queue;
4
- * > - different `uniqueID`: called `first in first out` style;
5
- * > - same `uniqueID`: will be grouped, only the already running callback and the last callback will be called;
6
- * ```js
7
- * // @ts-check
8
- * import { PingUnique } from 'vivth';
9
- * const uniqueID = 'yourUniqueID'; // can be anything, even a reference to an object;
10
- * const debounceMS = 0; // in miliseconds, optionals, default is 0;
11
- * const handler = () =>{
12
- * new PingUnique(uniqueID, async () => {
13
- * // your code
14
- * }, debounceMS);
15
- * }
16
- * ```
17
- * - this class provides `QUnique.makeQClass`;
18
- * >- this method will setup `QUnique` to use the inputed `queueMap`(as arg0) as centralized lookup for queue managed by `QUnique`;
19
- * >- usefull to modify this class for browser runtime, since `vivth` cannot just refer to window, you can just add `window["someobject"]`: `Map<any, [()=>Promise<any>,number]>` as lookups;
20
- */
21
- export class PingUnique {
22
- /**
23
- * @param {Map<any, [()=>Promise<void>,number]>} queueMap
24
- * @returns {typeof PingUnique}
25
- */
26
- static makeQClass: (queueMap: Map<any, [() => Promise<void>, number]>) => typeof PingUnique;
27
- /**
28
- * @type {Map<any, [()=>Promise<void>,number]>}
29
- */
30
- static "__#3@#queue": Map<any, [() => Promise<void>, number]>;
31
- /**
32
- * @type {boolean}
33
- */
34
- static "__#3@#isRunning": boolean;
35
- /**
36
- * @param {any} id
37
- * @param {()=>Promise<void>} callback
38
- * @param {number} debounceMS
39
- */
40
- static "__#3@#push": (id: any, callback: () => Promise<void>, debounceMS: number) => void;
41
- static "__#3@#run": () => Promise<void>;
42
- /**
43
- * @param {any} id
44
- * @param {()=>Promise<void>} callback
45
- * @param {number} [debounceMS]
46
- */
47
- constructor(id: any, callback: () => Promise<void>, debounceMS?: number);
48
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * @description
3
- * - class that containts static methods to generate Promise based `awaiter` inside async function, to prevent race condition, including but not limited to:
4
- * > - modifying the same `Map`, `Set`(etc.) `Object`/`Instance` inside a `Promise.all`/any code that might fired simultanously;
5
- * ```js
6
- * import { Q } from 'vivth';
7
- *
8
- * const handler = async () => {
9
- * // your code;
10
- * const { resume } = await Q.fifo() // or await Q.unique(uniqueID);
11
- * // your code that modifies and/or access same `Map`;
12
- * resume();
13
- * // the rest of your code;
14
- * return;
15
- * }
16
- *
17
- * const runtime = async () => {
18
- * // await Promise.all(handler1, handler2, ..., handlern);
19
- * }
20
- *
21
- * runtime();
22
- * ```
23
- * - behaviour:
24
- * > - `fifo`: call all queued callback `first in first out` style;
25
- * > - `unique`: call all queued callback with the same `uniqueID` `first in first out` style, if the `uniqueID` is different it will be called in parallel;
26
- * - this class provides `Q.makeQClass`;
27
- * >- this method will setup `Q` to use the inputed `uniqueMap`(as arg0) as centralized lookup for queue managed by `Q`;
28
- * >- usefull to modify this class for browser runtime, since `vivth` cannot just refer to window, you can just add `window["someobject"]`: `Array<Map<any, Promise<any>>>` as lookups;
29
- */
30
- export class Q {
31
- /**
32
- * @param {Map<any, Promise<any>>} uniqueMap
33
- * @returns {typeof Q}
34
- */
35
- static makeQClass: (uniqueMap: Map<any, Promise<any>>) => typeof Q;
36
- /**
37
- * @typedef {import('../types/AnyButUndefined.type.mjs').AnyButUndefined} anyButUndefined
38
- */
39
- /**
40
- * @type {Promise<void>}
41
- */
42
- static "__#4@#fifo": Promise<void>;
43
- /**
44
- * Blocks execution for subsequent calls until the current one finishes.
45
- * @returns {Promise<{resume:()=>void}>} Resolves when it's safe to proceed, returning a cleanup function
46
- */
47
- static fifo: () => Promise<{
48
- resume: () => void;
49
- }>;
50
- /**
51
- * @type {Map<any, Promise<any>>}
52
- */
53
- static "__#4@#unique": Map<any, Promise<any>>;
54
- /**
55
- * Ensures that each id has only one task running at a time.
56
- * Calls with the same id will wait for the previous call to finish.
57
- * @param {anyButUndefined} id
58
- * @returns {Promise<{resume:()=>void}>} Resolves when it's safe to proceed for the given id, returning a cleanup function
59
- */
60
- static unique: (id: import("../types/AnyButUndefined.type.mjs").AnyButUndefined) => Promise<{
61
- resume: () => void;
62
- }>;
63
- }
@@ -1,47 +0,0 @@
1
- /**
2
- * @description
3
- * ```js
4
- * /**
5
- * * @typedef {[callback:()=>(any|Promise<any>),debounce?:(number)]} queueFIFODetails
6
- * *[blank]/
7
- * ```
8
- * - a class for Queue;
9
- * - for minimal total bundle size use `function` [NewPingFIFO](#newpingfifo) instead;
10
- * - this class provides `QFIFO.makeQClass`;
11
- * >- this method will setup `QFIFO` to use the inputed `queueArray`(as arg0) as centralized lookup for queue managed by `QFIFO`;
12
- * >- usefull to modify this class for browser runtime, since `vivth` cannot just refer to window, you can just add `window["someobject"]`: `Array<queueFIFODetails>` as lookups;
13
- */
14
- export class QFIFO {
15
- /**
16
- * @param {queueFIFODetails[]} queueArray
17
- * @returns {typeof QFIFO}
18
- */
19
- static makeQClass: (queueArray: queueFIFODetails[]) => typeof QFIFO;
20
- /**
21
- * @type {queueFIFODetails[]}
22
- */
23
- static "__#5@#queue": queueFIFODetails[];
24
- /**
25
- * @type {boolean}
26
- */
27
- static "__#5@#isRunning": boolean;
28
- /**
29
- * @type {(...queueFIFODetails:queueFIFODetails)=>void}
30
- */
31
- static assign: (...queueFIFODetails: queueFIFODetails) => void;
32
- /**
33
- * @param {queueFIFODetails} _queue
34
- */
35
- static "__#5@#push": (_queue: queueFIFODetails) => void;
36
- static "__#5@#run": () => Promise<void>;
37
- }
38
- /**
39
- * *[blank]/
40
- * ```
41
- * - a class for Queue;
42
- * - for minimal total bundle size use `function` [NewPingFIFO](#newpingfifo) instead;
43
- * - this class provides `QFIFO.makeQClass`;
44
- * >- this method will setup `QFIFO` to use the inputed `queueArray`(as arg0) as centralized lookup for queue managed by `QFIFO`;
45
- * >- usefull to modify this class for browser runtime, since `vivth` cannot just refer to window, you can just add `window["someobject"]`: `Array<queueFIFODetails>` as lookups;
46
- */
47
- export type queueFIFODetails = [callback: () => (any | Promise<any>), debounce?: (number)];
@@ -1,46 +0,0 @@
1
- /**
2
- * @description
3
- * - a class for Queue;
4
- * - for minimal total bundle size use `function` [NewPingUnique](#newpingunique) instead;
5
- * - this class provides `QUnique.makeQClass`;
6
- * >- this method will setup `QUnique` to use the inputed `queueMap`(as arg0) as centralized lookup for queue managed by `QUnique`;
7
- * >- usefull to modify this class for browser runtime, since `vivth` cannot just refer to window, you can just add `window["someobject"]`: `Map<any, [()=>Promise<any>,number]>` as lookups;
8
- */
9
- export class QUnique {
10
- /**
11
- * @param {Map<any, [()=>Promise<any>,number]>} queueMap
12
- * @returns {typeof QUnique}
13
- */
14
- static makeQClass: (queueMap: Map<any, [() => Promise<any>, number]>) => typeof QUnique;
15
- /**
16
- * @typedef {Object} queueUniqueObject
17
- * @property {any} i
18
- * @property {()=>(any|Promise<any>)} c
19
- * @property {number} [d]
20
- */
21
- /**
22
- * @type {Map<any, [()=>Promise<any>,number]>}
23
- */
24
- static "__#6@#queue": Map<any, [() => Promise<any>, number]>;
25
- /**
26
- * @type {boolean}
27
- */
28
- static "__#6@#isRunning": boolean;
29
- /**
30
- * @type {(queueUniqueObject:queueUniqueObject)=>void}
31
- */
32
- static assign: (queueUniqueObject: {
33
- i: any;
34
- c: () => (any | Promise<any>);
35
- d?: number;
36
- }) => void;
37
- /**
38
- * @param {queueUniqueObject} _queue
39
- */
40
- static "__#6@#push": (_queue: {
41
- i: any;
42
- c: () => (any | Promise<any>);
43
- d?: number;
44
- }) => void;
45
- static "__#6@#run": () => Promise<void>;
46
- }
@@ -1,2 +0,0 @@
1
- export function timeout(ms: number): Promise<void>;
2
- export function isAsync(fn: (...any: any) => (any | Promise<any>)): boolean;
@@ -1 +0,0 @@
1
- export function NewQBlock(asyncCallaback: () => Promise<void>, objectReferenceID?: any): void;