@datadog/browser-rum-nextjs 7.3.0 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/cjs/domain/error/addNextjsError.js +42 -41
  2. package/cjs/domain/error/addNextjsError.js.map +1 -1
  3. package/cjs/domain/error/errorBoundary.js +21 -22
  4. package/cjs/domain/error/errorBoundary.js.map +1 -1
  5. package/cjs/domain/nextJSRouter/computeViewNameFromParams.js +19 -33
  6. package/cjs/domain/nextJSRouter/computeViewNameFromParams.js.map +1 -1
  7. package/cjs/domain/nextJSRouter/datadogAppRouter.js +18 -17
  8. package/cjs/domain/nextJSRouter/datadogAppRouter.js.map +1 -1
  9. package/cjs/domain/nextJSRouter/datadogPagesRouter.js +17 -22
  10. package/cjs/domain/nextJSRouter/datadogPagesRouter.js.map +1 -1
  11. package/cjs/domain/nextjsPlugin.js +31 -56
  12. package/cjs/domain/nextjsPlugin.js.map +1 -1
  13. package/cjs/entries/main.js +12 -15
  14. package/esm/domain/error/addNextjsError.mjs +46 -0
  15. package/esm/domain/error/addNextjsError.mjs.map +1 -0
  16. package/esm/domain/error/errorBoundary.mjs +24 -0
  17. package/esm/domain/error/errorBoundary.mjs.map +1 -0
  18. package/esm/domain/nextJSRouter/computeViewNameFromParams.mjs +22 -0
  19. package/esm/domain/nextJSRouter/computeViewNameFromParams.mjs.map +1 -0
  20. package/esm/domain/nextJSRouter/datadogAppRouter.mjs +21 -0
  21. package/esm/domain/nextJSRouter/datadogAppRouter.mjs.map +1 -0
  22. package/esm/domain/nextJSRouter/datadogPagesRouter.mjs +20 -0
  23. package/esm/domain/nextJSRouter/datadogPagesRouter.mjs.map +1 -0
  24. package/esm/domain/nextjsPlugin.mjs +42 -0
  25. package/esm/domain/nextjsPlugin.mjs.map +1 -0
  26. package/esm/entries/main.mjs +6 -0
  27. package/package.json +10 -10
  28. package/cjs/entries/main.js.map +0 -1
  29. package/esm/domain/error/addNextjsError.d.ts +0 -23
  30. package/esm/domain/error/addNextjsError.js +0 -42
  31. package/esm/domain/error/addNextjsError.js.map +0 -1
  32. package/esm/domain/error/errorBoundary.d.ts +0 -17
  33. package/esm/domain/error/errorBoundary.js +0 -21
  34. package/esm/domain/error/errorBoundary.js.map +0 -1
  35. package/esm/domain/nextJSRouter/computeViewNameFromParams.d.ts +0 -4
  36. package/esm/domain/nextJSRouter/computeViewNameFromParams.js +0 -33
  37. package/esm/domain/nextJSRouter/computeViewNameFromParams.js.map +0 -1
  38. package/esm/domain/nextJSRouter/datadogAppRouter.d.ts +0 -1
  39. package/esm/domain/nextJSRouter/datadogAppRouter.js +0 -17
  40. package/esm/domain/nextJSRouter/datadogAppRouter.js.map +0 -1
  41. package/esm/domain/nextJSRouter/datadogPagesRouter.d.ts +0 -1
  42. package/esm/domain/nextJSRouter/datadogPagesRouter.js +0 -22
  43. package/esm/domain/nextJSRouter/datadogPagesRouter.js.map +0 -1
  44. package/esm/domain/nextjsPlugin.d.ts +0 -11
  45. package/esm/domain/nextjsPlugin.js +0 -62
  46. package/esm/domain/nextjsPlugin.js.map +0 -1
  47. package/esm/entries/main.d.ts +0 -7
  48. package/esm/entries/main.js +0 -6
  49. package/esm/entries/main.js.map +0 -1
@@ -1,45 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addNextjsError = addNextjsError;
4
- const time_1 = require("@datadog/js-core/time");
5
- const browser_core_1 = require("@datadog/browser-core");
6
- const nextjsPlugin_1 = require("../nextjsPlugin");
1
+ const require_nextjsPlugin = require("../nextjsPlugin.js");
2
+ let _datadog_browser_core = require("@datadog/browser-core");
3
+ let _datadog_js_core_time = require("@datadog/js-core/time");
4
+ //#region src/domain/error/addNextjsError.ts
7
5
  /**
8
- * Add a Next.js error to the RUM session.
9
- *
10
- * @category Error
11
- * @example
12
- * ```ts
13
- * // app/error.tsx (or app/global-error.tsx)
14
- * 'use client'
15
- * import { useEffect } from 'react'
16
- * import { addNextjsError } from '@datadog/browser-rum-nextjs'
17
- *
18
- * export default function Error({ error }: { error: Error & { digest?: string } }) {
19
- * useEffect(() => {
20
- * addNextjsError(error)
21
- * }, [error])
22
- * return <div>Something went wrong</div>
23
- * }
24
- * ```
25
- */
6
+ * Add a Next.js error to the RUM session.
7
+ *
8
+ * @category Error
9
+ * @example
10
+ * ```ts
11
+ * // app/error.tsx (or app/global-error.tsx)
12
+ * 'use client'
13
+ * import { useEffect } from 'react'
14
+ * import { addNextjsError } from '@datadog/browser-rum-nextjs'
15
+ *
16
+ * export default function Error({ error }: { error: Error & { digest?: string } }) {
17
+ * useEffect(() => {
18
+ * addNextjsError(error)
19
+ * }, [error])
20
+ * return <div>Something went wrong</div>
21
+ * }
22
+ * ```
23
+ */
26
24
  function addNextjsError(error, errorInfo) {
27
- const handlingStack = (0, browser_core_1.createHandlingStack)('nextjs error');
28
- const startClocks = (0, time_1.clocksNow)();
29
- (0, nextjsPlugin_1.onRumStart)((addError) => {
30
- (0, browser_core_1.callMonitored)(() => {
31
- addError({
32
- error,
33
- handlingStack,
34
- componentStack: errorInfo?.componentStack ?? undefined,
35
- startClocks,
36
- context: {
37
- ...error.dd_context,
38
- ...(error.digest && { nextjs: { digest: error.digest } }),
39
- framework: 'nextjs',
40
- },
41
- });
42
- });
43
- });
25
+ const handlingStack = (0, _datadog_browser_core.createHandlingStack)("nextjs error");
26
+ const startClocks = (0, _datadog_js_core_time.clocksNow)();
27
+ require_nextjsPlugin.onRumStart((addError) => {
28
+ (0, _datadog_browser_core.callMonitored)(() => {
29
+ addError({
30
+ error,
31
+ handlingStack,
32
+ componentStack: errorInfo?.componentStack ?? void 0,
33
+ startClocks,
34
+ context: {
35
+ ...error.dd_context,
36
+ ...error.digest && { nextjs: { digest: error.digest } },
37
+ framework: "nextjs"
38
+ }
39
+ });
40
+ });
41
+ });
44
42
  }
43
+ //#endregion
44
+ exports.addNextjsError = addNextjsError;
45
+
45
46
  //# sourceMappingURL=addNextjsError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"addNextjsError.js","sourceRoot":"","sources":["../../../src/domain/error/addNextjsError.ts"],"names":[],"mappings":";;AAyBA,wCAkBC;AA3CD,gDAAiD;AACjD,wDAA0E;AAG1E,kDAA4C;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,cAAc,CAAC,KAAkC,EAAE,SAAqB;IACtF,MAAM,aAAa,GAAG,IAAA,kCAAmB,EAAC,cAAc,CAAC,CAAA;IACzD,MAAM,WAAW,GAAG,IAAA,gBAAS,GAAE,CAAA;IAC/B,IAAA,yBAAU,EAAC,CAAC,QAAQ,EAAE,EAAE;QACtB,IAAA,4BAAa,EAAC,GAAG,EAAE;YACjB,QAAQ,CAAC;gBACP,KAAK;gBACL,aAAa;gBACb,cAAc,EAAE,SAAS,EAAE,cAAc,IAAI,SAAS;gBACtD,WAAW;gBACX,OAAO,EAAE;oBACP,GAAI,KAA0C,CAAC,UAAU;oBACzD,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;oBACzD,SAAS,EAAE,QAAQ;iBACpB;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"addNextjsError.js","names":[],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored, createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/browser-core'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,iBAAA,GAAA,sBAAA,oBAAA,CAAoC,cAAc;CACxD,MAAM,eAAA,GAAA,sBAAA,UAAA,CAAwB;CAC9B,qBAAA,YAAY,aAAa;EACvB,CAAA,GAAA,sBAAA,cAAA,OAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
