vivth 1.3.2 → 1.3.4

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 (61) hide show
  1. package/README.md +2156 -1782
  2. package/README.src.md +10 -0
  3. package/bun.lock +6 -0
  4. package/index.mjs +12 -3
  5. package/package.json +4 -2
  6. package/src/bundler/CompileJS.mjs +62 -28
  7. package/src/bundler/EsBundler.mjs +2 -1
  8. package/src/bundler/FSInline.mjs +8 -1
  9. package/src/bundler/FSInlineAnalyzer.mjs +47 -38
  10. package/src/bundler/adds/ToBundledJSPlugin.mjs +42 -28
  11. package/src/bundler/adds/pluginVivthBundle.mjs +3 -1
  12. package/src/class/EventSignal.mjs +15 -9
  13. package/src/class/FileSafe.mjs +30 -1
  14. package/src/class/ListSignal.mjs +1 -1
  15. package/src/class/LitExp.mjs +3 -2
  16. package/src/class/Paths.mjs +2 -11
  17. package/src/class/QChannel.mjs +4 -5
  18. package/src/class/SafeExit.mjs +7 -24
  19. package/src/class/Setup.mjs +5 -8
  20. package/src/class/Signal.mjs +4 -1
  21. package/src/common/Base64URL.mjs +6 -4
  22. package/src/common/Dev.mjs +134 -0
  23. package/src/common/DevBundled.mjs +5 -0
  24. package/src/common/Trace.mjs +24 -0
  25. package/src/doc/JSautoDOC.mjs +16 -11
  26. package/src/doc/correctBeforeParse.mjs +1 -1
  27. package/src/doc/parsedFile.mjs +1 -1
  28. package/src/function/GetNamedImportAlias.mjs +37 -0
  29. package/src/function/LazyFactory.mjs +1 -1
  30. package/src/function/TsToMjs.mjs +3 -3
  31. package/src/types/DevTestCB.mjs +11 -0
  32. package/src/types/Runtime.mjs +0 -1
  33. package/src/types/VivthDevCodeBlockStringType.mjs +6 -0
  34. package/tsconfig.json +6 -1
  35. package/types/index.d.mts +8 -3
  36. package/types/src/bundler/CompileJS.d.mts +58 -28
  37. package/types/src/bundler/EsBundler.d.mts +2 -2
  38. package/types/src/bundler/FSInline.d.mts +8 -1
  39. package/types/src/bundler/FSInlineAnalyzer.d.mts +1 -0
  40. package/types/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -3
  41. package/types/src/class/EventSignal.d.mts +8 -8
  42. package/types/src/class/FileSafe.d.mts +21 -0
  43. package/types/src/class/ListSignal.d.mts +2 -2
  44. package/types/src/class/LitExp.d.mts +1 -0
  45. package/types/src/class/Paths.d.mts +2 -9
  46. package/types/src/class/QChannel.d.mts +4 -4
  47. package/types/src/class/SafeExit.d.mts +7 -24
  48. package/types/src/class/Setup.d.mts +5 -8
  49. package/types/src/common/Base64URL.d.mts +5 -3
  50. package/types/src/common/Dev.d.mts +68 -0
  51. package/types/src/common/DevBundled.d.mts +3 -0
  52. package/types/src/common/Trace.d.mts +14 -0
  53. package/types/src/doc/JSautoDOC.d.mts +8 -7
  54. package/types/src/function/GetNamedImportAlias.d.mts +22 -0
  55. package/types/src/function/LazyFactory.d.mts +1 -1
  56. package/types/src/function/TsToMjs.d.mts +3 -3
  57. package/types/src/function/WithDefer.d.mts +10 -0
  58. package/types/src/types/DevTestCB.d.mts +3 -0
  59. package/types/src/types/IsDevCBStringType.d.mts +4 -0
  60. package/types/src/types/Runtime.d.mts +3 -0
  61. package/types/src/types/VivthDevCodeBlockStringType.d.mts +4 -0
