@use-tusk/drift-node-sdk 0.1.5 → 0.1.6

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.d.cts CHANGED
@@ -1,3 +1,85 @@
1
+ import { NextConfig } from "next";
2
+
3
+ //#region src/nextjs/types.d.ts
4
+
5
+ /**
6
+ * Options for configuring Tusk Drift's Next.js integration.
7
+ */
8
+ interface TuskDriftNextOptions {
9
+ /**
10
+ * Enable debug logging for Tusk Drift's Next.js integration.
11
+ * When enabled, logs information about configuration changes and version detection.
12
+ *
13
+ * @default false
14
+ */
15
+ debug?: boolean;
16
+ /**
17
+ * Disable automatic setting of `experimental.instrumentationHook`.
18
+ * Use this if you want to manually control the instrumentation hook setting.
19
+ *
20
+ * @default false
21
+ */
22
+ disableInstrumentationHook?: boolean;
23
+ /**
24
+ * Suppress all warnings from Tusk Drift's Next.js integration.
25
+ * Not recommended unless you know what you're doing.
26
+ *
27
+ * @default false
28
+ */
29
+ suppressWarnings?: boolean;
30
+ }
31
+ /**
32
+ * Type for Next.js config that can be an object or a function returning an object.
33
+ */
34
+
35
+ //#endregion
36
+ //#region src/nextjs/withTuskDrift.d.ts
37
+ /**
38
+ * Wraps your Next.js configuration with Tusk Drift instrumentation setup.
39
+ *
40
+ * This function automatically configures Next.js to work with Tusk Drift by:
41
+ * - Enabling the Next.js instrumentation hook (for Next.js < 15.0.0-rc.1)
42
+ * - Configuring webpack externals to prevent bundling of core instrumentation packages
43
+ * - Preserving your existing Next.js configuration and webpack customizations
44
+ *
45
+ * @param nextConfig - Your existing Next.js configuration object (optional)
46
+ * @param options - Additional options to configure Tusk Drift's behavior (optional)
47
+ * @returns The wrapped Next.js configuration with Tusk Drift instrumentation enabled
48
+ *
49
+ * @example
50
+ * Basic usage:
51
+ * ```javascript
52
+ * // next.config.js
53
+ * const { withTuskDrift } = require('@use-tusk/drift-node-sdk');
54
+ *
55
+ * module.exports = withTuskDrift({
56
+ * // Your Next.js config
57
+ * });
58
+ * ```
59
+ *
60
+ * @example
61
+ * With debug logging:
62
+ * ```javascript
63
+ * // next.config.js
64
+ * const { withTuskDrift } = require('@use-tusk/drift-node-sdk');
65
+ *
66
+ * module.exports = withTuskDrift(
67
+ * {
68
+ * // Your Next.js config
69
+ * },
70
+ * {
71
+ * debug: true,
72
+ * }
73
+ * );
74
+ * ```
75
+ *
76
+ * @remarks
77
+ * The following webpack externals are added for server-side builds:
78
+ * - `require-in-the-middle` - Required for CommonJS module interception
79
+ * - `jsonpath` - Required for schema manipulation
80
+ */
81
+ declare function withTuskDrift(nextConfig?: NextConfig, options?: TuskDriftNextOptions): NextConfig;
82
+ //#endregion
1
83
  //#region src/core/types.d.ts
2
84
 
3
85
  type OneOf<T extends object> = { [K in keyof T]: Required<Pick<T, K>> & Partial<Record<Exclude<keyof T, K>, null>> }[keyof T];
@@ -166,5 +248,5 @@ interface TuskDriftPublicAPI {
166
248
  }
167
249
  declare const TuskDrift: TuskDriftPublicAPI;
168
250
  //#endregion
169
- export { TuskDrift };
251
+ export { TuskDrift, type TuskDriftNextOptions, withTuskDrift };
170
252
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,7 +1,87 @@
1
1
  import { SpanKind } from "@opentelemetry/api";
