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.
- package/README.md +2156 -1782
- package/README.src.md +10 -0
- package/bun.lock +6 -0
- package/index.mjs +12 -3
- package/package.json +4 -2
- package/src/bundler/CompileJS.mjs +62 -28
- package/src/bundler/EsBundler.mjs +2 -1
- package/src/bundler/FSInline.mjs +8 -1
- package/src/bundler/FSInlineAnalyzer.mjs +47 -38
- package/src/bundler/adds/ToBundledJSPlugin.mjs +42 -28
- package/src/bundler/adds/pluginVivthBundle.mjs +3 -1
- package/src/class/EventSignal.mjs +15 -9
- package/src/class/FileSafe.mjs +30 -1
- package/src/class/ListSignal.mjs +1 -1
- package/src/class/LitExp.mjs +3 -2
- package/src/class/Paths.mjs +2 -11
- package/src/class/QChannel.mjs +4 -5
- package/src/class/SafeExit.mjs +7 -24
- package/src/class/Setup.mjs +5 -8
- package/src/class/Signal.mjs +4 -1
- package/src/common/Base64URL.mjs +6 -4
- package/src/common/Dev.mjs +134 -0
- package/src/common/DevBundled.mjs +5 -0
- package/src/common/Trace.mjs +24 -0
- package/src/doc/JSautoDOC.mjs +16 -11
- package/src/doc/correctBeforeParse.mjs +1 -1
- package/src/doc/parsedFile.mjs +1 -1
- package/src/function/GetNamedImportAlias.mjs +37 -0
- package/src/function/LazyFactory.mjs +1 -1
- package/src/function/TsToMjs.mjs +3 -3
- package/src/types/DevTestCB.mjs +11 -0
- package/src/types/Runtime.mjs +0 -1
- package/src/types/VivthDevCodeBlockStringType.mjs +6 -0
- package/tsconfig.json +6 -1
- package/types/index.d.mts +8 -3
- package/types/src/bundler/CompileJS.d.mts +58 -28
- package/types/src/bundler/EsBundler.d.mts +2 -2
- package/types/src/bundler/FSInline.d.mts +8 -1
- package/types/src/bundler/FSInlineAnalyzer.d.mts +1 -0
- package/types/src/bundler/adds/ToBundledJSPlugin.d.mts +6 -3
- package/types/src/class/EventSignal.d.mts +8 -8
- package/types/src/class/FileSafe.d.mts +21 -0
- package/types/src/class/ListSignal.d.mts +2 -2
- package/types/src/class/LitExp.d.mts +1 -0
- package/types/src/class/Paths.d.mts +2 -9
- package/types/src/class/QChannel.d.mts +4 -4
- package/types/src/class/SafeExit.d.mts +7 -24
- package/types/src/class/Setup.d.mts +5 -8
- package/types/src/common/Base64URL.d.mts +5 -3
- package/types/src/common/Dev.d.mts +68 -0
- package/types/src/common/DevBundled.d.mts +3 -0
- package/types/src/common/Trace.d.mts +14 -0
- package/types/src/doc/JSautoDOC.d.mts +8 -7
- package/types/src/function/GetNamedImportAlias.d.mts +22 -0
- package/types/src/function/LazyFactory.d.mts +1 -1
- package/types/src/function/TsToMjs.d.mts +3 -3
- package/types/src/function/WithDefer.d.mts +10 -0
- package/types/src/types/DevTestCB.d.mts +3 -0
- package/types/src/types/IsDevCBStringType.d.mts +4 -0
- package/types/src/types/Runtime.d.mts +3 -0
- 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
|
|
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
|
|
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
|
|
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;
|