@@ -1,24 +1,23 @@
1
- "use strict";
2
- 'use client';
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.ErrorBoundary = void 0;
5
- const internal_1 = require("@datadog/browser-rum-react/internal");
6
- const addNextjsError_1 = require("./addNextjsError");
1
+ "use client";
2
+ const require_addNextjsError = require("./addNextjsError.js");
3
+ //#region src/domain/error/errorBoundary.ts
7
4
  /**
8
- * ErrorBoundary component to report React errors to Datadog using the Next.js error context.
9
- *
10
- * For more advanced error handling, you can use the {@link addNextjsError} function.
11
- *
12
- * @category Error
13
- * @example
14
- * ```ts
15
- * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'
16
- *
17
- * <ErrorBoundary fallback={() => null}>
18
- * <Component />
19
- * </ErrorBoundary>
20
- * ```
21
- */
22
- // eslint-disable-next-line local-rules/disallow-side-effects
23
- exports.ErrorBoundary = (0, internal_1.createErrorBoundary)(addNextjsError_1.addNextjsError);
5
+ * ErrorBoundary component to report React errors to Datadog using the Next.js error context.
6
+ *
7
+ * For more advanced error handling, you can use the {@link addNextjsError} function.
8
+ *
9
+ * @category Error
10
+ * @example
11
+ * ```ts
12
+ * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'
13
+ *
14
+ * <ErrorBoundary fallback={() => null}>
15
+ * <Component />
16
+ * </ErrorBoundary>
17
+ * ```
18
+ */
19
+ const ErrorBoundary = (0, require("@datadog/browser-rum-react/internal").createErrorBoundary)(require_addNextjsError.addNextjsError);
20
+ //#endregion
21
+ exports.ErrorBoundary = ErrorBoundary;
22
+
24
23
  //# sourceMappingURL=errorBoundary.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"errorBoundary.js","sourceRoot":"","sources":["../../../src/domain/error/errorBoundary.ts"],"names":[],"mappings":";AAAA,YAAY,CAAA;;;AACZ,kEAAyE;AAEzE,qDAAiD;AAEjD;;;;;;;;;;;;;;GAcG;AACH,6DAA6D;AAChD,QAAA,aAAa,GAAG,IAAA,8BAAmB,EAAC,+BAAc,CAAC,CAAA"}
