8000 feat(feedback): Create async bundles and code to resolve helper inte… · n4bb12/sentry-javascript@a6e7324 · GitHub
[go: up one dir, main page]

Skip to content

Commit a6e7324

Browse files
authored
feat(feedback): Create async bundles and code to resolve helper integrations (getsentry#11621)
1 parent 7eb000c commit a6e7324

24 files changed

+301
-377
lines changed

.size-limit.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,35 +52,28 @@ module.exports = [
5252
path: 'packages/browser/build/npm/esm/index.js',
5353
import: createImport('init', 'browserTracingIntegration', 'replayIntegration', 'feedbackIntegration'),
5454
gzip: true,
55-
limit: '83 KB',
55+
limit: '86 KB',
5656
},
5757
{
5858
name: '@sentry/browser (incl. Feedback)',
5959
path: 'packages/browser/build/npm/esm/index.js',
6060
import: createImport('init', 'feedbackIntegration'),
6161
gzip: true,
62-
limit: '37 KB',
63-
},
64-
{
65-
name: '@sentry/browser (incl. Feedback, Feedback Modal)',
66-
path: 'packages/browser/build/npm/esm/index.js',
67-
import: createImport('init', 'feedbackIntegration', 'feedbackModalIntegration'),
68-
gzip: true,
69-
limit: '37 KB',
62+
limit: '40 KB',
7063
},
7164
{
72-
name: '@sentry/browser (incl. Feedback, Feedback Modal, Feedback Screenshot)',
65+
name: '@sentry/browser (incl. sendFeedback)',
7366
path: 'packages/browser/build/npm/esm/index.js',
74-
import: createImport('init', 'feedbackIntegration', 'feedbackModalIntegration', 'feedbackScreenshotIntegration'),
67+
import: createImport('init', 'sendFeedback'),
7568
gzip: true,
76-
limit: '40 KB',
69+
limit: '28 KB',
7770
},
7871
{
79-
name: '@sentry/browser (incl. sendFeedback)',
72+
name: '@sentry/browser (incl. FeedbackAsync)',
8073
path: 'packages/browser/build/npm/esm/index.js',
81-
import: createImport('init', 'sendFeedback'),
74+
import: createImport('init', 'feedbackAsyncIntegration'),
8275
gzip: true,
83-
limit: '30 KB',
76+
limit: '33 KB',
8477
},
8578
// React SDK (ESM)
8679
{
@@ -167,6 +160,13 @@ module.exports = [
167160
brotli: false,
168161
limit: '220 KB',
169162
},
163+
{
164+
name: 'CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed',
165+
path: createCDNPath('bundle.tracing.replay.feedback.min.js'),
166+
gzip: false,
167+
brotli: false,
168+
limit: '261 KB',
169+
},
170170
// Next.js SDK (ESM)
171171
{
172172
name: '@sentry/nextjs (client)',

packages/browser/src/feedback.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import {
2+
buildFeedbackIntegration,
3+
feedbackModalIntegration,
4+
feedbackScreenshotIntegration,
5+
} from '@sentry-internal/feedback';
6+
import { lazyLoadIntegration } from './utils/lazyLoadIntegration';
7+
8+
// The full feedback widget, with everything pre-loaded
9+
export const feedbackIntegration = buildFeedbackIntegration({
10+
lazyLoadIntegration,
11+
getModalIntegration: () => feedbackModalIntegration,
12+
getScreenshotIntegration: () => feedbackScreenshotIntegration,
13+
});

packages/browser/src/feedbackAsync.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { buildFeedbackIntegration } from '@sentry-internal/feedback';
2+
import { lazyLoadIntegration } from './utils/lazyLoadIntegration';
3+
4+
// This is for users who want to have a lazy-loaded feedback widget
5+
export const feedbackAsyncIntegration = buildFeedbackIntegration({
6+
lazyLoadIntegration,
7+
});

packages/browser/src/index.bundle.feedback.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@ import { browserTracingIntegrationShim, replayIntegrationShim } from '@sentry-in
22

33 F438
export * from './index.bundle.base';
44

5-
export {
6-
feedbackIntegration,
7-
feedbackModalIntegration,
8-
feedbackScreenshotIntegration,
9-
getFeedback,
10-
} from '@sentry-internal/feedback';
5+
export { feedbackIntegration } from './feedback';
6+
export { getFeedback } from '@sentry-internal/feedback';
117

128
export { browserTracingIntegrationShim as browserTracingIntegration, replayIntegrationShim as replayIntegration };
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
import {
2-
browserTracingIntegrationShim,
3-
feedbackIntegrationShim,
4-
feedbackModalIntegrationShim,
5-
feedbackScreenshotIntegrationShim,
6-
} from '@sentry-internal/integration-shims';
1+
import { browserTracingIntegrationShim, feedbackIntegrationShim } from '@sentry-internal/integration-shims';
72

83
export * from './index.bundle.base';
94

105
export { replayIntegration } from '@sentry-internal/replay';
116

12-
export {
13-
browserTracingIntegrationShim as browserTracingIntegration,
14-
feedbackIntegrationShim as feedbackIntegration,
15-
feedbackModalIntegrationShim as feedbackModalIntegration,
16-
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
17-
};
7+
export { browserTracingIntegrationShim as browserTracingIntegration, feedbackIntegrationShim as feedbackIntegration };

packages/browser/src/index.bundle.tracing.replay.feedback.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,8 @@ export {
1515
setMeasurement,
1616
} from '@sentry/core';
1717

18-
export {
19-
feedbackIntegration,
20-
feedbackModalIntegration,
21-
feedbackScreenshotIntegration,
22-
getFeedback,
23-
} from '@sentry-internal/feedback';
18+
export { feedbackIntegration } from './feedback';
19+
export { getFeedback } from '@sentry-internal/feedback';
2420

2521
export {
2622
browserTracingIntegration,

packages/browser/src/index.bundle.tracing.replay.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import {
2-
feedbackIntegrationShim,
3-
feedbackModalIntegrationShim,
4-
feedbackScreenshotIntegrationShim,
5-
} from '@sentry-internal/integration-shims';
1+
import { feedbackIntegrationShim } from '@sentry-internal/integration-shims';
62
import { registerSpanErrorInstrumentation } from '@sentry/core';
73

84
registerSpanErrorInstrumentation();
@@ -26,10 +22,6 @@ export {
2622
startBrowserTracingPageLoadSpan,
2723
} from './tracing/browserTracingIntegration';
2824

29-
export {
30-
feedbackIntegrationShim as feedbackIntegration,
31-
feedbackModalIntegrationShim as feedbackModalIntegration,
32-
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
33-
};
25+
export { feedbackIntegrationShim as feedbackIntegration };
3426

3527
export { replayIntegration } from '@sentry-internal/replay';

packages/browser/src/index.bundle.tracing.ts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import {
2-
feedbackIntegrationShim,
3-
feedbackModalIntegrationShim,
4-
feedbackScreenshotIntegrationShim,
5-
replayIntegrationShim,
6-
} from '@sentry-internal/integration-shims';
1+
import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims';
72
import { registerSpanErrorInstrumentation } from '@sentry/core';
83

94
registerSpanErrorInstrumentation();
@@ -27,9 +22,4 @@ export {
2722
startBrowserTracingPageLoadSpan,
2823
} from './tracing/browserTracingIntegration';
2924

30-
export {
31-
feedbackIntegrationShim as feedbackIntegration,
32-
feedbackModalIntegrationShim as feedbackModalIntegration,
33-
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
34-
replayIntegrationShim as replayIntegration,
35-
};
25+
export { feedbackIntegrationShim as feedbackIntegration, replayIntegrationShim as replayIntegration };

packages/browser/src/index.bundle.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import {
22
browserTracingIntegrationShim,
33
feedbackIntegrationShim,
4-
feedbackModalIntegrationShim,
5-
feedbackScreenshotIntegrationShim,
64
replayIntegrationShim,
75
} from '@sentry-internal/integration-shims';
86

@@ -11,7 +9,5 @@ export * from './index.bundle.base';
119
export {
1210
browserTracingIntegrationShim as browserTracingIntegration,
1311
feedbackIntegrationShim as feedbackIntegration,
14-
feedbackModalIntegrationShim as feedbackModalIntegration,
15-
feedbackScreenshotIntegrationShim as feedbackScreenshotIntegration,
1612
replayIntegrationShim as replayIntegration,
1713
};

packages/browser/src/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ export type {
3030

3131
export { replayCanvasIntegration } from '@sentry-internal/replay-canvas';
3232

33+
export { feedbackIntegration } from './feedback';
34+
export { feedbackAsyncIntegration } from './feedbackAsync';
3335
export {
34-
feedbackIntegration,
35-
feedbackModalIntegration,
36-
feedbackScreenshotIntegration,
3736
getFeedback,
3837
sendFeedback,
3938
} from '@sentry-internal/feedback';

0 commit comments

Comments
 (0)
0