vivth 1.2.2 → 1.2.3

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/index.mjs CHANGED
@@ -6,12 +6,11 @@
6
6
  * this library is made and distributed under MIT license;
7
7
  */
8
8
 
9
- export { CompileJS } from './src/bundler/CompileJS.mjs';
10
9
  export { CreateESPlugin } from './src/bundler/CreateESPlugin.mjs';
11
10
  export { EsBundler } from './src/bundler/EsBundler.mjs';
12
11
  export { FSInline } from './src/bundler/FSInline.mjs';
13
12
  export { FSInlineAnalyzer } from './src/bundler/FSInlineAnalyzer.mjs';
14
- export { Console } from './src/class/Console.mjs';
13
+ export { CompileJS } from './src/bundler/CompileJS.mjs';
15
14
  export { Derived } from './src/class/Derived.mjs';
16
15
  export { Effect } from './src/class/Effect.mjs';
17
16
  export { EnvSignal } from './src/class/EnvSignal.mjs';
@@ -19,28 +18,29 @@ export { EventSignal } from './src/class/EventSignal.mjs';
19
18
  export { FileSafe } from './src/class/FileSafe.mjs';
20
19
  export { ListDerived } from './src/class/ListDerived.mjs';
21
20
  export { ListSignal } from './src/class/ListSignal.mjs';
22
- export { LitExp } from './src/class/LitExp.mjs';
23
21
  export { Paths } from './src/class/Paths.mjs';
24
22
  export { QChannel } from './src/class/QChannel.mjs';
25
23
  export { SafeExit } from './src/class/SafeExit.mjs';
26
24
  export { Setup } from './src/class/Setup.mjs';
27
25
  export { Signal } from './src/class/Signal.mjs';
28
26
  export { WorkerMainThread } from './src/class/WorkerMainThread.mjs';
29
- export { Base64URL } from './src/common/Base64URL.mjs';
27
+ export { Console } from './src/class/Console.mjs';
30
28
  export { Base64URLFromFile } from './src/common/Base64URLFromFile.mjs';
31
29
  export { EventNameSpace } from './src/common/EventNameSpace.mjs';
32
- export { CreateImmutable } from './src/function/CreateImmutable.mjs';
30
+ export { JSautoDOC } from './src/doc/JSautoDOC.mjs';
31
+ export { LitExp } from './src/class/LitExp.mjs';
33
32
  export { EventCheck } from './src/function/EventCheck.mjs';
34
33
  export { EventObject } from './src/function/EventObject.mjs';
35
- export { GetRuntime } from './src/function/GetRuntime.mjs';
36
34
  export { IsAsync } from './src/function/IsAsync.mjs';
35
+ export { GetRuntime } from './src/function/GetRuntime.mjs';
37
36
  export { LazyFactory } from './src/function/LazyFactory.mjs';
38
37
  export { Timeout } from './src/function/Timeout.mjs';
39
38
  export { Try } from './src/function/Try.mjs';
40
39
  export { TryAsync } from './src/function/TryAsync.mjs';
41
40
  export { TrySync } from './src/function/TrySync.mjs';
42
41
  export { TsToMjs } from './src/function/TsToMjs.mjs';
43
- export { JSautoDOC } from './src/doc/JSautoDOC.mjs';
42
+ export { Base64URL } from './src/common/Base64URL.mjs';
43
+ export { CreateImmutable } from './src/function/CreateImmutable.mjs';
44
44
  export { WorkerResult } from './src/class/WorkerResult.mjs';
45
45
  export { WorkerThread } from './src/class/WorkerThread.mjs';
46
46
  export { ToBundledJSPlugin } from './src/bundler/adds/ToBundledJSPlugin.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vivth",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "library primitives",
5
5
  "main": "index.mjs",
6
6
  "types": "./types/index.d.mts",
@@ -1,6 +1,6 @@
1
1
  // @ts-check
2
2
 
3
- import { readFile, readdir } from 'node:fs/promises';
3
+ import { readFile } from 'node:fs/promises';
4
4
  import { join, extname, basename, dirname } from 'node:path';
5
5
  import { platform } from 'node:os';
6
6
 
@@ -13,6 +13,7 @@ import { FSInlineAnalyzer } from './FSInlineAnalyzer.mjs';
13
13
 
