@intlayer/chokidar 7.0.3 → 7.0.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/dist/cjs/_virtual/_utils_asset.cjs +1 -1
- package/dist/cjs/index.cjs +4 -2
- package/dist/cjs/utils/runParallel/bin.cjs +55 -0
- package/dist/cjs/utils/runParallel/bin.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/bootstrap.cjs +24 -0
- package/dist/cjs/utils/runParallel/bootstrap.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/index.cjs +111 -0
- package/dist/cjs/utils/runParallel/index.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/pidTree.cjs +145 -0
- package/dist/cjs/utils/runParallel/pidTree.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/ps.cjs +49 -0
- package/dist/cjs/utils/runParallel/ps.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/runTask.cjs +155 -0
- package/dist/cjs/utils/runParallel/runTask.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/spawnPosix.cjs +60 -0
- package/dist/cjs/utils/runParallel/spawnPosix.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/spawnWin32.cjs +44 -0
- package/dist/cjs/utils/runParallel/spawnWin32.cjs.map +1 -0
- package/dist/cjs/utils/runParallel/wmic.cjs +52 -0
- package/dist/cjs/utils/runParallel/wmic.cjs.map +1 -0
- package/dist/esm/_virtual/_utils_asset.mjs +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/utils/runParallel/bin.mjs +53 -0
- package/dist/esm/utils/runParallel/bin.mjs.map +1 -0
- package/dist/esm/utils/runParallel/bootstrap.mjs +23 -0
- package/dist/esm/utils/runParallel/bootstrap.mjs.map +1 -0
- package/dist/esm/utils/runParallel/index.mjs +109 -0
- package/dist/esm/utils/runParallel/index.mjs.map +1 -0
- package/dist/esm/utils/runParallel/pidTree.mjs +143 -0
- package/dist/esm/utils/runParallel/pidTree.mjs.map +1 -0
- package/dist/esm/utils/runParallel/ps.mjs +47 -0
- package/dist/esm/utils/runParallel/ps.mjs.map +1 -0
- package/dist/esm/utils/runParallel/runTask.mjs +153 -0
- package/dist/esm/utils/runParallel/runTask.mjs.map +1 -0
- package/dist/esm/utils/runParallel/spawnPosix.mjs +58 -0
- package/dist/esm/utils/runParallel/spawnPosix.mjs.map +1 -0
- package/dist/esm/utils/runParallel/spawnWin32.mjs +42 -0
- package/dist/esm/utils/runParallel/spawnWin32.mjs.map +1 -0
- package/dist/esm/utils/runParallel/wmic.mjs +50 -0
- package/dist/esm/utils/runParallel/wmic.mjs.map +1 -0
- package/dist/types/buildIntlayerDictionary/buildIntlayerDictionary.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/writeDynamicDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeFetchDictionary.d.ts +3 -3
- package/dist/types/buildIntlayerDictionary/writeMergedDictionary.d.ts +2 -2
- package/dist/types/buildIntlayerDictionary/writeRemoteDictionary.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts +2 -2
- package/dist/types/createDictionaryEntryPoint/generateDictionaryListContent.d.ts +2 -2
- package/dist/types/index.d.ts +3 -2
- package/dist/types/loadDictionaries/loadRemoteDictionaries.d.ts +2 -2
- package/dist/types/utils/chunkJSON.d.ts.map +1 -1
- package/dist/types/utils/runParallel/bin.d.ts +15 -0
- package/dist/types/utils/runParallel/bin.d.ts.map +1 -0
- package/dist/types/utils/runParallel/bootstrap.d.ts +5 -0
- package/dist/types/utils/runParallel/bootstrap.d.ts.map +1 -0
- package/dist/types/utils/runParallel/index.d.ts +14 -0
- package/dist/types/utils/runParallel/index.d.ts.map +1 -0
- package/dist/types/utils/runParallel/pidTree.d.ts +24 -0
- package/dist/types/utils/runParallel/pidTree.d.ts.map +1 -0
- package/dist/types/utils/runParallel/ps.d.ts +11 -0
- package/dist/types/utils/runParallel/ps.d.ts.map +1 -0
- package/dist/types/utils/runParallel/runTask.d.ts +26 -0
- package/dist/types/utils/runParallel/runTask.d.ts.map +1 -0
- package/dist/types/utils/runParallel/spawnPosix.d.ts +21 -0
- package/dist/types/utils/runParallel/spawnPosix.d.ts.map +1 -0
- package/dist/types/utils/runParallel/spawnWin32.d.ts +21 -0
- package/dist/types/utils/runParallel/spawnWin32.d.ts.map +1 -0
- package/dist/types/utils/runParallel/wmic.d.ts +11 -0
- package/dist/types/utils/runParallel/wmic.d.ts.map +1 -0
- package/package.json +18 -18
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { run } from "./bin.mjs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/runParallel/ps.ts
|
|
5
|
+
/**
|
|
6
|
+
* Gets the list of all the pids of the system through the ps command.
|
|
7
|
+
* @param callback Callback function with error and process list.
|
|
8
|
+
*/
|
|
9
|
+
const ps = (callback) => {
|
|
10
|
+
run("ps", [
|
|
11
|
+
"-A",
|
|
12
|
+
"-o",
|
|
13
|
+
"ppid,pid"
|
|
14
|
+
], (err, stdout, code) => {
|
|
15
|
+
if (err) {
|
|
16
|
+
callback(err);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (code !== 0) {
|
|
20
|
+
callback(/* @__PURE__ */ new Error(`pidtree ps command exited with code ${code}`));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (!stdout) {
|
|
24
|
+
callback(/* @__PURE__ */ new Error("No stdout received from ps command"));
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const lines = stdout.split(os.EOL);
|
|
29
|
+
const list = [];
|
|
30
|
+
for (let i = 1; i < lines.length; i++) {
|
|
31
|
+
const trimmed = lines[i].trim();
|
|
32
|
+
if (!trimmed) continue;
|
|
33
|
+
const parts = trimmed.split(/\s+/);
|
|
34
|
+
const ppid = parseInt(parts[0], 10);
|
|
35
|
+
const pid = parseInt(parts[1], 10);
|
|
36
|
+
if (!Number.isNaN(ppid) && !Number.isNaN(pid)) list.push([ppid, pid]);
|
|
37
|
+
}
|
|
38
|
+
callback(null, list);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
callback(error instanceof Error ? error : new Error(String(error)));
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ps };
|
|
47
|
+
//# sourceMappingURL=ps.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ps.mjs","names":["list: ProcessList"],"sources":["../../../../src/utils/runParallel/ps.ts"],"sourcesContent":["import * as os from 'node:os';\nimport { run } from './bin';\n\ntype ProcessList = [number, number][]; // [PPID, PID][]\ntype ProcessListCallback = (err: Error | null, list?: ProcessList) => void;\n\n/**\n * Gets the list of all the pids of the system through the ps command.\n * @param callback Callback function with error and process list.\n */\nexport const ps = (callback: ProcessListCallback): void => {\n const args = ['-A', '-o', 'ppid,pid'];\n\n run('ps', args, (err, stdout, code) => {\n if (err) {\n callback(err);\n return;\n }\n if (code !== 0) {\n callback(new Error(`pidtree ps command exited with code ${code}`));\n return;\n }\n\n // Example of stdout\n //\n // PPID PID\n // 1 430\n // 430 432\n // 1 727\n // 1 7166\n\n if (!stdout) {\n callback(new Error('No stdout received from ps command'));\n return;\n }\n\n try {\n const lines = stdout.split(os.EOL);\n\n const list: ProcessList = [];\n for (let i = 1; i < lines.length; i++) {\n const trimmed = lines[i].trim();\n if (!trimmed) continue;\n const parts = trimmed.split(/\\s+/);\n const ppid = parseInt(parts[0], 10); // PPID\n const pid = parseInt(parts[1], 10); // PID\n if (!Number.isNaN(ppid) && !Number.isNaN(pid)) {\n list.push([ppid, pid]);\n }\n }\n\n callback(null, list);\n } catch (error) {\n callback(error instanceof Error ? error : new Error(String(error)));\n }\n });\n};\n"],"mappings":";;;;;;;;AAUA,MAAa,MAAM,aAAwC;AAGzD,KAAI,MAFS;EAAC;EAAM;EAAM;EAAW,GAEpB,KAAK,QAAQ,SAAS;AACrC,MAAI,KAAK;AACP,YAAS,IAAI;AACb;;AAEF,MAAI,SAAS,GAAG;AACd,4BAAS,IAAI,MAAM,uCAAuC,OAAO,CAAC;AAClE;;AAWF,MAAI,CAAC,QAAQ;AACX,4BAAS,IAAI,MAAM,qCAAqC,CAAC;AACzD;;AAGF,MAAI;GACF,MAAM,QAAQ,OAAO,MAAM,GAAG,IAAI;GAElC,MAAMA,OAAoB,EAAE;AAC5B,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;IACrC,MAAM,UAAU,MAAM,GAAG,MAAM;AAC/B,QAAI,CAAC,QAAS;IACd,MAAM,QAAQ,QAAQ,MAAM,MAAM;IAClC,MAAM,OAAO,SAAS,MAAM,IAAI,GAAG;IACnC,MAAM,MAAM,SAAS,MAAM,IAAI,GAAG;AAClC,QAAI,CAAC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,MAAM,IAAI,CAC3C,MAAK,KAAK,CAAC,MAAM,IAAI,CAAC;;AAI1B,YAAS,MAAM,KAAK;WACb,OAAO;AACd,YAAS,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC;;GAErE"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { Writable } from "node:stream";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/runParallel/runTask.ts
|
|
4
|
+
/**
|
|
5
|
+
* Remove the given value from the array.
|
|
6
|
+
*/
|
|
7
|
+
const remove = (array, x) => {
|
|
8
|
+
const index = array.indexOf(x);
|
|
9
|
+
if (index !== -1) array.splice(index, 1);
|
|
10
|
+
};
|
|
11
|
+
const signals = {
|
|
12
|
+
SIGABRT: 6,
|
|
13
|
+
SIGALRM: 14,
|
|
14
|
+
SIGBUS: 10,
|
|
15
|
+
SIGCHLD: 20,
|
|
16
|
+
SIGCONT: 19,
|
|
17
|
+
SIGFPE: 8,
|
|
18
|
+
SIGHUP: 1,
|
|
19
|
+
SIGILL: 4,
|
|
20
|
+
SIGINT: 2,
|
|
21
|
+
SIGKILL: 9,
|
|
22
|
+
SIGPIPE: 13,
|
|
23
|
+
SIGQUIT: 3,
|
|
24
|
+
SIGSEGV: 11,
|
|
25
|
+
SIGSTOP: 17,
|
|
26
|
+
SIGTERM: 15,
|
|
27
|
+
SIGTRAP: 5,
|
|
28
|
+
SIGTSTP: 18,
|
|
29
|
+
SIGTTIN: 21,
|
|
30
|
+
SIGTTOU: 22,
|
|
31
|
+
SIGUSR1: 30,
|
|
32
|
+
SIGUSR2: 31
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Converts a signal name to a number.
|
|
36
|
+
*/
|
|
37
|
+
const convert = (signal) => {
|
|
38
|
+
return signals[signal] || 0;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Simple in-memory writable stream
|
|
42
|
+
*/
|
|
43
|
+
var MemoryStream = class extends Writable {
|
|
44
|
+
chunks = [];
|
|
45
|
+
_write(chunk, _encoding, callback) {
|
|
46
|
+
this.chunks.push(chunk);
|
|
47
|
+
callback();
|
|
48
|
+
}
|
|
49
|
+
toString() {
|
|
50
|
+
return Buffer.concat(this.chunks).toString("utf8");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Run npm-scripts of given names in parallel.
|
|
55
|
+
*
|
|
56
|
+
* If a npm-script exited with a non-zero code, this aborts other all npm-scripts.
|
|
57
|
+
*
|
|
58
|
+
* Note: This is a simplified version for our use case.
|
|
59
|
+
* The full implementation would require the actual runTask function from npm-run-all.
|
|
60
|
+
*/
|
|
61
|
+
const runTasks = (tasks, options) => {
|
|
62
|
+
return new Promise((resolve, reject) => {
|
|
63
|
+
if (tasks.length === 0) {
|
|
64
|
+
resolve([]);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const results = tasks.map((task) => ({
|
|
68
|
+
name: task,
|
|
69
|
+
code: void 0
|
|
70
|
+
}));
|
|
71
|
+
const queue = tasks.map((task, index) => ({
|
|
72
|
+
name: task,
|
|
73
|
+
index
|
|
74
|
+
}));
|
|
75
|
+
const promises = [];
|
|
76
|
+
let error = null;
|
|
77
|
+
let aborted = false;
|
|
78
|
+
/**
|
|
79
|
+
* Done.
|
|
80
|
+
*/
|
|
81
|
+
const done = () => {
|
|
82
|
+
if (error == null) resolve(results);
|
|
83
|
+
else reject(error);
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Aborts all tasks.
|
|
87
|
+
*/
|
|
88
|
+
const abort = () => {
|
|
89
|
+
if (aborted) return;
|
|
90
|
+
aborted = true;
|
|
91
|
+
if (promises.length === 0) done();
|
|
92
|
+
else {
|
|
93
|
+
for (const p of promises) p.abort?.();
|
|
94
|
+
Promise.all(promises).then(done, reject);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Runs a next task.
|
|
99
|
+
*/
|
|
100
|
+
const next = () => {
|
|
101
|
+
if (aborted) return;
|
|
102
|
+
if (queue.length === 0) {
|
|
103
|
+
if (promises.length === 0) done();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const originalOutputStream = options.stdout;
|
|
107
|
+
const optionsClone = { ...options };
|
|
108
|
+
const writer = new MemoryStream();
|
|
109
|
+
if (options.aggregateOutput) optionsClone.stdout = writer;
|
|
110
|
+
const task = queue.shift();
|
|
111
|
+
const promise = Promise.resolve({
|
|
112
|
+
name: task.name,
|
|
113
|
+
code: 0,
|
|
114
|
+
signal: null
|
|
115
|
+
});
|
|
116
|
+
promises.push(promise);
|
|
117
|
+
promise.then((result) => {
|
|
118
|
+
remove(promises, promise);
|
|
119
|
+
if (aborted) return;
|
|
120
|
+
if (options.aggregateOutput) originalOutputStream.write(writer.toString());
|
|
121
|
+
if (result.code === null && result.signal !== null && result.signal !== void 0) result.code = 128 + convert(result.signal);
|
|
122
|
+
results[task.index].code = result.code;
|
|
123
|
+
if (result.code) {
|
|
124
|
+
error = /* @__PURE__ */ new Error(`Task ${result.name} failed with code ${result.code}`);
|
|
125
|
+
if (!options.continueOnError) {
|
|
126
|
+
abort();
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (options.race && !result.code) {
|
|
131
|
+
abort();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
next();
|
|
135
|
+
}, (thisError) => {
|
|
136
|
+
remove(promises, promise);
|
|
137
|
+
if (!options.continueOnError || options.race) {
|
|
138
|
+
error = thisError;
|
|
139
|
+
abort();
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
next();
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
const max = options.maxParallel;
|
|
146
|
+
const end = typeof max === "number" && max > 0 ? Math.min(tasks.length, max) : tasks.length;
|
|
147
|
+
for (let i = 0; i < end; ++i) next();
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { runTasks };
|
|
153
|
+
//# sourceMappingURL=runTask.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runTask.mjs","names":["signals: Record<string, number>","results: TaskResult[]","queue: TaskQueueItem[]","promises: TaskPromise[]","error: Error | null"],"sources":["../../../../src/utils/runParallel/runTask.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { Writable } from 'node:stream';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Remove the given value from the array.\n */\nconst remove = <T>(array: T[], x: T): void => {\n const index = array.indexOf(x);\n if (index !== -1) {\n array.splice(index, 1);\n }\n};\n\nconst signals: Record<string, number> = {\n // Signal name mappings to their respective standard numeric codes.\n // See: https://man7.org/linux/man-pages/man7/signal.7.html\n\n SIGABRT: 6, // Abort signal from abort(3)\n SIGALRM: 14, // Timer signal from alarm(2)\n SIGBUS: 10, // Bus error (bad memory access)\n SIGCHLD: 20, // Child stopped or terminated\n SIGCONT: 19, // Continue if stopped\n SIGFPE: 8, // Floating point exception\n SIGHUP: 1, // Hangup detected on controlling terminal or death of controlling process\n SIGILL: 4, // Illegal Instruction\n SIGINT: 2, // Interrupt from keyboard (Ctrl+C)\n SIGKILL: 9, // Kill signal (cannot be caught or ignored)\n SIGPIPE: 13, // Broken pipe: write to pipe with no readers\n SIGQUIT: 3, // Quit from keyboard (Ctrl+\\)\n SIGSEGV: 11, // Invalid memory reference (segmentation fault)\n SIGSTOP: 17, // Stop process (cannot be caught or ignored)\n SIGTERM: 15, // Termination signal\n SIGTRAP: 5, // Trace/breakpoint trap\n SIGTSTP: 18, // Stop typed at tty (Ctrl+Z)\n SIGTTIN: 21, // tty input for background process\n SIGTTOU: 22, // tty output for background process\n SIGUSR1: 30, // User-defined signal 1\n SIGUSR2: 31, // User-defined signal 2\n};\n\n/**\n * Converts a signal name to a number.\n */\nconst convert = (signal: string): number => {\n return signals[signal] || 0;\n};\n\n/**\n * Simple in-memory writable stream\n */\nclass MemoryStream extends Writable {\n private chunks: Buffer[] = [];\n\n _write(\n chunk: Buffer,\n _encoding: string,\n callback: (error?: Error | null) => void\n ): void {\n this.chunks.push(chunk);\n callback();\n }\n\n toString(): string {\n return Buffer.concat(this.chunks).toString('utf8');\n }\n}\n\n//------------------------------------------------------------------------------\n// Types\n//------------------------------------------------------------------------------\n\ninterface TaskResult {\n name: string;\n code: number | null;\n signal?: string | null;\n}\n\ninterface TaskQueueItem {\n name: string;\n index: number;\n}\n\ninterface RunTaskOptions {\n stdout: NodeJS.WritableStream;\n stderr?: NodeJS.WritableStream;\n aggregateOutput?: boolean;\n continueOnError?: boolean;\n race?: boolean;\n maxParallel?: number;\n}\n\ninterface TaskPromise extends Promise<TaskResult> {\n abort?: () => void;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Run npm-scripts of given names in parallel.\n *\n * If a npm-script exited with a non-zero code, this aborts other all npm-scripts.\n *\n * Note: This is a simplified version for our use case.\n * The full implementation would require the actual runTask function from npm-run-all.\n */\nexport const runTasks = (\n tasks: string[],\n options: RunTaskOptions\n): Promise<TaskResult[]> => {\n return new Promise((resolve, reject) => {\n if (tasks.length === 0) {\n resolve([]);\n return;\n }\n\n const results: TaskResult[] = tasks.map((task) => ({\n name: task,\n code: undefined as any,\n }));\n const queue: TaskQueueItem[] = tasks.map((task, index) => ({\n name: task,\n index,\n }));\n const promises: TaskPromise[] = [];\n let error: Error | null = null;\n let aborted = false;\n\n /**\n * Done.\n */\n const done = (): void => {\n if (error == null) {\n resolve(results);\n } else {\n reject(error);\n }\n };\n\n /**\n * Aborts all tasks.\n */\n const abort = (): void => {\n if (aborted) {\n return;\n }\n aborted = true;\n\n if (promises.length === 0) {\n done();\n } else {\n for (const p of promises) {\n p.abort?.();\n }\n Promise.all(promises).then(done, reject);\n }\n };\n\n /**\n * Runs a next task.\n */\n const next = (): void => {\n if (aborted) {\n return;\n }\n if (queue.length === 0) {\n if (promises.length === 0) {\n done();\n }\n return;\n }\n\n const originalOutputStream = options.stdout;\n const optionsClone = { ...options };\n const writer = new MemoryStream();\n\n if (options.aggregateOutput) {\n optionsClone.stdout = writer as any;\n }\n\n const task = queue.shift()!;\n\n // Note: This requires the actual runTask implementation from npm-run-all\n // For now, this is a placeholder that would need to be implemented\n const promise = Promise.resolve({\n name: task.name,\n code: 0,\n signal: null,\n }) as TaskPromise;\n\n promises.push(promise);\n promise.then(\n (result) => {\n remove(promises, promise);\n if (aborted) {\n return;\n }\n\n if (options.aggregateOutput) {\n originalOutputStream.write(writer.toString());\n }\n\n // Check if the task failed as a result of a signal, and\n // amend the exit code as a result.\n if (\n result.code === null &&\n result.signal !== null &&\n result.signal !== undefined\n ) {\n // An exit caused by a signal must return a status code\n // of 128 plus the value of the signal code.\n // Ref: https://nodejs.org/api/process.html#process_exit_codes\n result.code = 128 + convert(result.signal);\n }\n\n // Save the result.\n results[task.index].code = result.code;\n\n // Aborts all tasks if it's an error.\n if (result.code) {\n error = new Error(\n `Task ${result.name} failed with code ${result.code}`\n );\n if (!options.continueOnError) {\n abort();\n return;\n }\n }\n\n // Aborts all tasks if options.race is true.\n if (options.race && !result.code) {\n abort();\n return;\n }\n\n // Call the next task.\n next();\n },\n (thisError: Error) => {\n remove(promises, promise);\n if (!options.continueOnError || options.race) {\n error = thisError;\n abort();\n return;\n }\n next();\n }\n );\n };\n\n const max = options.maxParallel;\n const end =\n typeof max === 'number' && max > 0\n ? Math.min(tasks.length, max)\n : tasks.length;\n for (let i = 0; i < end; ++i) {\n next();\n }\n });\n};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { list } from "./pidTree.mjs";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/runParallel/spawnPosix.ts
|
|
5
|
+
/**
|
|
6
|
+
* Kills the new process and its sub processes.
|
|
7
|
+
*/
|
|
8
|
+
const createKillHandler = (child) => {
|
|
9
|
+
return (signal) => {
|
|
10
|
+
if (!child.pid) return false;
|
|
11
|
+
try {
|
|
12
|
+
list(child.pid, { root: true }, (err, pids) => {
|
|
13
|
+
if (err) {
|
|
14
|
+
try {
|
|
15
|
+
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
16
|
+
} catch {}
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!pids) {
|
|
20
|
+
try {
|
|
21
|
+
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
22
|
+
} catch {}
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (const pid of pids) try {
|
|
26
|
+
process.kill(pid, signal ?? "SIGTERM");
|
|
27
|
+
} catch (_err) {}
|
|
28
|
+
});
|
|
29
|
+
} catch {
|
|
30
|
+
try {
|
|
31
|
+
process.kill(-child.pid, signal ?? "SIGTERM");
|
|
32
|
+
} catch {}
|
|
33
|
+
}
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Launches a new process with the given command.
|
|
39
|
+
* This is almost same as `child_process.spawn`.
|
|
40
|
+
*
|
|
41
|
+
* This returns a `ChildProcess` instance.
|
|
42
|
+
* `kill` method of the instance kills the new process and its sub processes.
|
|
43
|
+
*
|
|
44
|
+
* @param command - The command to run.
|
|
45
|
+
* @param args - List of string arguments.
|
|
46
|
+
* @param options - Options.
|
|
47
|
+
* @returns A ChildProcess instance of new process.
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
const spawnPosix = (command, args, options) => {
|
|
51
|
+
const child = spawn(command, args, options);
|
|
52
|
+
child.kill = createKillHandler(child);
|
|
53
|
+
return child;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
//#endregion
|
|
57
|
+
export { spawnPosix };
|
|
58
|
+
//# sourceMappingURL=spawnPosix.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawnPosix.mjs","names":["nodeSpawn"],"sources":["../../../../src/utils/runParallel/spawnPosix.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\nimport { list } from './pidTree';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes.\n */\nconst createKillHandler = (\n child: ChildProcess\n): ((signal?: NodeJS.Signals | number) => boolean) => {\n return (signal?: NodeJS.Signals | number): boolean => {\n if (!child.pid) return false;\n\n // Try using list if available\n try {\n list(child.pid, { root: true }, (err: Error | null, pids?: number[]) => {\n if (err) {\n // Fallback to process group kill\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n if (!pids) {\n // Fallback to process group kill if no pids returned\n try {\n process.kill(-child.pid!, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n return;\n }\n\n for (const pid of pids) {\n try {\n process.kill(pid, signal ?? 'SIGTERM');\n } catch (_err) {\n // ignore.\n }\n }\n });\n } catch {\n // pidtree not available, use process group kill\n try {\n process.kill(-child.pid, signal ?? 'SIGTERM');\n } catch {\n // ignore\n }\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnPosix = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;;AAeA,MAAM,qBACJ,UACoD;AACpD,SAAQ,WAA8C;AACpD,MAAI,CAAC,MAAM,IAAK,QAAO;AAGvB,MAAI;AACF,QAAK,MAAM,KAAK,EAAE,MAAM,MAAM,GAAG,KAAmB,SAAoB;AACtE,QAAI,KAAK;AAEP,SAAI;AACF,cAAQ,KAAK,CAAC,MAAM,KAAM,UAAU,UAAU;aACxC;AAGR;;AAGF,QAAI,CAAC,MAAM;AAET,SAAI;AACF,cAAQ,KAAK,CAAC,MAAM,KAAM,UAAU,UAAU;aACxC;AAGR;;AAGF,SAAK,MAAM,OAAO,KAChB,KAAI;AACF,aAAQ,KAAK,KAAK,UAAU,UAAU;aAC/B,MAAM;KAIjB;UACI;AAEN,OAAI;AACF,YAAQ,KAAK,CAAC,MAAM,KAAK,UAAU,UAAU;WACvC;;AAKV,SAAO;;;;;;;;;;;;;;;;AAqBX,MAAa,cACX,SACA,MACA,YACiB;CACjB,MAAM,QAAQA,MAAU,SAAS,MAAM,QAAQ;AAC/C,OAAM,OAAO,kBAAkB,MAAM;AAErC,QAAO"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/runParallel/spawnWin32.ts
|
|
4
|
+
/**
|
|
5
|
+
* Kills the new process and its sub processes forcibly.
|
|
6
|
+
*/
|
|
7
|
+
const createKillHandler = (child) => {
|
|
8
|
+
return () => {
|
|
9
|
+
if (!child.pid) return false;
|
|
10
|
+
try {
|
|
11
|
+
spawn("taskkill", [
|
|
12
|
+
"/F",
|
|
13
|
+
"/T",
|
|
14
|
+
"/PID",
|
|
15
|
+
String(child.pid)
|
|
16
|
+
], { stdio: "ignore" });
|
|
17
|
+
} catch {}
|
|
18
|
+
return true;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Launches a new process with the given command.
|
|
23
|
+
* This is almost same as `child_process.spawn`.
|
|
24
|
+
*
|
|
25
|
+
* This returns a `ChildProcess` instance.
|
|
26
|
+
* `kill` method of the instance kills the new process and its sub processes forcibly.
|
|
27
|
+
*
|
|
28
|
+
* @param command - The command to run.
|
|
29
|
+
* @param args - List of string arguments.
|
|
30
|
+
* @param options - Options.
|
|
31
|
+
* @returns A ChildProcess instance of new process.
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
const spawnWin32 = (command, args, options) => {
|
|
35
|
+
const child = spawn(command, args, options);
|
|
36
|
+
child.kill = createKillHandler(child);
|
|
37
|
+
return child;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { spawnWin32 };
|
|
42
|
+
//# sourceMappingURL=spawnWin32.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawnWin32.mjs","names":["nodeSpawn"],"sources":["../../../../src/utils/runParallel/spawnWin32.ts"],"sourcesContent":["//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport type { SpawnOptions } from 'node:child_process';\nimport { type ChildProcess, spawn as nodeSpawn } from 'node:child_process';\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Kills the new process and its sub processes forcibly.\n */\nconst createKillHandler = (child: ChildProcess) => {\n return (): boolean => {\n if (!child.pid) return false;\n\n try {\n nodeSpawn('taskkill', ['/F', '/T', '/PID', String(child.pid)], {\n stdio: 'ignore',\n });\n } catch {\n // ignore\n }\n\n return true;\n };\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Launches a new process with the given command.\n * This is almost same as `child_process.spawn`.\n *\n * This returns a `ChildProcess` instance.\n * `kill` method of the instance kills the new process and its sub processes forcibly.\n *\n * @param command - The command to run.\n * @param args - List of string arguments.\n * @param options - Options.\n * @returns A ChildProcess instance of new process.\n * @private\n */\nexport const spawnWin32 = (\n command: string,\n args: string[],\n options: SpawnOptions\n): ChildProcess => {\n const child = nodeSpawn(command, args, options);\n child.kill = createKillHandler(child);\n\n return child;\n};\n"],"mappings":";;;;;;AAcA,MAAM,qBAAqB,UAAwB;AACjD,cAAsB;AACpB,MAAI,CAAC,MAAM,IAAK,QAAO;AAEvB,MAAI;AACF,SAAU,YAAY;IAAC;IAAM;IAAM;IAAQ,OAAO,MAAM,IAAI;IAAC,EAAE,EAC7D,OAAO,UACR,CAAC;UACI;AAIR,SAAO;;;;;;;;;;;;;;;;AAqBX,MAAa,cACX,SACA,MACA,YACiB;CACjB,MAAM,QAAQA,MAAU,SAAS,MAAM,QAAQ;AAC/C,OAAM,OAAO,kBAAkB,MAAM;AAErC,QAAO"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { run } from "./bin.mjs";
|
|
2
|
+
import * as os from "node:os";
|
|
3
|
+
|
|
4
|
+
//#region src/utils/runParallel/wmic.ts
|
|
5
|
+
/**
|
|
6
|
+
* Gets the list of all the pids of the system through the wmic command.
|
|
7
|
+
* @param callback Callback function with error and process list.
|
|
8
|
+
*/
|
|
9
|
+
const wmic = (callback) => {
|
|
10
|
+
run("wmic", [
|
|
11
|
+
"PROCESS",
|
|
12
|
+
"get",
|
|
13
|
+
"ParentProcessId,ProcessId"
|
|
14
|
+
], {
|
|
15
|
+
windowsHide: true,
|
|
16
|
+
windowsVerbatimArguments: true
|
|
17
|
+
}, (err, stdout, code) => {
|
|
18
|
+
if (err) {
|
|
19
|
+
callback(err);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (code !== 0) {
|
|
23
|
+
callback(/* @__PURE__ */ new Error(`pidtree wmic command exited with code ${code}`));
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (!stdout) {
|
|
27
|
+
callback(/* @__PURE__ */ new Error("No stdout received from wmic command"));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const lines = stdout.split(os.EOL);
|
|
32
|
+
const list = [];
|
|
33
|
+
for (let i = 1; i < lines.length; i++) {
|
|
34
|
+
const trimmed = lines[i].trim();
|
|
35
|
+
if (!trimmed) continue;
|
|
36
|
+
const parts = trimmed.split(/\s+/);
|
|
37
|
+
const ppid = parseInt(parts[0], 10);
|
|
38
|
+
const pid = parseInt(parts[1], 10);
|
|
39
|
+
if (!Number.isNaN(ppid) && !Number.isNaN(pid)) list.push([ppid, pid]);
|
|
40
|
+
}
|
|
41
|
+
callback(null, list);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
callback(error instanceof Error ? error : new Error(String(error)));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
//#endregion
|
|
49
|
+
export { wmic };
|
|
50
|
+
//# sourceMappingURL=wmic.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wmic.mjs","names":["list: ProcessList"],"sources":["../../../../src/utils/runParallel/wmic.ts"],"sourcesContent":["import type { SpawnOptions } from 'node:child_process';\nimport * as os from 'node:os';\nimport { run } from './bin';\n\ntype ProcessList = [number, number][]; // [PPID, PID][]\ntype ProcessListCallback = (err: Error | null, list?: ProcessList) => void;\n\n/**\n * Gets the list of all the pids of the system through the wmic command.\n * @param callback Callback function with error and process list.\n */\nexport const wmic = (callback: ProcessListCallback): void => {\n const args = ['PROCESS', 'get', 'ParentProcessId,ProcessId'];\n const options: SpawnOptions = {\n windowsHide: true,\n windowsVerbatimArguments: true,\n };\n run('wmic', args, options, (err, stdout, code) => {\n if (err) {\n callback(err);\n return;\n }\n\n if (code !== 0) {\n callback(new Error(`pidtree wmic command exited with code ${code}`));\n return;\n }\n\n // Example of stdout\n //\n // ParentProcessId ProcessId\n // 0 777\n\n if (!stdout) {\n callback(new Error('No stdout received from wmic command'));\n return;\n }\n\n try {\n const lines = stdout.split(os.EOL);\n\n const list: ProcessList = [];\n for (let i = 1; i < lines.length; i++) {\n const trimmed = lines[i].trim();\n if (!trimmed) continue;\n const parts = trimmed.split(/\\s+/);\n const ppid = parseInt(parts[0], 10); // PPID\n const pid = parseInt(parts[1], 10); // PID\n if (!Number.isNaN(ppid) && !Number.isNaN(pid)) {\n list.push([ppid, pid]);\n }\n }\n\n callback(null, list);\n } catch (error) {\n callback(error instanceof Error ? error : new Error(String(error)));\n }\n });\n};\n"],"mappings":";;;;;;;;AAWA,MAAa,QAAQ,aAAwC;AAM3D,KAAI,QALS;EAAC;EAAW;EAAO;EAA4B,EAC9B;EAC5B,aAAa;EACb,0BAA0B;EAC3B,GAC2B,KAAK,QAAQ,SAAS;AAChD,MAAI,KAAK;AACP,YAAS,IAAI;AACb;;AAGF,MAAI,SAAS,GAAG;AACd,4BAAS,IAAI,MAAM,yCAAyC,OAAO,CAAC;AACpE;;AAQF,MAAI,CAAC,QAAQ;AACX,4BAAS,IAAI,MAAM,uCAAuC,CAAC;AAC3D;;AAGF,MAAI;GACF,MAAM,QAAQ,OAAO,MAAM,GAAG,IAAI;GAElC,MAAMA,OAAoB,EAAE;AAC5B,QAAK,IAAI,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;IACrC,MAAM,UAAU,MAAM,GAAG,MAAM;AAC/B,QAAI,CAAC,QAAS;IACd,MAAM,QAAQ,QAAQ,MAAM,MAAM;IAClC,MAAM,OAAO,SAAS,MAAM,IAAI,GAAG;IACnC,MAAM,MAAM,SAAS,MAAM,IAAI,GAAG;AAClC,QAAI,CAAC,OAAO,MAAM,KAAK,IAAI,CAAC,OAAO,MAAM,IAAI,CAC3C,MAAK,KAAK,CAAC,MAAM,IAAI,CAAC;;AAI1B,YAAS,MAAM,KAAK;WACb,OAAO;AACd,YAAS,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,CAAC;;GAErE"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { UnmergedDictionaryOutput } from "./writeUnmergedDictionary.js";
|
|
2
2
|
import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
|
|
3
3
|
import { LocalizedDictionaryOutput } from "./writeDynamicDictionary.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _intlayer_types1 from "@intlayer/types";
|
|
5
5
|
import { Dictionary } from "@intlayer/types";
|
|
6
6
|
|
|
7
7
|
//#region src/buildIntlayerDictionary/buildIntlayerDictionary.d.ts
|
|
8
8
|
/**
|
|
9
9
|
* This function transpile the bundled code to to make dictionaries as JSON files
|
|
10
10
|
*/
|
|
11
|
-
declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?:
|
|
11
|
+
declare const buildDictionary: (localDictionariesEntries: Dictionary[], configuration?: _intlayer_types1.IntlayerConfig, formats?: ("cjs" | "esm")[], importOtherDictionaries?: boolean) => Promise<{
|
|
12
12
|
unmergedDictionaries: UnmergedDictionaryOutput;
|
|
13
13
|
mergedDictionaries: MergedDictionaryOutput;
|
|
14
14
|
dynamicDictionaries: LocalizedDictionaryOutput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MergedDictionaryOutput } from "./writeMergedDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types4 from "@intlayer/types";
|
|
3
3
|
import { Dictionary, Locale } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/buildIntlayerDictionary/writeDynamicDictionary.d.ts
|
|
@@ -12,7 +12,7 @@ type LocalizedDictionaryOutput = Record<string, LocalizedDictionaryResult>;
|
|
|
12
12
|
/**
|
|
13
13
|
* This function generates the content of the dictionary list file
|
|
14
14
|
*/
|
|
15
|
-
declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?:
|
|
15
|
+
declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types4.IntlayerConfig) => string;
|
|
16
16
|
/**
|
|
17
17
|
* Write the localized dictionaries to the dictionariesDir
|
|
18
18
|
* @param mergedDictionaries - The merged dictionaries
|
|
@@ -29,7 +29,7 @@ declare const generateDictionaryEntryPoint: (localizedDictionariesPathsRecord: L
|
|
|
29
29
|
* // { key: 'home', content: { ... } },
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?:
|
|
32
|
+
declare const writeDynamicDictionary: (mergedDictionaries: MergedDictionaryOutput, configuration?: _intlayer_types4.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { DictionaryResult, LocalizedDictionaryOutput, LocalizedDictionaryResult, generateDictionaryEntryPoint, writeDynamicDictionary };
|
|
35
35
|
//# sourceMappingURL=writeDynamicDictionary.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { LocalizedDictionaryOutput, LocalizedDictionaryResult } from "./writeDynamicDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types2 from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/buildIntlayerDictionary/writeFetchDictionary.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* This function generates the content of the dictionary list file
|
|
7
7
|
*/
|
|
8
|
-
declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?:
|
|
8
|
+
declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: LocalizedDictionaryResult, format?: "cjs" | "esm", configuration?: _intlayer_types2.IntlayerConfig) => string;
|
|
9
9
|
/**
|
|
10
10
|
* Write the localized dictionaries to the dictionariesDir
|
|
11
11
|
* @param mergedDictionaries - The merged dictionaries
|
|
@@ -22,7 +22,7 @@ declare const generateDictionaryEntryPoint: (localedDictionariesPathsRecord: Loc
|
|
|
22
22
|
* // { key: 'home', content: { ... } },
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?:
|
|
25
|
+
declare const writeFetchDictionary: (dynamicDictionaries: LocalizedDictionaryOutput, configuration?: _intlayer_types2.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<LocalizedDictionaryOutput>;
|
|
26
26
|
//#endregion
|
|
27
27
|
export { generateDictionaryEntryPoint, writeFetchDictionary };
|
|
28
28
|
//# sourceMappingURL=writeFetchDictionary.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { UnmergedDictionaryOutput } from "./writeUnmergedDictionary.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types8 from "@intlayer/types";
|
|
3
3
|
import { Dictionary } from "@intlayer/types";
|
|
4
4
|
|
|
5
5
|
//#region src/buildIntlayerDictionary/writeMergedDictionary.d.ts
|
|
@@ -24,7 +24,7 @@ type MergedDictionaryOutput = Record<string, MergedDictionaryResult>;
|
|
|
24
24
|
* // { key: 'home', content: { ... } },
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
declare const writeMergedDictionaries: (groupedDictionaries: UnmergedDictionaryOutput, configuration?:
|
|
27
|
+
declare const writeMergedDictionaries: (groupedDictionaries: UnmergedDictionaryOutput, configuration?: _intlayer_types8.IntlayerConfig) => Promise<MergedDictionaryOutput>;
|
|
28
28
|
//#endregion
|
|
29
29
|
export { MergedDictionaryOutput, MergedDictionaryResult, writeMergedDictionaries };
|
|
30
30
|
//# sourceMappingURL=writeMergedDictionary.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types6 from "@intlayer/types";
|
|
2
2
|
import { Dictionary } from "@intlayer/types";
|
|
3
3
|
|
|
4
4
|
//#region src/buildIntlayerDictionary/writeRemoteDictionary.d.ts
|
|
@@ -19,7 +19,7 @@ import { Dictionary } from "@intlayer/types";
|
|
|
19
19
|
* // { key: 'home', content: { ... } },
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
declare const writeRemoteDictionary: (remoteDictionaries: Dictionary[], configuration?:
|
|
22
|
+
declare const writeRemoteDictionary: (remoteDictionaries: Dictionary[], configuration?: _intlayer_types6.IntlayerConfig) => Promise<Dictionary[]>;
|
|
23
23
|
//#endregion
|
|
24
24
|
export { writeRemoteDictionary };
|
|
25
25
|
//# sourceMappingURL=writeRemoteDictionary.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/createDictionaryEntryPoint/createDictionaryEntryPoint.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* This function generates a list of dictionaries in the main directory
|
|
6
6
|
*/
|
|
7
|
-
declare const createDictionaryEntryPoint: (configuration?:
|
|
7
|
+
declare const createDictionaryEntryPoint: (configuration?: _intlayer_types0.IntlayerConfig, formats?: ("cjs" | "esm")[]) => Promise<void>;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { createDictionaryEntryPoint };
|
|
10
10
|
//# sourceMappingURL=createDictionaryEntryPoint.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _intlayer_types0 from "@intlayer/types";
|
|
2
2
|
|
|
3
3
|
//#region src/createDictionaryEntryPoint/generateDictionaryListContent.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* This function generates the content of the dictionary list file
|
|
6
6
|
*/
|
|
7
|
-
declare const generateDictionaryListContent: (dictionaries: string[], functionName: string, format?: "cjs" | "esm", configuration?:
|
|
7
|
+
declare const generateDictionaryListContent: (dictionaries: string[], functionName: string, format?: "cjs" | "esm", configuration?: _intlayer_types0.IntlayerConfig) => string;
|
|
8
8
|
//#endregion
|
|
9
9
|
export { generateDictionaryListContent };
|
|
10
10
|
//# sourceMappingURL=generateDictionaryListContent.d.ts.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ import { getGlobalLimiter, getTaskLimiter, parallelizeGlobal } from "./utils/par
|
|
|
35
35
|
import { reduceObjectFormat } from "./utils/reduceObjectFormat.js";
|
|
36
36
|
import { resolveObjectPromises } from "./utils/resolveObjectPromises.js";
|
|
37
37
|
import { runOnce } from "./utils/runOnce.js";
|
|
38
|
-
import { ParallelHandle, runParallel } from "./utils/runParallel.js";
|
|
38
|
+
import { ParallelHandle, runParallel } from "./utils/runParallel/index.js";
|
|
39
39
|
import { sortAlphabetically } from "./utils/sortAlphabetically.js";
|
|
40
40
|
import { splitTextByLines } from "./utils/splitTextByLine.js";
|
|
41
41
|
import { verifyIdenticObjectFormat } from "./utils/verifyIdenticObjectFormat.js";
|
|
@@ -45,5 +45,6 @@ import { DictionaryStatus } from "./writeContentDeclaration/dictionaryStatus.js"
|
|
|
45
45
|
import { transformJSFile } from "./writeContentDeclaration/transformJSFile.js";
|
|
46
46
|
import { writeContentDeclaration } from "./writeContentDeclaration/writeContentDeclaration.js";
|
|
47
47
|
import { writeJSFile } from "./writeContentDeclaration/writeJSFile.js";
|
|
48
|
+
import { detectFormatCommand } from "./writeContentDeclaration/detectFormatCommand.js";
|
|
48
49
|
import { processContentDeclarationContent } from "./writeContentDeclaration/processContentDeclarationContent.js";
|
|
49
|
-
export { type DictionaryStatus, type DiffMode, type Extension, type Format, type JSONObject, type JsonChunk, type ListGitFilesOptions, type ListGitLinesOptions, type ParallelHandle, assembleJSON, buildAndWatchIntlayer, buildDictionary, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, fetchDistantDictionaries, formatLocale, formatPath, generateDictionaryListContent, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, kebabCaseToCamelCase, listDictionaries, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, processContentDeclarationContent, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, sortAlphabetically, splitTextByLines, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
50
|
+
export { type DictionaryStatus, type DiffMode, type Extension, type Format, type JSONObject, type JsonChunk, type ListGitFilesOptions, type ListGitLinesOptions, type ParallelHandle, assembleJSON, buildAndWatchIntlayer, buildDictionary, chunkJSON, cleanOutputDir, createDictionaryEntryPoint, createModuleAugmentation, createTypes, detectExportedComponentName, detectFormatCommand, fetchDistantDictionaries, formatLocale, formatPath, generateDictionaryListContent, getBuiltDictionariesPath, getBuiltDynamicDictionariesPath, getBuiltFetchDictionariesPath, getBuiltRemoteDictionariesPath, getBuiltUnmergedDictionariesPath, getChunk, getContentDeclarationFileTemplate, getExtensionFromFormat, getFileHash, getFormatFromExtension, getGlobalLimiter, getTaskLimiter, handleAdditionalContentDeclarationFile, handleContentDeclarationFileChange, handleUnlinkedContentDeclarationFile, isInvalidDictionary, kebabCaseToCamelCase, listDictionaries, listGitFiles, listGitLines, loadContentDeclarations, loadDictionaries, loadLocalDictionaries, loadRemoteDictionaries, pLimit, parallelize, parallelizeGlobal, prepareIntlayer, processContentDeclarationContent, reconstructFromSingleChunk, reduceDictionaryContent, reduceObjectFormat, resolveObjectPromises, runOnce, runParallel, sortAlphabetically, splitTextByLines, transformJSFile, verifyIdenticObjectFormat, watch, writeContentDeclaration, writeJSFile };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { DictionariesStatus } from "./loadDictionaries.js";
|
|
2
|
-
import * as
|
|
2
|
+
import * as _intlayer_types7 from "@intlayer/types";
|
|
3
3
|
import { Dictionary } from "@intlayer/types";
|
|
4
4
|
import { DictionaryAPI } from "@intlayer/backend";
|
|
5
5
|
|
|
6
6
|
//#region src/loadDictionaries/loadRemoteDictionaries.d.ts
|
|
7
7
|
declare const formatDistantDictionaries: (dictionaries: (DictionaryAPI | Dictionary)[]) => Dictionary[];
|
|
8
|
-
declare const loadRemoteDictionaries: (configuration?:
|
|
8
|
+
declare const loadRemoteDictionaries: (configuration?: _intlayer_types7.IntlayerConfig, onStatusUpdate?: (status: DictionariesStatus[]) => void, options?: {
|
|
9
9
|
onStartRemoteCheck?: () => void;
|
|
10
10
|
onStopRemoteCheck?: () => void;
|
|
11
11
|
onError?: (error: Error) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunkJSON.d.ts","names":[],"sources":["../../../src/utils/chunkJSON.ts"],"sourcesContent":[],"mappings":";;;AAUkB;;;;;AAGlB,KAHK,aAAA,GAGiB,MAAA,GACP,MAAA,
|
|
1
|
+
{"version":3,"file":"chunkJSON.d.ts","names":[],"sources":["../../../src/utils/chunkJSON.ts"],"sourcesContent":[],"mappings":";;;AAUkB;;;;;AAGlB,KAHK,aAAA,GAGiB,MAAA,GACP,MAAA,GAAA,OAAS,GAAA,IAAA;AACtB,KAJG,SAAA,GAAY,aAMA,GANgB,UAMP,GANoB,SAMpB;AAErB,KANO,UAAA,GAMA;EAEP,CAAA,CAAA,EAAA,MAAA,CAAQ,EAPE,SAOF;AAA4C,CAAA;AAG7C,KAPP,SAAA,GAAY,SAYJ,EAAA;AAAyB,KAVjC,IAAA,GAAO,KAYC,CAAA,MAAA,GAAA,MAAA,CAAA;AAEb,KAZK,QAAA,GAYgB;EAuMR,EAAA,EAAA,KAAA;EACJ,IAAA,EApN0B,IAoN1B;EAAa,KAAA,EApN0B,SAoN1B;CAEnB;KArNE,cAAA,GAqNO;EAsHC,EAAA,EAAA,YAAA;EACJ,IAAA,EA1UD,IA0UC;EACN,KAAA,EAAA,MAAA;EAAa,KAAA,EAAA,MAAA;EA+Ff,KAAA,EAAA,MAAA;AAED,CAAA;KAvaK,KAAA,GAAQ,QAuawB,GAvab,cAuaa;KArahC,QAAA,GAqa8C,QAAA,GAAA,OAAA;AAAa,KAnapD,SAAA,GAmaoD;EAkL/D,aAAA,EAAA,CAAA;;;YAjlBW;;WAED;;;;;cAiME,mBACJ,aAAa,gCAEnB;;;;;;;;;;;cAsHU,oCACJ,cACN,aAAa;cAiGH,uBAAwB,gBAAc,aAAa"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { SpawnOptions } from "node:child_process";
|
|
2
|
+
|
|
3
|
+
//#region src/utils/runParallel/bin.d.ts
|
|
4
|
+
type BinCallback = (err: Error | null, stdout?: string, code?: number) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Spawn a binary and read its stdout.
|
|
7
|
+
* @param cmd The name of the binary to spawn.
|
|
8
|
+
* @param args The arguments for the binary.
|
|
9
|
+
* @param options Optional option for the spawn function.
|
|
10
|
+
* @param done Callback function.
|
|
11
|
+
*/
|
|
12
|
+
declare const run: (cmd: string, args: string[], options: SpawnOptions | BinCallback | undefined, done?: BinCallback) => void;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { run };
|
|
15
|
+
//# sourceMappingURL=bin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","names":[],"sources":["../../../../src/utils/runParallel/bin.ts"],"sourcesContent":[],"mappings":";;;KAGK,WAAA,SAAoB;;AAFqC;AAsB9D;;;;;cAAa,4CAGF,eAAe,gCACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","names":[],"sources":["../../../../src/utils/runParallel/bootstrap.ts"],"sourcesContent":[],"mappings":";cAIa,qCAAoC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/utils/runParallel/index.d.ts
|
|
2
|
+
type ParallelHandle = {
|
|
3
|
+
kill: () => void;
|
|
4
|
+
result: Promise<any>;
|
|
5
|
+
commandText: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Start a cross-platform parallel process using npm-run-all approach.
|
|
9
|
+
* Accepts either a single string (e.g., 'next start') or an array of tokens (e.g., ['next', 'start']).
|
|
10
|
+
*/
|
|
11
|
+
declare const runParallel: (proc?: string | string[]) => ParallelHandle;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { ParallelHandle, runParallel };
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../../src/utils/runParallel/index.ts"],"sourcesContent":[],"mappings":";KAIY,cAAA;EAAA,IAAA,EAAA,GAAA,GAAA,IAAA;EAUC,MAAA,EARH,OAsIT,CAAA,GAAA,CAAA;;;;;;;cA9HY,2CAA0C"}
|