next-plugin-agent-tail 0.2.0 → 0.3.1

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 CHANGED
@@ -2,32 +2,34 @@
2
2
 
3
3
  Next.js plugin for [agent-tail](https://agent-tail.vercel.app/) — captures browser `console.log`, `console.warn`, `console.error`, unhandled errors, and unhandled promise rejections to log files on disk during development.
4
4
 
5
+ > **Tip:** Install the umbrella [`agent-tail`](https://www.npmjs.com/package/agent-tail) package to get the CLI, Vite plugin, and Next.js plugin in one install: `npm install -D agent-tail`
6
+
5
7
  ## Install
6
8
 
7
9
  ```bash
8
- npm install -D next-plugin-agent-tail
10
+ npm install -D agent-tail
9
11
  ```
10
12
 
11
13
  ## Setup
12
14
 
13
15
  ```ts
14
16
  // next.config.ts
15
- import { with_browser_logs } from "next-plugin-agent-tail"
17
+ import { withAgentTail } from "agent-tail/next"
16
18
 
17
- export default with_browser_logs({
19
+ export default withAgentTail({
18
20
  // your Next.js config
19
21
  })
20
22
  ```
21
23
 
22
24
  ```tsx
23
25
  // app/layout.tsx
24
- import { BrowserLogsScript } from "next-plugin-agent-tail/script"
26
+ import { AgentTailScript } from "agent-tail/next/script"
25
27
 
26
28
  export default function RootLayout({ children }: { children: React.ReactNode }) {
27
29
  return (
28
30
  <html>
29
31
  <head>
30
- {process.env.NODE_ENV === "development" && <BrowserLogsScript />}
32
+ {process.env.NODE_ENV === "development" && <AgentTailScript />}
31
33
  </head>
32
34
  <body>{children}</body>
33
35
  </html>
@@ -37,7 +39,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
37
39
 
38
40
  ```ts
39
41
  // app/api/__browser-logs/route.ts
40
- export { POST } from "next-plugin-agent-tail/handler"
42
+ export { POST } from "agent-tail/next/handler"
41
43
  ```
42
44
 
43
45
  Then in another terminal:
@@ -51,7 +53,7 @@ tail -f tmp/logs/latest/browser.log
51
53
  Use both the plugin and the CLI to get browser console logs *and* server output in one place:
52
54
 
53
55
  ```bash
54
- npx agent-tail-core run 'fe: npm run dev' 'api: uvicorn main:app'
56
+ agent-tail run 'fe: npm run dev' 'api: uvicorn main:app'
55
57
  ```
56
58
 
57
59
  ## Docs
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { POST, pages_handler } from "./handler.mjs";
2
- import { BrowserLogsScript } from "./script.mjs";
2
+ import { AgentTailScript } from "./script.mjs";
3
3
  import { BrowserLogsOptions, BrowserLogsOptions as BrowserLogsOptions$1, DEFAULT_OPTIONS, LogEntry, ResolvedOptions } from "agent-tail-core";
4
4
 
5
5
  //#region src/with-browser-logs.d.ts
@@ -8,6 +8,6 @@ interface NextConfig {
8
8
  webpack?: (config: any, context: any) => any;
9
9
  [key: string]: any;
10
10
  }
11
- declare function with_browser_logs(next_config?: NextConfig, user_options?: BrowserLogsOptions$1): NextConfig;
11
+ declare function withAgentTail(next_config?: NextConfig, user_options?: BrowserLogsOptions$1): NextConfig;
12
12
  //#endregion
13
- export { type BrowserLogsOptions, BrowserLogsScript, DEFAULT_OPTIONS, type LogEntry, POST, type ResolvedOptions, pages_handler, with_browser_logs };
13
+ export { AgentTailScript, type BrowserLogsOptions, DEFAULT_OPTIONS, type LogEntry, POST, type ResolvedOptions, pages_handler, withAgentTail };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
- import { BrowserLogsScript } from "./script.mjs";
1
+ import { AgentTailScript } from "./script.mjs";
2
2
  import { POST, pages_handler } from "./handler.mjs";
3
3
  import { DEFAULT_OPTIONS, LogManager, resolve_options } from "agent-tail-core";
4
4
 
5
5
  //#region src/with-browser-logs.ts
6
- function with_browser_logs(next_config = {}, user_options) {
6
+ function withAgentTail(next_config = {}, user_options) {
7
7
  const options = resolve_options(user_options);
8
8
  const log_manager = new LogManager(options);
9
9
  const project_root = process.cwd();
@@ -24,4 +24,4 @@ function with_browser_logs(next_config = {}, user_options) {
24
24
  }
25
25
 
26
26
  //#endregion
27
- export { BrowserLogsScript, DEFAULT_OPTIONS, POST, pages_handler, with_browser_logs };
27
+ export { AgentTailScript, DEFAULT_OPTIONS, POST, pages_handler, withAgentTail };
package/dist/script.d.mts CHANGED
@@ -2,28 +2,28 @@ import { BrowserLogsOptions } from "agent-tail-core";
2
2
  import * as react_jsx_runtime0 from "react/jsx-runtime";
3
3
 
4
4
  //#region src/script.d.ts
5
- interface BrowserLogsScriptProps {
5
+ interface AgentTailScriptProps {
6
6
  options?: BrowserLogsOptions;
7
7
  }
8
8
  /**
9
9
  * React component that injects the browser log capture script.
10
10
  *
11
11
  * Usage in app/layout.tsx:
12
- * import { BrowserLogsScript } from "next-plugin-browser-logs/script"
12
+ * import { AgentTailScript } from "next-plugin-agent-tail/script"
13
13
  *
14
14
  * export default function RootLayout({ children }) {
15
15
  * return (
16
16
  * <html>
17
17
  * <head>
18
- * {process.env.NODE_ENV === "development" && <BrowserLogsScript />}
18
+ * {process.env.NODE_ENV === "development" && <AgentTailScript />}
19
19
  * </head>
20
20
  * <body>{children}</body>
21
21
  * </html>
22
22
  * )
23
23
  * }
24
24
  */
25
- declare function BrowserLogsScript({
25
+ declare function AgentTailScript({
26
26
  options: user_options
27
- }?: BrowserLogsScriptProps): react_jsx_runtime0.JSX.Element;
27
+ }?: AgentTailScriptProps): react_jsx_runtime0.JSX.Element;
28
28
  //#endregion
29
- export { BrowserLogsScript };
29
+ export { AgentTailScript };
package/dist/script.mjs CHANGED
@@ -1,5 +1,4 @@
1
1
  import { generate_client_script, resolve_options } from "agent-tail-core";
2
- import "react";
3
2
  import { jsx } from "react/jsx-runtime";
4
3
 
5
4
  //#region src/script.tsx
@@ -7,20 +6,20 @@ import { jsx } from "react/jsx-runtime";
7
6
  * React component that injects the browser log capture script.
8
7
  *
9
8
  * Usage in app/layout.tsx:
10
- * import { BrowserLogsScript } from "next-plugin-browser-logs/script"
9
+ * import { AgentTailScript } from "next-plugin-agent-tail/script"
11
10
  *
12
11
  * export default function RootLayout({ children }) {
13
12
  * return (
14
13
  * <html>
15
14
  * <head>
16
- * {process.env.NODE_ENV === "development" && <BrowserLogsScript />}
15
+ * {process.env.NODE_ENV === "development" && <AgentTailScript />}
17
16
  * </head>
18
17
  * <body>{children}</body>
19
18
  * </html>
20
19
  * )
21
20
  * }
22
21
  */
23
- function BrowserLogsScript({ options: user_options } = {}) {
22
+ function AgentTailScript({ options: user_options } = {}) {
24
23
  return /* @__PURE__ */ jsx("script", {
25
24
  dangerouslySetInnerHTML: { __html: generate_client_script(resolve_options(user_options)) },
26
25
  suppressHydrationWarning: true
@@ -28,4 +27,4 @@ function BrowserLogsScript({ options: user_options } = {}) {
28
27
  }
29
28
 
30
29
  //#endregion
31
- export { BrowserLogsScript };
30
+ export { AgentTailScript };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "next-plugin-agent-tail",
3
3
  "type": "module",
4
- "version": "0.2.0",
4
+ "version": "0.3.1",
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.2.0"
41
+ "agent-tail-core": "^0.3.1"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "next": ">=13.0.0"