14
14
  /**
15
15
  * @typedef {'win32' | 'linux' | 'darwin' | string} PlatformKey
16
+ * @typedef {import('./CreateESPlugin.mjs')["CreateESPlugin"]} CreateESPlugin
16
17
  */
17
18
 
18
19
  let binaryExtension = undefined;
@@ -97,6 +98,8 @@ const getBinaryExtension = () => {
97
98
  * - `key` are to used as `--keyName`;
98
99
  * - value are the following value of the key;
99
100
  * - no need to add the output/outdir, as it use the `options.outDir`;
101
+ * @param {ReturnType<CreateESPlugin>[]} [options.esBundlerPlugins]
102
+ * - plugins for `EsBundler`;
100
103
  * @return {ReturnType<TryAsync<{compileResult:Promise<any>,
101
104
  * commandCalled: string;
102
105
  * compiledBinFile: string;
@@ -115,7 +118,8 @@ const getBinaryExtension = () => {
115
118
  * compiler: 'pkg',
116
119
  * compilerArguments: {
117
120
  * target: ['node18-win-x64'],
118
- * }
121
+ * },
122
+ * esBundlerPlugins: [],
119
123
  * }),
120
124
  * CompileJS({
121
125
  * entryPoint: join(Paths.root, '/dev'),
@@ -124,7 +128,8 @@ const getBinaryExtension = () => {
124
128
  * compiler: 'bun',
125
129
  * compilerArguments: {
126
130
  * target: ['bun-win-x64'],
127
- * }
131
+ * },
132
+ * esBundlerPlugins: [],
128
133
  * }),
129
134
  * ])
130
135
  */
