vite-plugin-agent-tail 0.3.1 → 0.3.3
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/index.mjs +7 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
|
-
import { DEFAULT_OPTIONS, LogManager, format_log_line, generate_client_script, resolve_options, should_exclude } from "agent-tail-core";
|
|
2
|
+
import { DEFAULT_OPTIONS, LogManager, SESSION_ENV_VAR, format_log_line, generate_client_script, resolve_options, should_exclude } from "agent-tail-core";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.ts
|
|
5
5
|
function agentTail(user_options) {
|
|
@@ -10,8 +10,12 @@ function agentTail(user_options) {
|
|
|
10
10
|
name: "vite-plugin-agent-tail",
|
|
11
11
|
apply: "serve",
|
|
12
12
|
configureServer(server) {
|
|
13
|
-
const
|
|
14
|
-
log_path = log_manager.
|
|
13
|
+
const parent_session = process.env[SESSION_ENV_VAR];
|
|
14
|
+
if (parent_session && fs.existsSync(parent_session)) log_path = log_manager.join_session(parent_session);
|
|
15
|
+
else {
|
|
16
|
+
const project_root = server.config.root;
|
|
17
|
+
log_path = log_manager.initialize(project_root);
|
|
18
|
+
}
|
|
15
19
|
server.middlewares.use(options.endpoint, (req, res) => {
|
|
16
20
|
if (req.method !== "POST") {
|
|
17
21
|
res.writeHead(405);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-agent-tail",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.3",
|
|
5
5
|
"description": "Vite plugin for agent-tail — pipes browser console logs to files on disk during development.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"README.md"
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"agent-tail-core": "^0.3.
|
|
33
|
+
"agent-tail-core": "^0.3.3"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"vite": ">=5.0.0"
|