@rslint/core 0.3.0 → 0.3.2-canary.1774331097
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/browser.d.ts +39 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +147 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +120 -0
- package/dist/config-loader.d.ts +14 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +94 -0
- package/dist/configs/import.d.ts +6 -0
- package/dist/configs/import.d.ts.map +1 -0
- package/dist/configs/import.js +7 -0
- package/dist/configs/index.d.ts +12 -0
- package/dist/configs/index.d.ts.map +1 -0
- package/dist/configs/index.js +16 -0
- package/dist/configs/javascript.d.ts +6 -0
- package/dist/configs/javascript.d.ts.map +1 -0
- package/dist/configs/javascript.js +73 -0
- package/dist/configs/react.d.ts +6 -0
- package/dist/configs/react.d.ts.map +1 -0
- package/dist/configs/react.js +31 -0
- package/dist/configs/typescript.d.ts +8 -0
- package/dist/configs/typescript.d.ts.map +1 -0
- package/dist/configs/typescript.js +113 -0
- package/dist/define-config.d.ts +21 -0
- package/dist/define-config.d.ts.map +1 -0
- package/dist/define-config.js +6 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/node.d.ts +31 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +116 -0
- package/dist/service.d.ts +30 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +71 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/types.d.ts +342 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/args.d.ts +18 -0
- package/dist/utils/args.d.ts.map +1 -0
- package/dist/utils/args.js +76 -0
- package/dist/utils/config-discovery.d.ts +27 -0
- package/dist/utils/config-discovery.d.ts.map +1 -0
- package/dist/utils/config-discovery.js +131 -0
- package/dist/worker.d.ts +2 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +112 -0
- package/package.json +8 -8
package/dist/worker.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/// <reference lib="webworker" />
|
|
2
|
+
// Global state for the worker
|
|
3
|
+
let rslintProcess = null;
|
|
4
|
+
let nextMessageId = 1;
|
|
5
|
+
let pendingMessages = new Map();
|
|
6
|
+
/**
|
|
7
|
+
* Initialize the rslint process (could be WASM or other browser-compatible implementation)
|
|
8
|
+
*/
|
|
9
|
+
async function initializeRslint() {
|
|
10
|
+
try {
|
|
11
|
+
// In a real implementation, this would load the rslint WASM module
|
|
12
|
+
// or initialize a browser-compatible version of rslint
|
|
13
|
+
// For now, we'll simulate the initialization
|
|
14
|
+
// Example: Load WASM module
|
|
15
|
+
// const rslintWasm = await import('./rslint.wasm');
|
|
16
|
+
// rslintProcess = await rslintWasm.default();
|
|
17
|
+
console.log('Rslint worker initialized');
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
console.error('Failed to initialize rslint:', error);
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Send a message to the rslint process
|
|
26
|
+
*/
|
|
27
|
+
async function sendToRslint(kind, data) {
|
|
28
|
+
if (!rslintProcess) {
|
|
29
|
+
throw new Error('Rslint process not initialized');
|
|
30
|
+
}
|
|
31
|
+
// In a real implementation, this would call the appropriate method on the rslint process
|
|
32
|
+
// For now, we'll simulate the response
|
|
33
|
+
switch (kind) {
|
|
34
|
+
case 'handshake':
|
|
35
|
+
return { version: '1.0.0', status: 'ok' };
|
|
36
|
+
case 'lint':
|
|
37
|
+
// Simulate linting response
|
|
38
|
+
return {
|
|
39
|
+
diagnostics: [],
|
|
40
|
+
errorCount: 0,
|
|
41
|
+
fileCount: data.files?.length || 0,
|
|
42
|
+
ruleCount: 0,
|
|
43
|
+
duration: '0ms',
|
|
44
|
+
};
|
|
45
|
+
case 'applyFixes':
|
|
46
|
+
// Simulate apply fixes response
|
|
47
|
+
return {
|
|
48
|
+
fixedContent: [data.fileContent],
|
|
49
|
+
wasFixed: false,
|
|
50
|
+
appliedCount: 0,
|
|
51
|
+
unappliedCount: data.diagnostics?.length || 0,
|
|
52
|
+
};
|
|
53
|
+
case 'exit':
|
|
54
|
+
rslintProcess = null;
|
|
55
|
+
return { status: 'ok' };
|
|
56
|
+
default:
|
|
57
|
+
throw new Error(`Unknown message kind: ${kind}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Handle messages from the main thread
|
|
62
|
+
*/
|
|
63
|
+
async function handleMessage(event) {
|
|
64
|
+
const { id, kind, data } = event.data;
|
|
65
|
+
try {
|
|
66
|
+
// Ensure rslint is initialized
|
|
67
|
+
if (!rslintProcess && kind !== 'exit') {
|
|
68
|
+
await initializeRslint();
|
|
69
|
+
}
|
|
70
|
+
// Send message to rslint and get response
|
|
71
|
+
const response = await sendToRslint(kind, data);
|
|
72
|
+
// Send response back to main thread
|
|
73
|
+
self.postMessage({
|
|
74
|
+
id,
|
|
75
|
+
kind: 'response',
|
|
76
|
+
data: response,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
// Send error back to main thread
|
|
81
|
+
self.postMessage({
|
|
82
|
+
id,
|
|
83
|
+
kind: 'error',
|
|
84
|
+
data: {
|
|
85
|
+
message: error instanceof Error ? error.message : String(error),
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Handle worker errors
|
|
92
|
+
*/
|
|
93
|
+
function handleError(error) {
|
|
94
|
+
console.error('Worker error:', error);
|
|
95
|
+
// Send error to main thread for all pending messages
|
|
96
|
+
for (const [id, pending] of pendingMessages) {
|
|
97
|
+
self.postMessage({
|
|
98
|
+
id,
|
|
99
|
+
kind: 'error',
|
|
100
|
+
data: {
|
|
101
|
+
message: `Worker error: ${error.message}`,
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
pendingMessages.clear();
|
|
106
|
+
}
|
|
107
|
+
// Set up event listeners
|
|
108
|
+
self.addEventListener('message', handleMessage);
|
|
109
|
+
self.addEventListener('error', handleError);
|
|
110
|
+
// Initialize the worker
|
|
111
|
+
console.log('Rslint worker started');
|
|
112
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rslint/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2-canary.1774331097",
|
|
4
4
|
"exports": {
|
|
5
5
|
".": {
|
|
6
6
|
"@typescript/source": "./src/index.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@types/node": "24.0.14",
|
|
52
52
|
"typescript": "5.9.3",
|
|
53
53
|
"@typescript/native-preview": "7.0.0-dev.20250904.1",
|
|
54
|
-
"@rslint/api": "0.3.
|
|
54
|
+
"@rslint/api": "0.3.2-canary.1774331097"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"jiti": "^2.0.0"
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@rslint/darwin-
|
|
66
|
-
"@rslint/
|
|
67
|
-
"@rslint/linux-
|
|
68
|
-
"@rslint/win32-
|
|
69
|
-
"@rslint/
|
|
70
|
-
"@rslint/
|
|
65
|
+
"@rslint/darwin-x64": "0.3.2-canary.1774331097",
|
|
66
|
+
"@rslint/win32-arm64": "0.3.2-canary.1774331097",
|
|
67
|
+
"@rslint/linux-arm64": "0.3.2-canary.1774331097",
|
|
68
|
+
"@rslint/win32-x64": "0.3.2-canary.1774331097",
|
|
69
|
+
"@rslint/darwin-arm64": "0.3.2-canary.1774331097",
|
|
70
|
+
"@rslint/linux-x64": "0.3.2-canary.1774331097"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build:bin": "go build -v -o bin/ ../../cmd/rslint",
|