@vite-plugin-opencode-assistant/shared 1.0.62 → 1.0.64

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.
@@ -34,8 +34,13 @@ function detectLogLevel(line) {
34
34
  }
35
35
  function parseLogTimestamp(line) {
36
36
  const timestampPatterns = [
37
+ /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{2}:\d{2})/,
37
38
  /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z?)/,
39
+ /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)/,
38
40
  /(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/,
41
+ /(\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} [+-]\d{4})/,
42
+ /(\d{2}\/\d{2}\/\d{4},\s*\d{1,2}:\d{2}:\d{2}\s*(?:AM|PM))/i,
43
+ /([A-Z]{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT)/,
39
44
  /(\[([^\]]+)\])/
40
45
  ];
41
46
  for (const pattern of timestampPatterns) {
@@ -63,11 +68,16 @@ function readLogFile(options) {
63
68
  const lines = content.split("\n").filter((line) => line.trim());
64
69
  const entries = [];
65
70
  const sinceDate = since ? new Date(since) : null;
71
+ let lastTimestamp = null;
66
72
  for (const line of lines) {
73
+ const parsedTimestamp = parseLogTimestamp(line);
74
+ if (parsedTimestamp) {
75
+ lastTimestamp = parsedTimestamp;
76
+ }
67
77
  const entry = {
68
78
  level: detectLogLevel(line),
69
79
  message: line,
70
- timestamp: parseLogTimestamp(line) || (/* @__PURE__ */ new Date()).toISOString(),
80
+ timestamp: parsedTimestamp || lastTimestamp || (/* @__PURE__ */ new Date()).toISOString(),
71
81
  source: `file:${name}`
72
82
  };
73
83
  if (sinceDate && new Date(entry.timestamp) < sinceDate) {
@@ -67,8 +67,13 @@ function detectLogLevel(line) {
67
67
  }
68
68
  function parseLogTimestamp(line) {
69
69
  const timestampPatterns = [
70
+ /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}[+-]\d{2}:\d{2})/,
70
71
  /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z?)/,
72
+ /(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z)/,
71
73
  /(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/,
74
+ /(\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} [+-]\d{4})/,
75
+ /(\d{2}\/\d{2}\/\d{4},\s*\d{1,2}:\d{2}:\d{2}\s*(?:AM|PM))/i,
76
+ /([A-Z]{3}, \d{2} \w{3} \d{4} \d{2}:\d{2}:\d{2} GMT)/,
72
77
  /(\[([^\]]+)\])/
73
78
  ];
74
79
  for (const pattern of timestampPatterns) {
@@ -96,11 +101,16 @@ function readLogFile(options) {
96
101
  const lines = content.split("\n").filter((line) => line.trim());
97
102
  const entries = [];
98
103
  const sinceDate = since ? new Date(since) : null;
104
+ let lastTimestamp = null;
99
105
  for (const line of lines) {
106
+ const parsedTimestamp = parseLogTimestamp(line);
107
+ if (parsedTimestamp) {
108
+ lastTimestamp = parsedTimestamp;
109
+ }
100
110
  const entry = {
101
111
  level: detectLogLevel(line),
102
112
  message: line,
103
- timestamp: parseLogTimestamp(line) || (/* @__PURE__ */ new Date()).toISOString(),
113
+ timestamp: parsedTimestamp || lastTimestamp || (/* @__PURE__ */ new Date()).toISOString(),
104
114
  source: `file:${name}`
105
115
  };
106
116
  if (sinceDate && new Date(entry.timestamp) < sinceDate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-plugin-opencode-assistant/shared",
3
- "version": "1.0.62",
3
+ "version": "1.0.64",
4
4
  "type": "module",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "es/index.mjs",