@@ -0,0 +1,22 @@
1
+ /**
2
+ * @description
3
+ * - regex helper for:
4
+ * >- get named import; OR
5
+ * >- alias of named import;
6
+ * @param {string} content
7
+ * @param {string} moduleName
8
+ * @param {string} packageName
9
+ * @returns {string|undefined}
10
+ * @example
11
+ * import { GetNamedImportAlias } from 'vivth';
12
+ *
13
+ * const checkNoAlias = `
14
+ * import { something } from 'packageName';
15
+ * `
16
+ * const checkAlias = `
17
+ * import { something as somethingElse } from 'packageName';
18
+ * `
19
+ * GetNamedImportAlias(checkNoAlias, 'something', 'packageName'); // 'something'
20
+ * GetNamedImportAlias(checkAlias, 'something', 'packageName'); // 'somethingElse'
21
+ */
22
+ export function GetNamedImportAlias(content: string, moduleName: string, packageName: string): string | undefined;
@@ -29,7 +29,7 @@
29
29
  * const a = myInstance; // not yet initiated;
30
30
  * const b = a.myProp // imediately initiated;
31
31
  * // OR
32
- * myInstance["vivth:unwrapLazy;"]() // forcefully call the callback;
32
+ * myInstance["vivth:unwrapLazy;"]() // forcefully call factory generator;
33
33
  */
34
34
  export function LazyFactory<FACTORY>(factory: () => FACTORY): FACTORY & {
35
35
  [unwrapLazy]: () => FACTORY;
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @description
3
- * - turn `.mts`||`.ts` file into `.mjs`, no bundling, just translation;
3
+ * - turn `.mts`||`.ts` file into `.mjs`, no bundling, just traspilation;
4
4
  * - on certain circumstance where `.mjs` result needed to be typed, you need to manually add `jsdoc`;
5
- * >- uses `"at"preserve` to register `jsdoc` inline;
5
+ * >- uses `"at"preserve` to register `jsdoc`;
6
6
  * @param {string} path_
7
7
  * - path from `Paths.root`;
8
8
  * @param {Object} [options]
@@ -15,7 +15,7 @@
15
15
  * @example
16
16
  * import { TsToMjs } from 'vivth';
17
17
  *
18
- * TsToMjs('./myFile.mts', { encoding: 'utf-8', overrideDir: './other/dir' });
18
+ * await TsToMjs('./myFile.mts', { encoding: 'utf-8', overrideDir: './other/dir' });
19
19
  */
20
20
  export function TsToMjs(path_: string, { overrideDir, encoding }?: {
21
21
  overrideDir?: string | undefined;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Description
3
+ * @param {(
4
+ * this:{defer:(tobeDefered:()=>Promise<void>)=>void}
5
+ * )=>Promise<void>} cb
6
+ * @returns {void}
7
+ */
8
+ export function WithDefer(cb: (this: {
9
+ defer: (tobeDefered: () => Promise<void>) => void;
10
+ }) => Promise<void>): void;
@@ -0,0 +1,3 @@
1
+ export type DevTestCB = (testName: string, testCallback: () => Promise<boolean>) => Promise<{
2
+ removeId: () => void;
3
+ }>;
@@ -0,0 +1,4 @@
1
+ /**
2
+ * - closing helper for `Dev.IsDevCB`;
3
+ */
4
+ export type IsDevCBStringType = "IsDevCB";
@@ -1 +1,4 @@
1
+ /**
2
+ * - for popular runtimes check;
3
+ */
1
4
  export type Runtime = "node" | "bun" | "deno" | "browser" | "unknown";
@@ -0,0 +1,4 @@
1
+ /**
2
+ * - closing helper for `Dev.vivthDevCodeBlock`;
3
+ */
4
+ export type VivthDevCodeBlockStringType = "vivthDevCodeBlock";