@vite-plugin-opencode-assistant/shared 1.0.66 → 1.0.68
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/es/file-log-watcher.mjs
CHANGED
|
@@ -82,7 +82,7 @@ function readLogFileTail(options) {
|
|
|
82
82
|
const chunkSize = 16 * 1024;
|
|
83
83
|
let position = stat.size;
|
|
84
84
|
let buffer = Buffer.alloc(0);
|
|
85
|
-
|
|
85
|
+
let lineCount = 0;
|
|
86
86
|
while (position > 0 && lineCount <= lines) {
|
|
87
87
|
const readSize = Math.min(chunkSize, position);
|
|
88
88
|
position -= readSize;
|
|
@@ -90,6 +90,7 @@ function readLogFileTail(options) {
|
|
|
90
90
|
fs.readSync(fd, chunk, 0, readSize, position);
|
|
91
91
|
buffer = Buffer.concat([chunk, buffer]);
|
|
92
92
|
const newLineCount = buffer.filter((byte) => byte === 10).length;
|
|
93
|
+
lineCount = newLineCount;
|
|
93
94
|
if (newLineCount >= lines) {
|
|
94
95
|
const linesArray = buffer.toString("utf-8").split("\n");
|
|
95
96
|
const excessLines = newLineCount - lines;
|
package/lib/file-log-watcher.cjs
CHANGED
|
@@ -115,7 +115,7 @@ function readLogFileTail(options) {
|
|
|
115
115
|
const chunkSize = 16 * 1024;
|
|
116
116
|
let position = stat.size;
|
|
117
117
|
let buffer = Buffer.alloc(0);
|
|
118
|
-
|
|
118
|
+
let lineCount = 0;
|
|
119
119
|
while (position > 0 && lineCount <= lines) {
|
|
120
120
|
const readSize = Math.min(chunkSize, position);
|
|
121
121
|
position -= readSize;
|
|
@@ -123,6 +123,7 @@ function readLogFileTail(options) {
|
|
|
123
123
|
import_fs.default.readSync(fd, chunk, 0, readSize, position);
|
|
124
124
|
buffer = Buffer.concat([chunk, buffer]);
|
|
125
125
|
const newLineCount = buffer.filter((byte) => byte === 10).length;
|
|
126
|
+
lineCount = newLineCount;
|
|
126
127
|
if (newLineCount >= lines) {
|
|
127
128
|
const linesArray = buffer.toString("utf-8").split("\n");
|
|
128
129
|
const excessLines = newLineCount - lines;
|