vivth 1.2.1 → 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/README.md +582 -587
- package/index.mjs +6 -6
- package/package.json +1 -1
- package/src/bundler/CompileJS.mjs +10 -3
- package/src/bundler/EsBundler.mjs +0 -1
- package/src/bundler/FSInlineAnalyzer.mjs +0 -2
- package/src/class/WorkerMainThread.mjs +12 -20
- package/src/class/WorkerMainThreadBundled.mjs +2 -8
- package/types/index.d.mts +6 -6
- package/types/src/bundler/CompileJS.d.mts +9 -3
- package/types/src/class/Setup.d.mts +1 -2
- package/types/src/class/WorkerMainThread.d.mts +12 -20
- package/types/src/class/WorkerMainThreadBundled.d.mts +2 -9
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 {
|
|
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 {
|
|
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
30
|
export { JSautoDOC } from './src/doc/JSautoDOC.mjs';
|
|
33
|
-
export {
|
|
31
|
+
export { LitExp } from './src/class/LitExp.mjs';
|
|
34
32
|
export { EventCheck } from './src/function/EventCheck.mjs';
|
|
35
33
|
export { EventObject } from './src/function/EventObject.mjs';
|
|
36
|
-
export { GetRuntime } from './src/function/GetRuntime.mjs';
|
|
37
34
|
export { IsAsync } from './src/function/IsAsync.mjs';
|
|
35
|
+
export { GetRuntime } from './src/function/GetRuntime.mjs';
|
|
38
36
|
export { LazyFactory } from './src/function/LazyFactory.mjs';
|
|
39
37
|
export { Timeout } from './src/function/Timeout.mjs';
|
|
40
38
|
export { Try } from './src/function/Try.mjs';
|
|
41
39
|
export { TryAsync } from './src/function/TryAsync.mjs';
|
|
42
40
|
export { TrySync } from './src/function/TrySync.mjs';
|
|
43
41
|
export { TsToMjs } from './src/function/TsToMjs.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
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import { readFile
|
|
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) {
|
|
@@ -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);
|
|
@@ -43,31 +43,32 @@ export class WorkerMainThread {
|
|
|
43
43
|
* @param {typeof WorkerMainThread["pathValidator"]} param0.pathValidator
|
|
44
44
|
* - example:
|
|
45
45
|
* ```js
|
|
46
|
-
* async (workerPath, root
|
|
46
|
+
* async (workerPath, root) => {
|
|
47
47
|
* const truePathCheck = `${root}/${base}/${workerPath}`;
|
|
48
48
|
* const res = await fetch(truePathCheck);
|
|
49
49
|
* // might also check wheter it need base or not
|
|
50
50
|
* return await res.ok;
|
|
51
51
|
* }
|
|
52
52
|
* ```
|
|
53
|
-
* @param {typeof WorkerMainThread["basePath"]} [param0.basePath]
|
|
54
|
-
* - additonal realtivePath from rootPath;
|
|
55
|
-
* - default: '';
|
|
56
53
|
* @example
|
|
57
54
|
* import { Worker } from 'node:worker_threads';
|
|
58
55
|
* import { WorkerMainThread } from 'vivth';
|
|
59
56
|
*
|
|
60
57
|
* WorkerMainThread.setup({
|
|
61
58
|
* workerClass: Worker,
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
59
|
+
* pathValidator: async ({worker, root}) => {
|
|
60
|
+
* const res = await fetch(`${root}/${worker}`);
|
|
61
|
+
* if (res.ok) {
|
|
62
|
+
* return res
|
|
63
|
+
* }
|
|
64
|
+
* const res2 = await fetch(`${root}/someAdditionalPath/${worker}`);
|
|
65
|
+
* if (res2.ok) {
|
|
66
|
+
* return res2
|
|
67
|
+
* }
|
|
67
68
|
* },
|
|
68
69
|
* });
|
|
69
70
|
*/
|
|
70
|
-
static setup = ({ workerClass, pathValidator
|
|
71
|
+
static setup = ({ workerClass, pathValidator }) => {
|
|
71
72
|
if (!Paths.root) {
|
|
72
73
|
return;
|
|
73
74
|
}
|
|
@@ -78,7 +79,6 @@ export class WorkerMainThread {
|
|
|
78
79
|
WorkerMainThread.#isRegistered = true;
|
|
79
80
|
WorkerMainThread.workerClass = workerClass;
|
|
80
81
|
WorkerMainThread.pathValidator = pathValidator;
|
|
81
|
-
WorkerMainThread.basePath = basePath;
|
|
82
82
|
};
|
|
83
83
|
/**
|
|
84
84
|
* @description
|
|
@@ -87,18 +87,11 @@ export class WorkerMainThread {
|
|
|
87
87
|
* @type {typeof Worker|typeof import('worker_threads').Worker}
|
|
88
88
|
*/
|
|
89
89
|
static workerClass;
|
|
90
|
-
/**
|
|
91
|
-
* @description
|
|
92
|
-
* - reference for worker file `basePath`;
|
|
93
|
-
* - edit via `setup`;
|
|
94
|
-
* @type {string}
|
|
95
|
-
*/
|
|
96
|
-
static basePath;
|
|
97
90
|
/**
|
|
98
91
|
* @description
|
|
99
92
|
* - reference for validating path;
|
|
100
93
|
* - edit via `setup`;
|
|
101
|
-
* @type {(paths:{worker: string, root:string
|
|
94
|
+
* @type {(paths:{worker: string, root:string})=>Promise<string>}
|
|
102
95
|
*/
|
|
103
96
|
static pathValidator;
|
|
104
97
|
static #options = /** @type {import('worker_threads').WorkerOptions & { type?: 'module' }} */ ({
|
|
@@ -157,7 +150,6 @@ export class WorkerMainThread {
|
|
|
157
150
|
return await pathValidator({
|
|
158
151
|
worker: handler,
|
|
159
152
|
root: Paths.root,
|
|
160
|
-
base: WorkerMainThread.basePath,
|
|
161
153
|
});
|
|
162
154
|
});
|
|
163
155
|
if (error) {
|
|
@@ -33,9 +33,8 @@ export class WorkerMainThread {
|
|
|
33
33
|
* @param {Object} param0
|
|
34
34
|
* @param {typeof WorkerMainThread["workerClass"]} param0.workerClass
|
|
35
35
|
* @param {typeof WorkerMainThread["pathValidator"]} param0.pathValidator
|
|
36
|
-
* @param {typeof WorkerMainThread["basePath"]} [param0.basePath]
|
|
37
36
|
*/
|
|
38
|
-
static setup = ({ workerClass, pathValidator
|
|
37
|
+
static setup = ({ workerClass, pathValidator }) => {
|
|
39
38
|
if (!Paths.root) {
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
@@ -46,18 +45,13 @@ export class WorkerMainThread {
|
|
|
46
45
|
WorkerMainThread.#isRegistered = true;
|
|
47
46
|
WorkerMainThread.workerClass = workerClass;
|
|
48
47
|
WorkerMainThread.pathValidator = pathValidator;
|
|
49
|
-
WorkerMainThread.basePath = basePath;
|
|
50
48
|
};
|
|
51
49
|
/**
|
|
52
50
|
* @type {typeof Worker|typeof import('worker_threads').Worker}
|
|
53
51
|
*/
|
|
54
52
|
static workerClass;
|
|
55
53
|
/**
|
|
56
|
-
* @type {string}
|
|
57
|
-
*/
|
|
58
|
-
static basePath;
|
|
59
|
-
/**
|
|
60
|
-
* @type {(paths:{worker: string, root:string, base: string})=>Promise<string>}
|
|
54
|
+
* @type {(paths:{worker: string, root:string})=>Promise<string>}
|
|
61
55
|
*/
|
|
62
56
|
static pathValidator;
|
|
63
57
|
static #options = /** @type {import('worker_threads').WorkerOptions & { type?: 'module' }} */ ({
|
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 {
|
|
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 {
|
|
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
22
|
export { JSautoDOC } from "./src/doc/JSautoDOC.mjs";
|
|
25
|
-
export {
|
|
23
|
+
export { LitExp } from "./src/class/LitExp.mjs";
|
|
26
24
|
export { EventCheck } from "./src/function/EventCheck.mjs";
|
|
27
25
|
export { EventObject } from "./src/function/EventObject.mjs";
|
|
28
|
-
export { GetRuntime } from "./src/function/GetRuntime.mjs";
|
|
29
26
|
export { IsAsync } from "./src/function/IsAsync.mjs";
|
|
27
|
+
export { GetRuntime } from "./src/function/GetRuntime.mjs";
|
|
30
28
|
export { LazyFactory } from "./src/function/LazyFactory.mjs";
|
|
31
29
|
export { Timeout } from "./src/function/Timeout.mjs";
|
|
32
30
|
export { Try } from "./src/function/Try.mjs";
|
|
33
31
|
export { TryAsync } from "./src/function/TryAsync.mjs";
|
|
34
32
|
export { TrySync } from "./src/function/TrySync.mjs";
|
|
35
33
|
export { TsToMjs } from "./src/function/TsToMjs.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';
|
|
@@ -54,10 +54,9 @@ export class Setup {
|
|
|
54
54
|
* },
|
|
55
55
|
* });
|
|
56
56
|
*/
|
|
57
|
-
static workerMain: ({ workerClass, pathValidator
|
|
57
|
+
static workerMain: ({ workerClass, pathValidator }: {
|
|
58
58
|
workerClass: (typeof WorkerMainThread)["workerClass"];
|
|
59
59
|
pathValidator: (typeof WorkerMainThread)["pathValidator"];
|
|
60
|
-
basePath?: (typeof WorkerMainThread)["basePath"];
|
|
61
60
|
}) => void;
|
|
62
61
|
/**
|
|
63
62
|
* @description
|
|
@@ -29,34 +29,34 @@ export class WorkerMainThread<WT extends WorkerThread> {
|
|
|
29
29
|
* @param {typeof WorkerMainThread["pathValidator"]} param0.pathValidator
|
|
30
30
|
* - example:
|
|
31
31
|
* ```js
|
|
32
|
-
* async (workerPath, root
|
|
32
|
+
* async (workerPath, root) => {
|
|
33
33
|
* const truePathCheck = `${root}/${base}/${workerPath}`;
|
|
34
34
|
* const res = await fetch(truePathCheck);
|
|
35
35
|
* // might also check wheter it need base or not
|
|
36
36
|
* return await res.ok;
|
|
37
37
|
* }
|
|
38
38
|
* ```
|
|
39
|
-
* @param {typeof WorkerMainThread["basePath"]} [param0.basePath]
|
|
40
|
-
* - additonal realtivePath from rootPath;
|
|
41
|
-
* - default: '';
|
|
42
39
|
* @example
|
|
43
40
|
* import { Worker } from 'node:worker_threads';
|
|
44
41
|
* import { WorkerMainThread } from 'vivth';
|
|
45
42
|
*
|
|
46
43
|
* WorkerMainThread.setup({
|
|
47
44
|
* workerClass: Worker,
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
45
|
+
* pathValidator: async ({worker, root}) => {
|
|
46
|
+
* const res = await fetch(`${root}/${worker}`);
|
|
47
|
+
* if (res.ok) {
|
|
48
|
+
* return res
|
|
49
|
+
* }
|
|
50
|
+
* const res2 = await fetch(`${root}/someAdditionalPath/${worker}`);
|
|
51
|
+
* if (res2.ok) {
|
|
52
|
+
* return res2
|
|
53
|
+
* }
|
|
53
54
|
* },
|
|
54
55
|
* });
|
|
55
56
|
*/
|
|
56
|
-
static setup: ({ workerClass, pathValidator
|
|
57
|
+
static setup: ({ workerClass, pathValidator }: {
|
|
57
58
|
workerClass: (typeof WorkerMainThread)["workerClass"];
|
|
58
59
|
pathValidator: (typeof WorkerMainThread)["pathValidator"];
|
|
59
|
-
basePath?: (typeof WorkerMainThread)["basePath"];
|
|
60
60
|
}) => void;
|
|
61
61
|
/**
|
|
62
62
|
* @description
|
|
@@ -65,23 +65,15 @@ export class WorkerMainThread<WT extends WorkerThread> {
|
|
|
65
65
|
* @type {typeof Worker|typeof import('worker_threads').Worker}
|
|
66
66
|
*/
|
|
67
67
|
static workerClass: typeof Worker | typeof import("worker_threads").Worker;
|
|
68
|
-
/**
|
|
69
|
-
* @description
|
|
70
|
-
* - reference for worker file `basePath`;
|
|
71
|
-
* - edit via `setup`;
|
|
72
|
-
* @type {string}
|
|
73
|
-
*/
|
|
74
|
-
static basePath: string;
|
|
75
68
|
/**
|
|
76
69
|
* @description
|
|
77
70
|
* - reference for validating path;
|
|
78
71
|
* - edit via `setup`;
|
|
79
|
-
* @type {(paths:{worker: string, root:string
|
|
72
|
+
* @type {(paths:{worker: string, root:string})=>Promise<string>}
|
|
80
73
|
*/
|
|
81
74
|
static pathValidator: (paths: {
|
|
82
75
|
worker: string;
|
|
83
76
|
root: string;
|
|
84
|
-
base: string;
|
|
85
77
|
}) => Promise<string>;
|
|
86
78
|
static #options: import("worker_threads").WorkerOptions & {
|
|
87
79
|
type?: "module";
|
|
@@ -18,28 +18,21 @@ export class WorkerMainThread<WT extends WorkerThread> {
|
|
|
18
18
|
* @param {Object} param0
|
|
19
19
|
* @param {typeof WorkerMainThread["workerClass"]} param0.workerClass
|
|
20
20
|
* @param {typeof WorkerMainThread["pathValidator"]} param0.pathValidator
|
|
21
|
-
* @param {typeof WorkerMainThread["basePath"]} [param0.basePath]
|
|
22
21
|
*/
|
|
23
|
-
static setup: ({ workerClass, pathValidator
|
|
22
|
+
static setup: ({ workerClass, pathValidator }: {
|
|
24
23
|
workerClass: (typeof WorkerMainThread)["workerClass"];
|
|
25
24
|
pathValidator: (typeof WorkerMainThread)["pathValidator"];
|
|
26
|
-
basePath?: (typeof WorkerMainThread)["basePath"];
|
|
27
25
|
}) => void;
|
|
28
26
|
/**
|
|
29
27
|
* @type {typeof Worker|typeof import('worker_threads').Worker}
|
|
30
28
|
*/
|
|
31
29
|
static workerClass: typeof Worker | typeof import("worker_threads").Worker;
|
|
32
30
|
/**
|
|
33
|
-
* @type {string}
|
|
34
|
-
*/
|
|
35
|
-
static basePath: string;
|
|
36
|
-
/**
|
|
37
|
-
* @type {(paths:{worker: string, root:string, base: string})=>Promise<string>}
|
|
31
|
+
* @type {(paths:{worker: string, root:string})=>Promise<string>}
|
|
38
32
|
*/
|
|
39
33
|
static pathValidator: (paths: {
|
|
40
34
|
worker: string;
|
|
41
35
|
root: string;
|
|
42
|
-
base: string;
|
|
43
36
|
}) => Promise<string>;
|
|
44
37
|
static #options: import("worker_threads").WorkerOptions & {
|
|
45
38
|
type?: "module";
|