1
+ {"version":3,"file":"errorBoundary.js","names":["addNextjsError"],"sources":["../../../src/domain/error/errorBoundary.ts"],"sourcesContent":["'use client'\nimport { createErrorBoundary } from '@datadog/browser-rum-react/internal'\nexport type { ErrorBoundaryFallback, ErrorBoundaryProps } from '@datadog/browser-rum-react/internal'\nimport { addNextjsError } from './addNextjsError'\n\n/**\n * ErrorBoundary component to report React errors to Datadog using the Next.js error context.\n *\n * For more advanced error handling, you can use the {@link addNextjsError} function.\n *\n * @category Error\n * @example\n * ```ts\n * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'\n *\n * <ErrorBoundary fallback={() => null}>\n * <Component />\n * </ErrorBoundary>\n * ```\n */\n// eslint-disable-next-line local-rules/disallow-side-effects\nexport const ErrorBoundary = createErrorBoundary(addNextjsError)\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqBA,MAAa,iBAAA,gDAAA,CAAA,CAAA,oBAAA,CAAoCA,uBAAAA,cAAc"}
@@ -1,36 +1,22 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.computeViewNameFromParams = computeViewNameFromParams;
1
+ //#region src/domain/nextJSRouter/computeViewNameFromParams.ts
4
2
  function computeViewNameFromParams(pathname, params) {
5
- if (Object.keys(params).length === 0) {
6
- return pathname;
7
- }
8
- const segments = pathname.split('/');
9
- // Process catch-all (array) params first to prevent their segments from being
10
- // consumed by regular param replacements when values overlap.
11
- for (const [paramName, paramValue] of Object.entries(params)) {
12
- if (!Array.isArray(paramValue) || paramValue.length === 0) {
13
- continue;
14
- }
15
- for (let i = 0; i < segments.length; i++) {
16
- if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {
17
- segments.splice(i, paramValue.length, `[...${paramName}]`);
18
- break;
19
- }
20
- }
21
- }
22
- // Process regular (string) params greedily left-to-right.
23
- // When multiple params share the same value, names are assigned left-to-right in param iteration order.
24
- // When a param value also appears in a static segment, the leftmost occurrence is assumed to be dynamic.
25
- for (const [paramName, paramValue] of Object.entries(params)) {
26
- if (typeof paramValue !== 'string' || !paramValue) {
27
- continue;
28
- }
29
- const index = segments.indexOf(paramValue);
30
- if (index !== -1) {
31
- segments[index] = `[${paramName}]`;
32
- }
33
- }
34
- return segments.join('/');
3
+ if (Object.keys(params).length === 0) return pathname;
4
+ const segments = pathname.split("/");
5
+ for (const [paramName, paramValue] of Object.entries(params)) {
6
+ if (!Array.isArray(paramValue) || paramValue.length === 0) continue;
7
+ for (let i = 0; i < segments.length; i++) if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {
8
+ segments.splice(i, paramValue.length, `[...${paramName}]`);
9
+ break;
10
+ }
11
+ }
12
+ for (const [paramName, paramValue] of Object.entries(params)) {
13
+ if (typeof paramValue !== "string" || !paramValue) continue;
14
+ const index = segments.indexOf(paramValue);
15
+ if (index !== -1) segments[index] = `[${paramName}]`;
16
+ }
17
+ return segments.join("/");
35
18
  }
19
+ //#endregion
20
+ exports.computeViewNameFromParams = computeViewNameFromParams;
21
+
36
22
  //# sourceMappingURL=computeViewNameFromParams.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"computeViewNameFromParams.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/computeViewNameFromParams.ts"],"names":[],"mappings":";;AAIA,8DAmCC;AAnCD,SAAgB,yBAAyB,CAAC,QAAgB,EAAE,MAAc;IACxE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAEpC,8EAA8E;IAC9E,8DAA8D;IAC9D,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1D,SAAQ;QACV,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,SAAS,GAAG,CAAC,CAAA;gBAC1D,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IAED,0DAA0D;IAC1D,wGAAwG;IACxG,yGAAyG;IACzG,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YAClD,SAAQ;QACV,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAC1C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,SAAS,GAAG,CAAA;QACpC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC"}
1
+ {"version":3,"file":"computeViewNameFromParams.js","names":[],"sources":["../../../src/domain/nextJSRouter/computeViewNameFromParams.ts"],"sourcesContent":["import type { useParams } from 'next/navigation'\n\ntype Params = ReturnType<typeof useParams>\n\nexport function computeViewNameFromParams(pathname: string, params: Params): string {\n if (Object.keys(params).length === 0) {\n return pathname\n }\n\n const segments = pathname.split('/')\n\n // Process catch-all (array) params first to prevent their segments from being\n // consumed by regular param replacements when values overlap.\n for (const [paramName, paramValue] of Object.entries(params)) {\n if (!Array.isArray(paramValue) || paramValue.length === 0) {\n continue\n }\n for (let i = 0; i < segments.length; i++) {\n if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {\n segments.splice(i, paramValue.length, `[...${paramName}]`)\n break\n }\n }\n }\n\n // Process regular (string) params greedily left-to-right.\n // When multiple params share the same value, names are assigned left-to-right in param iteration order.\n // When a param value also appears in a static segment, the leftmost occurrence is assumed to be dynamic.\n for (const [paramName, paramValue] of Object.entries(params)) {\n if (typeof paramValue !== 'string' || !paramValue) {\n continue\n }\n const index = segments.indexOf(paramValue)\n if (index !== -1) {\n segments[index] = `[${paramName}]`\n }\n }\n\n return segments.join('/')\n}\n"],"mappings":";AAIA,SAAgB,0BAA0B,UAAkB,QAAwB;CAClF,IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,WAAW,GACjC,OAAO;CAGT,MAAM,WAAW,SAAS,MAAM,GAAG;CAInC,KAAK,MAAM,CAAC,WAAW,eAAe,OAAO,QAAQ,MAAM,GAAG;EAC5D,IAAI,CAAC,MAAM,QAAQ,UAAU,KAAK,WAAW,WAAW,GACtD;EAEF,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,IAAI,IAAI,WAAW,UAAU,SAAS,UAAU,WAAW,OAAO,GAAG,MAAM,SAAS,IAAI,OAAO,CAAC,GAAG;GACjG,SAAS,OAAO,GAAG,WAAW,QAAQ,OAAO,UAAU,EAAE;GACzD;EACF;CAEJ;CAKA,KAAK,MAAM,CAAC,WAAW,eAAe,OAAO,QAAQ,MAAM,GAAG;EAC5D,IAAI,OAAO,eAAe,YAAY,CAAC,YACrC;EAEF,MAAM,QAAQ,SAAS,QAAQ,UAAU;EACzC,IAAI,UAAU,IACZ,SAAS,SAAS,IAAI,UAAU;CAEpC;CAEA,OAAO,SAAS,KAAK,GAAG;AAC1B"}
@@ -1,20 +1,21 @@
1
- "use strict";
2
- 'use client';
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.DatadogAppRouter = DatadogAppRouter;
5
- const react_1 = require("react");
6
- const navigation_1 = require("next/navigation");
7
- const browser_core_1 = require("@datadog/browser-core");
8
- const nextjsPlugin_1 = require("../nextjsPlugin");
9
- const computeViewNameFromParams_1 = require("./computeViewNameFromParams");
1
+ "use client";
2
+ const require_nextjsPlugin = require("../nextjsPlugin.js");
3
+ const require_computeViewNameFromParams = require("./computeViewNameFromParams.js");
4
+ let _datadog_browser_core = require("@datadog/browser-core");
5
+ let react = require("react");
6
+ let next_navigation_js = require("next/navigation.js");
7
+ //#region src/domain/nextJSRouter/datadogAppRouter.tsx
10
8
  function DatadogAppRouter() {
11
- const pathname = (0, browser_core_1.mockable)(navigation_1.usePathname)();
12
- const params = (0, browser_core_1.mockable)(navigation_1.useParams)();
13
- const previousPathname = (0, browser_core_1.mockable)(react_1.useRef)(null);
14
- if (previousPathname.current !== pathname) {
15
- previousPathname.current = pathname;
16
- (0, nextjsPlugin_1.startNextjsView)((0, computeViewNameFromParams_1.computeViewNameFromParams)(pathname, params));
17
- }
18
- return null;
9
+ const pathname = (0, _datadog_browser_core.mockable)(next_navigation_js.usePathname)();
10
+ const params = (0, _datadog_browser_core.mockable)(next_navigation_js.useParams)();
11
+ const previousPathname = (0, _datadog_browser_core.mockable)(react.useRef)(null);
12
+ if (previousPathname.current !== pathname) {
13
+ previousPathname.current = pathname;
14
+ require_nextjsPlugin.startNextjsView(require_computeViewNameFromParams.computeViewNameFromParams(pathname, params));
15
+ }
16
+ return null;
19
17
  }
18
+ //#endregion
19
+ exports.DatadogAppRouter = DatadogAppRouter;
20
+
20
21
  //# sourceMappingURL=datadogAppRouter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datadogAppRouter.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;AAQZ,4CAWC;AAjBD,iCAA8B;AAC9B,gDAAwD;AACxD,wDAAgD;AAChD,kDAAiD;AACjD,2EAAuE;AAEvE,SAAgB,gBAAgB;IAC9B,MAAM,QAAQ,GAAG,IAAA,uBAAQ,EAAC,wBAAW,CAAC,EAAE,CAAA;IACxC,MAAM,MAAM,GAAG,IAAA,uBAAQ,EAAC,sBAAS,CAAC,EAAE,CAAA;IACpC,MAAM,gBAAgB,GAAG,IAAA,uBAAQ,EAAC,cAAM,CAAC,CAAgB,IAAI,CAAC,CAAA;IAE9D,IAAI,gBAAgB,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1C,gBAAgB,CAAC,OAAO,GAAG,QAAQ,CAAA;QACnC,IAAA,8BAAe,EAAC,IAAA,qDAAyB,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
1
+ {"version":3,"file":"datadogAppRouter.js","names":["usePathname","useParams","useRef","computeViewNameFromParams"],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,YAAA,GAAA,sBAAA,SAAA,CAAoBA,mBAAAA,WAAW,CAAC,CAAC;CACvC,MAAM,UAAA,GAAA,sBAAA,SAAA,CAAkBC,mBAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,oBAAA,GAAA,sBAAA,SAAA,CAA4BC,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,qBAAA,gBAAgBC,kCAAAA,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
@@ -1,25 +1,20 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DatadogPagesRouter = DatadogPagesRouter;
4
- const react_1 = require("react");
5
- const router_1 = require("next/router");
6
- const browser_core_1 = require("@datadog/browser-core");
7
- const nextjsPlugin_1 = require("../nextjsPlugin");
1
+ const require_nextjsPlugin = require("../nextjsPlugin.js");
2
+ let _datadog_browser_core = require("@datadog/browser-core");
3
+ let react = require("react");
4
+ let next_router_js = require("next/router.js");
5
+ //#region src/domain/nextJSRouter/datadogPagesRouter.tsx
8
6
  function DatadogPagesRouter() {
9
- const router = (0, browser_core_1.mockable)(router_1.useRouter)();
10
- const previousPath = (0, browser_core_1.mockable)(react_1.useRef)(null);
11
- if (!router.isReady) {
12
- return null;
13
- }
14
- // Extract the path portion of asPath (without query params or hash) to detect navigations.
15
- const path = router.asPath.split(/[?#]/)[0];
16
- if (previousPath.current !== path) {
17
- // router.pathname is the route pattern (e.g., "/user/[id]") — used as the view name
18
- // router.asPath is the actual URL (e.g., "/user/42") — used to detect navigations between
19
- // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)
20
- previousPath.current = path;
21
- (0, nextjsPlugin_1.startNextjsView)(router.pathname);
22
- }
23
- return null;
7
+ const router = (0, _datadog_browser_core.mockable)(next_router_js.useRouter)();
8
+ const previousPath = (0, _datadog_browser_core.mockable)(react.useRef)(null);
9
+ if (!router.isReady) return null;
10
+ const path = router.asPath.split(/[?#]/)[0];
11
+ if (previousPath.current !== path) {
12
+ previousPath.current = path;
13
+ require_nextjsPlugin.startNextjsView(router.pathname);
14
+ }
15
+ return null;
24
16
  }
17
+ //#endregion
18
+ exports.DatadogPagesRouter = DatadogPagesRouter;
19
+
25
20
  //# sourceMappingURL=datadogPagesRouter.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"datadogPagesRouter.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"names":[],"mappings":";;AAKA,gDAoBC;AAzBD,iCAA8B;AAC9B,wCAAuC;AACvC,wDAAgD;AAChD,kDAAiD;AAEjD,SAAgB,kBAAkB;IAChC,MAAM,MAAM,GAAG,IAAA,uBAAQ,EAAC,kBAAS,CAAC,EAAE,CAAA;IACpC,MAAM,YAAY,GAAG,IAAA,uBAAQ,EAAC,cAAM,CAAC,CAAgB,IAAI,CAAC,CAAA;IAE1D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2FAA2F;IAC3F,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3C,IAAI,YAAY,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAClC,oFAAoF;QACpF,0FAA0F;QAC1F,gFAAgF;QAChF,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;QAC3B,IAAA,8BAAe,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
1
+ {"version":3,"file":"datadogPagesRouter.js","names":["useRouter","useRef"],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,UAAA,GAAA,sBAAA,SAAA,CAAkBA,eAAAA,SAAS,CAAC,CAAC;CACnC,MAAM,gBAAA,GAAA,sBAAA,SAAA,CAAwBC,MAAAA,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,qBAAA,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
@@ -1,70 +1,45 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.nextjsPlugin = nextjsPlugin;
4
- exports.startNextjsView = startNextjsView;
5
- exports.onRouterTransitionStart = onRouterTransitionStart;
6
- exports.onRumInit = onRumInit;
7
- exports.onRumStart = onRumStart;
8
- exports.resetNextjsPlugin = resetNextjsPlugin;
9
- const browser_core_1 = require("@datadog/browser-core");
1
+ let _datadog_browser_core = require("@datadog/browser-core");
2
+ //#region src/domain/nextjsPlugin.ts
10
3
  let globalPublicApi;
11
4
  let globalAddError;
12
5
  let lastNavigationUrl;
13
6
  const onRumInitSubscribers = [];
14
7
  const onRumStartSubscribers = [];
15
8
  function nextjsPlugin() {
16
- return {
17
- name: 'nextjs',
18
- onInit({ publicApi, initConfiguration }) {
19
- globalPublicApi = publicApi;
20
- initConfiguration.trackViewsManually = true;
21
- for (const subscriber of onRumInitSubscribers) {
22
- subscriber(publicApi);
23
- }
24
- },
25
- onRumStart({ addError }) {
26
- globalAddError = addError;
27
- if (addError) {
28
- for (const subscriber of onRumStartSubscribers) {
29
- subscriber(addError);
30
- }
31
- }
32
- },
33
- };
9
+ return {
10
+ name: "nextjs",
11
+ onInit({ publicApi, initConfiguration }) {
12
+ globalPublicApi = publicApi;
13
+ initConfiguration.trackViewsManually = true;
14
+ for (const subscriber of onRumInitSubscribers) subscriber(publicApi);
15
+ },
16
+ onRumStart({ addError }) {
17
+ globalAddError = addError;
18
+ if (addError) for (const subscriber of onRumStartSubscribers) subscriber(addError);
19
+ }
20
+ };
34
21
  }
35
22
  function startNextjsView(viewName) {
36
- if (globalPublicApi) {
37
- // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location
38
- const url = lastNavigationUrl ? (0, browser_core_1.buildUrl)(lastNavigationUrl, window.location.origin).href : undefined;
39
- lastNavigationUrl = undefined;
40
- globalPublicApi.startView({ name: viewName, url });
41
- }
23
+ if (globalPublicApi) {
24
+ const url = lastNavigationUrl ? (0, _datadog_browser_core.buildUrl)(lastNavigationUrl, window.location.origin).href : void 0;
25
+ lastNavigationUrl = void 0;
26
+ globalPublicApi.startView({
27
+ name: viewName,
28
+ url
29
+ });
30
+ }
42
31
  }
43
- // Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders
44
32
  function onRouterTransitionStart(url) {
45
- lastNavigationUrl = url;
46
- }
47
- function onRumInit(callback) {
48
- if (globalPublicApi) {
49
- callback(globalPublicApi);
50
- }
51
- else {
52
- onRumInitSubscribers.push(callback);
53
- }
33
+ lastNavigationUrl = url;
54
34
  }
55
35
  function onRumStart(callback) {
56
- if (globalAddError) {
57
- callback(globalAddError);
58
- }
59
- else {
60
- onRumStartSubscribers.push(callback);
61
- }
62
- }
63
- function resetNextjsPlugin() {
64
- globalPublicApi = undefined;
65
- globalAddError = undefined;
66
- onRumInitSubscribers.length = 0;
67
- onRumStartSubscribers.length = 0;
68
- lastNavigationUrl = undefined;
36
+ if (globalAddError) callback(globalAddError);
37
+ else onRumStartSubscribers.push(callback);
69
38
  }
39
+ //#endregion
40
+ exports.nextjsPlugin = nextjsPlugin;
41
+ exports.onRouterTransitionStart = onRouterTransitionStart;
42
+ exports.onRumStart = onRumStart;
43
+ exports.startNextjsView = startNextjsView;
44
+
70
45
  //# sourceMappingURL=nextjsPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nextjsPlugin.js","sourceRoot":"","sources":["../../src/domain/nextjsPlugin.ts"],"names":[],"mappings":";;AAeA,oCAoBC;AAED,0CAOC;AAGD,0DAEC;AAED,8BAMC;AAED,gCAMC;AAED,8CAMC;AAzED,wDAAgD;AAQhD,IAAI,eAAyC,CAAA;AAC7C,IAAI,cAAsD,CAAA;AAC1D,IAAI,iBAAqC,CAAA;AAEzC,MAAM,oBAAoB,GAAqB,EAAE,CAAA;AACjD,MAAM,qBAAqB,GAAsB,EAAE,CAAA;AAEnD,SAAgB,YAAY;IAC1B,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,MAAM,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;YACrC,eAAe,GAAG,SAAS,CAAA;YAC3B,iBAAiB,CAAC,kBAAkB,GAAG,IAAI,CAAA;YAE3C,KAAK,MAAM,UAAU,IAAI,oBAAoB,EAAE,CAAC;gBAC9C,UAAU,CAAC,SAAS,CAAC,CAAA;YACvB,CAAC;QACH,CAAC;QACD,UAAU,CAAC,EAAE,QAAQ,EAAE;YACrB,cAAc,GAAG,QAAQ,CAAA;YACzB,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,MAAM,UAAU,IAAI,qBAAqB,EAAE,CAAC;oBAC/C,UAAU,CAAC,QAAQ,CAAC,CAAA;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;KACkB,CAAA;AACvB,CAAC;AAED,SAAgB,eAAe,CAAC,QAAgB;IAC9C,IAAI,eAAe,EAAE,CAAC;QACpB,6HAA6H;QAC7H,MAAM,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,IAAA,uBAAQ,EAAC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;QACpG,iBAAiB,GAAG,SAAS,CAAA;QAC7B,eAAe,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,+GAA+G;AAC/G,SAAgB,uBAAuB,CAAC,GAAW;IACjD,iBAAiB,GAAG,GAAG,CAAA;AACzB,CAAC;AAED,SAAgB,SAAS,CAAC,QAAwB;IAChD,IAAI,eAAe,EAAE,CAAC;QACpB,QAAQ,CAAC,eAAe,CAAC,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;AACH,CAAC;AAED,SAAgB,UAAU,CAAC,QAAyB;IAClD,IAAI,cAAc,EAAE,CAAC;QACnB,QAAQ,CAAC,cAAc,CAAC,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;AACH,CAAC;AAED,SAAgB,iBAAiB;IAC/B,eAAe,GAAG,SAAS,CAAA;IAC3B,cAAc,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/B,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAA;IAChC,iBAAiB,GAAG,SAAS,CAAA;AAC/B,CAAC"}
1
+ {"version":3,"file":"nextjsPlugin.js","names":[],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart'>\n\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n } satisfies RumPlugin\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n}\n"],"mappings":";;AAQA,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GAEvC,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;CACF;AACF;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,qBAAA,GAAA,sBAAA,SAAA,CAA6B,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ErrorBoundary = exports.addNextjsError = exports.DatadogPagesRouter = exports.DatadogAppRouter = exports.onRouterTransitionStart = exports.nextjsPlugin = void 0;
4
- var nextjsPlugin_1 = require("../domain/nextjsPlugin");
5
- Object.defineProperty(exports, "nextjsPlugin", { enumerable: true, get: function () { return nextjsPlugin_1.nextjsPlugin; } });
6
- Object.defineProperty(exports, "onRouterTransitionStart", { enumerable: true, get: function () { return nextjsPlugin_1.onRouterTransitionStart; } });
7
- var datadogAppRouter_1 = require("../domain/nextJSRouter/datadogAppRouter");
8
- Object.defineProperty(exports, "DatadogAppRouter", { enumerable: true, get: function () { return datadogAppRouter_1.DatadogAppRouter; } });
9
- var datadogPagesRouter_1 = require("../domain/nextJSRouter/datadogPagesRouter");
10
- Object.defineProperty(exports, "DatadogPagesRouter", { enumerable: true, get: function () { return datadogPagesRouter_1.DatadogPagesRouter; } });
11
- var addNextjsError_1 = require("../domain/error/addNextjsError");
12
- Object.defineProperty(exports, "addNextjsError", { enumerable: true, get: function () { return addNextjsError_1.addNextjsError; } });
13
- var errorBoundary_1 = require("../domain/error/errorBoundary");
14
- Object.defineProperty(exports, "ErrorBoundary", { enumerable: true, get: function () { return errorBoundary_1.ErrorBoundary; } });
15
- //# sourceMappingURL=main.js.map
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_nextjsPlugin = require("../domain/nextjsPlugin.js");
3
+ const require_datadogAppRouter = require("../domain/nextJSRouter/datadogAppRouter.js");
4
+ const require_datadogPagesRouter = require("../domain/nextJSRouter/datadogPagesRouter.js");
5
+ const require_addNextjsError = require("../domain/error/addNextjsError.js");
6
+ const require_errorBoundary = require("../domain/error/errorBoundary.js");
7
+ exports.DatadogAppRouter = require_datadogAppRouter.DatadogAppRouter;
8
+ exports.DatadogPagesRouter = require_datadogPagesRouter.DatadogPagesRouter;
9
+ exports.ErrorBoundary = require_errorBoundary.ErrorBoundary;
10
+ exports.addNextjsError = require_addNextjsError.addNextjsError;
11
+ exports.nextjsPlugin = require_nextjsPlugin.nextjsPlugin;
12
+ exports.onRouterTransitionStart = require_nextjsPlugin.onRouterTransitionStart;
@@ -0,0 +1,46 @@
1
+ import { onRumStart } from "../nextjsPlugin.mjs";
2
+ import { callMonitored, createHandlingStack } from "@datadog/browser-core";
3
+ import { clocksNow } from "@datadog/js-core/time";
4
+ //#region src/domain/error/addNextjsError.ts
5
+ /**
6
+ * Add a Next.js error to the RUM session.
7
+ *
8
+ * @category Error
9
+ * @example
10
+ * ```ts
11
+ * // app/error.tsx (or app/global-error.tsx)
12
+ * 'use client'
13
+ * import { useEffect } from 'react'
14
+ * import { addNextjsError } from '@datadog/browser-rum-nextjs'
15
+ *
16
+ * export default function Error({ error }: { error: Error & { digest?: string } }) {
17
+ * useEffect(() => {
18
+ * addNextjsError(error)
19
+ * }, [error])
20
+ * return <div>Something went wrong</div>
21
+ * }
22
+ * ```
23
+ */
24
+ function addNextjsError(error, errorInfo) {
25
+ const handlingStack = createHandlingStack("nextjs error");
26
+ const startClocks = clocksNow();
27
+ onRumStart((addError) => {
28
+ callMonitored(() => {
29
+ addError({
30
+ error,
31
+ handlingStack,
32
+ componentStack: errorInfo?.componentStack ?? void 0,
33
+ startClocks,
34
+ context: {
35
+ ...error.dd_context,
36
+ ...error.digest && { nextjs: { digest: error.digest } },
37
+ framework: "nextjs"
38
+ }
39
+ });
40
+ });
41
+ });
42
+ }
43
+ //#endregion
44
+ export { addNextjsError };
45
+
46
+ //# sourceMappingURL=addNextjsError.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addNextjsError.mjs","names":[],"sources":["../../../src/domain/error/addNextjsError.ts"],"sourcesContent":["import { clocksNow } from '@datadog/js-core/time'\nimport { callMonitored, createHandlingStack } from '@datadog/browser-core'\nimport type { Context } from '@datadog/browser-core'\nimport type { ErrorInfo } from 'react'\nimport { onRumStart } from '../nextjsPlugin'\n\n/**\n * Add a Next.js error to the RUM session.\n *\n * @category Error\n * @example\n * ```ts\n * // app/error.tsx (or app/global-error.tsx)\n * 'use client'\n * import { useEffect } from 'react'\n * import { addNextjsError } from '@datadog/browser-rum-nextjs'\n *\n * export default function Error({ error }: { error: Error & { digest?: string } }) {\n * useEffect(() => {\n * addNextjsError(error)\n * }, [error])\n * return <div>Something went wrong</div>\n * }\n * ```\n */\nexport function addNextjsError(error: Error & { digest?: string }, errorInfo?: ErrorInfo) {\n const handlingStack = createHandlingStack('nextjs error')\n const startClocks = clocksNow()\n onRumStart((addError) => {\n callMonitored(() => {\n addError({\n error,\n handlingStack,\n componentStack: errorInfo?.componentStack ?? undefined,\n startClocks,\n context: {\n ...(error as Error & { dd_context?: Context }).dd_context,\n ...(error.digest && { nextjs: { digest: error.digest } }),\n framework: 'nextjs',\n },\n })\n })\n })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eAAe,OAAoC,WAAuB;CACxF,MAAM,gBAAgB,oBAAoB,cAAc;CACxD,MAAM,cAAc,UAAU;CAC9B,YAAY,aAAa;EACvB,oBAAoB;GAClB,SAAS;IACP;IACA;IACA,gBAAgB,WAAW,kBAAkB,KAAA;IAC7C;IACA,SAAS;KACP,GAAI,MAA2C;KAC/C,GAAI,MAAM,UAAU,EAAE,QAAQ,EAAE,QAAQ,MAAM,OAAO,EAAE;KACvD,WAAW;IACb;GACF,CAAC;EACH,CAAC;CACH,CAAC;AACH"}
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { addNextjsError } from "./addNextjsError.mjs";
3
+ import { createErrorBoundary } from "@datadog/browser-rum-react/internal";
4
+ //#region src/domain/error/errorBoundary.ts
5
+ /**
6
+ * ErrorBoundary component to report React errors to Datadog using the Next.js error context.
7
+ *
8
+ * For more advanced error handling, you can use the {@link addNextjsError} function.
9
+ *
10
+ * @category Error
11
+ * @example
12
+ * ```ts
13
+ * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'
14
+ *
15
+ * <ErrorBoundary fallback={() => null}>
16
+ * <Component />
17
+ * </ErrorBoundary>
18
+ * ```
19
+ */
20
+ const ErrorBoundary = createErrorBoundary(addNextjsError);
21
+ //#endregion
22
+ export { ErrorBoundary };
23
+
24
+ //# sourceMappingURL=errorBoundary.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorBoundary.mjs","names":[],"sources":["../../../src/domain/error/errorBoundary.ts"],"sourcesContent":["'use client'\nimport { createErrorBoundary } from '@datadog/browser-rum-react/internal'\nexport type { ErrorBoundaryFallback, ErrorBoundaryProps } from '@datadog/browser-rum-react/internal'\nimport { addNextjsError } from './addNextjsError'\n\n/**\n * ErrorBoundary component to report React errors to Datadog using the Next.js error context.\n *\n * For more advanced error handling, you can use the {@link addNextjsError} function.\n *\n * @category Error\n * @example\n * ```ts\n * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'\n *\n * <ErrorBoundary fallback={() => null}>\n * <Component />\n * </ErrorBoundary>\n * ```\n */\n// eslint-disable-next-line local-rules/disallow-side-effects\nexport const ErrorBoundary = createErrorBoundary(addNextjsError)\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqBA,MAAa,gBAAgB,oBAAoB,cAAc"}
@@ -0,0 +1,22 @@
1
+ //#region src/domain/nextJSRouter/computeViewNameFromParams.ts
2
+ function computeViewNameFromParams(pathname, params) {
3
+ if (Object.keys(params).length === 0) return pathname;
4
+ const segments = pathname.split("/");
5
+ for (const [paramName, paramValue] of Object.entries(params)) {
6
+ if (!Array.isArray(paramValue) || paramValue.length === 0) continue;
7
+ for (let i = 0; i < segments.length; i++) if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {
8
+ segments.splice(i, paramValue.length, `[...${paramName}]`);
9
+ break;
10
+ }
11
+ }
12
+ for (const [paramName, paramValue] of Object.entries(params)) {
13
+ if (typeof paramValue !== "string" || !paramValue) continue;
14
+ const index = segments.indexOf(paramValue);
15
+ if (index !== -1) segments[index] = `[${paramName}]`;
16
+ }
17
+ return segments.join("/");
18
+ }
19
+ //#endregion
20
+ export { computeViewNameFromParams };
21
+
22
+ //# sourceMappingURL=computeViewNameFromParams.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeViewNameFromParams.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/computeViewNameFromParams.ts"],"sourcesContent":["import type { useParams } from 'next/navigation'\n\ntype Params = ReturnType<typeof useParams>\n\nexport function computeViewNameFromParams(pathname: string, params: Params): string {\n if (Object.keys(params).length === 0) {\n return pathname\n }\n\n const segments = pathname.split('/')\n\n // Process catch-all (array) params first to prevent their segments from being\n // consumed by regular param replacements when values overlap.\n for (const [paramName, paramValue] of Object.entries(params)) {\n if (!Array.isArray(paramValue) || paramValue.length === 0) {\n continue\n }\n for (let i = 0; i < segments.length; i++) {\n if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {\n segments.splice(i, paramValue.length, `[...${paramName}]`)\n break\n }\n }\n }\n\n // Process regular (string) params greedily left-to-right.\n // When multiple params share the same value, names are assigned left-to-right in param iteration order.\n // When a param value also appears in a static segment, the leftmost occurrence is assumed to be dynamic.\n for (const [paramName, paramValue] of Object.entries(params)) {\n if (typeof paramValue !== 'string' || !paramValue) {\n continue\n }\n const index = segments.indexOf(paramValue)\n if (index !== -1) {\n segments[index] = `[${paramName}]`\n }\n }\n\n return segments.join('/')\n}\n"],"mappings":";AAIA,SAAgB,0BAA0B,UAAkB,QAAwB;CAClF,IAAI,OAAO,KAAK,MAAM,CAAC,CAAC,WAAW,GACjC,OAAO;CAGT,MAAM,WAAW,SAAS,MAAM,GAAG;CAInC,KAAK,MAAM,CAAC,WAAW,eAAe,OAAO,QAAQ,MAAM,GAAG;EAC5D,IAAI,CAAC,MAAM,QAAQ,UAAU,KAAK,WAAW,WAAW,GACtD;EAEF,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,IAAI,IAAI,WAAW,UAAU,SAAS,UAAU,WAAW,OAAO,GAAG,MAAM,SAAS,IAAI,OAAO,CAAC,GAAG;GACjG,SAAS,OAAO,GAAG,WAAW,QAAQ,OAAO,UAAU,EAAE;GACzD;EACF;CAEJ;CAKA,KAAK,MAAM,CAAC,WAAW,eAAe,OAAO,QAAQ,MAAM,GAAG;EAC5D,IAAI,OAAO,eAAe,YAAY,CAAC,YACrC;EAEF,MAAM,QAAQ,SAAS,QAAQ,UAAU;EACzC,IAAI,UAAU,IACZ,SAAS,SAAS,IAAI,UAAU;CAEpC;CAEA,OAAO,SAAS,KAAK,GAAG;AAC1B"}
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { startNextjsView } from "../nextjsPlugin.mjs";
3
+ import { computeViewNameFromParams } from "./computeViewNameFromParams.mjs";
4
+ import { mockable } from "@datadog/browser-core";
5
+ import { useRef } from "react";
6
+ import { useParams, usePathname } from "next/navigation.js";
7
+ //#region src/domain/nextJSRouter/datadogAppRouter.tsx
8
+ function DatadogAppRouter() {
9
+ const pathname = mockable(usePathname)();
10
+ const params = mockable(useParams)();
11
+ const previousPathname = mockable(useRef)(null);
12
+ if (previousPathname.current !== pathname) {
13
+ previousPathname.current = pathname;
14
+ startNextjsView(computeViewNameFromParams(pathname, params));
15
+ }
16
+ return null;
17
+ }
18
+ //#endregion
19
+ export { DatadogAppRouter };
20
+
21
+ //# sourceMappingURL=datadogAppRouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datadogAppRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"sourcesContent":["'use client'\n\nimport { useRef } from 'react'\nimport { usePathname, useParams } from 'next/navigation'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\nimport { computeViewNameFromParams } from './computeViewNameFromParams'\n\nexport function DatadogAppRouter() {\n const pathname = mockable(usePathname)()\n const params = mockable(useParams)()\n const previousPathname = mockable(useRef)<string | null>(null)\n\n if (previousPathname.current !== pathname) {\n previousPathname.current = pathname\n startNextjsView(computeViewNameFromParams(pathname, params))\n }\n\n return null\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,mBAAmB;CACjC,MAAM,WAAW,SAAS,WAAW,CAAC,CAAC;CACvC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,mBAAmB,SAAS,MAAM,CAAC,CAAgB,IAAI;CAE7D,IAAI,iBAAiB,YAAY,UAAU;EACzC,iBAAiB,UAAU;EAC3B,gBAAgB,0BAA0B,UAAU,MAAM,CAAC;CAC7D;CAEA,OAAO;AACT"}
@@ -0,0 +1,20 @@
1
+ import { startNextjsView } from "../nextjsPlugin.mjs";
2
+ import { mockable } from "@datadog/browser-core";
3
+ import { useRef } from "react";
4
+ import { useRouter } from "next/router.js";
5
+ //#region src/domain/nextJSRouter/datadogPagesRouter.tsx
6
+ function DatadogPagesRouter() {
7
+ const router = mockable(useRouter)();
8
+ const previousPath = mockable(useRef)(null);
9
+ if (!router.isReady) return null;
10
+ const path = router.asPath.split(/[?#]/)[0];
11
+ if (previousPath.current !== path) {
12
+ previousPath.current = path;
13
+ startNextjsView(router.pathname);
14
+ }
15
+ return null;
16
+ }
17
+ //#endregion
18
+ export { DatadogPagesRouter };
19
+
20
+ //# sourceMappingURL=datadogPagesRouter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datadogPagesRouter.mjs","names":[],"sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useRouter } from 'next/router'\nimport { mockable } from '@datadog/browser-core'\nimport { startNextjsView } from '../nextjsPlugin'\n\nexport function DatadogPagesRouter() {\n const router = mockable(useRouter)()\n const previousPath = mockable(useRef)<string | null>(null)\n\n if (!router.isReady) {\n return null\n }\n\n // Extract the path portion of asPath (without query params or hash) to detect navigations.\n const path = router.asPath.split(/[?#]/)[0]\n\n if (previousPath.current !== path) {\n // router.pathname is the route pattern (e.g., \"/user/[id]\") — used as the view name\n // router.asPath is the actual URL (e.g., \"/user/42\") — used to detect navigations between\n // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)\n previousPath.current = path\n startNextjsView(router.pathname)\n }\n\n return null\n}\n"],"mappings":";;;;;AAKA,SAAgB,qBAAqB;CACnC,MAAM,SAAS,SAAS,SAAS,CAAC,CAAC;CACnC,MAAM,eAAe,SAAS,MAAM,CAAC,CAAgB,IAAI;CAEzD,IAAI,CAAC,OAAO,SACV,OAAO;CAIT,MAAM,OAAO,OAAO,OAAO,MAAM,MAAM,CAAC,CAAC;CAEzC,IAAI,aAAa,YAAY,MAAM;EAIjC,aAAa,UAAU;EACvB,gBAAgB,OAAO,QAAQ;CACjC;CAEA,OAAO;AACT"}
@@ -0,0 +1,42 @@
1
+ import { buildUrl } from "@datadog/browser-core";
2
+ //#region src/domain/nextjsPlugin.ts
3
+ let globalPublicApi;
4
+ let globalAddError;
5
+ let lastNavigationUrl;
6
+ const onRumInitSubscribers = [];
7
+ const onRumStartSubscribers = [];
8
+ function nextjsPlugin() {
9
+ return {
10
+ name: "nextjs",
11
+ onInit({ publicApi, initConfiguration }) {
12
+ globalPublicApi = publicApi;
13
+ initConfiguration.trackViewsManually = true;
14
+ for (const subscriber of onRumInitSubscribers) subscriber(publicApi);
15
+ },
16
+ onRumStart({ addError }) {
17
+ globalAddError = addError;
18
+ if (addError) for (const subscriber of onRumStartSubscribers) subscriber(addError);
19
+ }
20
+ };
21
+ }
22
+ function startNextjsView(viewName) {
23
+ if (globalPublicApi) {
24
+ const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : void 0;
25
+ lastNavigationUrl = void 0;
26
+ globalPublicApi.startView({
27
+ name: viewName,
28
+ url
29
+ });
30
+ }
31
+ }
32
+ function onRouterTransitionStart(url) {
33
+ lastNavigationUrl = url;
34
+ }
35
+ function onRumStart(callback) {
36
+ if (globalAddError) callback(globalAddError);
37
+ else onRumStartSubscribers.push(callback);
38
+ }
39
+ //#endregion
40
+ export { nextjsPlugin, onRouterTransitionStart, onRumStart, startNextjsView };
41
+
42
+ //# sourceMappingURL=nextjsPlugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nextjsPlugin.mjs","names":[],"sources":["../../src/domain/nextjsPlugin.ts"],"sourcesContent":["import { buildUrl } from '@datadog/browser-core'\nimport type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core'\n\nexport type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart'>\n\ntype InitSubscriber = (rumPublicApi: RumPublicApi) => void\ntype StartSubscriber = (addError: StartRumResult['addError']) => void\n\nlet globalPublicApi: RumPublicApi | undefined\nlet globalAddError: StartRumResult['addError'] | undefined\nlet lastNavigationUrl: string | undefined\n\nconst onRumInitSubscribers: InitSubscriber[] = []\nconst onRumStartSubscribers: StartSubscriber[] = []\n\nexport function nextjsPlugin(): NextjsPlugin {\n return {\n name: 'nextjs',\n onInit({ publicApi, initConfiguration }) {\n globalPublicApi = publicApi\n initConfiguration.trackViewsManually = true\n\n for (const subscriber of onRumInitSubscribers) {\n subscriber(publicApi)\n }\n },\n onRumStart({ addError }) {\n globalAddError = addError\n if (addError) {\n for (const subscriber of onRumStartSubscribers) {\n subscriber(addError)\n }\n }\n },\n } satisfies RumPlugin\n}\n\nexport function startNextjsView(viewName: string) {\n if (globalPublicApi) {\n // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location\n const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined\n lastNavigationUrl = undefined\n globalPublicApi.startView({ name: viewName, url })\n }\n}\n\n// Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders\nexport function onRouterTransitionStart(url: string) {\n lastNavigationUrl = url\n}\n\nexport function onRumInit(callback: InitSubscriber) {\n if (globalPublicApi) {\n callback(globalPublicApi)\n } else {\n onRumInitSubscribers.push(callback)\n }\n}\n\nexport function onRumStart(callback: StartSubscriber) {\n if (globalAddError) {\n callback(globalAddError)\n } else {\n onRumStartSubscribers.push(callback)\n }\n}\n\nexport function resetNextjsPlugin() {\n globalPublicApi = undefined\n globalAddError = undefined\n onRumInitSubscribers.length = 0\n onRumStartSubscribers.length = 0\n lastNavigationUrl = undefined\n}\n"],"mappings":";;AAQA,IAAI;AACJ,IAAI;AACJ,IAAI;AAEJ,MAAM,uBAAyC,CAAC;AAChD,MAAM,wBAA2C,CAAC;AAElD,SAAgB,eAA6B;CAC3C,OAAO;EACL,MAAM;EACN,OAAO,EAAE,WAAW,qBAAqB;GACvC,kBAAkB;GAClB,kBAAkB,qBAAqB;GAEvC,KAAK,MAAM,cAAc,sBACvB,WAAW,SAAS;EAExB;EACA,WAAW,EAAE,YAAY;GACvB,iBAAiB;GACjB,IAAI,UACF,KAAK,MAAM,cAAc,uBACvB,WAAW,QAAQ;EAGzB;CACF;AACF;AAEA,SAAgB,gBAAgB,UAAkB;CAChD,IAAI,iBAAiB;EAEnB,MAAM,MAAM,oBAAoB,SAAS,mBAAmB,OAAO,SAAS,MAAM,CAAC,CAAC,OAAO,KAAA;EAC3F,oBAAoB,KAAA;EACpB,gBAAgB,UAAU;GAAE,MAAM;GAAU;EAAI,CAAC;CACnD;AACF;AAGA,SAAgB,wBAAwB,KAAa;CACnD,oBAAoB;AACtB;AAUA,SAAgB,WAAW,UAA2B;CACpD,IAAI,gBACF,SAAS,cAAc;MAEvB,sBAAsB,KAAK,QAAQ;AAEvC"}
@@ -0,0 +1,6 @@
1
+ import { nextjsPlugin, onRouterTransitionStart } from "../domain/nextjsPlugin.mjs";
2
+ import { DatadogAppRouter } from "../domain/nextJSRouter/datadogAppRouter.mjs";
3
+ import { DatadogPagesRouter } from "../domain/nextJSRouter/datadogPagesRouter.mjs";
4
+ import { addNextjsError } from "../domain/error/addNextjsError.mjs";
5
+ import { ErrorBoundary } from "../domain/error/errorBoundary.mjs";
6
+ export { DatadogAppRouter, DatadogPagesRouter, ErrorBoundary, addNextjsError, nextjsPlugin, onRouterTransitionStart };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@datadog/browser-rum-nextjs",
3
- "version": "7.3.0",
3
+ "version": "7.4.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "cjs/entries/main.js",
6
- "module": "esm/entries/main.js",
6
+ "module": "esm/entries/main.mjs",
7
7
  "types": "cjs/entries/main.d.ts",
8
8
  "files": [
9
9
  "cjs",
@@ -17,10 +17,10 @@
17
17
  "prepack": "yarn build"
18
18
  },
19
19
  "dependencies": {
20
- "@datadog/browser-core": "7.3.0",
21
- "@datadog/browser-rum-core": "7.3.0",
22
- "@datadog/browser-rum-react": "7.3.0",
23
- "@datadog/js-core": "0.0.2"
20
+ "@datadog/browser-core": "7.4.0",
21
+ "@datadog/browser-rum-core": "7.4.0",
22
+ "@datadog/browser-rum-react": "7.4.0",
23
+ "@datadog/js-core": "0.0.4"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "next": ">=13.0.0",
@@ -43,9 +43,9 @@
43
43
  "extends": "../../package.json"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/react": "19.2.15",
47
- "next": "16.2.6",
48
- "react": "19.2.6",
49
- "react-dom": "19.2.6"
46
+ "@types/react": "19.2.17",
47
+ "next": "16.2.9",
48
+ "react": "19.2.7",
49
+ "react-dom": "19.2.7"
50
50
  }
51
51
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/entries/main.ts"],"names":[],"mappings":";;;AAAA,uDAA8E;AAArE,4GAAA,YAAY,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAE9C,4EAA0E;AAAjE,oHAAA,gBAAgB,OAAA;AACzB,gFAA8E;AAArE,wHAAA,kBAAkB,OAAA;AAC3B,iEAA+D;AAAtD,gHAAA,cAAc,OAAA;AACvB,+DAA6D;AAApD,8GAAA,aAAa,OAAA"}
@@ -1,23 +0,0 @@
1
- import type { ErrorInfo } from 'react';
2
- /**
3
- * Add a Next.js error to the RUM session.
4
- *
5
- * @category Error
6
- * @example
7
- * ```ts
8
- * // app/error.tsx (or app/global-error.tsx)
9
- * 'use client'
10
- * import { useEffect } from 'react'
11
- * import { addNextjsError } from '@datadog/browser-rum-nextjs'
12
- *
13
- * export default function Error({ error }: { error: Error & { digest?: string } }) {
14
- * useEffect(() => {
15
- * addNextjsError(error)
16
- * }, [error])
17
- * return <div>Something went wrong</div>
18
- * }
19
- * ```
20
- */
21
- export declare function addNextjsError(error: Error & {
22
- digest?: string;
23
- }, errorInfo?: ErrorInfo): void;
@@ -1,42 +0,0 @@
1
- import { clocksNow } from '@datadog/js-core/time';
2
- import { callMonitored, createHandlingStack } from '@datadog/browser-core';
3
- import { onRumStart } from '../nextjsPlugin';
4
- /**
5
- * Add a Next.js error to the RUM session.
6
- *
7
- * @category Error
8
- * @example
9
- * ```ts
10
- * // app/error.tsx (or app/global-error.tsx)
11
- * 'use client'
12
- * import { useEffect } from 'react'
13
- * import { addNextjsError } from '@datadog/browser-rum-nextjs'
14
- *
15
- * export default function Error({ error }: { error: Error & { digest?: string } }) {
16
- * useEffect(() => {
17
- * addNextjsError(error)
18
- * }, [error])
19
- * return <div>Something went wrong</div>
20
- * }
21
- * ```
22
- */
23
- export function addNextjsError(error, errorInfo) {
24
- const handlingStack = createHandlingStack('nextjs error');
25
- const startClocks = clocksNow();
26
- onRumStart((addError) => {
27
- callMonitored(() => {
28
- addError({
29
- error,
30
- handlingStack,
31
- componentStack: errorInfo?.componentStack ?? undefined,
32
- startClocks,
33
- context: {
34
- ...error.dd_context,
35
- ...(error.digest && { nextjs: { digest: error.digest } }),
36
- framework: 'nextjs',
37
- },
38
- });
39
- });
40
- });
41
- }
42
- //# sourceMappingURL=addNextjsError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addNextjsError.js","sourceRoot":"","sources":["../../../src/domain/error/addNextjsError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAG1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,cAAc,CAAC,KAAkC,EAAE,SAAqB;IACtF,MAAM,aAAa,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAA;IACzD,MAAM,WAAW,GAAG,SAAS,EAAE,CAAA;IAC/B,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtB,aAAa,CAAC,GAAG,EAAE;YACjB,QAAQ,CAAC;gBACP,KAAK;gBACL,aAAa;gBACb,cAAc,EAAE,SAAS,EAAE,cAAc,IAAI,SAAS;gBACtD,WAAW;gBACX,OAAO,EAAE;oBACP,GAAI,KAA0C,CAAC,UAAU;oBACzD,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC;oBACzD,SAAS,EAAE,QAAQ;iBACpB;aACF,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -1,17 +0,0 @@
1
- export type { ErrorBoundaryFallback, ErrorBoundaryProps } from '@datadog/browser-rum-react/internal';
2
- /**
3
- * ErrorBoundary component to report React errors to Datadog using the Next.js error context.
4
- *
5
- * For more advanced error handling, you can use the {@link addNextjsError} function.
6
- *
7
- * @category Error
8
- * @example
9
- * ```ts
10
- * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'
11
- *
12
- * <ErrorBoundary fallback={() => null}>
13
- * <Component />
14
- * </ErrorBoundary>
15
- * ```
16
- */
17
- export declare const ErrorBoundary: import("react").ComponentClass<import("@datadog/browser-rum-react/internal").ErrorBoundaryProps, any>;
@@ -1,21 +0,0 @@
1
- 'use client';
2
- import { createErrorBoundary } from '@datadog/browser-rum-react/internal';
3
- import { addNextjsError } from './addNextjsError';
4
- /**
5
- * ErrorBoundary component to report React errors to Datadog using the Next.js error context.
6
- *
7
- * For more advanced error handling, you can use the {@link addNextjsError} function.
8
- *
9
- * @category Error
10
- * @example
11
- * ```ts
12
- * import { ErrorBoundary } from '@datadog/browser-rum-nextjs'
13
- *
14
- * <ErrorBoundary fallback={() => null}>
15
- * <Component />
16
- * </ErrorBoundary>
17
- * ```
18
- */
19
- // eslint-disable-next-line local-rules/disallow-side-effects
20
- export const ErrorBoundary = createErrorBoundary(addNextjsError);
21
- //# sourceMappingURL=errorBoundary.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorBoundary.js","sourceRoot":"","sources":["../../../src/domain/error/errorBoundary.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AACZ,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AAEzE,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAEjD;;;;;;;;;;;;;;GAcG;AACH,6DAA6D;AAC7D,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { useParams } from 'next/navigation';
2
- type Params = ReturnType<typeof useParams>;
3
- export declare function computeViewNameFromParams(pathname: string, params: Params): string;
4
- export {};
@@ -1,33 +0,0 @@
1
- export function computeViewNameFromParams(pathname, params) {
2
- if (Object.keys(params).length === 0) {
3
- return pathname;
4
- }
5
- const segments = pathname.split('/');
6
- // Process catch-all (array) params first to prevent their segments from being
7
- // consumed by regular param replacements when values overlap.
8
- for (const [paramName, paramValue] of Object.entries(params)) {
9
- if (!Array.isArray(paramValue) || paramValue.length === 0) {
10
- continue;
11
- }
12
- for (let i = 0; i < segments.length; i++) {
13
- if (i + paramValue.length <= segments.length && paramValue.every((v, j) => segments[i + j] === v)) {
14
- segments.splice(i, paramValue.length, `[...${paramName}]`);
15
- break;
16
- }
17
- }
18
- }
19
- // Process regular (string) params greedily left-to-right.
20
- // When multiple params share the same value, names are assigned left-to-right in param iteration order.
21
- // When a param value also appears in a static segment, the leftmost occurrence is assumed to be dynamic.
22
- for (const [paramName, paramValue] of Object.entries(params)) {
23
- if (typeof paramValue !== 'string' || !paramValue) {
24
- continue;
25
- }
26
- const index = segments.indexOf(paramValue);
27
- if (index !== -1) {
28
- segments[index] = `[${paramName}]`;
29
- }
30
- }
31
- return segments.join('/');
32
- }
33
- //# sourceMappingURL=computeViewNameFromParams.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeViewNameFromParams.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/computeViewNameFromParams.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,yBAAyB,CAAC,QAAgB,EAAE,MAAc;IACxE,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAEpC,8EAA8E;IAC9E,8DAA8D;IAC9D,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1D,SAAQ;QACV,CAAC;QACD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACzC,IAAI,CAAC,GAAG,UAAU,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAClG,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,OAAO,SAAS,GAAG,CAAC,CAAA;gBAC1D,MAAK;YACP,CAAC;QACH,CAAC;IACH,CAAC;IAED,0DAA0D;IAC1D,wGAAwG;IACxG,yGAAyG;IACzG,KAAK,MAAM,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC7D,IAAI,OAAO,UAAU,KAAK,QAAQ,IAAI,CAAC,UAAU,EAAE,CAAC;YAClD,SAAQ;QACV,CAAC;QACD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QAC1C,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;YACjB,QAAQ,CAAC,KAAK,CAAC,GAAG,IAAI,SAAS,GAAG,CAAA;QACpC,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC3B,CAAC"}
@@ -1 +0,0 @@
1
- export declare function DatadogAppRouter(): null;
@@ -1,17 +0,0 @@
1
- 'use client';
2
- import { useRef } from 'react';
3
- import { usePathname, useParams } from 'next/navigation';
4
- import { mockable } from '@datadog/browser-core';
5
- import { startNextjsView } from '../nextjsPlugin';
6
- import { computeViewNameFromParams } from './computeViewNameFromParams';
7
- export function DatadogAppRouter() {
8
- const pathname = mockable(usePathname)();
9
- const params = mockable(useParams)();
10
- const previousPathname = mockable(useRef)(null);
11
- if (previousPathname.current !== pathname) {
12
- previousPathname.current = pathname;
13
- startNextjsView(computeViewNameFromParams(pathname, params));
14
- }
15
- return null;
16
- }
17
- //# sourceMappingURL=datadogAppRouter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datadogAppRouter.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/datadogAppRouter.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAEvE,MAAM,UAAU,gBAAgB;IAC9B,MAAM,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAA;IACxC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAA;IACpC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAgB,IAAI,CAAC,CAAA;IAE9D,IAAI,gBAAgB,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC1C,gBAAgB,CAAC,OAAO,GAAG,QAAQ,CAAA;QACnC,eAAe,CAAC,yBAAyB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -1 +0,0 @@
1
- export declare function DatadogPagesRouter(): null;
@@ -1,22 +0,0 @@
1
- import { useRef } from 'react';
2
- import { useRouter } from 'next/router';
3
- import { mockable } from '@datadog/browser-core';
4
- import { startNextjsView } from '../nextjsPlugin';
5
- export function DatadogPagesRouter() {
6
- const router = mockable(useRouter)();
7
- const previousPath = mockable(useRef)(null);
8
- if (!router.isReady) {
9
- return null;
10
- }
11
- // Extract the path portion of asPath (without query params or hash) to detect navigations.
12
- const path = router.asPath.split(/[?#]/)[0];
13
- if (previousPath.current !== path) {
14
- // router.pathname is the route pattern (e.g., "/user/[id]") — used as the view name
15
- // router.asPath is the actual URL (e.g., "/user/42") — used to detect navigations between
16
- // different concrete URLs of the same dynamic route (e.g., /user/42 → /user/43)
17
- previousPath.current = path;
18
- startNextjsView(router.pathname);
19
- }
20
- return null;
21
- }
22
- //# sourceMappingURL=datadogPagesRouter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"datadogPagesRouter.js","sourceRoot":"","sources":["../../../src/domain/nextJSRouter/datadogPagesRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,UAAU,kBAAkB;IAChC,MAAM,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAA;IACpC,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAgB,IAAI,CAAC,CAAA;IAE1D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,2FAA2F;IAC3F,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAE3C,IAAI,YAAY,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;QAClC,oFAAoF;QACpF,0FAA0F;QAC1F,gFAAgF;QAChF,YAAY,CAAC,OAAO,GAAG,IAAI,CAAA;QAC3B,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { RumPlugin, RumPublicApi, StartRumResult } from '@datadog/browser-rum-core';
2
- export type NextjsPlugin = Pick<Required<RumPlugin>, 'name' | 'onInit' | 'onRumStart'>;
3
- type InitSubscriber = (rumPublicApi: RumPublicApi) => void;
4
- type StartSubscriber = (addError: StartRumResult['addError']) => void;
5
- export declare function nextjsPlugin(): NextjsPlugin;
6
- export declare function startNextjsView(viewName: string): void;
7
- export declare function onRouterTransitionStart(url: string): void;
8
- export declare function onRumInit(callback: InitSubscriber): void;
9
- export declare function onRumStart(callback: StartSubscriber): void;
10
- export declare function resetNextjsPlugin(): void;
11
- export {};
@@ -1,62 +0,0 @@
1
- import { buildUrl } from '@datadog/browser-core';
2
- let globalPublicApi;
3
- let globalAddError;
4
- let lastNavigationUrl;
5
- const onRumInitSubscribers = [];
6
- const onRumStartSubscribers = [];
7
- export function nextjsPlugin() {
8
- return {
9
- name: 'nextjs',
10
- onInit({ publicApi, initConfiguration }) {
11
- globalPublicApi = publicApi;
12
- initConfiguration.trackViewsManually = true;
13
- for (const subscriber of onRumInitSubscribers) {
14
- subscriber(publicApi);
15
- }
16
- },
17
- onRumStart({ addError }) {
18
- globalAddError = addError;
19
- if (addError) {
20
- for (const subscriber of onRumStartSubscribers) {
21
- subscriber(addError);
22
- }
23
- }
24
- },
25
- };
26
- }
27
- export function startNextjsView(viewName) {
28
- if (globalPublicApi) {
29
- // Use the URL captured by onRouterTransitionStart if available, since React renders before pushState updates window.location
30
- const url = lastNavigationUrl ? buildUrl(lastNavigationUrl, window.location.origin).href : undefined;
31
- lastNavigationUrl = undefined;
32
- globalPublicApi.startView({ name: viewName, url });
33
- }
34
- }
35
- // Must be re-exported from the user's instrumentation-client.ts so we can capture the URL before React renders
36
- export function onRouterTransitionStart(url) {
37
- lastNavigationUrl = url;
38
- }
39
- export function onRumInit(callback) {
40
- if (globalPublicApi) {
41
- callback(globalPublicApi);
42
- }
43
- else {
44
- onRumInitSubscribers.push(callback);
45
- }
46
- }
47
- export function onRumStart(callback) {
48
- if (globalAddError) {
49
- callback(globalAddError);
50
- }
51
- else {
52
- onRumStartSubscribers.push(callback);
53
- }
54
- }
55
- export function resetNextjsPlugin() {
56
- globalPublicApi = undefined;
57
- globalAddError = undefined;
58
- onRumInitSubscribers.length = 0;
59
- onRumStartSubscribers.length = 0;
60
- lastNavigationUrl = undefined;
61
- }
62
- //# sourceMappingURL=nextjsPlugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nextjsPlugin.js","sourceRoot":"","sources":["../../src/domain/nextjsPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAQhD,IAAI,eAAyC,CAAA;AAC7C,IAAI,cAAsD,CAAA;AAC1D,IAAI,iBAAqC,CAAA;AAEzC,MAAM,oBAAoB,GAAqB,EAAE,CAAA;AACjD,MAAM,qBAAqB,GAAsB,EAAE,CAAA;AAEnD,MAAM,UAAU,YAAY;IAC1B,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,MAAM,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE;YACrC,eAAe,GAAG,SAAS,CAAA;YAC3B,iBAAiB,CAAC,kBAAkB,GAAG,IAAI,CAAA;YAE3C,KAAK,MAAM,UAAU,IAAI,oBAAoB,EAAE,CAAC;gBAC9C,UAAU,CAAC,SAAS,CAAC,CAAA;YACvB,CAAC;QACH,CAAC;QACD,UAAU,CAAC,EAAE,QAAQ,EAAE;YACrB,cAAc,GAAG,QAAQ,CAAA;YACzB,IAAI,QAAQ,EAAE,CAAC;gBACb,KAAK,MAAM,UAAU,IAAI,qBAAqB,EAAE,CAAC;oBAC/C,UAAU,CAAC,QAAQ,CAAC,CAAA;gBACtB,CAAC;YACH,CAAC;QACH,CAAC;KACkB,CAAA;AACvB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,IAAI,eAAe,EAAE,CAAC;QACpB,6HAA6H;QAC7H,MAAM,GAAG,GAAG,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAA;QACpG,iBAAiB,GAAG,SAAS,CAAA;QAC7B,eAAe,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,iBAAiB,GAAG,GAAG,CAAA;AACzB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,QAAwB;IAChD,IAAI,eAAe,EAAE,CAAC;QACpB,QAAQ,CAAC,eAAe,CAAC,CAAA;IAC3B,CAAC;SAAM,CAAC;QACN,oBAAoB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACrC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAAyB;IAClD,IAAI,cAAc,EAAE,CAAC;QACnB,QAAQ,CAAC,cAAc,CAAC,CAAA;IAC1B,CAAC;SAAM,CAAC;QACN,qBAAqB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,eAAe,GAAG,SAAS,CAAA;IAC3B,cAAc,GAAG,SAAS,CAAA;IAC1B,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAA;IAC/B,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAA;IAChC,iBAAiB,GAAG,SAAS,CAAA;AAC/B,CAAC"}
@@ -1,7 +0,0 @@
1
- export { nextjsPlugin, onRouterTransitionStart } from '../domain/nextjsPlugin';
2
- export type { NextjsPlugin } from '../domain/nextjsPlugin';
3
- export { DatadogAppRouter } from '../domain/nextJSRouter/datadogAppRouter';
4
- export { DatadogPagesRouter } from '../domain/nextJSRouter/datadogPagesRouter';
5
- export { addNextjsError } from '../domain/error/addNextjsError';
6
- export { ErrorBoundary } from '../domain/error/errorBoundary';
7
- export type { ErrorBoundaryFallback, ErrorBoundaryProps } from '../domain/error/errorBoundary';
@@ -1,6 +0,0 @@
1
- export { nextjsPlugin, onRouterTransitionStart } from '../domain/nextjsPlugin';
2
- export { DatadogAppRouter } from '../domain/nextJSRouter/datadogAppRouter';
3
- export { DatadogPagesRouter } from '../domain/nextJSRouter/datadogPagesRouter';
4
- export { addNextjsError } from '../domain/error/addNextjsError';
5
- export { ErrorBoundary } from '../domain/error/errorBoundary';
6
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/entries/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAE9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAA"}