@mugenlabs/logtape-devtools 0.2.0 → 0.3.0
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 +189 -20
- package/assets/panel.png +0 -0
- package/dist/chunk-CYXOBB6A.mjs +247 -0
- package/dist/chunk-CYXOBB6A.mjs.map +1 -0
- package/dist/index.d.ts +38 -67
- package/dist/index.mjs +338 -496
- package/dist/index.mjs.map +1 -1
- package/dist/sink.d.ts +130 -0
- package/dist/sink.mjs +13 -0
- package/dist/sink.mjs.map +1 -0
- package/package.json +23 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,7 @@
|
|
|
1
|
+
import * as _logtape_logtape from '@logtape/logtape';
|
|
1
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type LogLevel = "trace" | "debug" | "info" | "warning" | "error" | "fatal";
|
|
5
|
-
declare const LOG_LEVELS: LogLevel[];
|
|
6
|
-
interface DevtoolsLogRecord {
|
|
7
|
-
/** Source location of the log call (only present when `experimentalCaptureStackTrace` is enabled). */
|
|
8
|
-
caller?: string;
|
|
9
|
-
category: string[];
|
|
10
|
-
id: string;
|
|
11
|
-
level: LogLevel;
|
|
12
|
-
message: unknown[];
|
|
13
|
-
messageText: string;
|
|
14
|
-
properties: Record<string, unknown>;
|
|
15
|
-
timestamp: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type Listener = () => void;
|
|
19
|
-
interface LogStore {
|
|
20
|
-
addRecord(record: DevtoolsLogRecord): void;
|
|
21
|
-
clear(): void;
|
|
22
|
-
getSnapshot(): DevtoolsLogRecord[];
|
|
23
|
-
setMaxSize(size: number): void;
|
|
24
|
-
subscribe(listener: Listener): () => void;
|
|
25
|
-
}
|
|
26
|
-
declare function createLogStore(maxSize?: number): LogStore;
|
|
27
|
-
/** Default shared store instance used when no custom store is provided */
|
|
28
|
-
declare const defaultLogStore: LogStore;
|
|
3
|
+
import { LogStore, DevtoolsSinkOptions } from './sink.js';
|
|
4
|
+
export { DevtoolsLogRecord, LOG_LEVELS, LogLevel, LogStoreOptions, createDevtoolsSink, createLogStore, defaultLogStore } from './sink.js';
|
|
29
5
|
|
|
30
6
|
interface LogTapeDevtoolsPluginOptions {
|
|
31
7
|
/** Whether to open the devtools panel by default. Default: true */
|
|
@@ -53,53 +29,48 @@ declare const createLogTapeDevtoolsPlugin: (options?: LogTapeDevtoolsPluginOptio
|
|
|
53
29
|
render: react_jsx_runtime.JSX.Element;
|
|
54
30
|
};
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Capture the source location of each log call via stack trace parsing.
|
|
64
|
-
*
|
|
65
|
-
* **Experimental / dev-only** — relies on `new Error().stack` which is
|
|
66
|
-
* engine-dependent. Automatically disabled in production builds (when
|
|
67
|
-
* `process.env.NODE_ENV === "production"`) because minified bundles
|
|
68
|
-
* produce meaningless file/line references. Note that source maps do not
|
|
69
|
-
* help here — browsers do not apply source maps to `Error.stack`.
|
|
70
|
-
*
|
|
71
|
-
* Set `forceStackTrace` to `true` to override the production guard — useful
|
|
72
|
-
* when your production build ships unminified code.
|
|
73
|
-
*
|
|
74
|
-
* @default true
|
|
75
|
-
*/
|
|
76
|
-
experimentalCaptureStackTrace?: boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Force stack trace capture even in production builds.
|
|
79
|
-
* Only has an effect when `experimentalCaptureStackTrace` is `true`.
|
|
80
|
-
*
|
|
81
|
-
* @default false
|
|
82
|
-
*/
|
|
83
|
-
forceStackTrace?: boolean;
|
|
84
|
-
/** Custom log store instance. Defaults to the shared store. */
|
|
32
|
+
/** Options for {@link createLogTapeDevtools}. */
|
|
33
|
+
interface CreateLogTapeDevtoolsOptions {
|
|
34
|
+
/** Plugin options, minus `store` — the shared store is wired automatically. */
|
|
35
|
+
plugin?: Omit<LogTapeDevtoolsPluginOptions, "store">;
|
|
36
|
+
/** Sink options, minus `store` — the shared store is wired automatically. */
|
|
37
|
+
sink?: Omit<DevtoolsSinkOptions, "store">;
|
|
38
|
+
/** Store shared by the sink and the plugin. Defaults to the shared store. */
|
|
85
39
|
store?: LogStore;
|
|
86
40
|
}
|
|
87
41
|
/**
|
|
88
|
-
* Creates a LogTape sink
|
|
42
|
+
* Creates a LogTape sink and its matching TanStack DevTools plugin, both wired
|
|
43
|
+
* to the same store.
|
|
89
44
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
45
|
+
* Use this instead of calling `createDevtoolsSink` and
|
|
46
|
+
* `createLogTapeDevtoolsPlugin` separately when you do not need to hold on to
|
|
47
|
+
* the store yourself.
|
|
48
|
+
*
|
|
49
|
+
* ```tsx
|
|
50
|
+
* import { configure, getLogger } from "@logtape/logtape";
|
|
51
|
+
* import { TanStackDevtools } from "@tanstack/react-devtools";
|
|
52
|
+
* import { createLogTapeDevtools } from "@mugenlabs/logtape-devtools";
|
|
53
|
+
*
|
|
54
|
+
* const { sink, plugin } = createLogTapeDevtools();
|
|
94
55
|
*
|
|
95
56
|
* await configure({
|
|
96
|
-
* sinks: { devtools:
|
|
97
|
-
* loggers: [
|
|
98
|
-
* { category: ["app"], lowestLevel: "debug", sinks: ["devtools"] },
|
|
99
|
-
* ],
|
|
57
|
+
* sinks: { devtools: sink },
|
|
58
|
+
* loggers: [{ category: [], lowestLevel: "trace", sinks: ["devtools"] }],
|
|
100
59
|
* });
|
|
60
|
+
*
|
|
61
|
+
* function App() {
|
|
62
|
+
* return <TanStackDevtools plugins={[plugin]} />;
|
|
63
|
+
* }
|
|
101
64
|
* ```
|
|
102
65
|
*/
|
|
103
|
-
declare function
|
|
66
|
+
declare function createLogTapeDevtools(options?: CreateLogTapeDevtoolsOptions): {
|
|
67
|
+
plugin: {
|
|
68
|
+
defaultOpen: boolean;
|
|
69
|
+
id: string;
|
|
70
|
+
name: string;
|
|
71
|
+
render: react_jsx_runtime.JSX.Element;
|
|
72
|
+
};
|
|
73
|
+
sink: _logtape_logtape.Sink;
|
|
74
|
+
};
|
|
104
75
|
|
|
105
|
-
export { type
|
|
76
|
+
export { type CreateLogTapeDevtoolsOptions, DevtoolsSinkOptions, LogStore, type LogTapeDevtoolsPluginOptions, createLogTapeDevtools, createLogTapeDevtoolsPlugin };
|