@rslint/core 0.5.2 → 0.5.4-canary.1781059600
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/bin/rslint.cjs +21 -4
- package/dist/0~engine.js +406 -0
- package/dist/34.js +33 -0
- package/dist/browser.d.ts +52 -39
- package/dist/browser.js +42 -74
- package/dist/cli.d.ts +3 -2
- package/dist/cli.js +1051 -93
- package/dist/config-loader.d.ts +45 -14
- package/dist/config-loader.js +95 -59
- package/dist/eslint-plugin/612.js +43 -0
- package/dist/eslint-plugin/index.d.ts +892 -0
- package/dist/eslint-plugin/index.js +26692 -0
- package/dist/eslint-plugin/lint-worker.js +26225 -0
- package/dist/eslint-plugin/types.d.ts +23 -0
- package/dist/eslint-plugin/types.js +1 -0
- package/dist/index.d.ts +626 -19
- package/dist/index.js +598 -15
- package/dist/service.d.ts +360 -30
- package/dist/service.js +19 -34
- package/package.json +27 -11
- package/dist/browser.d.ts.map +0 -1
- package/dist/cli.d.ts.map +0 -1
- package/dist/config-loader.d.ts.map +0 -1
- package/dist/configs/import.d.ts +0 -6
- package/dist/configs/import.d.ts.map +0 -1
- package/dist/configs/import.js +0 -7
- package/dist/configs/index.d.ts +0 -16
- package/dist/configs/index.d.ts.map +0 -1
- package/dist/configs/index.js +0 -32
- package/dist/configs/javascript.d.ts +0 -6
- package/dist/configs/javascript.d.ts.map +0 -1
- package/dist/configs/javascript.js +0 -72
- package/dist/configs/jest.d.ts +0 -7
- package/dist/configs/jest.d.ts.map +0 -1
- package/dist/configs/jest.js +0 -35
- package/dist/configs/promise.d.ts +0 -6
- package/dist/configs/promise.d.ts.map +0 -1
- package/dist/configs/promise.js +0 -20
- package/dist/configs/react-hooks.d.ts +0 -6
- package/dist/configs/react-hooks.d.ts.map +0 -1
- package/dist/configs/react-hooks.js +0 -24
- package/dist/configs/react.d.ts +0 -6
- package/dist/configs/react.d.ts.map +0 -1
- package/dist/configs/react.js +0 -31
- package/dist/configs/typescript.d.ts +0 -8
- package/dist/configs/typescript.d.ts.map +0 -1
- package/dist/configs/typescript.js +0 -119
- package/dist/configs/unicorn.d.ts +0 -8
- package/dist/configs/unicorn.d.ts.map +0 -1
- package/dist/configs/unicorn.js +0 -161
- package/dist/define-config.d.ts +0 -109
- package/dist/define-config.d.ts.map +0 -1
- package/dist/define-config.js +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/node.d.ts +0 -31
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js +0 -116
- package/dist/service.d.ts.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -342
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/utils/args.d.ts +0 -19
- package/dist/utils/args.d.ts.map +0 -1
- package/dist/utils/args.js +0 -101
- package/dist/utils/config-discovery.d.ts +0 -47
- package/dist/utils/config-discovery.d.ts.map +0 -1
- package/dist/utils/config-discovery.js +0 -238
- package/dist/worker.d.ts +0 -2
- package/dist/worker.d.ts.map +0 -1
- package/dist/worker.js +0 -114
package/dist/browser.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Browser implementation of RslintService using web workers
|
|
3
|
-
*/
|
|
4
|
-
export class BrowserRslintService {
|
|
1
|
+
class BrowserRslintService {
|
|
5
2
|
nextMessageId;
|
|
6
3
|
pendingMessages;
|
|
7
4
|
worker;
|
|
@@ -9,139 +6,110 @@ export class BrowserRslintService {
|
|
|
9
6
|
chunks;
|
|
10
7
|
chunkSize;
|
|
11
8
|
expectedSize;
|
|
12
|
-
constructor(options)
|
|
9
|
+
constructor(options){
|
|
13
10
|
this.nextMessageId = 1;
|
|
14
11
|
this.pendingMessages = new Map();
|
|
15
12
|
this.chunks = [];
|
|
16
13
|
this.chunkSize = 0;
|
|
17
14
|
this.expectedSize = null;
|
|
18
|
-
// In browser, we need to use a web worker that can run the rslint binary
|
|
19
|
-
// This would typically be a WASM version or a worker that can spawn processes
|
|
20
15
|
this.workerUrl = options.workerUrl;
|
|
21
16
|
this.ensureWorker(options.wasmUrl);
|
|
22
17
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Initialize the web worker
|
|
25
|
-
*/
|
|
26
18
|
async ensureWorker(wasmUrl) {
|
|
27
19
|
if (!this.worker) {
|
|
28
|
-
this.worker = new Worker(this.workerUrl, {
|
|
29
|
-
|
|
20
|
+
this.worker = new Worker(this.workerUrl, {
|
|
21
|
+
name: 'rslint-worker.js'
|
|
22
|
+
});
|
|
23
|
+
this.worker.onmessage = (event)=>{
|
|
30
24
|
this.handlePacket(event.data);
|
|
31
25
|
};
|
|
32
|
-
this.worker.onerror = (error)
|
|
26
|
+
this.worker.onerror = (error)=>{
|
|
33
27
|
console.error('Worker error:', error);
|
|
34
|
-
|
|
35
|
-
for (const [, pending] of this.pendingMessages) {
|
|
36
|
-
pending.reject(new Error(`Worker error: ${error.message}`));
|
|
37
|
-
}
|
|
28
|
+
for (const [, pending] of this.pendingMessages)pending.reject(new Error(`Worker error: ${error.message}`));
|
|
38
29
|
this.pendingMessages.clear();
|
|
39
30
|
};
|
|
40
31
|
this.worker.postMessage({
|
|
41
32
|
kind: 'init',
|
|
42
|
-
data: {
|
|
33
|
+
data: {
|
|
34
|
+
version: '1.0.0',
|
|
35
|
+
wasmURL: wasmUrl
|
|
36
|
+
}
|
|
43
37
|
});
|
|
44
38
|
}
|
|
45
39
|
return this.worker;
|
|
46
40
|
}
|
|
47
|
-
/**
|
|
48
|
-
* Handle incoming binary data chunks
|
|
49
|
-
*/
|
|
50
41
|
handlePacket(chunk) {
|
|
51
42
|
this.chunks.push(chunk);
|
|
52
43
|
this.chunkSize += chunk.length;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if (this.expectedSize === null) {
|
|
57
|
-
if (this.chunkSize < 4)
|
|
58
|
-
return;
|
|
59
|
-
// Combine chunks to read the message length
|
|
44
|
+
while(true){
|
|
45
|
+
if (null === this.expectedSize) {
|
|
46
|
+
if (this.chunkSize < 4) return;
|
|
60
47
|
const combined = this.combineChunks();
|
|
61
48
|
const dataView = new DataView(combined.buffer, combined.byteOffset, combined.byteLength);
|
|
62
|
-
this.expectedSize = dataView.getUint32(0, true);
|
|
63
|
-
|
|
64
|
-
|
|
49
|
+
this.expectedSize = dataView.getUint32(0, true);
|
|
50
|
+
this.chunks = [
|
|
51
|
+
combined.slice(4)
|
|
52
|
+
];
|
|
65
53
|
this.chunkSize -= 4;
|
|
66
54
|
}
|
|
67
|
-
|
|
68
|
-
if (this.chunkSize < this.expectedSize)
|
|
69
|
-
return;
|
|
70
|
-
// Read the message content
|
|
55
|
+
if (this.chunkSize < this.expectedSize) return;
|
|
71
56
|
const combined = this.combineChunks();
|
|
72
57
|
const messageBytes = combined.slice(0, this.expectedSize);
|
|
73
58
|
const message = new TextDecoder().decode(messageBytes);
|
|
74
|
-
// Handle the message
|
|
75
59
|
try {
|
|
76
60
|
const parsed = JSON.parse(message);
|
|
77
61
|
this.handleResponse(parsed);
|
|
78
|
-
}
|
|
79
|
-
catch (err) {
|
|
62
|
+
} catch (err) {
|
|
80
63
|
console.error('Error parsing message:', err);
|
|
81
64
|
}
|
|
82
|
-
|
|
83
|
-
|
|
65
|
+
this.chunks = [
|
|
66
|
+
combined.slice(this.expectedSize)
|
|
67
|
+
];
|
|
84
68
|
this.chunkSize = this.chunks[0].length;
|
|
85
69
|
this.expectedSize = null;
|
|
86
70
|
}
|
|
87
71
|
}
|
|
88
|
-
/**
|
|
89
|
-
* Combine multiple Uint8Array chunks into a single Uint8Array
|
|
90
|
-
*/
|
|
91
72
|
combineChunks() {
|
|
92
|
-
if (this.chunks.length
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
const totalLength = this.chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
73
|
+
if (1 === this.chunks.length) return this.chunks[0];
|
|
74
|
+
const totalLength = this.chunks.reduce((sum, chunk)=>sum + chunk.length, 0);
|
|
96
75
|
const combined = new Uint8Array(totalLength);
|
|
97
76
|
let offset = 0;
|
|
98
|
-
for (const chunk of this.chunks)
|
|
77
|
+
for (const chunk of this.chunks){
|
|
99
78
|
combined.set(chunk, offset);
|
|
100
79
|
offset += chunk.length;
|
|
101
80
|
}
|
|
102
81
|
return combined;
|
|
103
82
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Send a message to the worker
|
|
106
|
-
*/
|
|
107
83
|
async sendMessage(kind, data) {
|
|
108
|
-
return new Promise((resolve, reject)
|
|
84
|
+
return new Promise((resolve, reject)=>{
|
|
109
85
|
const id = this.nextMessageId++;
|
|
110
|
-
const message = {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
86
|
+
const message = {
|
|
87
|
+
id,
|
|
88
|
+
kind,
|
|
89
|
+
data
|
|
90
|
+
};
|
|
91
|
+
this.pendingMessages.set(id, {
|
|
92
|
+
resolve,
|
|
93
|
+
reject
|
|
94
|
+
});
|
|
114
95
|
this.worker.postMessage(message);
|
|
115
96
|
});
|
|
116
97
|
}
|
|
117
|
-
/**
|
|
118
|
-
* Handle messages from the worker
|
|
119
|
-
*/
|
|
120
98
|
handleResponse(message) {
|
|
121
99
|
const { id, kind, data } = message;
|
|
122
100
|
const pending = this.pendingMessages.get(id);
|
|
123
|
-
if (!pending)
|
|
124
|
-
return;
|
|
101
|
+
if (!pending) return;
|
|
125
102
|
this.pendingMessages.delete(id);
|
|
126
|
-
if (
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
else {
|
|
130
|
-
pending.resolve(data);
|
|
131
|
-
}
|
|
103
|
+
if ('error' === kind) pending.reject(new Error(data.message));
|
|
104
|
+
else pending.resolve(data);
|
|
132
105
|
}
|
|
133
|
-
/**
|
|
134
|
-
* Terminate the worker
|
|
135
|
-
*/
|
|
136
106
|
terminate() {
|
|
137
107
|
if (this.worker) {
|
|
138
|
-
|
|
139
|
-
for (const [, pending] of this.pendingMessages) {
|
|
140
|
-
pending.reject(new Error('Service terminated'));
|
|
141
|
-
}
|
|
108
|
+
for (const [, pending] of this.pendingMessages)pending.reject(new Error('Service terminated'));
|
|
142
109
|
this.pendingMessages.clear();
|
|
143
110
|
this.worker.terminate();
|
|
144
111
|
this.worker = null;
|
|
145
112
|
}
|
|
146
113
|
}
|
|
147
114
|
}
|
|
115
|
+
export { BrowserRslintService };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export declare function run(binPath: string, argv: string[], startTime: number): Promise<number>;
|
|
2
|
-
|
|
1
|
+
export declare function run(binPath: string, argv: string[], startTime: number): Promise<number>;
|
|
2
|
+
|
|
3
|
+
export { }
|