2
2
  import { PackageType, StatusCode } from "@use-tusk/drift-schemas/core/span";
3
3
  import "@use-tusk/drift-schemas/core/json_schema";
4
+ import { NextConfig } from "next";
4
5
 
6
+ //#region src/nextjs/types.d.ts
7
+ /**
8
+ * Options for configuring Tusk Drift's Next.js integration.
9
+ */
10
+ interface TuskDriftNextOptions {
11
+ /**
12
+ * Enable debug logging for Tusk Drift's Next.js integration.
13
+ * When enabled, logs information about configuration changes and version detection.
14
+ *
15
+ * @default false
16
+ */
17
+ debug?: boolean;
18
+ /**
19
+ * Disable automatic setting of `experimental.instrumentationHook`.
20
+ * Use this if you want to manually control the instrumentation hook setting.
21
+ *
22
+ * @default false
23
+ */
24
+ disableInstrumentationHook?: boolean;
25
+ /**
26
+ * Suppress all warnings from Tusk Drift's Next.js integration.
27
+ * Not recommended unless you know what you're doing.
28
+ *
29
+ * @default false
30
+ */
31
+ suppressWarnings?: boolean;
32
+ }
33
+ /**
34
+ * Type for Next.js config that can be an object or a function returning an object.
35
+ */
36
+
37
+ //#endregion
38
+ //#region src/nextjs/withTuskDrift.d.ts
39
+ /**
40
+ * Wraps your Next.js configuration with Tusk Drift instrumentation setup.
41
+ *
42
+ * This function automatically configures Next.js to work with Tusk Drift by:
43
+ * - Enabling the Next.js instrumentation hook (for Next.js < 15.0.0-rc.1)
44
+ * - Configuring webpack externals to prevent bundling of core instrumentation packages
45
+ * - Preserving your existing Next.js configuration and webpack customizations
46
+ *
47
+ * @param nextConfig - Your existing Next.js configuration object (optional)
48
+ * @param options - Additional options to configure Tusk Drift's behavior (optional)
49
+ * @returns The wrapped Next.js configuration with Tusk Drift instrumentation enabled
50
+ *
51
+ * @example
52
+ * Basic usage:
53
+ * ```javascript
54
+ * // next.config.js
55
+ * const { withTuskDrift } = require('@use-tusk/drift-node-sdk');
56
+ *
57
+ * module.exports = withTuskDrift({
58
+ * // Your Next.js config
59
+ * });
60
+ * ```
61
+ *
62
+ * @example
63
+ * With debug logging:
64
+ * ```javascript
65
+ * // next.config.js
66
+ * const { withTuskDrift } = require('@use-tusk/drift-node-sdk');
67
+ *
68
+ * module.exports = withTuskDrift(
69
+ * {
70
+ * // Your Next.js config
71
+ * },
72
+ * {
73
+ * debug: true,
74
+ * }
75
+ * );
76
+ * ```
77
+ *
78
+ * @remarks
79
+ * The following webpack externals are added for server-side builds:
80
+ * - `require-in-the-middle` - Required for CommonJS module interception
81
+ * - `jsonpath` - Required for schema manipulation
82
+ */
83
+ declare function withTuskDrift(nextConfig?: NextConfig, options?: TuskDriftNextOptions): NextConfig;
84
+ //#endregion
5
85
  //#region src/core/types.d.ts
6
86
 
7
87
  type OneOf<T extends object> = { [K in keyof T]: Required<Pick<T, K>> & Partial<Record<Exclude<keyof T, K>, null>> }[keyof T];
@@ -170,5 +250,5 @@ interface TuskDriftPublicAPI {
170
250
  }
171
251
  declare const TuskDrift: TuskDriftPublicAPI;
172
252
  //#endregion
173
- export { TuskDrift };
253
+ export { TuskDrift, type TuskDriftNextOptions, withTuskDrift };
174
254
  //# sourceMappingURL=index.d.ts.map