@interfere/next 0.1.0-alpha.10 → 0.1.0-alpha.11

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.
Files changed (120) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +3 -3
  3. package/dist/_virtual/{rolldown_runtime.mjs → _rolldown/runtime.mjs} +1 -1
  4. package/dist/build/env-config.d.mts +3 -1
  5. package/dist/build/env-config.d.mts.map +1 -1
  6. package/dist/build/env-config.mjs +9 -1
  7. package/dist/build/env-config.mjs.map +1 -1
  8. package/dist/build/exchange-surface.d.mts +9 -0
  9. package/dist/build/exchange-surface.d.mts.map +1 -0
  10. package/dist/build/exchange-surface.mjs +36 -0
  11. package/dist/build/exchange-surface.mjs.map +1 -0
  12. package/dist/build/loaders/value-injection-loader.d.mts.map +1 -1
  13. package/dist/build/logger.d.mts.map +1 -1
  14. package/dist/build/nextjs-version.d.mts.map +1 -1
  15. package/dist/build/nextjs-version.mjs +1 -1
  16. package/dist/build/release-program.d.mts +3 -3
  17. package/dist/build/release-program.d.mts.map +1 -1
  18. package/dist/build/release-program.mjs +4 -6
  19. package/dist/build/release-program.mjs.map +1 -1
  20. package/dist/build/services/config.service.d.mts.map +1 -1
  21. package/dist/build/services/config.service.mjs.map +1 -1
  22. package/dist/build/services/instrumentation-detection.service.d.mts.map +1 -1
  23. package/dist/build/services/preflight.service.d.mts +2 -3
  24. package/dist/build/services/preflight.service.d.mts.map +1 -1
  25. package/dist/build/services/preflight.service.mjs +24 -33
  26. package/dist/build/services/preflight.service.mjs.map +1 -1
  27. package/dist/build/services/release-identity.service.d.mts +4 -3
  28. package/dist/build/services/release-identity.service.d.mts.map +1 -1
  29. package/dist/build/services/release-identity.service.mjs +23 -10
  30. package/dist/build/services/release-identity.service.mjs.map +1 -1
  31. package/dist/build/services/source-map.service.d.mts +3 -7
  32. package/dist/build/services/source-map.service.d.mts.map +1 -1
  33. package/dist/build/services/source-map.service.mjs.map +1 -1
  34. package/dist/build/source-maps/api.d.mts +25 -16
  35. package/dist/build/source-maps/api.d.mts.map +1 -1
  36. package/dist/build/source-maps/api.mjs +11 -8
  37. package/dist/build/source-maps/api.mjs.map +1 -1
  38. package/dist/build/source-maps/client.d.mts +22 -21
  39. package/dist/build/source-maps/client.d.mts.map +1 -1
  40. package/dist/build/source-maps/client.mjs +14 -9
  41. package/dist/build/source-maps/client.mjs.map +1 -1
  42. package/dist/build/source-maps/errors.d.mts +118 -106
  43. package/dist/build/source-maps/errors.d.mts.map +1 -1
  44. package/dist/build/source-maps/errors.mjs +42 -18
  45. package/dist/build/source-maps/errors.mjs.map +1 -1
  46. package/dist/build/source-maps/files.d.mts.map +1 -1
  47. package/dist/build/source-maps/providers/deployment/detector.d.mts +7 -16
  48. package/dist/build/source-maps/providers/deployment/detector.d.mts.map +1 -1
  49. package/dist/build/source-maps/providers/deployment/detector.mjs +2 -2
  50. package/dist/build/source-maps/providers/deployment/detector.mjs.map +1 -1
  51. package/dist/build/source-maps/providers/deployment/types.d.mts +2 -2
  52. package/dist/build/source-maps/providers/deployment/types.d.mts.map +1 -1
  53. package/dist/build/source-maps/providers/deployment/vercel.d.mts.map +1 -1
  54. package/dist/build/source-maps/providers/deployment/vercel.mjs +7 -18
  55. package/dist/build/source-maps/providers/deployment/vercel.mjs.map +1 -1
  56. package/dist/build/source-maps/providers/source-control/detector.d.mts +5 -4
  57. package/dist/build/source-maps/providers/source-control/detector.d.mts.map +1 -1
  58. package/dist/build/source-maps/providers/source-control/detector.mjs +1 -1
  59. package/dist/build/source-maps/providers/source-control/detector.mjs.map +1 -1
  60. package/dist/build/source-maps/providers/source-control/git.d.mts.map +1 -1
  61. package/dist/build/source-maps/providers/source-control/git.mjs +4 -7
  62. package/dist/build/source-maps/providers/source-control/git.mjs.map +1 -1
  63. package/dist/build/source-maps/providers/source-control/types.d.mts +5 -3
  64. package/dist/build/source-maps/providers/source-control/types.d.mts.map +1 -1
  65. package/dist/build/with-interfere.d.mts +23 -23
  66. package/dist/build/with-interfere.d.mts.map +1 -1
  67. package/dist/build/with-interfere.mjs +47 -26
  68. package/dist/build/with-interfere.mjs.map +1 -1
  69. package/dist/client/auto-init.d.mts +3 -3
  70. package/dist/client/auto-init.d.mts.map +1 -1
  71. package/dist/client/auto-init.mjs +1 -1
  72. package/dist/client/auto-init.mjs.map +1 -1
  73. package/dist/client/provider.d.mts +2 -2
  74. package/dist/client/provider.d.mts.map +1 -1
  75. package/dist/client/provider.mjs.map +1 -1
  76. package/dist/lib/env.d.mts.map +1 -1
  77. package/dist/lib/types.d.mts +6 -6
  78. package/dist/lib/types.d.mts.map +1 -1
  79. package/dist/lib/types.mjs.map +1 -1
  80. package/dist/server/auto-init.d.mts +11 -10
  81. package/dist/server/auto-init.d.mts.map +1 -1
  82. package/dist/server/auto-init.mjs +3 -3
  83. package/dist/server/auto-init.mjs.map +1 -1
  84. package/dist/server/middleware.d.mts.map +1 -1
  85. package/dist/server/middleware.mjs +9 -10
  86. package/dist/server/middleware.mjs.map +1 -1
  87. package/dist/server/on-request-error.d.mts +7 -7
  88. package/dist/server/on-request-error.d.mts.map +1 -1
  89. package/dist/server/on-request-error.mjs +2 -2
  90. package/dist/server/on-request-error.mjs.map +1 -1
  91. package/dist/server/proxy.d.mts.map +1 -1
  92. package/dist/server/proxy.mjs +4 -5
  93. package/dist/server/proxy.mjs.map +1 -1
  94. package/dist/server/route-handler.d.mts +31 -1
  95. package/dist/server/route-handler.d.mts.map +1 -1
  96. package/dist/server/route-handler.mjs +72 -67
  97. package/dist/server/route-handler.mjs.map +1 -1
  98. package/dist/server/sdk.d.mts +29 -29
  99. package/dist/server/sdk.d.mts.map +1 -1
  100. package/dist/server/sdk.mjs +2 -2
  101. package/dist/server/sdk.mjs.map +1 -1
  102. package/dist/server/services/config.service.d.mts +33 -6
  103. package/dist/server/services/config.service.d.mts.map +1 -1
  104. package/dist/server/services/config.service.mjs +54 -30
  105. package/dist/server/services/config.service.mjs.map +1 -1
  106. package/dist/server/services/error-tracking.service.d.mts.map +1 -1
  107. package/dist/server/services/error-tracking.service.mjs +1 -1
  108. package/dist/server/services/error-tracking.service.mjs.map +1 -1
  109. package/dist/server/session-context.d.mts +11 -11
  110. package/dist/server/session-context.d.mts.map +1 -1
  111. package/dist/server/session-context.mjs.map +1 -1
  112. package/package.json +38 -34
  113. package/dist/build/secret-key.d.mts +0 -10
  114. package/dist/build/secret-key.d.mts.map +0 -1
  115. package/dist/build/secret-key.mjs +0 -16
  116. package/dist/build/secret-key.mjs.map +0 -1
  117. package/dist/lib/test-utils/make-next-request.d.mts +0 -6
  118. package/dist/lib/test-utils/make-next-request.d.mts.map +0 -1
  119. package/dist/lib/test-utils/make-next-request.mjs +0 -12
  120. package/dist/lib/test-utils/make-next-request.mjs.map +0 -1
@@ -1,12 +1,14 @@
1
1
  import { SourceControlDetectionError } from "../../errors.mjs";
2
2
  import { Effect } from "effect";
3
- import { ReleaseSourceMetadata, ReleaseSourceType } from "@interfere/types/releases/definition";
3
+ import { ReleaseSourceMetadata } from "@interfere/types/integrations";
4
4
 
5
5
  //#region src/build/source-maps/providers/source-control/types.d.ts
6
6
  type SourceControlProvider = {
7
- type: ReleaseSourceType;
7
+ name: "github";
8
8
  detect: Effect.Effect<boolean>;
9
- getMetadata: Effect.Effect<ReleaseSourceMetadata, SourceControlDetectionError>;
9
+ getMetadata: Effect.Effect<ReleaseSourceMetadata & {
10
+ gitCommitSha: string;
11
+ }, SourceControlDetectionError>;
10
12
  };
11
13
  //#endregion
12
14
  export { SourceControlProvider };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/source-control/types.ts"],"mappings":";;;;;KASY,qBAAA;EAAA,IAAA,EACJ,iBAAA;EAAA,MAAA,EACE,MAAA,CAAO,MAAA;EAAA,WAAA,EACF,MAAA,CAAO,MAAA,CAClB,qBAAA,EACA,2BAAA;AAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../../../../src/build/source-maps/providers/source-control/types.ts"],"mappings":";;;;;KAMY,qBAAA;EACV,IAAA;EACA,MAAA,EAAQ,MAAA,CAAO,MAAA;EACf,WAAA,EAAa,MAAA,CAAO,MAAA,CAClB,qBAAA;IAA0B,YAAA;EAAA,GAC1B,2BAAA;AAAA"}
@@ -3,41 +3,41 @@ import { NextConfig } from "next";
3
3
  //#region src/build/with-interfere.d.ts
4
4
  type InterfereFeatures = {
5
5
  /**
6
- * Enable error tracking
7
- * @default true
8
- */
6
+ * Enable error tracking
7
+ * @default true
8
+ */
9
9
  errorTracking?: boolean;
10
10
  /**
11
- * Enable session replay
12
- * @default true in production, false in development
13
- */
11
+ * Enable session replay
12
+ * @default true in production, false in development
13
+ */
14
14
  replay?: boolean;
15
15
  /**
16
- * Enable performance monitoring
17
- * @default true
18
- */
16
+ * Enable performance monitoring
17
+ * @default true
18
+ */
19
19
  performanceMonitoring?: boolean;
20
20
  };
21
21
  type InterfereOptions = {
22
22
  /**
23
- * Environment name
24
- * @default "production"
25
- */
23
+ * Environment name
24
+ * @default "production"
25
+ */
26
26
  environment?: string;
27
27
  /**
28
- * Enable debug logging
29
- * @default false
30
- */
28
+ * Enable debug logging
29
+ * @default false
30
+ */
31
31
  debug?: boolean;
32
32
  /**
33
- * Whether to delete source maps after upload to prevent leakage
34
- * @default true
35
- */
33
+ * Whether to delete source maps after upload to prevent leakage
34
+ * @default true
35
+ */
36
36
  cleanupSourceMaps?: boolean;
37
37
  /**
38
- * Feature flags for the SDK.
39
- * These are injected at build time and available to the client SDK.
40
- */
38
+ * Feature flags for the SDK.
39
+ * These are injected at build time and available to the client SDK.
40
+ */
41
41
  features?: InterfereFeatures;
42
42
  };
