next-plugin-agent-tail 0.3.7 → 0.3.9
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/README.md +1 -1
- package/dist/handler.d.mts +2 -2
- package/dist/handler.mjs +6 -6
- package/dist/index.mjs +3 -3
- package/dist/script.mjs +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
package/dist/handler.d.mts
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Next.js App Router API route handler.
|
|
4
4
|
*
|
|
5
|
-
* Usage in app/api/
|
|
5
|
+
* Usage in app/api/browser-logs/route.ts:
|
|
6
6
|
* export { POST } from "next-plugin-browser-logs/handler"
|
|
7
7
|
*/
|
|
8
8
|
declare function POST(request: Request): Promise<Response>;
|
|
9
9
|
/**
|
|
10
10
|
* Pages Router API route handler.
|
|
11
11
|
*
|
|
12
|
-
* Usage in pages/api/
|
|
12
|
+
* Usage in pages/api/browser-logs.ts:
|
|
13
13
|
* export default pages_handler
|
|
14
14
|
*/
|
|
15
15
|
declare function pages_handler(req: {
|
package/dist/handler.mjs
CHANGED
|
@@ -5,14 +5,14 @@ import { format_log_line, should_exclude } from "agent-tail-core";
|
|
|
5
5
|
/**
|
|
6
6
|
* Next.js App Router API route handler.
|
|
7
7
|
*
|
|
8
|
-
* Usage in app/api/
|
|
8
|
+
* Usage in app/api/browser-logs/route.ts:
|
|
9
9
|
* export { POST } from "next-plugin-browser-logs/handler"
|
|
10
10
|
*/
|
|
11
11
|
async function POST(request) {
|
|
12
|
-
const log_path = process.env.
|
|
12
|
+
const log_path = process.env.AGENT_TAIL_LOG_PATH;
|
|
13
13
|
if (!log_path) return new Response("Browser logs not configured", { status: 500 });
|
|
14
14
|
try {
|
|
15
|
-
const excludes = JSON.parse(process.env.
|
|
15
|
+
const excludes = JSON.parse(process.env.AGENT_TAIL_EXCLUDES || "[]");
|
|
16
16
|
let entries = await request.json();
|
|
17
17
|
if (excludes.length) entries = entries.filter((e) => !should_exclude(e.args.join(" "), excludes));
|
|
18
18
|
const lines = entries.map(format_log_line).join("");
|
|
@@ -25,7 +25,7 @@ async function POST(request) {
|
|
|
25
25
|
/**
|
|
26
26
|
* Pages Router API route handler.
|
|
27
27
|
*
|
|
28
|
-
* Usage in pages/api/
|
|
28
|
+
* Usage in pages/api/browser-logs.ts:
|
|
29
29
|
* export default pages_handler
|
|
30
30
|
*/
|
|
31
31
|
function pages_handler(req, res) {
|
|
@@ -33,13 +33,13 @@ function pages_handler(req, res) {
|
|
|
33
33
|
res.status(405).end();
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
|
-
const log_path = process.env.
|
|
36
|
+
const log_path = process.env.AGENT_TAIL_LOG_PATH;
|
|
37
37
|
if (!log_path) {
|
|
38
38
|
res.status(500).end();
|
|
39
39
|
return;
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
|
-
const excludes = JSON.parse(process.env.
|
|
42
|
+
const excludes = JSON.parse(process.env.AGENT_TAIL_EXCLUDES || "[]");
|
|
43
43
|
let entries = typeof req.body === "string" ? JSON.parse(req.body) : req.body;
|
|
44
44
|
if (excludes.length) entries = entries.filter((e) => !should_exclude(e.args.join(" "), excludes));
|
|
45
45
|
const lines = entries.map(format_log_line).join("");
|
package/dist/index.mjs
CHANGED
|
@@ -18,9 +18,9 @@ function withAgentTail(next_config = {}, user_options) {
|
|
|
18
18
|
...next_config,
|
|
19
19
|
env: {
|
|
20
20
|
...next_config.env,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
AGENT_TAIL_ENDPOINT: options.endpoint,
|
|
22
|
+
AGENT_TAIL_LOG_PATH: log_path,
|
|
23
|
+
AGENT_TAIL_EXCLUDES: JSON.stringify(options.excludes)
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
if (typeof next_config.webpack === "function") result.webpack = (config, context) => {
|
package/dist/script.mjs
CHANGED
|
@@ -20,8 +20,10 @@ import { jsx } from "react/jsx-runtime";
|
|
|
20
20
|
* }
|
|
21
21
|
*/
|
|
22
22
|
function AgentTailScript({ options: user_options } = {}) {
|
|
23
|
+
const options = resolve_options(user_options);
|
|
24
|
+
if (process.env.AGENT_TAIL_ENDPOINT) options.endpoint = process.env.AGENT_TAIL_ENDPOINT;
|
|
23
25
|
return /* @__PURE__ */ jsx("script", {
|
|
24
|
-
dangerouslySetInnerHTML: { __html: generate_client_script(
|
|
26
|
+
dangerouslySetInnerHTML: { __html: generate_client_script(options) },
|
|
25
27
|
suppressHydrationWarning: true
|
|
26
28
|
});
|
|
27
29
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-plugin-agent-tail",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.9",
|
|
5
5
|
"description": "Next.js plugin for agent-tail — pipes browser console logs to files on disk during development.",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"agent-tail-core": "^0.3.
|
|
41
|
+
"agent-tail-core": "^0.3.9"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"next": ">=13.0.0"
|