Skip to content

Commit ef7d7e8

Browse files
committed
update rollup
1 parent 4877b4f commit ef7d7e8

File tree

12 files changed

+31
-51
lines changed

12 files changed

+31
-51
lines changed

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import deepMerge from 'deepmerge';
88

99
import {
1010
getEs5Polyfills,
11+
makeAliasPlugin,
1112
makeBrowserBuildPlugin,
1213
makeCleanupPlugin,
1314
makeCommonJSPlugin,
@@ -29,6 +30,7 @@ export function makeBaseBundleConfig(options) {
2930

3031
const isEs5 = jsVersion.toLowerCase() === 'es5';
3132

33+
const aliasPlugin = makeAliasPlugin();
3234
const nodeResolvePlugin = makeNodeResolvePlugin();
3335
const sucrasePlugin = makeSucrasePlugin();
3436
const cleanupPlugin = makeCleanupPlugin();
@@ -124,8 +126,8 @@ export function makeBaseBundleConfig(options) {
124126
esModule: false,
125127
},
126128
plugins: isEs5
127-
? [tsPlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin]
128-
: [sucrasePlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin],
129+
? [tsPlugin, aliasPlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin]
130+
: [sucrasePlugin, aliasPlugin, nodeResolvePlugin, cleanupPlugin, licensePlugin],
129131
treeshake: 'smallest',
130132
};
131133

dev-packages/rollup-utils/npmHelpers.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import * as path from 'path';
99
import deepMerge from 'deepmerge';
1010

1111
import {
12+
makeAliasPlugin,
1213
makeCleanupPlugin,
1314
makeDebugBuildStatementReplacePlugin,
1415
makeExtractPolyfillsPlugin,
@@ -30,6 +31,7 @@ export function makeBaseNPMConfig(options = {}) {
3031
addPolyfills = true,
3132
} = options;
3233

34+
const aliasPlugin = makeAliasPlugin();
3335
const nodeResolvePlugin = makeNodeResolvePlugin();
3436
const sucrasePlugin = makeSucrasePlugin({ disableESTransforms: !addPolyfills });
3537
const debugBuildStatementReplacePlugin = makeDebugBuildStatementReplacePlugin();
@@ -91,6 +93,7 @@ export function makeBaseNPMConfig(options = {}) {
9193
},
9294

9395
plugins: [
96+
aliasPlugin,
9497
nodeResolvePlugin,
9598
setSdkSourcePlugin,
9699
sucrasePlugin,

dev-packages/rollup-utils/plugins/bundlePlugins.mjs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/**
2+
* Alias plugin docs: https://github.com/rollup/plugins/tree/master/packages/alias
23
* CommonJS plugin docs: https://github.com/rollup/plugins/tree/master/packages/commonjs
34
* License plugin docs: https://github.com/mjeanroy/rollup-plugin-license
45
* Replace plugin docs: https://github.com/rollup/plugins/tree/master/packages/replace
@@ -13,6 +14,7 @@ import * as fs from 'fs';
1314
import * as path from 'path';
1415
import { fileURLToPath } from 'url';
1516

17+
import alias from '@rollup/plugin-alias';
1618
import commonjs from '@rollup/plugin-commonjs';
1719
import { nodeResolve } from '@rollup/plugin-node-resolve';
1820
import replace from '@rollup/plugin-replace';
@@ -189,3 +191,14 @@ export function makeNodeResolvePlugin() {
189191
}
190192

191193
export { commonjs as makeCommonJSPlugin };
194+
195+
export function makeAliasPlugin() {
196+
return alias({
197+
entries: [
198+
{ find: 'react', replacement: 'preact/compat' },
199+
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
200+
{ find: 'react-dom', replacement: 'preact/compat' },
201+
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
202+
]
203+
});
204+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
],
9191
"devDependencies": {
9292
"@biomejs/biome": "^1.4.0",
93+
"@rollup/plugin-alias": "^5.1.0",
9394
"@rollup/plugin-commonjs": "^21.0.1",
9495
"@rollup/plugin-node-resolve": "^13.1.3",
9596
"@rollup/plugin-replace": "^3.0.1",

packages/feedback-screenshot/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
"@sentry/types": "7.100.0",
3434
"@sentry/utils": "7.100.0",
3535
"preact": "^10.19.4",
36-
"preact-compat": "^3.19.0",
37-
"@rollup/plugin-alias": "5.1.0"
36+
"preact-compat": "^3.19.0"
3837
},
3938
"scripts": {
4039
"build": "run-p build:transpile build:types build:bundle",

packages/feedback-screenshot/rollup.bundle.config.mjs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
11
import { makeBaseBundleConfig, makeBundleConfigVariants } from '@sentry-internal/rollup-utils';
2-
import alias from '@rollup/plugin-alias';
32

43
const baseBundleConfig = makeBaseBundleConfig({
54
bundleType: 'addon',
65
entrypoints: ['src/index.ts'],
76
jsVersion: 'es6',
87
licenseTitle: '@sentry-internal/feedback-screenshot',
98
outputFileBase: () => 'bundles/feedback-screenshot',
10-
plugins: [
11-
alias({
12-
entries: [
13-
{ find: 'react', replacement: 'preact/compat' },
14-
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
15-
{ find: 'react-dom', replacement: 'preact/compat' },
16-
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
17-
]
18-
})
19-
],
20-
219
});
2210

2311
const builds = makeBundleConfigVariants(baseBundleConfig);
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
2-
import alias from '@rollup/plugin-alias';
32

43
export default makeNPMConfigVariants(
54
makeBaseNPMConfig({
@@ -13,15 +12,5 @@ export default makeNPMConfigVariants(
1312
preserveModules: false,
1413
},
1514
},
16-
plugins: ['@babel/transform-react-jsx', { pragma: 'h' },
17-
alias({
18-
entries: [
19-
{ find: 'react', replacement: 'preact/compat' },
20-
{ find: 'react-dom/test-utils', replacement: 'preact/test-utils' },
21-
{ find: 'react-dom', replacement: 'preact/compat' },
22-
{ find: 'react/jsx-runtime', replacement: 'preact/jsx-runtime' }
23-
]
24-
})
25-
],
2615
}),
2716
);

packages/feedback-screenshot/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ export {
55
} from './screenshot';
66
export type { FeedbackScreenshotIntegrationOptions } from './screenshot';
77

8-
console.log('screenshot 6');
8+
console.log('screenshot 9');

packages/feedback-screenshot/src/screenshot.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ import { h, render } from 'preact';
66

77
interface FeedbackScreenshotOptions {
88
el: Element;
9-
props: string;
9+
props: unknown;
1010
}
1111

1212
export interface FeedbackScreenshotIntegrationOptions {
1313
el: Element;
14-
props: string;
14+
props: unknown;
1515
}
1616

1717
const INTEGRATION_NAME = 'FeedbackScreenshot';
@@ -24,7 +24,7 @@ export const _feedbackScreenshotIntegration = ((options: Partial<FeedbackScreens
2424
// eslint-disable-next-line @typescript-eslint/no-empty-function
2525
setupOnce() {},
2626
getOptions(): FeedbackScreenshotIntegrationOptions {
27-
return { el: options.el || WINDOW.document.createElement('div'), props: options.props || 'prop' };
27+
return { el: options.el || WINDOW.document.createElement('div'), props: options.props || null };
2828
},
2929
renderScreenshotWidget: (options: FeedbackScreenshotOptions) => {
3030
return render(h(Hello, null), options.el);
Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
1-
import { h, render } from 'preact';
2-
3-
interface FeedbackScreenshotOptions {
4-
el: Element;
5-
props: string;
6-
}
1+
import { h, createElement } from 'preact';
72

83
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
9-
export function Hello(options: FeedbackScreenshotOptions) {
10-
console.log('screenshot widget');
4+
export function Hello() {
5+
console.log('screenshot widget 1');
116
return h('div', null, 'hello');
127
}

packages/feedback/src/widget/Form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ export function Form({
158158

159159
const screenshot = createElement('div', { className: 'btn-group' });
160160

161-
// @ts-expect-error testing
161+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
162162
ScreenshotIntegration.feedbackScreenshotIntegration().renderScreenshotWidget({
163163
el: screenshot,
164164
props: null,

yarn.lock

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5293,7 +5293,7 @@
52935293
dependencies:
52945294
web-streams-polyfill "^3.1.1"
52955295

5296-
5296+
"@rollup/plugin-alias@^5.1.0":
52975297
version "5.1.0"
52985298
resolved "https://registry.yarnpkg.com/@rollup/plugin-alias/-/plugin-alias-5.1.0.tgz#99a94accc4ff9a3483be5baeedd5d7da3b597e93"
52995299
integrity sha512-lpA3RZ9PdIG7qqhEfv79tBffNaoDuukFDrmhLqg9ifv99u/ehn+lOg30x2zmhf8AQqQUZaMk/B9fZraQ6/acDQ==
@@ -5549,16 +5549,6 @@
55495549
semver "7.3.2"
55505550
semver-intersect "1.4.0"
55515551

5552-
"@sentry-internal/feedback-screenshot@file:packages/feedback-screenshot":
5553-
version "7.100.0"
5554-
dependencies:
5555-
"@rollup/plugin-alias" "5.1.0"
5556-
"@sentry/core" "7.100.0"
5557-
"@sentry/types" "7.100.0"
5558-
"@sentry/utils" "7.100.0"
5559-
preact "^10.19.4"
5560-
preact-compat "^3.19.0"
5561-
55625552
"@sentry-internal/[email protected]":
55635553
version "2.11.0"
55645554
resolved "https://registry.yarnpkg.com/@sentry-internal/rrdom/-/rrdom-2.11.0.tgz#f7c8f54705ad84ece0e97e53f12e87c687749b32"

0 commit comments

Comments
 (0)