@@ -135,6 +140,7 @@ export async function CompileJS({
135
140
  outDir,
136
141
  compiler = undefined,
137
142
  compilerArguments = undefined,
143
+ esBundlerPlugins = [],
138
144
  }) {
139
145
  return await TryAsync(async () => {
140
146
  /**
@@ -176,6 +182,7 @@ export async function CompileJS({
176
182
  {
177
183
  minify: minifyFirst,
178
184
  format,
185
+ plugins: esBundlerPlugins,
179
186
  }
180
187
  );
181
188
  if (errorPrep) {
@@ -71,7 +71,6 @@ export async function EsBundler(
71
71
  contents: content,
72
72
  loader,
73
73
  resolveDir: root ?? Paths.root,
74
- ...esbuildOptions.banner,
75
74
  },
76
75
  bundle: true,
77
76
  write: false,
@@ -101,9 +101,7 @@ export class FSInlineAnalyzer {
101
101
  }
102
102
  const {
103
103
  result: { named: namedWorker },
104
- regexp,
105
104
  } = resultMatchingWorker;
106
-
107
105
  for (let i = 0; i < namedWorker.length; i++) {
108
106
  const { path } = namedWorker[i];
109
107
  const fullPath = join(Paths.root, path);
package/types/index.d.mts CHANGED
@@ -1,9 +1,8 @@
1
- export { CompileJS } from "./src/bundler/CompileJS.mjs";
2
1
  export { CreateESPlugin } from "./src/bundler/CreateESPlugin.mjs";
3
2
  export { EsBundler } from "./src/bundler/EsBundler.mjs";
4
3
  export { FSInline } from "./src/bundler/FSInline.mjs";
5
4
  export { FSInlineAnalyzer } from "./src/bundler/FSInlineAnalyzer.mjs";
6
- export { Console } from "./src/class/Console.mjs";
5
+ export { CompileJS } from "./src/bundler/CompileJS.mjs";
7
6
  export { Derived } from "./src/class/Derived.mjs";
8
7
  export { Effect } from "./src/class/Effect.mjs";
9
8
  export { EnvSignal } from "./src/class/EnvSignal.mjs";
@@ -11,28 +10,29 @@ export { EventSignal } from "./src/class/EventSignal.mjs";
11
10
  export { FileSafe } from "./src/class/FileSafe.mjs";
12
11
  export { ListDerived } from "./src/class/ListDerived.mjs";
13
12
  export { ListSignal } from "./src/class/ListSignal.mjs";
14
- export { LitExp } from "./src/class/LitExp.mjs";
15
13
  export { Paths } from "./src/class/Paths.mjs";
16
14
  export { QChannel } from "./src/class/QChannel.mjs";
17
15
  export { SafeExit } from "./src/class/SafeExit.mjs";
18
16
  export { Setup } from "./src/class/Setup.mjs";
19
17
  export { Signal } from "./src/class/Signal.mjs";
20
18
  export { WorkerMainThread } from "./src/class/WorkerMainThread.mjs";
21
- export { Base64URL } from "./src/common/Base64URL.mjs";
19
+ export { Console } from "./src/class/Console.mjs";
22
20
  export { Base64URLFromFile } from "./src/common/Base64URLFromFile.mjs";
23
21
  export { EventNameSpace } from "./src/common/EventNameSpace.mjs";
24
- export { CreateImmutable } from "./src/function/CreateImmutable.mjs";
22
+ export { JSautoDOC } from "./src/doc/JSautoDOC.mjs";
23
+ export { LitExp } from "./src/class/LitExp.mjs";
25
24
  export { EventCheck } from "./src/function/EventCheck.mjs";
26
25
  export { EventObject } from "./src/function/EventObject.mjs";
27
- export { GetRuntime } from "./src/function/GetRuntime.mjs";
28
26
  export { IsAsync } from "./src/function/IsAsync.mjs";
27
+ export { GetRuntime } from "./src/function/GetRuntime.mjs";
29
28
  export { LazyFactory } from "./src/function/LazyFactory.mjs";
30
29
  export { Timeout } from "./src/function/Timeout.mjs";
31
30
  export { Try } from "./src/function/Try.mjs";
32
31
  export { TryAsync } from "./src/function/TryAsync.mjs";
33
32
  export { TrySync } from "./src/function/TrySync.mjs";
34
33
  export { TsToMjs } from "./src/function/TsToMjs.mjs";
35
- export { JSautoDOC } from "./src/doc/JSautoDOC.mjs";
34
+ export { Base64URL } from "./src/common/Base64URL.mjs";
35
+ export { CreateImmutable } from "./src/function/CreateImmutable.mjs";
36
36
  export { WorkerResult } from "./src/class/WorkerResult.mjs";
37
37
  export { WorkerThread } from "./src/class/WorkerThread.mjs";
38
38
  export { ToBundledJSPlugin } from "./src/bundler/adds/ToBundledJSPlugin.mjs";
@@ -35,6 +35,8 @@
35
35
  * - `key` are to used as `--keyName`;
36
36
  * - value are the following value of the key;
37
37
  * - no need to add the output/outdir, as it use the `options.outDir`;
38
+ * @param {ReturnType<CreateESPlugin>[]} [options.esBundlerPlugins]
39
+ * - plugins for `EsBundler`;
38
40
  * @return {ReturnType<TryAsync<{compileResult:Promise<any>,
39
41
  * commandCalled: string;
40
42
  * compiledBinFile: string;
@@ -53,7 +55,8 @@
53
55
  * compiler: 'pkg',
54
56
  * compilerArguments: {
55
57
  * target: ['node18-win-x64'],
56
- * }
58
+ * },
59
+ * esBundlerPlugins: [],
57
60
  * }),
58
61
  * CompileJS({
59
62
  * entryPoint: join(Paths.root, '/dev'),
@@ -62,17 +65,20 @@
62
65
  * compiler: 'bun',
63
66
  * compilerArguments: {
64
67
  * target: ['bun-win-x64'],
65
- * }
68
+ * },
69
+ * esBundlerPlugins: [],
66
70
  * }),
67
71
  * ])
68
72
  */
69
- export function CompileJS({ entryPoint, minifyFirst, encoding, outDir, compiler, compilerArguments, }: {
73
+ export function CompileJS({ entryPoint, minifyFirst, encoding, outDir, compiler, compilerArguments, esBundlerPlugins, }: {
70
74
  entryPoint: string;
71
75
  encoding?: BufferEncoding;
72
76
  minifyFirst: boolean;
73
77
  outDir: string;
74
78
  compiler?: "pkg" | "bun" | "deno";
75
79
  compilerArguments?: Record<string, string>;
80
+ esBundlerPlugins?: ReturnType<CreateESPlugin>[];
76
81
  }): ReturnType<typeof TryAsync>;
77
82
  export type PlatformKey = "win32" | "linux" | "darwin" | string;
83
+ export type CreateESPlugin = typeof import("./CreateESPlugin.mjs")["CreateESPlugin"];
78
84
  import { TryAsync } from '../function/TryAsync.mjs';