43
43
  type NextConfigWithInterfere = NextConfig & {
@@ -46,7 +46,7 @@ type NextConfigWithInterfere = NextConfig & {
46
46
  /**
47
47
  * Next.js configuration wrapper that automatically uploads source maps in production builds
48
48
  *
49
- * SECURITY: Secret key must be set via INTERFERE_SECRET_KEY env var (without NEXT_PUBLIC_ prefix)
49
+ * SECURITY: API key must be set via INTERFERE_API_KEY env var (without NEXT_PUBLIC_ prefix)
50
50
  *
51
51
  * @example
52
52
  * ```js
@@ -65,6 +65,6 @@ type NextConfigWithInterfere = NextConfig & {
65
65
  declare function withInterfere({
66
66
  interfere,
67
67
  ...nextConfig
68
- }?: NextConfigWithInterfere): () => NextConfig;
68
+ }?: NextConfigWithInterfere): () => NextConfig | Promise<NextConfig>;
69
69
  //#endregion
70
70
  export { InterfereFeatures, InterfereOptions, withInterfere };
@@ -1 +1 @@
1
- {"version":3,"file":"with-interfere.d.mts","names":[],"sources":["../../src/build/with-interfere.ts"],"mappings":";;;KAkBY,iBAAA;EAAA;AAoBZ;AAwBE;AA2GF;EAvJY,aAAA;EAAA;AAoBZ;AAwBE;AA2GF;EAvJY,MAAA;EAAA;AAoBZ;AAwBE;AA2GF;EAvJY,qBAAA;AAAA;AAAA,KAoBA,gBAAA;EAAA;AAwBV;AA2GF;;EAnIY,WAAA;EAAA;AAwBV;AA2GF;;EAnIY,KAAA;EAAA;AAwBV;AA2GF;;EAnIY,iBAAA;EAAA;AAwBV;AA2GF;;EAnIY,QAAA,GAuBC,iBAAA;AAAA;AAAA,KAGR,uBAAA,GAA0B,UAAA;EAAA,SAAA,GACjB,gBAAA;AAAA;AAAA;AAwGd;;;;;;;;;;;;;;;;;;AAxGc,iBAwGE,aAAA,CAAA;EAAA,SAAA;EAAA,GAAA;AAAA,IAGb,uBAAA,SAAqC,UAAA"}
1
+ {"version":3,"file":"with-interfere.d.mts","names":[],"sources":["../../src/build/with-interfere.ts"],"mappings":";;;KAkBY,iBAAA;;AAAZ;;;EAKE,aAAA;EAAA;;;;EAMA,MAAA;EASU;;;;EAHV,qBAAA;AAAA;AAAA,KAGU,gBAAA;EAuBV;;;;EAlBA,WAAA;EAqB0B;;;;EAf1B,KAAA;EAgBY;;;AAgId;EA1IE,iBAAA;;;;;EAMA,QAAA,GAAW,iBAAA;AAAA;AAAA,KAGR,uBAAA,GAA0B,UAAA;EAC7B,SAAA,GAAY,gBAAA;AAAA;;;;;;;;;;;;;;;;;;;;iBAgIE,aAAA,CAAA;EACd,SAAA;EAAA,GACG;AAAA,IACF,uBAAA,SAAqC,UAAA,GAAa,OAAA,CAAQ,UAAA"}
@@ -6,11 +6,20 @@ import { detectAndValidateInstrumentationSync } from "./services/instrumentation
6
6
  import { PreflightService, PreflightServiceLive } from "./services/preflight.service.mjs";
7
7
  import { withInterfereLogger } from "@interfere/effect-utils/observability";
8
8
  import chalk from "chalk";
9
- import { Effect, Option } from "effect";
9
+ import { Cause, Effect, Option } from "effect";
10
10
  import * as path$1 from "node:path";
11
11
  import { fileURLToPath } from "node:url";
12
12
 
13
13
  //#region src/build/with-interfere.ts
14
+ function getInterfereUsageMessage(error) {
15
+ const cause = error?.cause;
16
+ if (cause === void 0) return null;
17
+ const option = Cause.failureOption(cause);
18
+ if (option._tag !== "Some") return null;
19
+ const first = option.value;
20
+ if (first && typeof first === "object" && "_tag" in first && first._tag === "WithInterfereUsageError" && "message" in first && typeof first.message === "string") return first.message;
21
+ return null;
22
+ }
14
23
  function createWebpackConfig(existingWebpack, instrumentationFiles, injectionValues) {
15
24
  const filePaths = [instrumentationFiles.client, instrumentationFiles.server].filter((p) => p !== null);
16
25
  if (filePaths.length === 0) return existingWebpack ?? ((config) => config);
@@ -57,7 +66,7 @@ function createTurbopackConfig(existingTurbopack, clientFilePath, injectionValue
57
66
  /**
58
67
  * Next.js configuration wrapper that automatically uploads source maps in production builds
59
68
  *
60
- * SECURITY: Secret key must be set via INTERFERE_SECRET_KEY env var (without NEXT_PUBLIC_ prefix)
69
+ * SECURITY: API key must be set via INTERFERE_API_KEY env var (without NEXT_PUBLIC_ prefix)
61
70
  *
62
71
  * @example
63
72
  * ```js
@@ -74,32 +83,44 @@ function createTurbopackConfig(existingTurbopack, clientFilePath, injectionValue
74
83
  * ```
75
84
  */
76
85
  function withInterfere({ interfere = {}, ...nextConfig } = {}) {
77
- const interfereConfig = Effect.gen(function* () {
86
+ const configProgram = Effect.gen(function* () {
78
87
  return yield* (yield* PreflightService).buildConfig(interfere);
79
- }).pipe(Effect.provide(PreflightServiceLive), Effect.runSync);
80
- const identityProgram = Effect.gen(function* () {
81
- return yield* (yield* ReleaseIdentityService).pipe(Effect.option);
82
- }).pipe(Effect.provide(ReleaseIdentityServiceLive), Effect.runSync);
83
- const identity = Option.getOrUndefined(identityProgram);
84
- let instrumentationFiles;
85
- try {
86
- const { files, serverValidation } = detectAndValidateInstrumentationSync();
87
- instrumentationFiles = files;
88
- if (serverValidation.hasFile && !serverValidation.hasOnRequestError && interfereConfig.enabled) console.warn(chalk.yellow("\n⚠️ Missing onRequestError export in instrumentation.ts\n\n For comprehensive server-side error tracking, add:\n\n" + chalk.cyan(" import { captureRequestError } from '@interfere/next/server/on-request-error';\n\n export async function onRequestError(error, request, context) {\n await captureRequestError({ error, request, context });\n }\n") + "\n This captures errors from React Server Components, SSR, API routes, and more.\n Learn more: https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n"));
89
- } catch {
90
- instrumentationFiles = {
91
- server: null,
92
- client: null
88
+ }).pipe(Effect.provide(PreflightServiceLive));
89
+ return async function buildConfig() {
90
+ let interfereConfig;
91
+ try {
92
+ interfereConfig = await Effect.runPromise(configProgram);
93
+ } catch (error) {
94
+ const message = getInterfereUsageMessage(error);
95
+ if (message) {
96
+ console.error(chalk.red("\n❌ Interfere configuration failed\n\n") + chalk.red(" ") + message + "\n\n" + chalk.dim(" Ensure you are using the correct INTERFERE_API_KEY and that it is scoped to a surface;\n") + chalk.dim(" the exchange API must be reachable from this environment.\n"));
97
+ throw new Error(message);
98
+ }
99
+ throw error;
100
+ }
101
+ const identityProgram = Effect.gen(function* () {
102
+ return yield* (yield* ReleaseIdentityService).pipe(Effect.option);
103
+ }).pipe(Effect.provide(ReleaseIdentityServiceLive), Effect.runSync);
104
+ const identity = Option.getOrUndefined(identityProgram);
105
+ let instrumentationFiles;
106
+ try {
107
+ const { files, serverValidation } = detectAndValidateInstrumentationSync();
108
+ instrumentationFiles = files;
109
+ if (serverValidation.hasFile && !serverValidation.hasOnRequestError && interfereConfig.enabled) console.warn(chalk.yellow("\n⚠️ Missing onRequestError export in instrumentation.ts\n\n For comprehensive server-side error tracking, add:\n\n" + chalk.cyan(" import { captureRequestError } from '@interfere/next/server/on-request-error';\n\n export async function onRequestError(error, request, context) {\n await captureRequestError({ error, request, context });\n }\n") + "\n This captures errors from React Server Components, SSR, API routes, and more.\n Learn more: https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\n"));
110
+ } catch {
111
+ instrumentationFiles = {
112
+ server: null,
113
+ client: null
114
+ };
115
+ }
116
+ const injectionValues = {
117
+ __INTERFERE_BUILD_ID__: identity?.buildId ?? null,
118
+ __INTERFERE_RELEASE_ID__: identity?.releaseId ?? null,
119
+ __INTERFERE_ENVIRONMENT__: interfereConfig.environment,
120
+ __INTERFERE_ENABLED__: interfereConfig.enabled,
121
+ ...interfere.features && { __INTERFERE_FEATURES__: interfere.features },
122
+ ...interfereConfig.enabled && interfereConfig.surface && { __INTERFERE_SURFACE_SLUG__: interfereConfig.surface }
93
123
  };
94
- }
95
- const injectionValues = {
96
- __INTERFERE_BUILD_ID__: identity?.buildId ?? null,
97
- __INTERFERE_RELEASE_ID__: identity?.releaseId ?? null,
98
- __INTERFERE_ENVIRONMENT__: interfereConfig.environment,
99
- __INTERFERE_ENABLED__: interfereConfig.enabled,
100
- ...interfere.features && { __INTERFERE_FEATURES__: interfere.features }
101
- };
102
- return function buildConfig() {
103
124
  const env = {
104
125
  ...nextConfig.env,
105
126
  NEXT_PUBLIC_INTERFERE_ENVIRONMENT: interfereConfig.environment,
@@ -1 +1 @@
1
- {"version":3,"file":"with-interfere.mjs","names":["path"],"sources":["../../src/build/with-interfere.ts"],"sourcesContent":["import { withInterfereLogger } from \"@interfere/effect-utils/observability\";\nimport chalk from \"chalk\";\nimport { Effect, Option } from \"effect\";\nimport type { NextConfig } from \"next\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Configuration as WebpackConfiguration, RuleSetRule } from \"webpack\";\nimport type { ValueInjectionLoaderOptions } from \"./loaders/value-injection-loader.js\";\nimport { nextBuildLogger } from \"./logger.js\";\nimport { detectNextJsVersion, requiresInstrumentationHook } from \"./nextjs-version.js\";\nimport { createReleaseLayers, releaseProgram } from \"./release-program.js\";\nimport {\n detectAndValidateInstrumentationSync,\n type InstrumentationFiles,\n} from \"./services/instrumentation-detection.service.js\";\nimport { PreflightService, PreflightServiceLive } from \"./services/preflight.service.js\";\nimport { ReleaseIdentityService, ReleaseIdentityServiceLive } from \"./services/release-identity.service.js\";\n\nexport type InterfereFeatures = {\n /**\n * Enable error tracking\n * @default true\n */\n errorTracking?: boolean;\n\n /**\n * Enable session replay\n * @default true in production, false in development\n */\n replay?: boolean;\n\n /**\n * Enable performance monitoring\n * @default true\n */\n performanceMonitoring?: boolean;\n};\n\nexport type InterfereOptions = {\n /**\n * Environment name\n * @default \"production\"\n */\n environment?: string;\n\n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Whether to delete source maps after upload to prevent leakage\n * @default true\n */\n cleanupSourceMaps?: boolean;\n\n /**\n * Feature flags for the SDK.\n * These are injected at build time and available to the client SDK.\n */\n features?: InterfereFeatures;\n};\n\ntype NextConfigWithInterfere = NextConfig & {\n interfere?: InterfereOptions;\n};\n\nfunction createWebpackConfig(\n existingWebpack: NextConfig[\"webpack\"],\n instrumentationFiles: InstrumentationFiles,\n injectionValues: Record<string, unknown>\n): NextConfig[\"webpack\"] {\n const filePaths = [instrumentationFiles.client, instrumentationFiles.server].filter(\n (p): p is string => p !== null\n );\n\n if (filePaths.length === 0) {\n return existingWebpack ?? ((config) => config);\n }\n\n return (config, options) => {\n const loaderPath = path.resolve(\n path.dirname(fileURLToPath(import.meta.url)),\n \"loaders\",\n \"value-injection-loader.js\"\n );\n\n const rules: RuleSetRule[] = filePaths.map((filePath) => {\n const normalizedPath = path.normalize(filePath);\n return {\n test: (resource: string) =>\n resource ? path.normalize(resource) === normalizedPath : false,\n use: { loader: loaderPath, options: { values: injectionValues } satisfies ValueInjectionLoaderOptions },\n };\n });\n\n const resultConfig = existingWebpack ? existingWebpack(config, options) : config;\n const webpackConfig = resultConfig as WebpackConfiguration;\n webpackConfig.module = webpackConfig.module ?? {};\n webpackConfig.module.rules = webpackConfig.module.rules ?? [];\n webpackConfig.module.rules.push(...rules);\n\n return resultConfig;\n };\n}\n\n// JSONValue type from Next.js - doesn't allow null\ntype JSONValue = string | number | boolean | JSONValue[] | { [k: string]: JSONValue };\n\nfunction serializeForTurbopack(value: unknown): string {\n return JSON.stringify(value);\n}\n\nfunction createTurbopackConfig(\n existingTurbopack: NextConfig[\"turbopack\"],\n clientFilePath: string | null,\n injectionValues: Record<string, unknown>\n): NextConfig[\"turbopack\"] {\n const loaderPath = path.resolve(\n path.dirname(fileURLToPath(import.meta.url)),\n \"loaders\",\n \"value-injection-loader.js\"\n );\n\n const baseTurbopack = existingTurbopack ?? {};\n\n if (!clientFilePath) {\n return baseTurbopack;\n }\n\n const clientFileName = path.basename(clientFilePath);\n const serializedValues = serializeForTurbopack(injectionValues);\n\n return {\n ...baseTurbopack,\n rules: {\n ...baseTurbopack.rules,\n [`**/${clientFileName}`]: {\n loaders: [\n {\n loader: loaderPath,\n options: { serializedValues } as Record<string, JSONValue>,\n },\n ],\n },\n },\n };\n}\n\n/**\n * Next.js configuration wrapper that automatically uploads source maps in production builds\n *\n * SECURITY: Secret key must be set via INTERFERE_SECRET_KEY env var (without NEXT_PUBLIC_ prefix)\n *\n * @example\n * ```js\n * // next.config.js\n * import { withInterfere } from '@interfere/next/config';\n *\n * export default withInterfere({\n * environment: 'staging',\n * debug: true,\n * cleanupSourceMaps: true\n * })({\n * // Your Next.js config\n * });\n * ```\n */\nexport function withInterfere({\n interfere = {},\n ...nextConfig\n}: NextConfigWithInterfere = {}): () => NextConfig {\n const configProgram = Effect.gen(function* () {\n const preflight = yield* PreflightService;\n return yield* preflight.buildConfig(interfere);\n }).pipe(\n Effect.provide(PreflightServiceLive),\n Effect.runSync\n );\n\n const interfereConfig = configProgram;\n \n const identityProgram = Effect.gen(function* () {\n const identityEffect = yield* ReleaseIdentityService;\n return yield* identityEffect.pipe(Effect.option);\n }).pipe(\n Effect.provide(ReleaseIdentityServiceLive),\n Effect.runSync\n );\n \n const identity = Option.getOrUndefined(identityProgram);\n\n let instrumentationFiles: InstrumentationFiles;\n try {\n const { files, serverValidation } = detectAndValidateInstrumentationSync();\n instrumentationFiles = files;\n\n if (\n serverValidation.hasFile &&\n !serverValidation.hasOnRequestError &&\n interfereConfig.enabled\n ) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ Missing onRequestError export in instrumentation.ts\\n\\n\" +\n \" For comprehensive server-side error tracking, add:\\n\\n\" +\n chalk.cyan(\n \" import { captureRequestError } from '@interfere/next/server/on-request-error';\\n\\n\" +\n \" export async function onRequestError(error, request, context) {\\n\" +\n \" await captureRequestError({ error, request, context });\\n\" +\n \" }\\n\"\n ) +\n \"\\n This captures errors from React Server Components, SSR, API routes, and more.\\n\" +\n \" Learn more: https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\\n\"\n )\n );\n }\n } catch {\n instrumentationFiles = { server: null, client: null };\n }\n\n const injectionValues: Record<string, unknown> = {\n __INTERFERE_BUILD_ID__: identity?.buildId ?? null,\n __INTERFERE_RELEASE_ID__: identity?.releaseId ?? null,\n __INTERFERE_ENVIRONMENT__: interfereConfig.environment,\n __INTERFERE_ENABLED__: interfereConfig.enabled,\n ...(interfere.features && { __INTERFERE_FEATURES__: interfere.features }),\n };\n\n return function buildConfig() {\n const env = {\n ...nextConfig.env,\n NEXT_PUBLIC_INTERFERE_ENVIRONMENT: interfereConfig.environment,\n ...(identity?.buildId\n ? { NEXT_PUBLIC_INTERFERE_BUILD_ID: identity.buildId }\n : {}),\n ...(identity?.releaseId\n ? { NEXT_PUBLIC_INTERFERE_RELEASE_ID: identity.releaseId }\n : {}),\n };\n\n const compiler = !interfereConfig.enabled\n ? nextConfig.compiler\n : {\n ...nextConfig.compiler,\n runAfterProductionCompile: async (ctx: {\n projectDir: string;\n distDir: string;\n }) => {\n const existingHook = nextConfig.compiler?.runAfterProductionCompile;\n if (existingHook) {\n await existingHook(ctx);\n }\n\n const scopedProgram = releaseProgram.pipe(\n Effect.provide(createReleaseLayers(interfereConfig)),\n Effect.scoped\n ) as Effect.Effect<unknown, unknown, never>;\n\n await Effect.runPromise(\n withInterfereLogger(\"next\", scopedProgram, { logger: nextBuildLogger })\n );\n },\n };\n\n const webpack = createWebpackConfig(nextConfig.webpack, instrumentationFiles, injectionValues);\n const turbopack = createTurbopackConfig(nextConfig.turbopack, instrumentationFiles.client, injectionValues);\n\n // Determine if we need to set instrumentationHook based on Next.js version\n const nextJsVersion = detectNextJsVersion();\n const experimental = buildExperimentalConfig(nextConfig.experimental, nextJsVersion);\n\n return {\n ...nextConfig,\n compiler,\n env,\n webpack,\n turbopack,\n productionBrowserSourceMaps: interfereConfig.enabled ? true : nextConfig.productionBrowserSourceMaps,\n experimental,\n };\n };\n}\n\n// Type extension for instrumentationHook which was removed from Next.js types\n// in newer versions but we still need to support for older Next.js versions\ntype ExperimentalConfigWithInstrumentationHook = NextConfig[\"experimental\"] & {\n instrumentationHook?: boolean;\n};\n\n/**\n * Builds the experimental config, conditionally including instrumentationHook\n * based on the detected Next.js version.\n */\nfunction buildExperimentalConfig(\n existingExperimental: NextConfig[\"experimental\"],\n nextJsVersion: string | undefined\n): ExperimentalConfigWithInstrumentationHook {\n // Cast to include the instrumentationHook property for older Next.js versions\n const existing = existingExperimental as ExperimentalConfigWithInstrumentationHook;\n\n // From Next.js version 15.0.0-canary.124 onwards, Next.js no longer requires\n // the `experimental.instrumentationHook` option and will print a warning when\n // it is set, so we need to conditionally provide it for lower versions.\n if (nextJsVersion && requiresInstrumentationHook(nextJsVersion)) {\n if (existing?.instrumentationHook === false) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ [@interfere/next] You turned off `experimental.instrumentationHook`.\\n\" +\n \" Note that Interfere will not be initialized if you did not set it up inside `instrumentation.(js|ts)`.\\n\"\n )\n );\n }\n return {\n ...existing,\n instrumentationHook: true,\n };\n }\n\n if (!nextJsVersion) {\n // If we cannot detect a Next.js version for whatever reason, the sensible\n // default is to set instrumentationHook, even though it may create a warning.\n if (existing && \"instrumentationHook\" in existing) {\n if (existing.instrumentationHook === false) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ [@interfere/next] You set `experimental.instrumentationHook` to `false`.\\n\" +\n \" If you are using Next.js 15+, you can remove that option.\\n\" +\n \" If you are using Next.js 14 or lower, you need to set it to `true` for the SDK to be properly initialized.\\n\"\n )\n );\n }\n // User has explicitly set the option, respect their choice\n return existing;\n }\n\n console.log(\n chalk.blue(\n \"\\n[@interfere/next] Could not determine your Next.js version.\\n\" +\n \" If you are using Next.js 15+, Next.js may show a warning about `experimental.instrumentationHook`.\\n\" +\n \" To silence it, explicitly set `experimental.instrumentationHook` to `undefined` in your next.config.\\n\" +\n \" If you are on Next.js 14 or lower, explicitly set it to `true`.\\n\"\n )\n );\n return {\n ...existing,\n instrumentationHook: true,\n };\n }\n\n // Next.js version detected and doesn't require the hook\n // Just return the existing experimental config without adding instrumentationHook\n return existing;\n}\n"],"mappings":";;;;;;;;;;;;;AAoEA,SAAS,oBACP,iBACA,sBACA,iBACuB;CACvB,MAAM,YAAY,CAAC,qBAAqB,QAAQ,qBAAqB,OAAO,CAAC,QAC1E,MAAmB,MAAM,KAC3B;AAED,KAAI,UAAU,WAAW,EACvB,QAAO,qBAAqB,WAAW;AAGzC,SAAQ,QAAQ,YAAY;EAC1B,MAAM,aAAaA,OAAK,QACtBA,OAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC,EAC5C,WACA,4BACD;EAED,MAAM,QAAuB,UAAU,KAAK,aAAa;GACvD,MAAM,iBAAiBA,OAAK,UAAU,SAAS;AAC/C,UAAO;IACL,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GACA;GACA,6BAA6B,gBAAgB,UAAU,OAAO,WAAW;GACzE;GACD;;;;;;;AAcL,SAAS,wBACP,sBACA,eAC2C;CAE3C,MAAM,WAAW;AAKjB,KAAI,iBAAiB,4BAA4B,cAAc,EAAE;AAC/D,MAAI,UAAU,wBAAwB,MACpC,SAAQ,KACN,MAAM,OACJ,0LAED,CACF;AAEH,SAAO;GACL,GAAG;GACH,qBAAqB;GACtB;;AAGH,KAAI,CAAC,eAAe;AAGlB,MAAI,YAAY,yBAAyB,UAAU;AACjD,OAAI,SAAS,wBAAwB,MACnC,SAAQ,KACN,MAAM,OACJ,gQAGD,CACF;AAGH,UAAO;;AAGT,UAAQ,IACN,MAAM,KACJ,sVAID,CACF;AACD,SAAO;GACL,GAAG;GACH,qBAAqB;GACtB;;AAKH,QAAO"}
1
+ {"version":3,"file":"with-interfere.mjs","names":["path"],"sources":["../../src/build/with-interfere.ts"],"sourcesContent":["import { withInterfereLogger } from \"@interfere/effect-utils/observability\";\nimport chalk from \"chalk\";\nimport { Cause, Effect, Option } from \"effect\";\nimport type { NextConfig } from \"next\";\nimport * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport type { Configuration as WebpackConfiguration, RuleSetRule } from \"webpack\";\nimport type { ValueInjectionLoaderOptions } from \"./loaders/value-injection-loader.js\";\nimport { nextBuildLogger } from \"./logger.js\";\nimport { detectNextJsVersion, requiresInstrumentationHook } from \"./nextjs-version.js\";\nimport { createReleaseLayers, releaseProgram } from \"./release-program.js\";\nimport {\n detectAndValidateInstrumentationSync,\n type InstrumentationFiles,\n} from \"./services/instrumentation-detection.service.js\";\nimport { PreflightService, PreflightServiceLive } from \"./services/preflight.service.js\";\nimport { ReleaseIdentityService, ReleaseIdentityServiceLive } from \"./services/release-identity.service.js\";\n\nexport type InterfereFeatures = {\n /**\n * Enable error tracking\n * @default true\n */\n errorTracking?: boolean;\n\n /**\n * Enable session replay\n * @default true in production, false in development\n */\n replay?: boolean;\n\n /**\n * Enable performance monitoring\n * @default true\n */\n performanceMonitoring?: boolean;\n};\n\nexport type InterfereOptions = {\n /**\n * Environment name\n * @default \"production\"\n */\n environment?: string;\n\n /**\n * Enable debug logging\n * @default false\n */\n debug?: boolean;\n\n /**\n * Whether to delete source maps after upload to prevent leakage\n * @default true\n */\n cleanupSourceMaps?: boolean;\n\n /**\n * Feature flags for the SDK.\n * These are injected at build time and available to the client SDK.\n */\n features?: InterfereFeatures;\n};\n\ntype NextConfigWithInterfere = NextConfig & {\n interfere?: InterfereOptions;\n};\n\nfunction getInterfereUsageMessage(error: unknown): string | null {\n const withCause = error as { cause?: unknown };\n const cause = withCause?.cause;\n if (cause === undefined) {\n return null;\n }\n const option = Cause.failureOption(cause as Cause.Cause<unknown>);\n if (option._tag !== \"Some\") {\n return null;\n }\n const first = option.value;\n if (\n first &&\n typeof first === \"object\" &&\n \"_tag\" in first &&\n first._tag === \"WithInterfereUsageError\" &&\n \"message\" in first &&\n typeof first.message === \"string\"\n ) {\n return first.message;\n }\n return null;\n}\n\nfunction createWebpackConfig(\n existingWebpack: NextConfig[\"webpack\"],\n instrumentationFiles: InstrumentationFiles,\n injectionValues: Record<string, unknown>\n): NextConfig[\"webpack\"] {\n const filePaths = [instrumentationFiles.client, instrumentationFiles.server].filter(\n (p): p is string => p !== null\n );\n\n if (filePaths.length === 0) {\n return existingWebpack ?? ((config) => config);\n }\n\n return (config, options) => {\n const loaderPath = path.resolve(\n path.dirname(fileURLToPath(import.meta.url)),\n \"loaders\",\n \"value-injection-loader.js\"\n );\n\n const rules: RuleSetRule[] = filePaths.map((filePath) => {\n const normalizedPath = path.normalize(filePath);\n return {\n test: (resource: string) =>\n resource ? path.normalize(resource) === normalizedPath : false,\n use: { loader: loaderPath, options: { values: injectionValues } satisfies ValueInjectionLoaderOptions },\n };\n });\n\n const resultConfig = existingWebpack ? existingWebpack(config, options) : config;\n const webpackConfig = resultConfig as WebpackConfiguration;\n webpackConfig.module = webpackConfig.module ?? {};\n webpackConfig.module.rules = webpackConfig.module.rules ?? [];\n webpackConfig.module.rules.push(...rules);\n\n return resultConfig;\n };\n}\n\n// JSONValue type from Next.js - doesn't allow null\ntype JSONValue = string | number | boolean | JSONValue[] | { [k: string]: JSONValue };\n\nfunction serializeForTurbopack(value: unknown): string {\n return JSON.stringify(value);\n}\n\nfunction createTurbopackConfig(\n existingTurbopack: NextConfig[\"turbopack\"],\n clientFilePath: string | null,\n injectionValues: Record<string, unknown>\n): NextConfig[\"turbopack\"] {\n const loaderPath = path.resolve(\n path.dirname(fileURLToPath(import.meta.url)),\n \"loaders\",\n \"value-injection-loader.js\"\n );\n\n const baseTurbopack = existingTurbopack ?? {};\n\n if (!clientFilePath) {\n return baseTurbopack;\n }\n\n const clientFileName = path.basename(clientFilePath);\n const serializedValues = serializeForTurbopack(injectionValues);\n\n return {\n ...baseTurbopack,\n rules: {\n ...baseTurbopack.rules,\n [`**/${clientFileName}`]: {\n loaders: [\n {\n loader: loaderPath,\n options: { serializedValues } as Record<string, JSONValue>,\n },\n ],\n },\n },\n };\n}\n\n/**\n * Next.js configuration wrapper that automatically uploads source maps in production builds\n *\n * SECURITY: API key must be set via INTERFERE_API_KEY env var (without NEXT_PUBLIC_ prefix)\n *\n * @example\n * ```js\n * // next.config.js\n * import { withInterfere } from '@interfere/next/config';\n *\n * export default withInterfere({\n * environment: 'staging',\n * debug: true,\n * cleanupSourceMaps: true\n * })({\n * // Your Next.js config\n * });\n * ```\n */\nexport function withInterfere({\n interfere = {},\n ...nextConfig\n}: NextConfigWithInterfere = {}): () => NextConfig | Promise<NextConfig> {\n const configProgram = Effect.gen(function* () {\n const preflight = yield* PreflightService;\n return yield* preflight.buildConfig(interfere);\n }).pipe(Effect.provide(PreflightServiceLive));\n\n return async function buildConfig(): Promise<NextConfig> {\n let interfereConfig;\n try {\n interfereConfig = await Effect.runPromise(configProgram);\n } catch (error: unknown) {\n const message = getInterfereUsageMessage(error);\n if (message) {\n console.error(\n chalk.red(\"\\n❌ Interfere configuration failed\\n\\n\") +\n chalk.red(\" \") +\n message +\n \"\\n\\n\" +\n chalk.dim(\" Ensure you are using the correct INTERFERE_API_KEY and that it is scoped to a surface;\\n\") +\n chalk.dim(\" the exchange API must be reachable from this environment.\\n\")\n );\n throw new Error(message);\n }\n throw error;\n }\n\n const identityProgram = Effect.gen(function* () {\n const identityEffect = yield* ReleaseIdentityService;\n return yield* identityEffect.pipe(Effect.option);\n }).pipe(\n Effect.provide(ReleaseIdentityServiceLive),\n Effect.runSync\n );\n \n const identity = Option.getOrUndefined(identityProgram);\n\n let instrumentationFiles: InstrumentationFiles;\n try {\n const { files, serverValidation } = detectAndValidateInstrumentationSync();\n instrumentationFiles = files;\n\n if (\n serverValidation.hasFile &&\n !serverValidation.hasOnRequestError &&\n interfereConfig.enabled\n ) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ Missing onRequestError export in instrumentation.ts\\n\\n\" +\n \" For comprehensive server-side error tracking, add:\\n\\n\" +\n chalk.cyan(\n \" import { captureRequestError } from '@interfere/next/server/on-request-error';\\n\\n\" +\n \" export async function onRequestError(error, request, context) {\\n\" +\n \" await captureRequestError({ error, request, context });\\n\" +\n \" }\\n\"\n ) +\n \"\\n This captures errors from React Server Components, SSR, API routes, and more.\\n\" +\n \" Learn more: https://nextjs.org/docs/app/api-reference/file-conventions/instrumentation\\n\"\n )\n );\n }\n } catch {\n instrumentationFiles = { server: null, client: null };\n }\n\n const injectionValues: Record<string, unknown> = {\n __INTERFERE_BUILD_ID__: identity?.buildId ?? null,\n __INTERFERE_RELEASE_ID__: identity?.releaseId ?? null,\n __INTERFERE_ENVIRONMENT__: interfereConfig.environment,\n __INTERFERE_ENABLED__: interfereConfig.enabled,\n ...(interfere.features && { __INTERFERE_FEATURES__: interfere.features }),\n ...(interfereConfig.enabled &&\n interfereConfig.surface && {\n __INTERFERE_SURFACE_SLUG__: interfereConfig.surface,\n }),\n };\n\n const env = {\n ...nextConfig.env,\n NEXT_PUBLIC_INTERFERE_ENVIRONMENT: interfereConfig.environment,\n ...(identity?.buildId\n ? { NEXT_PUBLIC_INTERFERE_BUILD_ID: identity.buildId }\n : {}),\n ...(identity?.releaseId\n ? { NEXT_PUBLIC_INTERFERE_RELEASE_ID: identity.releaseId }\n : {}),\n };\n\n const compiler = !interfereConfig.enabled\n ? nextConfig.compiler\n : {\n ...nextConfig.compiler,\n runAfterProductionCompile: async (ctx: {\n projectDir: string;\n distDir: string;\n }) => {\n const existingHook = nextConfig.compiler?.runAfterProductionCompile;\n if (existingHook) {\n await existingHook(ctx);\n }\n\n const scopedProgram = releaseProgram.pipe(\n Effect.provide(createReleaseLayers(interfereConfig)),\n Effect.scoped\n ) as Effect.Effect<unknown, unknown, never>;\n\n await Effect.runPromise(\n withInterfereLogger(\"next\", scopedProgram, {\n logger: nextBuildLogger,\n })\n );\n },\n };\n\n const webpack = createWebpackConfig(nextConfig.webpack, instrumentationFiles, injectionValues);\n const turbopack = createTurbopackConfig(nextConfig.turbopack, instrumentationFiles.client, injectionValues);\n\n const nextJsVersion = detectNextJsVersion();\n const experimental = buildExperimentalConfig(nextConfig.experimental, nextJsVersion);\n\n return {\n ...nextConfig,\n compiler,\n env,\n webpack,\n turbopack,\n productionBrowserSourceMaps: interfereConfig.enabled ? true : nextConfig.productionBrowserSourceMaps,\n experimental,\n };\n };\n}\n\n// Type extension for instrumentationHook which was removed from Next.js types\n// in newer versions but we still need to support for older Next.js versions\ntype ExperimentalConfigWithInstrumentationHook = NextConfig[\"experimental\"] & {\n instrumentationHook?: boolean;\n};\n\n/**\n * Builds the experimental config, conditionally including instrumentationHook\n * based on the detected Next.js version.\n */\nfunction buildExperimentalConfig(\n existingExperimental: NextConfig[\"experimental\"],\n nextJsVersion: string | undefined\n): ExperimentalConfigWithInstrumentationHook {\n // Cast to include the instrumentationHook property for older Next.js versions\n const existing = existingExperimental as ExperimentalConfigWithInstrumentationHook;\n\n // From Next.js version 15.0.0-canary.124 onwards, Next.js no longer requires\n // the `experimental.instrumentationHook` option and will print a warning when\n // it is set, so we need to conditionally provide it for lower versions.\n if (nextJsVersion && requiresInstrumentationHook(nextJsVersion)) {\n if (existing?.instrumentationHook === false) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ [@interfere/next] You turned off `experimental.instrumentationHook`.\\n\" +\n \" Note that Interfere will not be initialized if you did not set it up inside `instrumentation.(js|ts)`.\\n\"\n )\n );\n }\n return {\n ...existing,\n instrumentationHook: true,\n };\n }\n\n if (!nextJsVersion) {\n // If we cannot detect a Next.js version for whatever reason, the sensible\n // default is to set instrumentationHook, even though it may create a warning.\n if (existing && \"instrumentationHook\" in existing) {\n if (existing.instrumentationHook === false) {\n console.warn(\n chalk.yellow(\n \"\\n⚠️ [@interfere/next] You set `experimental.instrumentationHook` to `false`.\\n\" +\n \" If you are using Next.js 15+, you can remove that option.\\n\" +\n \" If you are using Next.js 14 or lower, you need to set it to `true` for the SDK to be properly initialized.\\n\"\n )\n );\n }\n // User has explicitly set the option, respect their choice\n return existing;\n }\n\n console.log(\n chalk.blue(\n \"\\n[@interfere/next] Could not determine your Next.js version.\\n\" +\n \" If you are using Next.js 15+, Next.js may show a warning about `experimental.instrumentationHook`.\\n\" +\n \" To silence it, explicitly set `experimental.instrumentationHook` to `undefined` in your next.config.\\n\" +\n \" If you are on Next.js 14 or lower, explicitly set it to `true`.\\n\"\n )\n );\n return {\n ...existing,\n instrumentationHook: true,\n };\n }\n\n // Next.js version detected and doesn't require the hook\n // Just return the existing experimental config without adding instrumentationHook\n return existing;\n}\n"],"mappings":";;;;;;;;;;;;;AAoEA,SAAS,yBAAyB,OAA+B;CAE/D,MAAM,QADY,OACO;AACzB,KAAI,UAAU,OACZ,QAAO;CAET,MAAM,SAAS,MAAM,cAAc,MAA8B;AACjE,KAAI,OAAO,SAAS,OAClB,QAAO;CAET,MAAM,QAAQ,OAAO;AACrB,KACE,SACA,OAAO,UAAU,YACjB,UAAU,SACV,MAAM,SAAS,6BACf,aAAa,SACb,OAAO,MAAM,YAAY,SAEzB,QAAO,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;GACL,GAAG;GACH,qBAAqB;GACtB;;AAKH,QAAO"}
@@ -6,8 +6,8 @@ import { Config } from "@interfere/types/sdk/config";
6
6
  */
7
7
  interface InjectedFeatures {
8
8
  errorTracking?: boolean;
9
- replay?: boolean;
10
9
  performanceMonitoring?: boolean;
10
+ replay?: boolean;
11
11
  }
12
12
  /**
13
13
  * Build-time injected values set by the value-injection-loader.
@@ -31,11 +31,11 @@ type InjectedConfigKey = (typeof INJECTED_CONFIG_KEYS)[number];
31
31
  * Partial config that can be provided by users to override injected values.
32
32
  */
33
33
  interface AutoInitConfigOverrides {
34
- features?: Config["features"];
35
34
  batch?: Config["batch"];
35
+ features?: Config["features"];
36
+ metadata?: Partial<Config["metadata"]>;
36
37
  offline?: Config["offline"];
37
38
  proxyUrl?: string;
38
- metadata?: Partial<Config["metadata"]>;
39
39
  }
40
40
  /**
41
41
  * Reads configuration from build-time injected values.
@@ -1 +1 @@
1
- {"version":3,"file":"auto-init.d.mts","names":[],"sources":["../../src/client/auto-init.ts"],"mappings":";;;;AAEwE;AAM9C;UAAhB,gBAAA;EAAA,aAAA;EAAA,MAAA;EAAA,qBAAA;AAAA;AAAA;AAAgB;;;AAAhB,QAAA,MAAA;EAAA,IAAA,sBAAA;EAAA,IAAA,wBAAA;EAAA,IAAA,yBAAA;EAAA,IAAA,qBAAA;EAAA,IAAA,sBAAA,EAoBoB,gBAAA;EAAA,IAAA,yBAAA;AAAA;AAAA;;;AAS9B;AAT8B,cASjB,oBAAA;AAAA,KAQD,iBAAA,WAA4B,oBAAA;AAAA;AAKxC;;AALwC,UAKvB,uBAAA;EAAA,QAAA,GACJ,MAAA;EAAA,KAAA,GACH,MAAA;EAAA,OAAA,GACE,MAAA;EAAA,QAAA;EAAA,QAAA,GAEC,OAAA,CAAQ,MAAA;AAAA;AAAA;;;AAWrB;AAmEA;AAkDA;AAQA;;AAxIqB,iBAWL,iBAAA,CAAA,GAAqB,OAAA,CAAQ,MAAA;AAAA;AAmE7C;AAkDA;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA7H6C,iBAmE7B,cAAA,CAAA,UAAA,GACD,uBAAA,GACZ,MAAA;AAAA;AAgDH;AAQA;AAxDG,iBAgDa,aAAA,CAAA;AAAA;AAQhB;;;AARgB,iBAQA,wBAAA,CAAA"}
1
+ {"version":3,"file":"auto-init.d.mts","names":[],"sources":["../../src/client/auto-init.ts"],"mappings":";;;;;AAEwE;UAM9D,gBAAA;EACR,aAAA;EACA,qBAAA;EACA,MAAA;AAAA;;;;AAAM;QAOA,MAAA;EAAA,IAEF,sBAAA;EAAA,IAEA,wBAAA;EAAA,IAEA,yBAAA;EAAA,IAEA,qBAAA;EAAA,IAEA,sBAAA,EAAwB,gBAAA;EAAA,IAExB,yBAAA;AAAA;;;;;cAOO,oBAAA;AAAA,KAQD,iBAAA,WAA4B,oBAAA;AARxC;;;AAAA,UAaiB,uBAAA;EACf,KAAA,GAAQ,MAAA;EACR,QAAA,GAAW,MAAA;EACX,QAAA,GAAW,OAAA,CAAQ,MAAA;EACnB,OAAA,GAAU,MAAA;EACV,QAAA;AAAA;AALF;;;;;;;;AAAA,iBAgBgB,iBAAA,CAAA,GAAqB,OAAA,CAAQ,MAAA;;;;;;;;;;;;;;AAA7C;;;;;AAmEA;;;;;;;;;AAkDA;;;;iBAlDgB,cAAA,CACd,UAAA,GAAa,uBAAA,GACZ,MAAA;AAwDH;;;AAAA,iBARgB,aAAA,CAAA;;;;;iBAQA,wBAAA,CAAA"}
@@ -81,7 +81,7 @@ function autoInitClient(userConfig) {
81
81
  }
82
82
  const injectedConfig = getInjectedConfig();
83
83
  if (!injectedConfig) {
84
- if (process.env.NODE_ENV === "development") console.info("[Interfere] No injected config found. SDK disabled. Ensure INTERFERE_SECRET_KEY is set and withInterfere() is configured.");
84
+ if (process.env.NODE_ENV === "development") console.info("[Interfere] No injected config found. SDK disabled. Ensure INTERFERE_API_KEY is set and withInterfere() is configured.");
85
85
  return null;
86
86
  }
87
87
  const mergedConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"auto-init.mjs","names":[],"sources":["../../src/client/auto-init.ts"],"sourcesContent":["\"use client\";\n\nimport { type Config, configSchema } from \"@interfere/types/sdk/config\";\nimport { envSchema } from \"@interfere/types/sdk/runtime\";\n\n/**\n * Feature flags that can be injected at build time.\n */\ninterface InjectedFeatures {\n errorTracking?: boolean;\n replay?: boolean;\n performanceMonitoring?: boolean;\n}\n\n/**\n * Build-time injected values set by the value-injection-loader.\n * These are populated when instrumentation-client.ts is processed during build.\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __INTERFERE_BUILD_ID__: string | null | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_RELEASE_ID__: string | null | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_ENVIRONMENT__: string | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_ENABLED__: boolean | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_FEATURES__: InjectedFeatures | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_INITIALIZED__: boolean | undefined;\n}\n\n/**\n * The injected config keys that the value-injection-loader sets.\n * This is the canonical list of keys - keep in sync with withInterfere.\n */\nexport const INJECTED_CONFIG_KEYS = [\n \"__INTERFERE_BUILD_ID__\",\n \"__INTERFERE_RELEASE_ID__\",\n \"__INTERFERE_ENVIRONMENT__\",\n \"__INTERFERE_ENABLED__\",\n \"__INTERFERE_FEATURES__\",\n] as const;\n\nexport type InjectedConfigKey = (typeof INJECTED_CONFIG_KEYS)[number];\n\n/**\n * Partial config that can be provided by users to override injected values.\n */\nexport interface AutoInitConfigOverrides {\n features?: Config[\"features\"];\n batch?: Config[\"batch\"];\n offline?: Config[\"offline\"];\n proxyUrl?: string;\n metadata?: Partial<Config[\"metadata\"]>;\n}\n\n/**\n * Reads configuration from build-time injected values.\n *\n * The value-injection-loader prepends code to instrumentation-client.ts\n * that sets these globalThis values during the build process.\n *\n * @returns Partial config from injected values, or null if SDK is disabled\n */\nexport function getInjectedConfig(): Partial<Config> | null {\n if (typeof globalThis === \"undefined\") {\n return null;\n }\n\n const buildId = globalThis.__INTERFERE_BUILD_ID__;\n const releaseId = globalThis.__INTERFERE_RELEASE_ID__;\n const environmentRaw = globalThis.__INTERFERE_ENVIRONMENT__;\n const enabled = globalThis.__INTERFERE_ENABLED__;\n const features = globalThis.__INTERFERE_FEATURES__;\n\n // If not enabled, SDK was disabled (no valid INTERFERE_SECRET_KEY was set)\n if (!enabled) {\n return null;\n }\n\n // Parse environment with fallback\n const environment = environmentRaw\n ? (envSchema.safeParse(environmentRaw).data ?? \"production\")\n : \"production\";\n\n // For Next.js, we always use proxy mode - the proxy handles authentication\n // This means the client doesn't need the surface token at all\n return {\n metadata: {\n buildId: buildId ?? null,\n releaseId: releaseId ?? null,\n environment,\n runtime: \"browser\",\n },\n proxyUrl: \"/api/interfere\",\n // Include features if they were injected\n ...(features && { features }),\n };\n}\n\n/**\n * Initialize Interfere client automatically from build-time injected config.\n *\n * Call this from instrumentation-client.ts for zero-config initialization.\n * User-provided overrides take precedence over injected values.\n *\n * @param userConfig - Optional configuration overrides\n * @returns Parsed config if initialization succeeded, null if SDK is disabled or already initialized\n *\n * @example\n * ```ts\n * // instrumentation-client.ts\n * import { autoInitClient } from \"@interfere/next/auto-init\";\n *\n * const config = autoInitClient();\n * if (config) {\n * console.log(\"[Interfere] Client initialized\", config.metadata);\n * }\n * ```\n *\n * @example\n * ```ts\n * // With overrides\n * import { autoInitClient } from \"@interfere/next/auto-init\";\n *\n * const config = autoInitClient({\n * features: { replay: false },\n * batch: { size: 25, ms: 500 }\n * });\n * ```\n */\nexport function autoInitClient(\n userConfig?: AutoInitConfigOverrides\n): Config | null {\n // Prevent double initialization\n if (globalThis.__INTERFERE_INITIALIZED__) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\"[Interfere] Already initialized, skipping duplicate init\");\n }\n return null;\n }\n\n const injectedConfig = getInjectedConfig();\n if (!injectedConfig) {\n if (process.env.NODE_ENV === \"development\") {\n console.info(\n \"[Interfere] No injected config found. SDK disabled. \" +\n \"Ensure INTERFERE_SECRET_KEY is set and withInterfere() is configured.\"\n );\n }\n return null;\n }\n\n // Merge injected config with user overrides\n // User overrides take precedence\n const mergedConfig = {\n ...injectedConfig,\n ...(userConfig?.features && { features: userConfig.features }),\n ...(userConfig?.batch && { batch: userConfig.batch }),\n ...(userConfig?.offline && { offline: userConfig.offline }),\n ...(userConfig?.proxyUrl && { proxyUrl: userConfig.proxyUrl }),\n metadata: {\n ...injectedConfig.metadata,\n ...userConfig?.metadata,\n },\n };\n\n // Validate and parse the merged config\n const parseResult = configSchema.safeParse(mergedConfig);\n if (!parseResult.success) {\n console.error(\"[Interfere] Failed to parse config:\", parseResult.error);\n return null;\n }\n\n globalThis.__INTERFERE_INITIALIZED__ = true;\n return parseResult.data;\n}\n\n/**\n * Check if Interfere has already been initialized.\n */\nexport function isInitialized(): boolean {\n return globalThis.__INTERFERE_INITIALIZED__ === true;\n}\n\n/**\n * Reset initialization state. Only use for testing.\n * @internal\n */\nexport function resetInitializationState(): void {\n globalThis.__INTERFERE_INITIALIZED__ = undefined;\n}\n"],"mappings":";;;;;;;;;;AAqCA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACD;;;;;;;;;AAuBD,SAAgB,oBAA4C;AAC1D,KAAI,OAAO,eAAe,YACxB,QAAO;CAGT,MAAM,UAAU,WAAW;CAC3B,MAAM,YAAY,WAAW;CAC7B,MAAM,iBAAiB,WAAW;CAClC,MAAM,UAAU,WAAW;CAC3B,MAAM,WAAW,WAAW;AAG5B,KAAI,CAAC,QACH,QAAO;CAIT,MAAM,cAAc,iBACf,UAAU,UAAU,eAAe,CAAC,QAAQ,eAC7C;AAIJ,QAAO;EACL,UAAU;GACR,SAAS,WAAW;GACpB,WAAW,aAAa;GACxB;GACA,SAAS;GACV;EACD,UAAU;EAEV,GAAI,YAAY,EAAE,UAAU;EAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH,SAAgB,eACd,YACe;AAEf,KAAI,WAAW,2BAA2B;AACxC,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KAAK,2DAA2D;AAE1E,SAAO;;CAGT,MAAM,iBAAiB,mBAAmB;AAC1C,KAAI,CAAC,gBAAgB;AACnB,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KACN,4HAED;AAEH,SAAO;;CAKT,MAAM,eAAe;EACnB,GAAG;EACH,GAAI,YAAY,YAAY,EAAE,UAAU,WAAW,UAAU;EAC7D,GAAI,YAAY,SAAS,EAAE,OAAO,WAAW,OAAO;EACpD,GAAI,YAAY,WAAW,EAAE,SAAS,WAAW,SAAS;EAC1D,GAAI,YAAY,YAAY,EAAE,UAAU,WAAW,UAAU;EAC7D,UAAU;GACR,GAAG,eAAe;GAClB,GAAG,YAAY;GAChB;EACF;CAGD,MAAM,cAAc,aAAa,UAAU,aAAa;AACxD,KAAI,CAAC,YAAY,SAAS;AACxB,UAAQ,MAAM,uCAAuC,YAAY,MAAM;AACvE,SAAO;;AAGT,YAAW,4BAA4B;AACvC,QAAO,YAAY;;;;;AAMrB,SAAgB,gBAAyB;AACvC,QAAO,WAAW,8BAA8B;;;;;;AAOlD,SAAgB,2BAAiC;AAC/C,YAAW,4BAA4B"}
1
+ {"version":3,"file":"auto-init.mjs","names":[],"sources":["../../src/client/auto-init.ts"],"sourcesContent":["\"use client\";\n\nimport { type Config, configSchema } from \"@interfere/types/sdk/config\";\nimport { envSchema } from \"@interfere/types/sdk/runtime\";\n\n/**\n * Feature flags that can be injected at build time.\n */\ninterface InjectedFeatures {\n errorTracking?: boolean;\n performanceMonitoring?: boolean;\n replay?: boolean;\n}\n\n/**\n * Build-time injected values set by the value-injection-loader.\n * These are populated when instrumentation-client.ts is processed during build.\n */\ndeclare global {\n // eslint-disable-next-line no-var\n var __INTERFERE_BUILD_ID__: string | null | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_RELEASE_ID__: string | null | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_ENVIRONMENT__: string | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_ENABLED__: boolean | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_FEATURES__: InjectedFeatures | undefined;\n // eslint-disable-next-line no-var\n var __INTERFERE_INITIALIZED__: boolean | undefined;\n}\n\n/**\n * The injected config keys that the value-injection-loader sets.\n * This is the canonical list of keys - keep in sync with withInterfere.\n */\nexport const INJECTED_CONFIG_KEYS = [\n \"__INTERFERE_BUILD_ID__\",\n \"__INTERFERE_RELEASE_ID__\",\n \"__INTERFERE_ENVIRONMENT__\",\n \"__INTERFERE_ENABLED__\",\n \"__INTERFERE_FEATURES__\",\n] as const;\n\nexport type InjectedConfigKey = (typeof INJECTED_CONFIG_KEYS)[number];\n\n/**\n * Partial config that can be provided by users to override injected values.\n */\nexport interface AutoInitConfigOverrides {\n batch?: Config[\"batch\"];\n features?: Config[\"features\"];\n metadata?: Partial<Config[\"metadata\"]>;\n offline?: Config[\"offline\"];\n proxyUrl?: string;\n}\n\n/**\n * Reads configuration from build-time injected values.\n *\n * The value-injection-loader prepends code to instrumentation-client.ts\n * that sets these globalThis values during the build process.\n *\n * @returns Partial config from injected values, or null if SDK is disabled\n */\nexport function getInjectedConfig(): Partial<Config> | null {\n if (typeof globalThis === \"undefined\") {\n return null;\n }\n\n const buildId = globalThis.__INTERFERE_BUILD_ID__;\n const releaseId = globalThis.__INTERFERE_RELEASE_ID__;\n const environmentRaw = globalThis.__INTERFERE_ENVIRONMENT__;\n const enabled = globalThis.__INTERFERE_ENABLED__;\n const features = globalThis.__INTERFERE_FEATURES__;\n\n // If not enabled, SDK was disabled (no valid INTERFERE_API_KEY was set at build)\n if (!enabled) {\n return null;\n }\n\n // Parse environment with fallback\n const environment = environmentRaw\n ? (envSchema.safeParse(environmentRaw).data ?? \"production\")\n : \"production\";\n\n // For Next.js, we always use proxy mode - the proxy handles authentication\n // This means the client doesn't need the surface token at all\n return {\n metadata: {\n buildId: buildId ?? null,\n releaseId: releaseId ?? null,\n environment,\n runtime: \"browser\",\n },\n proxyUrl: \"/api/interfere\",\n // Include features if they were injected\n ...(features && { features }),\n };\n}\n\n/**\n * Initialize Interfere client automatically from build-time injected config.\n *\n * Call this from instrumentation-client.ts for zero-config initialization.\n * User-provided overrides take precedence over injected values.\n *\n * @param userConfig - Optional configuration overrides\n * @returns Parsed config if initialization succeeded, null if SDK is disabled or already initialized\n *\n * @example\n * ```ts\n * // instrumentation-client.ts\n * import { autoInitClient } from \"@interfere/next/auto-init\";\n *\n * const config = autoInitClient();\n * if (config) {\n * console.log(\"[Interfere] Client initialized\", config.metadata);\n * }\n * ```\n *\n * @example\n * ```ts\n * // With overrides\n * import { autoInitClient } from \"@interfere/next/auto-init\";\n *\n * const config = autoInitClient({\n * features: { replay: false },\n * batch: { size: 25, ms: 500 }\n * });\n * ```\n */\nexport function autoInitClient(\n userConfig?: AutoInitConfigOverrides\n): Config | null {\n // Prevent double initialization\n if (globalThis.__INTERFERE_INITIALIZED__) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\"[Interfere] Already initialized, skipping duplicate init\");\n }\n return null;\n }\n\n const injectedConfig = getInjectedConfig();\n if (!injectedConfig) {\n if (process.env.NODE_ENV === \"development\") {\n console.info(\n \"[Interfere] No injected config found. SDK disabled. \" +\n \"Ensure INTERFERE_API_KEY is set and withInterfere() is configured.\"\n );\n }\n return null;\n }\n\n // Merge injected config with user overrides\n // User overrides take precedence\n const mergedConfig = {\n ...injectedConfig,\n ...(userConfig?.features && { features: userConfig.features }),\n ...(userConfig?.batch && { batch: userConfig.batch }),\n ...(userConfig?.offline && { offline: userConfig.offline }),\n ...(userConfig?.proxyUrl && { proxyUrl: userConfig.proxyUrl }),\n metadata: {\n ...injectedConfig.metadata,\n ...userConfig?.metadata,\n },\n };\n\n // Validate and parse the merged config\n const parseResult = configSchema.safeParse(mergedConfig);\n if (!parseResult.success) {\n console.error(\"[Interfere] Failed to parse config:\", parseResult.error);\n return null;\n }\n\n globalThis.__INTERFERE_INITIALIZED__ = true;\n return parseResult.data;\n}\n\n/**\n * Check if Interfere has already been initialized.\n */\nexport function isInitialized(): boolean {\n return globalThis.__INTERFERE_INITIALIZED__ === true;\n}\n\n/**\n * Reset initialization state. Only use for testing.\n * @internal\n */\nexport function resetInitializationState(): void {\n globalThis.__INTERFERE_INITIALIZED__ = undefined;\n}\n"],"mappings":";;;;;;;;;;AAqCA,MAAa,uBAAuB;CAClC;CACA;CACA;CACA;CACA;CACD;;;;;;;;;AAuBD,SAAgB,oBAA4C;AAC1D,KAAI,OAAO,eAAe,YACxB,QAAO;CAGT,MAAM,UAAU,WAAW;CAC3B,MAAM,YAAY,WAAW;CAC7B,MAAM,iBAAiB,WAAW;CAClC,MAAM,UAAU,WAAW;CAC3B,MAAM,WAAW,WAAW;AAG5B,KAAI,CAAC,QACH,QAAO;CAIT,MAAM,cAAc,iBACf,UAAU,UAAU,eAAe,CAAC,QAAQ,eAC7C;AAIJ,QAAO;EACL,UAAU;GACR,SAAS,WAAW;GACpB,WAAW,aAAa;GACxB;GACA,SAAS;GACV;EACD,UAAU;EAEV,GAAI,YAAY,EAAE,UAAU;EAC7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCH,SAAgB,eACd,YACe;AAEf,KAAI,WAAW,2BAA2B;AACxC,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KAAK,2DAA2D;AAE1E,SAAO;;CAGT,MAAM,iBAAiB,mBAAmB;AAC1C,KAAI,CAAC,gBAAgB;AACnB,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KACN,yHAED;AAEH,SAAO;;CAKT,MAAM,eAAe;EACnB,GAAG;EACH,GAAI,YAAY,YAAY,EAAE,UAAU,WAAW,UAAU;EAC7D,GAAI,YAAY,SAAS,EAAE,OAAO,WAAW,OAAO;EACpD,GAAI,YAAY,WAAW,EAAE,SAAS,WAAW,SAAS;EAC1D,GAAI,YAAY,YAAY,EAAE,UAAU,WAAW,UAAU;EAC7D,UAAU;GACR,GAAG,eAAe;GAClB,GAAG,YAAY;GAChB;EACF;CAGD,MAAM,cAAc,aAAa,UAAU,aAAa;AACxD,KAAI,CAAC,YAAY,SAAS;AACxB,UAAQ,MAAM,uCAAuC,YAAY,MAAM;AACvE,SAAO;;AAGT,YAAW,4BAA4B;AACvC,QAAO,YAAY;;;;;AAMrB,SAAgB,gBAAyB;AACvC,QAAO,WAAW,8BAA8B;;;;;;AAOlD,SAAgB,2BAAiC;AAC/C,YAAW,4BAA4B"}
@@ -4,11 +4,11 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/client/provider.d.ts
6
6
  interface NextConfigInput {
7
+ batch?: ConfigInput["batch"];
7
8
  features?: ConfigInput["features"];
9
+ ingestUrl?: string;
8
10
  metadata?: ConfigInput["metadata"];
9
- batch?: ConfigInput["batch"];
10
11
  proxyUrl?: string;
11
- ingestUrl?: string;
12
12
  surfaceToken?: string;
13
13
  }
14
14
  declare function InterfereProvider({
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.mts","names":[],"sources":["../../src/client/provider.tsx"],"mappings":";;;;;UA2CU,eAAA;EAAA,QAAA,GACG,WAAA;EAAA,QAAA,GACA,WAAA;EAAA,KAAA,GACH,WAAA;EAAA,QAAA;EAAA,SAAA;EAAA,YAAA;AAAA;AAAA,iBAiCM,iBAAA,CAAA;EAAA,QAAA;EAAA,MAAA;EAAA,GAAA;AAAA,GAIb,IAAA,CAAK,sBAAA;EAAA,MAAA,GAA+C,eAAA;AAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
1
+ {"version":3,"file":"provider.d.mts","names":[],"sources":["../../src/client/provider.tsx"],"mappings":";;;;;UA2CU,eAAA;EACR,KAAA,GAAQ,WAAA;EACR,QAAA,GAAW,WAAA;EACX,SAAA;EACA,QAAA,GAAW,WAAA;EACX,QAAA;EACA,YAAA;AAAA;AAAA,iBA8Bc,iBAAA,CAAA;EACd,QAAA;EACA,MAAA;EAAA,GACG;AAAA,GACF,IAAA,CAAK,sBAAA;EAAsC,MAAA,GAAS,eAAA;AAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider.mjs","names":["InterfereProviderReact"],"sources":["../../src/client/provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { getRuntime } from \"@interfere/react/core/runtime/config\";\nimport {\n type InterfereProviderProps,\n InterfereProvider as InterfereProviderReact,\n} from \"@interfere/react/provider\";\nimport {\n type Config,\n type ConfigInput,\n configSchema,\n} from \"@interfere/types/sdk/config\";\nimport { envSchema } from \"@interfere/types/sdk/runtime\";\n\nimport { getInjectedConfig } from \"./auto-init.js\";\n\n/**\n * Get default metadata from environment variables (legacy approach)\n * or from injected config (instrumentation approach).\n */\nfunction getDefaultMetadata(): ConfigInput[\"metadata\"] {\n // First, try to get injected config from instrumentation-client.ts\n const injectedConfig = getInjectedConfig();\n if (injectedConfig?.metadata) {\n return {\n ...injectedConfig.metadata,\n runtime: getRuntime(),\n };\n }\n\n // Fallback to environment variables (legacy approach)\n return {\n buildId: process.env.NEXT_PUBLIC_INTERFERE_BUILD_ID ?? null,\n releaseId: process.env.NEXT_PUBLIC_INTERFERE_RELEASE_ID ?? null,\n environment: process.env.NEXT_PUBLIC_INTERFERE_ENVIRONMENT\n ? envSchema.parse(process.env.NEXT_PUBLIC_INTERFERE_ENVIRONMENT)\n : \"production\",\n runtime: getRuntime(),\n };\n}\n\n// Next.js-specific config type that allows omitting transport\n// because Next.js can provide its own proxy endpoint\ninterface NextConfigInput {\n features?: ConfigInput[\"features\"];\n metadata?: ConfigInput[\"metadata\"];\n batch?: ConfigInput[\"batch\"];\n proxyUrl?: string;\n ingestUrl?: string;\n surfaceToken?: string;\n}\n\nfunction mergeConfig(config: NextConfigInput): Config {\n const defaults = getDefaultMetadata();\n const incomingMeta = config.metadata ?? {};\n\n // Determine transport config:\n // - If they explicitly set proxyUrl, use proxy mode\n // - If they set ingestUrl or surfaceToken, use direct mode (let schema validate)\n // - Otherwise, default to Next.js proxy\n const hasTransportConfig =\n typeof config.proxyUrl !== \"undefined\" ||\n typeof config.ingestUrl !== \"undefined\" ||\n typeof config.surfaceToken !== \"undefined\";\n\n const transportConfig = hasTransportConfig\n ? config\n : { proxyUrl: \"/api/interfere\" }; // Default Next.js proxy endpoint\n\n return configSchema.parse({\n ...transportConfig,\n ...config,\n metadata: {\n ...defaults,\n ...incomingMeta,\n },\n });\n}\n\nexport function InterfereProvider({\n children,\n config = {},\n ...rest\n}: Omit<InterfereProviderProps, \"config\"> & { config?: NextConfigInput }) {\n const mergedConfig = mergeConfig(config);\n\n return (\n <InterfereProviderReact config={mergedConfig} {...rest}>\n {children}\n </InterfereProviderReact>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAS,qBAA8C;CAErD,MAAM,iBAAiB,mBAAmB;AAC1C,KAAI,gBAAgB,SAClB,QAAO;EACL,GAAG,eAAe;EAClB,SAAS,YAAY;EACtB;AAIH,QAAO;EACL,SAAS,QAAQ,IAAI,kCAAkC;EACvD,WAAW,QAAQ,IAAI,oCAAoC;EAC3D,aAAa,QAAQ,IAAI,oCACrB,UAAU,MAAM,QAAQ,IAAI,kCAAkC,GAC9D;EACJ,SAAS,YAAY;EACtB;;AAcH,SAAS,YAAY,QAAiC;CACpD,MAAM,WAAW,oBAAoB;CACrC,MAAM,eAAe,OAAO,YAAY,EAAE;CAW1C,MAAM,kBAJJ,OAAO,OAAO,aAAa,eAC3B,OAAO,OAAO,cAAc,eAC5B,OAAO,OAAO,iBAAiB,cAG7B,SACA,EAAE,UAAU,kBAAkB;AAElC,QAAO,aAAa,MAAM;EACxB,GAAG;EACH,GAAG;EACH,UAAU;GACR,GAAG;GACH,GAAG;GACJ;EACF,CAAC;;AAGJ,SAAgB,kBAAkB,EAChC,UACA,SAAS,EAAE,EACX,GAAG,QACqE;AAGxE,QACE,oBAACA;EAAuB,QAHL,YAAY,OAAO;EAGQ,GAAI;EAC/C;GACsB"}
1
+ {"version":3,"file":"provider.mjs","names":["InterfereProviderReact"],"sources":["../../src/client/provider.tsx"],"sourcesContent":["\"use client\";\n\nimport { getRuntime } from \"@interfere/react/core/runtime/config\";\nimport {\n type InterfereProviderProps,\n InterfereProvider as InterfereProviderReact,\n} from \"@interfere/react/provider\";\nimport {\n type Config,\n type ConfigInput,\n configSchema,\n} from \"@interfere/types/sdk/config\";\nimport { envSchema } from \"@interfere/types/sdk/runtime\";\n\nimport { getInjectedConfig } from \"./auto-init.js\";\n\n/**\n * Get default metadata from environment variables (legacy approach)\n * or from injected config (instrumentation approach).\n */\nfunction getDefaultMetadata(): ConfigInput[\"metadata\"] {\n // First, try to get injected config from instrumentation-client.ts\n const injectedConfig = getInjectedConfig();\n if (injectedConfig?.metadata) {\n return {\n ...injectedConfig.metadata,\n runtime: getRuntime(),\n };\n }\n\n // Fallback to environment variables (legacy approach)\n return {\n buildId: process.env.NEXT_PUBLIC_INTERFERE_BUILD_ID ?? null,\n releaseId: process.env.NEXT_PUBLIC_INTERFERE_RELEASE_ID ?? null,\n environment: process.env.NEXT_PUBLIC_INTERFERE_ENVIRONMENT\n ? envSchema.parse(process.env.NEXT_PUBLIC_INTERFERE_ENVIRONMENT)\n : \"production\",\n runtime: getRuntime(),\n };\n}\n\n// Next.js-specific config type that allows omitting transport\n// because Next.js can provide its own proxy endpoint\ninterface NextConfigInput {\n batch?: ConfigInput[\"batch\"];\n features?: ConfigInput[\"features\"];\n ingestUrl?: string;\n metadata?: ConfigInput[\"metadata\"];\n proxyUrl?: string;\n surfaceToken?: string;\n}\n\nfunction mergeConfig(config: NextConfigInput): Config {\n const defaults = getDefaultMetadata();\n const incomingMeta = config.metadata ?? {};\n\n // Determine transport config:\n // - If they explicitly set proxyUrl, use proxy mode\n // - If they set ingestUrl or surfaceToken, use direct mode (let schema validate)\n // - Otherwise, default to Next.js proxy\n const hasTransportConfig =\n typeof config.proxyUrl !== \"undefined\" ||\n typeof config.ingestUrl !== \"undefined\" ||\n typeof config.surfaceToken !== \"undefined\";\n\n const transportConfig = hasTransportConfig\n ? config\n : { proxyUrl: \"/api/interfere\" }; // Default Next.js proxy endpoint\n\n return configSchema.parse({\n ...transportConfig,\n ...config,\n metadata: {\n ...defaults,\n ...incomingMeta,\n },\n });\n}\n\nexport function InterfereProvider({\n children,\n config = {},\n ...rest\n}: Omit<InterfereProviderProps, \"config\"> & { config?: NextConfigInput }) {\n const mergedConfig = mergeConfig(config);\n\n return (\n <InterfereProviderReact config={mergedConfig} {...rest}>\n {children}\n </InterfereProviderReact>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAoBA,SAAS,qBAA8C;CAErD,MAAM,iBAAiB,mBAAmB;AAC1C,KAAI,gBAAgB,SAClB,QAAO;EACL,GAAG,eAAe;EAClB,SAAS,YAAY;EACtB;AAIH,QAAO;EACL,SAAS,QAAQ,IAAI,kCAAkC;EACvD,WAAW,QAAQ,IAAI,oCAAoC;EAC3D,aAAa,QAAQ,IAAI,oCACrB,UAAU,MAAM,QAAQ,IAAI,kCAAkC,GAC9D;EACJ,SAAS,YAAY;EACtB;;AAcH,SAAS,YAAY,QAAiC;CACpD,MAAM,WAAW,oBAAoB;CACrC,MAAM,eAAe,OAAO,YAAY,EAAE;CAW1C,MAAM,kBAJJ,OAAO,OAAO,aAAa,eAC3B,OAAO,OAAO,cAAc,eAC5B,OAAO,OAAO,iBAAiB,cAG7B,SACA,EAAE,UAAU,kBAAkB;AAElC,QAAO,aAAa,MAAM;EACxB,GAAG;EACH,GAAG;EACH,UAAU;GACR,GAAG;GACH,GAAG;GACJ;EACF,CAAC;;AAGJ,SAAgB,kBAAkB,EAChC,UACA,SAAS,EAAE,EACX,GAAG,QACqE;AAGxE,QACE,oBAACA;EAAuB,QAHL,YAAY,OAAO;EAGQ,GAAI;EAC/C;GACsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/lib/env.ts"],"mappings":";;AAQA;AAQA;;;;;iBARgB,aAAA,CAAA;AAAA,iBAQA,eAAA,CAAA"}
1
+ {"version":3,"file":"env.d.mts","names":[],"sources":["../../src/lib/env.ts"],"mappings":";;AAQA;;;;;AAQA;iBARgB,aAAA,CAAA;AAAA,iBAQA,eAAA,CAAA"}
@@ -4,18 +4,18 @@ type NonEmptyString = string & {
4
4
  };
5
5
  declare function toNonEmptyString(value: string): NonEmptyString | null;
6
6
  interface PreflightEnabled {
7
+ apiKey: NonEmptyString;
8
+ cleanupSourceMaps: boolean;
9
+ debug: boolean;
7
10
  enabled: true;
8
- surface: NonEmptyString;
9
- secretKey: NonEmptyString;
10
11
  environment: string;
11
- debug: boolean;
12
- cleanupSourceMaps: boolean;
12
+ surface: NonEmptyString;
13
13
  }
14
14
  interface PreflightDisabled {
15
+ cleanupSourceMaps: boolean;
16
+ debug: boolean;
15
17
  enabled: false;
16
18
  environment: string | undefined;
17
- debug: boolean;
18
- cleanupSourceMaps: boolean;
19
19
  }
20
20
  type PreflightConfig = PreflightEnabled | PreflightDisabled;
21
21
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/lib/types.ts"],"mappings":";KACY,cAAA;EAAA,SAAA,OAAA;AAAA;AAAA,iBAEI,gBAAA,CAAA,KAAA,WAAiC,cAAA;AAAA,UAIhC,gBAAA;EAAA,OAAA;EAAA,OAAA,EAEN,cAAA;EAAA,SAAA,EACE,cAAA;EAAA,WAAA;EAAA,KAAA;EAAA,iBAAA;AAAA;AAAA,UAMI,iBAAA;EAAA,OAAA;EAAA,WAAA;EAAA,KAAA;EAAA,iBAAA;AAAA;AAAA,KAOL,eAAA,GAAkB,gBAAA,GAAmB,iBAAA"}
1
+ {"version":3,"file":"types.d.mts","names":[],"sources":["../../src/lib/types.ts"],"mappings":";KACY,cAAA;EAAA,SAAqC,OAAA;AAAA;AAAA,iBAEjC,gBAAA,CAAiB,KAAA,WAAgB,cAAA;AAAA,UAIhC,gBAAA;EACf,MAAA,EAAQ,cAAA;EACR,iBAAA;EACA,KAAA;EACA,OAAA;EACA,WAAA;EACA,OAAA,EAAS,cAAA;AAAA;AAAA,UAGM,iBAAA;EACf,iBAAA;EACA,KAAA;EACA,OAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA,GAAkB,gBAAA,GAAmB,iBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.mjs","names":[],"sources":["../../src/lib/types.ts"],"sourcesContent":["// Branded non-empty string type to prevent passing empty strings accidentally\nexport type NonEmptyString = string & { readonly __brand: unique symbol };\n\nexport function toNonEmptyString(value: string): NonEmptyString | null {\n return value.length > 0 ? (value as NonEmptyString) : null;\n}\n\nexport interface PreflightEnabled {\n enabled: true;\n surface: NonEmptyString;\n secretKey: NonEmptyString;\n environment: string;\n debug: boolean;\n cleanupSourceMaps: boolean;\n}\n\nexport interface PreflightDisabled {\n enabled: false;\n environment: string | undefined;\n debug: boolean;\n cleanupSourceMaps: boolean;\n}\n\nexport type PreflightConfig = PreflightEnabled | PreflightDisabled;\n"],"mappings":";AAGA,SAAgB,iBAAiB,OAAsC;AACrE,QAAO,MAAM,SAAS,IAAK,QAA2B"}
1
+ {"version":3,"file":"types.mjs","names":[],"sources":["../../src/lib/types.ts"],"sourcesContent":["// Branded non-empty string type to prevent passing empty strings accidentally\nexport type NonEmptyString = string & { readonly __brand: unique symbol };\n\nexport function toNonEmptyString(value: string): NonEmptyString | null {\n return value.length > 0 ? (value as NonEmptyString) : null;\n}\n\nexport interface PreflightEnabled {\n apiKey: NonEmptyString;\n cleanupSourceMaps: boolean;\n debug: boolean;\n enabled: true;\n environment: string;\n surface: NonEmptyString;\n}\n\nexport interface PreflightDisabled {\n cleanupSourceMaps: boolean;\n debug: boolean;\n enabled: false;\n environment: string | undefined;\n}\n\nexport type PreflightConfig = PreflightEnabled | PreflightDisabled;\n"],"mappings":";AAGA,SAAgB,iBAAiB,OAAsC;AACrE,QAAO,MAAM,SAAS,IAAK,QAA2B"}
@@ -3,8 +3,8 @@ import { ServerSDK, ServerSDKConfig } from "./sdk.mjs";
3
3
  //#region src/server/auto-init.d.ts
4
4
  interface InjectedFeatures {
5
5
  errorTracking?: boolean;
6
- replay?: boolean;
7
6
  performanceMonitoring?: boolean;
7
+ replay?: boolean;
8
8
  }
9
9
  declare global {
10
10
  var __INTERFERE_BUILD_ID__: string | null | undefined;
@@ -12,21 +12,22 @@ declare global {
12
12
  var __INTERFERE_ENVIRONMENT__: string | undefined;
13
13
  var __INTERFERE_ENABLED__: boolean | undefined;
14
14
  var __INTERFERE_FEATURES__: InjectedFeatures | undefined;
15
+ var __INTERFERE_SURFACE_SLUG__: string | undefined;
15
16
  var __INTERFERE_SERVER_SDK__: ServerSDK | undefined;
16
17
  }
17
18
  interface AutoInitServerOptions {
18
19
  /**
19
- * Override the environment detected at build time.
20
- */
20
+ * Override the environment detected at build time.
21
+ */
21
22
  environment?: string;
22
23
  /**
23
- * Override feature flags.
24
- */
24
+ * Override feature flags.
25
+ */
25
26
  features?: Partial<ServerSDKConfig["features"]>;
26
27
  /**
27
- * Whether to install global error handlers (uncaughtException, unhandledRejection).
28
- * @default true
29
- */
28
+ * Whether to install global error handlers (uncaughtException, unhandledRejection).
29
+ * @default true
30
+ */
30
31
  installGlobalHandlers?: boolean;
31
32
  }
32
33
  /**
@@ -35,10 +36,10 @@ interface AutoInitServerOptions {
35
36
  interface AutoInitResult {
36
37
  /** Whether the SDK was successfully initialized */
37
38
  readonly initialized: boolean;
38
- /** The SDK instance if initialized */
39
- readonly sdk: ServerSDK | null;
40
39
  /** Reason for not initializing, if applicable */
41
40
  readonly reason?: string;
41
+ /** The SDK instance if initialized */
42
+ readonly sdk: ServerSDK | null;
42
43
  }
43
44
  /**
44
45
  * Automatically initialize the server-side Interfere SDK.
@@ -1 +1 @@
1
- {"version":3,"file":"auto-init.d.mts","names":[],"sources":["../../src/server/auto-init.ts"],"mappings":";;;UAEU,gBAAA;EAAA,aAAA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K,SAAA;AAAA;;;;;;;;;;AAoChB;;;;;;;;;AA8DA;;;;;AAOA;;;;;;;;;;iBArEgB,cAAA,CACd,OAAA,GAAU,qBAAA,GACT,cAAA;;;;;iBA4Da,YAAA,CAAA,GAAgB,SAAA;;;;iBAOhB,sBAAA,CAAA"}
@@ -48,12 +48,12 @@ function autoInitServer(options) {
48
48
  reason: "disabled_by_config"
49
49
  };
50
50
  }
51
- if (!process.env.INTERFERE_SECRET_KEY) {
52
- if (process.env.NODE_ENV === "development") console.warn("[Interfere] Server SDK not initialized: INTERFERE_SECRET_KEY not set.\nTo enable server-side error tracking, add INTERFERE_SECRET_KEY to your environment.");
51
+ if (!process.env.INTERFERE_API_KEY) {
52
+ if (process.env.NODE_ENV === "development") console.warn("[Interfere] Server SDK not initialized: INTERFERE_API_KEY not set.\nTo enable server-side error tracking, add INTERFERE_API_KEY to your environment. Ensure you are using the correct key.");
53
53
  return {
54
54
  initialized: false,
55
55
  sdk: null,
56
- reason: "missing_secret_key"
56
+ reason: "missing_api_key"
57
57
  };
58
58
  }
59
59
  const config = {
@@ -1 +1 @@
1
- {"version":3,"file":"auto-init.mjs","names":[],"sources":["../../src/server/auto-init.ts"],"sourcesContent":["import { ServerSDK, type ServerSDKConfig } from \"./sdk.js\";\n\ninterface InjectedFeatures {\n errorTracking?: boolean;\n replay?: boolean;\n performanceMonitoring?: boolean;\n}\n\ndeclare global {\n var __INTERFERE_BUILD_ID__: string | null | undefined;\n var __INTERFERE_RELEASE_ID__: string | null | undefined;\n var __INTERFERE_ENVIRONMENT__: string | undefined;\n var __INTERFERE_ENABLED__: boolean | undefined;\n var __INTERFERE_FEATURES__: InjectedFeatures | undefined;\n var __INTERFERE_SERVER_SDK__: ServerSDK | undefined;\n}\n\nexport interface AutoInitServerOptions {\n /**\n * Override the environment detected at build time.\n */\n environment?: string;\n\n /**\n * Override feature flags.\n */\n features?: Partial<ServerSDKConfig[\"features\"]>;\n\n /**\n * Whether to install global error handlers (uncaughtException, unhandledRejection).\n * @default true\n */\n installGlobalHandlers?: boolean;\n}\n\n/**\n * Result of auto-initialization.\n */\nexport interface AutoInitResult {\n /** Whether the SDK was successfully initialized */\n readonly initialized: boolean;\n /** The SDK instance if initialized */\n readonly sdk: ServerSDK | null;\n /** Reason for not initializing, if applicable */\n readonly reason?: string;\n}\n\n/**\n * Automatically initialize the server-side Interfere SDK.\n *\n * This function reads build-time values injected by `withInterfere()` and\n * initializes the SDK singleton. It should be called from `instrumentation.ts`.\n *\n * @example\n * ```ts\n * // instrumentation.ts\n * export async function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') {\n * const { autoInitServer } = await import('@interfere/next/server/auto-init');\n * autoInitServer();\n * }\n * }\n * ```\n *\n * @example With custom options\n * ```ts\n * // instrumentation.ts\n * export async function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') {\n * const { autoInitServer } = await import('@interfere/next/server/auto-init');\n * autoInitServer({\n * features: {\n * errorTracking: true,\n * performanceMonitoring: process.env.NODE_ENV === 'production',\n * },\n * });\n * }\n * }\n * ```\n */\nexport function autoInitServer(\n options?: AutoInitServerOptions\n): AutoInitResult {\n if (globalThis.__INTERFERE_SERVER_SDK__) {\n return {\n initialized: true,\n sdk: globalThis.__INTERFERE_SERVER_SDK__,\n reason: \"already_initialized\",\n };\n }\n\n if (globalThis.__INTERFERE_ENABLED__ === false) {\n if (process.env.NODE_ENV === \"development\") {\n console.log(\"[Interfere] Server SDK disabled via build config\");\n }\n return { initialized: false, sdk: null, reason: \"disabled_by_config\" };\n }\n\n if (!process.env.INTERFERE_SECRET_KEY) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\n \"[Interfere] Server SDK not initialized: INTERFERE_SECRET_KEY not set.\\n\" +\n \"To enable server-side error tracking, add INTERFERE_SECRET_KEY to your environment.\"\n );\n }\n return { initialized: false, sdk: null, reason: \"missing_secret_key\" };\n }\n\n const config: ServerSDKConfig = {\n metadata: {\n buildId: globalThis.__INTERFERE_BUILD_ID__ ?? null,\n releaseId: globalThis.__INTERFERE_RELEASE_ID__ ?? null,\n environment:\n options?.environment ??\n globalThis.__INTERFERE_ENVIRONMENT__ ??\n process.env.NODE_ENV ??\n \"production\",\n runtime: detectRuntime(),\n },\n features: {\n errorTracking: true,\n performanceMonitoring: true,\n ...(globalThis.__INTERFERE_FEATURES__ ?? {}),\n ...options?.features,\n },\n };\n\n const sdk = ServerSDK.init(config);\n\n if (options?.installGlobalHandlers !== false) {\n sdk.installGlobalHandlers();\n }\n\n globalThis.__INTERFERE_SERVER_SDK__ = sdk;\n\n return { initialized: true, sdk };\n}\n\n/**\n * Get the initialized server SDK instance.\n * Returns null if the SDK has not been initialized.\n */\nexport function getServerSDK(): ServerSDK | null {\n return globalThis.__INTERFERE_SERVER_SDK__ ?? ServerSDK.getInstance();\n}\n\n/**\n * Check if the server SDK is initialized.\n */\nexport function isServerSDKInitialized(): boolean {\n return (\n Boolean(globalThis.__INTERFERE_SERVER_SDK__) || ServerSDK.isInitialized()\n );\n}\n\nfunction detectRuntime(): \"nodejs\" | \"edge\" {\n if (process.env.NEXT_RUNTIME === \"edge\") {\n return \"edge\";\n }\n if (\n typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== \"undefined\"\n ) {\n return \"edge\";\n }\n return \"nodejs\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgFA,SAAgB,eACd,SACgB;AAChB,KAAI,WAAW,yBACb,QAAO;EACL,aAAa;EACb,KAAK,WAAW;EAChB,QAAQ;EACT;AAGH,KAAI,WAAW,0BAA0B,OAAO;AAC9C,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,IAAI,mDAAmD;AAEjE,SAAO;GAAE,aAAa;GAAO,KAAK;GAAM,QAAQ;GAAsB;;AAGxE,KAAI,CAAC,QAAQ,IAAI,sBAAsB;AACrC,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,KACN,6JAED;AAEH,SAAO;GAAE,aAAa;GAAO,KAAK;GAAM,QAAQ;GAAsB;;CAGxE,MAAM,SAA0B;EAC9B,UAAU;GACR,SAAS,WAAW,0BAA0B;GAC9C,WAAW,WAAW,4BAA4B;GAClD,aACE,SAAS,eACT,WAAW,6BACX,QAAQ,IAAI,YACZ;GACF,SAAS,eAAe;GACzB;EACD,UAAU;GACR,eAAe;GACf,uBAAuB;GACvB,GAAI,WAAW,0BAA0B,EAAE;GAC3C,GAAG,SAAS;GACb;EACF;CAED,MAAM,MAAM,UAAU,KAAK,OAAO;AAElC,KAAI,SAAS,0BAA0B,MACrC,KAAI,uBAAuB;AAG7B,YAAW,2BAA2B;AAEtC,QAAO;EAAE,aAAa;EAAM;EAAK;;;;;;AAOnC,SAAgB,eAAiC;AAC/C,QAAO,WAAW,4BAA4B,UAAU,aAAa;;;;;AAMvE,SAAgB,yBAAkC;AAChD,QACE,QAAQ,WAAW,yBAAyB,IAAI,UAAU,eAAe;;AAI7E,SAAS,gBAAmC;AAC1C,KAAI,QAAQ,IAAI,iBAAiB,OAC/B,QAAO;AAET,KACE,OAAQ,WAAyC,gBAAgB,YAEjE,QAAO;AAET,QAAO"}
1
+ {"version":3,"file":"auto-init.mjs","names":[],"sources":["../../src/server/auto-init.ts"],"sourcesContent":["import { ServerSDK, type ServerSDKConfig } from \"./sdk.js\";\n\ninterface InjectedFeatures {\n errorTracking?: boolean;\n performanceMonitoring?: boolean;\n replay?: boolean;\n}\n\ndeclare global {\n var __INTERFERE_BUILD_ID__: string | null | undefined;\n var __INTERFERE_RELEASE_ID__: string | null | undefined;\n var __INTERFERE_ENVIRONMENT__: string | undefined;\n var __INTERFERE_ENABLED__: boolean | undefined;\n var __INTERFERE_FEATURES__: InjectedFeatures | undefined;\n var __INTERFERE_SURFACE_SLUG__: string | undefined;\n var __INTERFERE_SERVER_SDK__: ServerSDK | undefined;\n}\n\nexport interface AutoInitServerOptions {\n /**\n * Override the environment detected at build time.\n */\n environment?: string;\n\n /**\n * Override feature flags.\n */\n features?: Partial<ServerSDKConfig[\"features\"]>;\n\n /**\n * Whether to install global error handlers (uncaughtException, unhandledRejection).\n * @default true\n */\n installGlobalHandlers?: boolean;\n}\n\n/**\n * Result of auto-initialization.\n */\nexport interface AutoInitResult {\n /** Whether the SDK was successfully initialized */\n readonly initialized: boolean;\n /** Reason for not initializing, if applicable */\n readonly reason?: string;\n /** The SDK instance if initialized */\n readonly sdk: ServerSDK | null;\n}\n\n/**\n * Automatically initialize the server-side Interfere SDK.\n *\n * This function reads build-time values injected by `withInterfere()` and\n * initializes the SDK singleton. It should be called from `instrumentation.ts`.\n *\n * @example\n * ```ts\n * // instrumentation.ts\n * export async function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') {\n * const { autoInitServer } = await import('@interfere/next/server/auto-init');\n * autoInitServer();\n * }\n * }\n * ```\n *\n * @example With custom options\n * ```ts\n * // instrumentation.ts\n * export async function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') {\n * const { autoInitServer } = await import('@interfere/next/server/auto-init');\n * autoInitServer({\n * features: {\n * errorTracking: true,\n * performanceMonitoring: process.env.NODE_ENV === 'production',\n * },\n * });\n * }\n * }\n * ```\n */\nexport function autoInitServer(\n options?: AutoInitServerOptions\n): AutoInitResult {\n if (globalThis.__INTERFERE_SERVER_SDK__) {\n return {\n initialized: true,\n sdk: globalThis.__INTERFERE_SERVER_SDK__,\n reason: \"already_initialized\",\n };\n }\n\n if (globalThis.__INTERFERE_ENABLED__ === false) {\n if (process.env.NODE_ENV === \"development\") {\n console.log(\"[Interfere] Server SDK disabled via build config\");\n }\n return { initialized: false, sdk: null, reason: \"disabled_by_config\" };\n }\n\n if (!process.env.INTERFERE_API_KEY) {\n if (process.env.NODE_ENV === \"development\") {\n console.warn(\n \"[Interfere] Server SDK not initialized: INTERFERE_API_KEY not set.\\n\" +\n \"To enable server-side error tracking, add INTERFERE_API_KEY to your environment. Ensure you are using the correct key.\"\n );\n }\n return { initialized: false, sdk: null, reason: \"missing_api_key\" };\n }\n\n const config: ServerSDKConfig = {\n metadata: {\n buildId: globalThis.__INTERFERE_BUILD_ID__ ?? null,\n releaseId: globalThis.__INTERFERE_RELEASE_ID__ ?? null,\n environment:\n options?.environment ??\n globalThis.__INTERFERE_ENVIRONMENT__ ??\n process.env.NODE_ENV ??\n \"production\",\n runtime: detectRuntime(),\n },\n features: {\n errorTracking: true,\n performanceMonitoring: true,\n ...(globalThis.__INTERFERE_FEATURES__ ?? {}),\n ...options?.features,\n },\n };\n\n const sdk = ServerSDK.init(config);\n\n if (options?.installGlobalHandlers !== false) {\n sdk.installGlobalHandlers();\n }\n\n globalThis.__INTERFERE_SERVER_SDK__ = sdk;\n\n return { initialized: true, sdk };\n}\n\n/**\n * Get the initialized server SDK instance.\n * Returns null if the SDK has not been initialized.\n */\nexport function getServerSDK(): ServerSDK | null {\n return globalThis.__INTERFERE_SERVER_SDK__ ?? ServerSDK.getInstance();\n}\n\n/**\n * Check if the server SDK is initialized.\n */\nexport function isServerSDKInitialized(): boolean {\n return (\n Boolean(globalThis.__INTERFERE_SERVER_SDK__) || ServerSDK.isInitialized()\n );\n}\n\nfunction detectRuntime(): \"nodejs\" | \"edge\" {\n if (process.env.NEXT_RUNTIME === \"edge\") {\n return \"edge\";\n }\n if (\n typeof (globalThis as { EdgeRuntime?: unknown }).EdgeRuntime !== \"undefined\"\n ) {\n return \"edge\";\n }\n return \"nodejs\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiFA,SAAgB,eACd,SACgB;AAChB,KAAI,WAAW,yBACb,QAAO;EACL,aAAa;EACb,KAAK,WAAW;EAChB,QAAQ;EACT;AAGH,KAAI,WAAW,0BAA0B,OAAO;AAC9C,MAAI,QAAQ,IAAI,aAAa,cAC3B,SAAQ,IAAI,mDAAmD;AAEjE,SAAO;GAAE,aAAa;GAAO,KAAK;GAAM,QAAQ;GAAsB;;AAGxE,KAAI,CAAC,QAAQ,IAAI,mBAAmB;AAClC,MAAI,QAAQ,IAAI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8DzB,2BAAA,CAAA,IAAA,KAAA,EAGO,KAAA,EAAA,SAAA;EAAA,MAAA;AAAA,MAAqC,OAAA"}
1
+ {"version":3,"file":"middleware.d.mts","names":[],"sources":["../../src/server/middleware.ts"],"mappings":";;;iBAgBgB,uBAAA,CACd,UAAA,GAAa,OAAA,EAAS,WAAA,KAAgB,OAAA,CAAQ,YAAA,IAAgB,YAAA,IAIhD,OAAA,EAAS,WAAA,KAAW,OAAA,CAAA,YAAA;AAAA,iBA0CpB,qBAAA,CACd,OAAA,GAAU,GAAA,EAAK,WAAA,KAAgB,OAAA,CAAQ,QAAA,KAIzB,GAAA,EAAK,WAAA,KAAW,OAAA,CAAA,QAAA;AAAA,iBA0ChB,4BAAA,eACA,IAAA,gBAAoB,OAAA,UAAA,CAClC,SAAA,EAAW,CAAA,EAAG,aAAA,YAAyB,CAAA;AAAA,iBA8DzB,2BAAA,CAAA,IAGA,KAAA,EAAO,KAAA,EAAO,SAAA;EAAa,MAAA;AAAA,MAAiB,OAAA"}