@warlock.js/core 4.0.15 → 4.0.17
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/esm/dev2-server/health-checker/index.d.ts +6 -0
- package/esm/dev2-server/health-checker/index.d.ts.map +1 -0
- package/esm/dev2-server/health-checker/workers/eslint-health.worker.js +214 -0
- package/esm/dev2-server/health-checker/workers/eslint-health.worker.js.map +1 -0
- package/esm/dev2-server/health-checker/workers/ts-health.worker.js +261 -0
- package/esm/dev2-server/health-checker/workers/ts-health.worker.js.map +1 -0
- package/esm/index.d.ts +1 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./checkers/base-health-checker";
|
|
2
|
+
export * from "./checkers/eslint-health-checker";
|
|
3
|
+
export * from "./checkers/typescript-health-checker";
|
|
4
|
+
export * from "./workers/eslint-health.worker";
|
|
5
|
+
export * from "./workers/ts-health.worker";
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dev2-server/health-checker/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,kCAAkC,CAAC;AACjD,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import {ESLint}from'eslint';import fs from'fs';import path from'path';import {parentPort,workerData}from'worker_threads';/**
|
|
2
|
+
* ESLint Health Check Worker
|
|
3
|
+
*
|
|
4
|
+
* This worker runs in a dedicated thread to perform ESLint linting
|
|
5
|
+
* without blocking the main dev server thread. It maintains a persistent
|
|
6
|
+
* ESLint instance for efficient linting.
|
|
7
|
+
*
|
|
8
|
+
* Communication:
|
|
9
|
+
* - Receives: { type: 'init' | 'check' | 'shutdown', ... }
|
|
10
|
+
* - Sends: { type: 'results' | 'initialized' | 'error', ... }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* ESLint Health Worker class
|
|
14
|
+
* Maintains persistent ESLint instance for efficient linting
|
|
15
|
+
*/
|
|
16
|
+
class ESLintHealthWorker {
|
|
17
|
+
/**
|
|
18
|
+
* ESLint instance
|
|
19
|
+
*/
|
|
20
|
+
eslint = null;
|
|
21
|
+
/**
|
|
22
|
+
* Whether the worker is initialized
|
|
23
|
+
*/
|
|
24
|
+
initialized = false;
|
|
25
|
+
/**
|
|
26
|
+
* Whether ESLint config was found
|
|
27
|
+
*/
|
|
28
|
+
hasConfig = false;
|
|
29
|
+
/**
|
|
30
|
+
* Current working directory
|
|
31
|
+
*/
|
|
32
|
+
cwd = process.cwd();
|
|
33
|
+
/**
|
|
34
|
+
* Initialize the worker with ESLint configuration
|
|
35
|
+
*/
|
|
36
|
+
initialize(config) {
|
|
37
|
+
try {
|
|
38
|
+
this.cwd = config.cwd || process.cwd();
|
|
39
|
+
// Check if ESLint flat config exists
|
|
40
|
+
const flatConfigPath = path.join(this.cwd, "eslint.config.js");
|
|
41
|
+
const flatConfigMjsPath = path.join(this.cwd, "eslint.config.mjs");
|
|
42
|
+
const flatConfigCjsPath = path.join(this.cwd, "eslint.config.cjs");
|
|
43
|
+
this.hasConfig =
|
|
44
|
+
fs.existsSync(flatConfigPath) ||
|
|
45
|
+
fs.existsSync(flatConfigMjsPath) ||
|
|
46
|
+
fs.existsSync(flatConfigCjsPath);
|
|
47
|
+
if (!this.hasConfig) {
|
|
48
|
+
this.initialized = true;
|
|
49
|
+
return { success: true, hasConfig: false };
|
|
50
|
+
}
|
|
51
|
+
// Create ESLint instance with flat config
|
|
52
|
+
this.eslint = new ESLint({
|
|
53
|
+
cwd: this.cwd,
|
|
54
|
+
});
|
|
55
|
+
this.initialized = true;
|
|
56
|
+
return { success: true, hasConfig: true };
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error("ESLint Worker: Failed to initialize:", error);
|
|
60
|
+
this.initialized = true;
|
|
61
|
+
return { success: false, hasConfig: false };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Check files for ESLint errors
|
|
66
|
+
*/
|
|
67
|
+
async checkFiles(files) {
|
|
68
|
+
if (!this.eslint || !this.hasConfig) {
|
|
69
|
+
// No ESLint config, return all files as healthy
|
|
70
|
+
return files.map((file) => ({
|
|
71
|
+
path: file.path,
|
|
72
|
+
relativePath: file.relativePath,
|
|
73
|
+
healthy: true,
|
|
74
|
+
errors: [],
|
|
75
|
+
warnings: [],
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
const results = [];
|
|
79
|
+
for (const file of files) {
|
|
80
|
+
// Only lint lintable files
|
|
81
|
+
if (!this.isLintableFile(file.path)) {
|
|
82
|
+
results.push({
|
|
83
|
+
path: file.path,
|
|
84
|
+
relativePath: file.relativePath,
|
|
85
|
+
healthy: true,
|
|
86
|
+
errors: [],
|
|
87
|
+
warnings: [],
|
|
88
|
+
});
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const result = await this.checkSingleFile(file);
|
|
93
|
+
results.push(result);
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
// On error, mark as healthy to avoid blocking
|
|
97
|
+
results.push({
|
|
98
|
+
path: file.path,
|
|
99
|
+
relativePath: file.relativePath,
|
|
100
|
+
healthy: true,
|
|
101
|
+
errors: [],
|
|
102
|
+
warnings: [],
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return results;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check a single file for lint issues
|
|
110
|
+
*/
|
|
111
|
+
async checkSingleFile(file) {
|
|
112
|
+
if (!this.eslint) {
|
|
113
|
+
return {
|
|
114
|
+
path: file.path,
|
|
115
|
+
relativePath: file.relativePath,
|
|
116
|
+
healthy: true,
|
|
117
|
+
errors: [],
|
|
118
|
+
warnings: [],
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
// Use lintText to lint from memory (not disk)
|
|
122
|
+
const lintResults = await this.eslint.lintText(file.content, {
|
|
123
|
+
filePath: file.path,
|
|
124
|
+
});
|
|
125
|
+
if (lintResults.length === 0) {
|
|
126
|
+
return {
|
|
127
|
+
path: file.path,
|
|
128
|
+
relativePath: file.relativePath,
|
|
129
|
+
healthy: true,
|
|
130
|
+
errors: [],
|
|
131
|
+
warnings: [],
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
const lintResult = lintResults[0];
|
|
135
|
+
const errors = [];
|
|
136
|
+
const warnings = [];
|
|
137
|
+
for (const message of lintResult.messages) {
|
|
138
|
+
const lintMessage = {
|
|
139
|
+
type: message.severity === 2 ? "error" : "warning",
|
|
140
|
+
message: message.message,
|
|
141
|
+
lineNumber: message.line || 1,
|
|
142
|
+
columnNumber: message.column || 1,
|
|
143
|
+
length: message.endColumn && message.column ? message.endColumn - message.column : 1,
|
|
144
|
+
filePath: file.path,
|
|
145
|
+
relativePath: file.relativePath,
|
|
146
|
+
ruleId: message.ruleId || undefined,
|
|
147
|
+
};
|
|
148
|
+
if (message.severity === 2) {
|
|
149
|
+
errors.push(lintMessage);
|
|
150
|
+
}
|
|
151
|
+
else if (message.severity === 1) {
|
|
152
|
+
warnings.push(lintMessage);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return {
|
|
156
|
+
path: file.path,
|
|
157
|
+
relativePath: file.relativePath,
|
|
158
|
+
healthy: errors.length === 0 && warnings.length === 0,
|
|
159
|
+
errors,
|
|
160
|
+
warnings,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Check if file is a lintable file
|
|
165
|
+
*/
|
|
166
|
+
isLintableFile(filePath) {
|
|
167
|
+
const ext = filePath.toLowerCase();
|
|
168
|
+
return (ext.endsWith(".ts") || ext.endsWith(".tsx") || ext.endsWith(".js") || ext.endsWith(".jsx"));
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Create worker instance
|
|
172
|
+
const worker = new ESLintHealthWorker();
|
|
173
|
+
// Handle messages from main thread
|
|
174
|
+
parentPort?.on("message", async (message) => {
|
|
175
|
+
try {
|
|
176
|
+
switch (message.type) {
|
|
177
|
+
case "init": {
|
|
178
|
+
const initResult = worker.initialize(message.config);
|
|
179
|
+
const response = {
|
|
180
|
+
type: "initialized",
|
|
181
|
+
success: initResult.success,
|
|
182
|
+
hasConfig: initResult.hasConfig,
|
|
183
|
+
};
|
|
184
|
+
parentPort?.postMessage(response);
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
case "check": {
|
|
188
|
+
const results = await worker.checkFiles(message.files);
|
|
189
|
+
const response = { type: "results", results };
|
|
190
|
+
parentPort?.postMessage(response);
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
case "filesDeleted": {
|
|
194
|
+
// ESLint doesn't maintain internal file cache (lints from memory)
|
|
195
|
+
// No cleanup needed, just acknowledge
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
198
|
+
case "shutdown": {
|
|
199
|
+
process.exit(0);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
const response = {
|
|
205
|
+
type: "error",
|
|
206
|
+
message: error instanceof Error ? error.message : String(error),
|
|
207
|
+
};
|
|
208
|
+
parentPort?.postMessage(response);
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
// Handle initialization from workerData if provided
|
|
212
|
+
if (workerData?.autoInit) {
|
|
213
|
+
worker.initialize({ cwd: workerData.cwd || process.cwd() });
|
|
214
|
+
}//# sourceMappingURL=eslint-health.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eslint-health.worker.js","sources":["../../../../src/dev2-server/health-checker/workers/eslint-health.worker.ts"],"sourcesContent":[null],"names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KAAK,CAAC;SAChE,CAAC;AACF,QAAA,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;AACnC,KAAA;AACH,CAAC,CAAC,CAAC;AAEH;AACA,IAAI,UAAU,EAAE,QAAQ,EAAE;AACxB,IAAA,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7D"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import ts from'typescript';import {parentPort,workerData}from'worker_threads';/**
|
|
2
|
+
* TypeScript Health Check Worker
|
|
3
|
+
*
|
|
4
|
+
* This worker runs in a dedicated thread to perform TypeScript type checking
|
|
5
|
+
* without blocking the main dev server thread. It maintains a persistent
|
|
6
|
+
* ts.Program instance for fast incremental type checking.
|
|
7
|
+
*
|
|
8
|
+
* Communication:
|
|
9
|
+
* - Receives: { type: 'init' | 'check' | 'fileChanges' | 'shutdown', ... }
|
|
10
|
+
* - Sends: { type: 'results' | 'initialized' | 'error', ... }
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* TypeScript Health Worker class
|
|
14
|
+
* Maintains persistent ts.Program for incremental type checking
|
|
15
|
+
*/
|
|
16
|
+
class TypeScriptHealthWorker {
|
|
17
|
+
/**
|
|
18
|
+
* Cached TypeScript program instance
|
|
19
|
+
*/
|
|
20
|
+
program = null;
|
|
21
|
+
/**
|
|
22
|
+
* Parsed TypeScript configuration
|
|
23
|
+
*/
|
|
24
|
+
parsedConfig = null;
|
|
25
|
+
/**
|
|
26
|
+
* In-memory file contents cache
|
|
27
|
+
*/
|
|
28
|
+
fileContents = new Map();
|
|
29
|
+
/**
|
|
30
|
+
* Whether the worker is initialized
|
|
31
|
+
*/
|
|
32
|
+
initialized = false;
|
|
33
|
+
/**
|
|
34
|
+
* Current working directory
|
|
35
|
+
*/
|
|
36
|
+
cwd = process.cwd();
|
|
37
|
+
/**
|
|
38
|
+
* Initialize the worker with TypeScript configuration
|
|
39
|
+
*/
|
|
40
|
+
initialize(config) {
|
|
41
|
+
try {
|
|
42
|
+
this.cwd = config.cwd || process.cwd();
|
|
43
|
+
// Try to load tsconfig.json
|
|
44
|
+
const tsconfigPath = config.tsconfigPath || ts.findConfigFile(this.cwd, ts.sys.fileExists);
|
|
45
|
+
if (!tsconfigPath) {
|
|
46
|
+
this.initialized = true;
|
|
47
|
+
return true; // No tsconfig, will skip type checking
|
|
48
|
+
}
|
|
49
|
+
const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
|
|
50
|
+
if (configFile.error) {
|
|
51
|
+
console.warn("TypeScript Worker: Error reading tsconfig:", configFile.error);
|
|
52
|
+
this.initialized = true;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
this.parsedConfig = ts.parseJsonConfigFileContent(configFile.config, ts.sys, this.cwd);
|
|
56
|
+
if (this.parsedConfig.errors.length > 0) {
|
|
57
|
+
console.warn("TypeScript Worker: tsconfig has errors:", this.parsedConfig.errors);
|
|
58
|
+
}
|
|
59
|
+
this.initialized = true;
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
console.error("TypeScript Worker: Failed to initialize:", error);
|
|
64
|
+
this.initialized = true;
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Check files for TypeScript errors
|
|
70
|
+
*/
|
|
71
|
+
checkFiles(files) {
|
|
72
|
+
if (!this.parsedConfig) {
|
|
73
|
+
// No config, return all files as healthy
|
|
74
|
+
return files.map((file) => ({
|
|
75
|
+
path: file.path,
|
|
76
|
+
relativePath: file.relativePath,
|
|
77
|
+
healthy: true,
|
|
78
|
+
errors: [],
|
|
79
|
+
warnings: [],
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
// Update in-memory file cache
|
|
83
|
+
for (const file of files) {
|
|
84
|
+
this.fileContents.set(file.path, file.content);
|
|
85
|
+
}
|
|
86
|
+
// Create or update the program (incremental)
|
|
87
|
+
this.program = ts.createProgram(Array.from(this.fileContents.keys()), this.parsedConfig.options, this.createCompilerHost(), this.program || undefined);
|
|
88
|
+
// Check each file
|
|
89
|
+
const results = [];
|
|
90
|
+
for (const file of files) {
|
|
91
|
+
const result = this.checkSingleFile(file);
|
|
92
|
+
results.push(result);
|
|
93
|
+
}
|
|
94
|
+
return results;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Handle file changes (update program incrementally)
|
|
98
|
+
*/
|
|
99
|
+
handleFileChanges(files) {
|
|
100
|
+
for (const file of files) {
|
|
101
|
+
this.fileContents.set(file.path, file.content);
|
|
102
|
+
}
|
|
103
|
+
// Recreate program with new file contents
|
|
104
|
+
if (this.parsedConfig && this.program) {
|
|
105
|
+
this.program = ts.createProgram(Array.from(this.fileContents.keys()), this.parsedConfig.options, this.createCompilerHost(), this.program || undefined);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Handle deleted files (remove from cache)
|
|
110
|
+
*/
|
|
111
|
+
handleFilesDeleted(files) {
|
|
112
|
+
let hasChanges = false;
|
|
113
|
+
for (const file of files) {
|
|
114
|
+
if (this.fileContents.has(file.path)) {
|
|
115
|
+
this.fileContents.delete(file.path);
|
|
116
|
+
hasChanges = true;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Recreate program without deleted files
|
|
120
|
+
if (hasChanges && this.parsedConfig) {
|
|
121
|
+
this.program = ts.createProgram(Array.from(this.fileContents.keys()), this.parsedConfig.options, this.createCompilerHost(), this.program || undefined);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Check a single file for diagnostics
|
|
126
|
+
*/
|
|
127
|
+
checkSingleFile(file) {
|
|
128
|
+
if (!this.program) {
|
|
129
|
+
return {
|
|
130
|
+
path: file.path,
|
|
131
|
+
relativePath: file.relativePath,
|
|
132
|
+
healthy: true,
|
|
133
|
+
errors: [],
|
|
134
|
+
warnings: [],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const sourceFile = this.program.getSourceFile(file.path);
|
|
138
|
+
if (!sourceFile) {
|
|
139
|
+
return {
|
|
140
|
+
path: file.path,
|
|
141
|
+
relativePath: file.relativePath,
|
|
142
|
+
healthy: true,
|
|
143
|
+
errors: [],
|
|
144
|
+
warnings: [],
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
const syntacticDiagnostics = this.program.getSyntacticDiagnostics(sourceFile);
|
|
148
|
+
const semanticDiagnostics = this.program.getSemanticDiagnostics(sourceFile);
|
|
149
|
+
const allDiagnostics = [...syntacticDiagnostics, ...semanticDiagnostics];
|
|
150
|
+
const errors = [];
|
|
151
|
+
const warnings = [];
|
|
152
|
+
for (const diagnostic of allDiagnostics) {
|
|
153
|
+
const message = this.formatDiagnostic(diagnostic, file);
|
|
154
|
+
if (diagnostic.category === ts.DiagnosticCategory.Error) {
|
|
155
|
+
errors.push(message);
|
|
156
|
+
}
|
|
157
|
+
else if (diagnostic.category === ts.DiagnosticCategory.Warning) {
|
|
158
|
+
warnings.push(message);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return {
|
|
162
|
+
path: file.path,
|
|
163
|
+
relativePath: file.relativePath,
|
|
164
|
+
healthy: errors.length === 0 && warnings.length === 0,
|
|
165
|
+
errors,
|
|
166
|
+
warnings,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Format a TypeScript diagnostic into our message format
|
|
171
|
+
*/
|
|
172
|
+
formatDiagnostic(diagnostic, file) {
|
|
173
|
+
let lineNumber = 1;
|
|
174
|
+
let columnNumber = 1;
|
|
175
|
+
let length = 1;
|
|
176
|
+
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
177
|
+
const pos = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
178
|
+
lineNumber = pos.line + 1;
|
|
179
|
+
columnNumber = pos.character + 1;
|
|
180
|
+
length = diagnostic.length || 1;
|
|
181
|
+
}
|
|
182
|
+
const messageText = typeof diagnostic.messageText === "string"
|
|
183
|
+
? diagnostic.messageText
|
|
184
|
+
: diagnostic.messageText.messageText;
|
|
185
|
+
return {
|
|
186
|
+
type: diagnostic.category === ts.DiagnosticCategory.Error ? "error" : "warning",
|
|
187
|
+
message: messageText,
|
|
188
|
+
lineNumber,
|
|
189
|
+
columnNumber,
|
|
190
|
+
length,
|
|
191
|
+
filePath: file.path,
|
|
192
|
+
relativePath: file.relativePath,
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Create a custom compiler host that reads from in-memory cache
|
|
197
|
+
*/
|
|
198
|
+
createCompilerHost() {
|
|
199
|
+
const defaultHost = ts.createCompilerHost(this.parsedConfig?.options || {});
|
|
200
|
+
return {
|
|
201
|
+
...defaultHost,
|
|
202
|
+
readFile: (fileName) => {
|
|
203
|
+
// Check in-memory cache first
|
|
204
|
+
if (this.fileContents.has(fileName)) {
|
|
205
|
+
return this.fileContents.get(fileName);
|
|
206
|
+
}
|
|
207
|
+
// Fall back to disk
|
|
208
|
+
return defaultHost.readFile(fileName);
|
|
209
|
+
},
|
|
210
|
+
fileExists: (fileName) => {
|
|
211
|
+
if (this.fileContents.has(fileName)) {
|
|
212
|
+
return true;
|
|
213
|
+
}
|
|
214
|
+
return defaultHost.fileExists(fileName);
|
|
215
|
+
},
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
// Create worker instance
|
|
220
|
+
const worker = new TypeScriptHealthWorker();
|
|
221
|
+
// Handle messages from main thread
|
|
222
|
+
parentPort?.on("message", (message) => {
|
|
223
|
+
try {
|
|
224
|
+
switch (message.type) {
|
|
225
|
+
case "init": {
|
|
226
|
+
const success = worker.initialize(message.config);
|
|
227
|
+
const response = { type: "initialized", success };
|
|
228
|
+
parentPort?.postMessage(response);
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
case "check": {
|
|
232
|
+
const results = worker.checkFiles(message.files);
|
|
233
|
+
const response = { type: "results", results };
|
|
234
|
+
parentPort?.postMessage(response);
|
|
235
|
+
break;
|
|
236
|
+
}
|
|
237
|
+
case "fileChanges": {
|
|
238
|
+
worker.handleFileChanges(message.files);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
case "filesDeleted": {
|
|
242
|
+
worker.handleFilesDeleted(message.files);
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
case "shutdown": {
|
|
246
|
+
process.exit(0);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
const response = {
|
|
252
|
+
type: "error",
|
|
253
|
+
message: error instanceof Error ? error.message : String(error),
|
|
254
|
+
};
|
|
255
|
+
parentPort?.postMessage(response);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
// Handle initialization from workerData if provided
|
|
259
|
+
if (workerData?.autoInit) {
|
|
260
|
+
worker.initialize({ cwd: workerData.cwd || process.cwd() });
|
|
261
|
+
}//# sourceMappingURL=ts-health.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ts-health.worker.js","sources":["../../../../src/dev2-server/health-checker/workers/ts-health.worker.ts"],"sourcesContent":[null],"names":[],"mappings":"8EAAA;;;;;;;;;;AAUG;AAqEH;;;AAGG;AACH,MAAM,sBAAsB,CAAA;AAC1B;;AAEG;IACK,OAAO,GAAsB,IAAI,CAAC;AAE1C;;AAEG;IACK,YAAY,GAAgC,IAAI,CAAC;AAEzD;;AAEG;AACK,IAAA,YAAY,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEjD;;AAEG;IACK,WAAW,GAAG,KAAK,CAAC;AAE5B;;AAEG;AACK,IAAA,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE,CAAC;AAEpC;;AAEG;AACI,IAAA,UAAU,CAAC,MAA8C,EAAA;QAC9D,IAAI;YACF,IAA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,gBAAA,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACxC,MAAM;AACP,aAAA;YAED,KAAK,cAAc,EAAE;AACnB,gBAAA,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACzC,MAAM;AACP,aAAA;YAED,KAAK,UAAU,EAAE;AACf,gBAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,aAAA;AACF,SAAA;AACF,KAAA;AAAC,IAAA,OAAO,KAAK,EAAE;AACd,QAAA,MAAM,QAAQ,GAAmB;AAC/B,YAAA,IAAI,EAAE,OAAO;AACb,YAAA,OAAO,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;SAChE,CAAC;AACF,QAAA,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;AACnC,KAAA;AACH,CAAC,CAAC,CAAC;AAEH;AACA,IAAI,UAAU,EAAE,QAAQ,EAAE;AACxB,IAAA,MAAM,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAC7D"}
|
package/esm/index.d.ts
CHANGED
package/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import'./validation/init.js';export{colors}from'@mongez/copper';export{bootstrap}from'./bootstrap.js';export{disconnectCache,disconnectDatabase,displayEnvironmentMode,executeDatabaseThenDisconnect,setupCache,setupDatabase}from'./bootstrap/setup.js';import'./cache/index.js';export{CLICommand,command}from'./cli/cli-command.js';export{config}from'./config/config-getter.js';export{registerAppConfig,registerLogConfig,registerMailConfig}from'./config/config-handlers.js';export{ConfigSpecialHandlers,configSpecialHandlers}from'./config/config-special-handlers.js';export{Sluggable}from'./database/decorators/sluggable.js';export{DatabaseLogModel}from'./database/models/database-log/database-log.js';export{BaseConnector}from'./dev2-server/connectors/base-connector.js';export{CacheConnector}from'./dev2-server/connectors/cache-connector.js';export{ConnectorsManager,connectorsManager}from'./dev2-server/connectors/connectors-manager.js';export{DatabaseConnector}from'./dev2-server/connectors/database-connector.js';export{HttpConnector}from'./dev2-server/connectors/http-connector.js';export{ConnectorPriority}from'./dev2-server/connectors/types.js';export{defaultHttpConfigurations,httpConfig}from'./http/config.js';export{createHttpApplication,stopHttpApplication}from'./http/createHttpApplication.js';export{RequestLog}from'./http/database/RequestLog.js';export{logResponse,wrapResponseInDataKey}from'./http/events.js';export{RequestController}from'./http/request-controller.js';export{UploadedFile}from'./http/uploaded-file.js';export{UPLOADS_DEFAULTS,uploadsConfig}from'./http/uploads-config.js';export{BadRequestError,ForbiddenError,ResourceNotFoundError,UnAuthorizedError}from'./http/errors/resource-not-found.error.js';export{cacheMiddleware}from'./http/middleware/cache-response-middleware.js';export{createRequestStore,currentRequest,fromRequest,requestContext,t,useRequestStore}from'./http/middleware/inject-request-context.js';export{registerHttpPlugins}from'./http/plugins.js';export{Request}from'./http/request.js';export{Response,ResponseStatus}from'./http/response.js';export{getServer,startServer}from'./http/server.js';export{Image}from'./image/image.js';export{setLogConfigurations}from'./logger/logger.js';export{getDefaultMailConfig,getMailMode,getMailerConfig,isDevelopmentMode,isProductionMode,isTestMode,resetMailConfig,resolveMailConfig,setMailConfigurations,setMailMode}from'./mail/config.js';export{MAIL_EVENTS,generateMailId,getMailEventName,mailEvents}from'./mail/events.js';export{closeAllMailers,closeMailer,getMailer,getPoolStats,verifyMailer}from'./mail/mailer-pool.js';export{renderReactMail}from'./mail/react-mail.js';export{sendMail}from'./mail/send-mail.js';export{Mail}from'./mail/mail.js';export{assertMailCount,assertMailSent,captureMail,clearTestMailbox,findMailsBySubject,findMailsTo,getLastMail,getMailboxSize,getTestMailbox,wasMailSentTo,wasMailSentWithSubject}from'./mail/test-mailbox.js';export{MailError}from'./mail/types.js';export{Output,output}from'./output/output.js';export{renderReact}from'./react/index.js';export{BaseRepositoryManager}from'./repositories/base-repository-manager.js';export{RepositoryDestroyManager}from'./repositories/repository-destroyer-manager.js';export{RepositoryFillerManager}from'./repositories/repository-filler-manager.js';export{RepositoryListManager}from'./repositories/repository-list-manager.js';export{RepositoryManager}from'./repositories/repository-manager.js';export{defaultRepositoryOptions}from'./repositories/utils.js';export{Restful}from'./restful/restful.js';export{Router,router}from'./router/router.js';export{route}from'./router/utils.js';export{storageConfig}from'./storage/config.js';export{ScopedStorage}from'./storage/scoped-storage.js';export{Storage,storage}from'./storage/storage.js';export{StorageFile}from'./storage/storage-file.js';export{MimeTypes,getMimeType}from'./storage/utils/mime.js';export{CloudDriver}from'./storage/drivers/cloud-driver.js';export{DOSpacesDriver}from'./storage/drivers/do-spaces-driver.js';export{LocalDriver}from'./storage/drivers/local-driver.js';export{R2Driver}from'./storage/drivers/r2-driver.js';export{S3Driver}from'./storage/drivers/s3-driver.js';export{createStore,useStore}from'./store/index.js';export{bootHttpTestingServer,bootTesting,terminateTesting}from'./tests/boot-testing.js';export{httpServerTest,terminateHttpServerTest}from'./tests/create-http-test-application.js';export{HttpResponseOutputTest}from'./tests/http-response-output-test.js';export{appLog}from'./utils/app-log.js';export{DatabaseLog}from'./utils/database-log.js';export{dateOutput}from'./utils/date-output.js';export{environment,setEnvironment}from'./utils/environment.js';export{getLocalized}from'./utils/get-localized.js';export{appPath,cachePath,configPath,consolePath,publicPath,rootPath,sanitizePath,srcPath,storagePath,tempPath,uploadsPath,warlockPath}from'./utils/paths.js';export{promiseAllObject}from'./utils/promise-all-object.js';export{Queue}from'./utils/queue.js';export{sleep}from'./utils/sleep.js';export{sluggable}from'./utils/sluggable.js';export{toJson}from'./utils/to-json.js';export{assetsUrl,publicUrl,setBaseUrl,uploadsUrl,url}from'./utils/urls.js';export{FileValidator}from'./validation/validators/file-validator.js';export{existsRule}from'./validation/database/exists.js';export{existsExceptCurrentIdRule}from'./validation/database/exists-except-current-id.js';export{existsExceptCurrentUserRule}from'./validation/database/exists-except-current-user.js';export{uniqueRule}from'./validation/database/unique.js';export{uniqueExceptCurrentIdRule}from'./validation/database/unique-except-current-id.js';export{uniqueExceptCurrentUserRule}from'./validation/database/unique-except-current-user.js';export{fileExtensionRule,fileRule,fileTypeRule,imageRule}from'./validation/file/file.js';export{v}from'@warlock.js/seal';export{defineConfig}from'./warlock-config/define-config.js';export{WarlockConfigManager,warlockConfigManager}from'./warlock-config/warlock-config.manager.js';export{DatabaseCacheDriver}from'./cache/database-cache-driver.js';//# sourceMappingURL=index.js.map
|
|
1
|
+
import'./validation/init.js';export{colors}from'@mongez/copper';export{bootstrap}from'./bootstrap.js';export{disconnectCache,disconnectDatabase,displayEnvironmentMode,executeDatabaseThenDisconnect,setupCache,setupDatabase}from'./bootstrap/setup.js';import'./cache/index.js';export{CLICommand,command}from'./cli/cli-command.js';export{config}from'./config/config-getter.js';export{registerAppConfig,registerLogConfig,registerMailConfig}from'./config/config-handlers.js';export{ConfigSpecialHandlers,configSpecialHandlers}from'./config/config-special-handlers.js';export{Sluggable}from'./database/decorators/sluggable.js';export{DatabaseLogModel}from'./database/models/database-log/database-log.js';export{BaseConnector}from'./dev2-server/connectors/base-connector.js';export{CacheConnector}from'./dev2-server/connectors/cache-connector.js';export{ConnectorsManager,connectorsManager}from'./dev2-server/connectors/connectors-manager.js';export{DatabaseConnector}from'./dev2-server/connectors/database-connector.js';export{HttpConnector}from'./dev2-server/connectors/http-connector.js';export{ConnectorPriority}from'./dev2-server/connectors/types.js';export{BaseHealthChecker}from'./dev2-server/health-checker/checkers/base-health-checker.js';export{EslintHealthChecker}from'./dev2-server/health-checker/checkers/eslint-health-checker.js';export{TypescriptHealthChecker}from'./dev2-server/health-checker/checkers/typescript-health-checker.js';import'./dev2-server/health-checker/workers/eslint-health.worker.js';import'./dev2-server/health-checker/workers/ts-health.worker.js';export{defaultHttpConfigurations,httpConfig}from'./http/config.js';export{createHttpApplication,stopHttpApplication}from'./http/createHttpApplication.js';export{RequestLog}from'./http/database/RequestLog.js';export{logResponse,wrapResponseInDataKey}from'./http/events.js';export{RequestController}from'./http/request-controller.js';export{UploadedFile}from'./http/uploaded-file.js';export{UPLOADS_DEFAULTS,uploadsConfig}from'./http/uploads-config.js';export{BadRequestError,ForbiddenError,ResourceNotFoundError,UnAuthorizedError}from'./http/errors/resource-not-found.error.js';export{cacheMiddleware}from'./http/middleware/cache-response-middleware.js';export{createRequestStore,currentRequest,fromRequest,requestContext,t,useRequestStore}from'./http/middleware/inject-request-context.js';export{registerHttpPlugins}from'./http/plugins.js';export{Request}from'./http/request.js';export{Response,ResponseStatus}from'./http/response.js';export{getServer,startServer}from'./http/server.js';export{Image}from'./image/image.js';export{setLogConfigurations}from'./logger/logger.js';export{getDefaultMailConfig,getMailMode,getMailerConfig,isDevelopmentMode,isProductionMode,isTestMode,resetMailConfig,resolveMailConfig,setMailConfigurations,setMailMode}from'./mail/config.js';export{MAIL_EVENTS,generateMailId,getMailEventName,mailEvents}from'./mail/events.js';export{closeAllMailers,closeMailer,getMailer,getPoolStats,verifyMailer}from'./mail/mailer-pool.js';export{renderReactMail}from'./mail/react-mail.js';export{sendMail}from'./mail/send-mail.js';export{Mail}from'./mail/mail.js';export{assertMailCount,assertMailSent,captureMail,clearTestMailbox,findMailsBySubject,findMailsTo,getLastMail,getMailboxSize,getTestMailbox,wasMailSentTo,wasMailSentWithSubject}from'./mail/test-mailbox.js';export{MailError}from'./mail/types.js';export{Output,output}from'./output/output.js';export{renderReact}from'./react/index.js';export{BaseRepositoryManager}from'./repositories/base-repository-manager.js';export{RepositoryDestroyManager}from'./repositories/repository-destroyer-manager.js';export{RepositoryFillerManager}from'./repositories/repository-filler-manager.js';export{RepositoryListManager}from'./repositories/repository-list-manager.js';export{RepositoryManager}from'./repositories/repository-manager.js';export{defaultRepositoryOptions}from'./repositories/utils.js';export{Restful}from'./restful/restful.js';export{Router,router}from'./router/router.js';export{route}from'./router/utils.js';export{storageConfig}from'./storage/config.js';export{ScopedStorage}from'./storage/scoped-storage.js';export{Storage,storage}from'./storage/storage.js';export{StorageFile}from'./storage/storage-file.js';export{MimeTypes,getMimeType}from'./storage/utils/mime.js';export{CloudDriver}from'./storage/drivers/cloud-driver.js';export{DOSpacesDriver}from'./storage/drivers/do-spaces-driver.js';export{LocalDriver}from'./storage/drivers/local-driver.js';export{R2Driver}from'./storage/drivers/r2-driver.js';export{S3Driver}from'./storage/drivers/s3-driver.js';export{createStore,useStore}from'./store/index.js';export{bootHttpTestingServer,bootTesting,terminateTesting}from'./tests/boot-testing.js';export{httpServerTest,terminateHttpServerTest}from'./tests/create-http-test-application.js';export{HttpResponseOutputTest}from'./tests/http-response-output-test.js';export{appLog}from'./utils/app-log.js';export{DatabaseLog}from'./utils/database-log.js';export{dateOutput}from'./utils/date-output.js';export{environment,setEnvironment}from'./utils/environment.js';export{getLocalized}from'./utils/get-localized.js';export{appPath,cachePath,configPath,consolePath,publicPath,rootPath,sanitizePath,srcPath,storagePath,tempPath,uploadsPath,warlockPath}from'./utils/paths.js';export{promiseAllObject}from'./utils/promise-all-object.js';export{Queue}from'./utils/queue.js';export{sleep}from'./utils/sleep.js';export{sluggable}from'./utils/sluggable.js';export{toJson}from'./utils/to-json.js';export{assetsUrl,publicUrl,setBaseUrl,uploadsUrl,url}from'./utils/urls.js';export{FileValidator}from'./validation/validators/file-validator.js';export{existsRule}from'./validation/database/exists.js';export{existsExceptCurrentIdRule}from'./validation/database/exists-except-current-id.js';export{existsExceptCurrentUserRule}from'./validation/database/exists-except-current-user.js';export{uniqueRule}from'./validation/database/unique.js';export{uniqueExceptCurrentIdRule}from'./validation/database/unique-except-current-id.js';export{uniqueExceptCurrentUserRule}from'./validation/database/unique-except-current-user.js';export{fileExtensionRule,fileRule,fileTypeRule,imageRule}from'./validation/file/file.js';export{v}from'@warlock.js/seal';export{defineConfig}from'./warlock-config/define-config.js';export{WarlockConfigManager,warlockConfigManager}from'./warlock-config/warlock-config.manager.js';export{DatabaseCacheDriver}from'./cache/database-cache-driver.js';//# sourceMappingURL=index.js.map
|