Skip to content

Commit dd8a6d8

Browse files
committed
use rollup json plugin
1 parent 9627ca5 commit dd8a6d8

File tree

6 files changed

+29
-14
lines changed

6 files changed

+29
-14
lines changed

dev-packages/rollup-utils/bundleHelpers.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
makeCleanupPlugin,
1212
makeCommonJSPlugin,
1313
makeIsDebugBuildPlugin,
14+
makeJsonPlugin,
1415
makeLicensePlugin,
1516
makeNodeResolvePlugin,
1617
makeRrwebBuildPlugin,
@@ -40,6 +41,8 @@ export function makeBaseBundleConfig(options) {
4041
// at all, and without `transformMixedEsModules`, they're only included if they're imported, not if they're required.)
4142
const commonJSPlugin = makeCommonJSPlugin({ transformMixedEsModules: true });
4243

44+
const jsonPlugin = makeJsonPlugin();
45+
4346
// used by `@sentry/browser`
4447
const standAloneBundleConfig = {
4548
output: {
@@ -89,7 +92,7 @@ export function makeBaseBundleConfig(options) {
8992
output: {
9093
format: 'cjs',
9194
},
92-
plugins: [commonJSPlugin],
95+
plugins: [jsonPlugin, commonJSPlugin],
9396
// Don't bundle any of Node's core modules
9497
external: builtinModules,
9598
};

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* Sucrase plugin docs: https://github.com/rollup/plugins/tree/master/packages/sucrase
88
*/
99

10+
import json from '@rollup/plugin-json';
1011
import replace from '@rollup/plugin-replace';
1112
import sucrase from '@rollup/plugin-sucrase';
1213
import cleanup from 'rollup-plugin-cleanup';
@@ -18,11 +19,17 @@ import cleanup from 'rollup-plugin-cleanup';
1819
*/
1920
export function makeSucrasePlugin(options = {}) {
2021
return sucrase({
22+
// Required for bundling OTEL code properly
23+
exclude: ['**/*.json'],
2124
transforms: ['typescript', 'jsx'],
2225
...options,
2326
});
2427
}
2528

29+
export function makeJsonPlugin() {
30+
return json();
31+
}
32+
2633
/**
2734
* Create a plugin which can be used to pause the build process at the given hook.
2835
*

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
"devDependencies": {
8888
"@biomejs/biome": "^1.4.0",
8989
"@rollup/plugin-commonjs": "^21.0.1",
90+
"@rollup/plugin-json": "^6.1.0",
9091
"@rollup/plugin-node-resolve": "^13.1.3",
9192
"@rollup/plugin-replace": "^3.0.1",
9293
"@rollup/plugin-sucrase": "^4.0.3",

packages/aws-serverless/rollup.aws.config.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default [
66
makeBaseBundleConfig({
77
// this automatically sets it to be CJS
88
bundleType: 'node',
9-
entrypoints: ['src/index.awslambda.ts'],
9+
entrypoints: ['src/index.ts'],
1010
licenseTitle: '@sentry/aws-serverless',
1111
outputFileBase: () => 'index',
1212
packageSpecificConfig: {
@@ -21,10 +21,6 @@ export default [
2121
// it to be `index.js` in the build script, since it's standing in for the index file of the npm package.
2222
{ variants: ['.min.js'] },
2323
),
24-
25-
// This builds a wrapper file, which our lambda layer integration automatically sets up to run as soon as node
26-
// launches (via the `NODE_OPTIONS="-r @sentry/aws-serverless/dist/awslambda-auto"` variable). Note the inclusion in this
27-
// path of the legacy `dist` folder; for backwards compatibility, in the build script we'll copy the file there.
2824
makeBaseNPMConfig({
2925
entrypoints: ['src/awslambda-auto.ts'],
3026
packageSpecificConfig: {

packages/aws-serverless/src/index.awslambda.ts

Lines changed: 0 additions & 8 deletions
This file was deleted.

yarn.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5597,6 +5597,13 @@
55975597
dependencies:
55985598
"@rollup/pluginutils" "^3.0.8"
55995599

5600+
"@rollup/plugin-json@^6.1.0":
5601+
version "6.1.0"
5602+
resolved "https://registry.yarnpkg.com/@rollup/plugin-json/-/plugin-json-6.1.0.tgz#fbe784e29682e9bb6dee28ea75a1a83702e7b805"
5603+
integrity sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==
5604+
dependencies:
5605+
"@rollup/pluginutils" "^5.1.0"
5606+
56005607
"@rollup/plugin-node-resolve@^13.0.0":
56015608
version "13.3.0"
56025609
resolved "https://registry.yarnpkg.com/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.3.0.tgz#da1c5c5ce8316cef96a2f823d111c1e4e498801c"
@@ -5691,6 +5698,15 @@
56915698
estree-walker "^2.0.2"
56925699
picomatch "^2.3.1"
56935700

5701+
"@rollup/pluginutils@^5.1.0":
5702+
version "5.1.0"
5703+
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-5.1.0.tgz#7e53eddc8c7f483a4ad0b94afb1f7f5fd3c771e0"
5704+
integrity sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==
5705+
dependencies:
5706+
"@types/estree" "^1.0.0"
5707+
estree-walker "^2.0.2"
5708+
picomatch "^2.3.1"
5709+
56945710
56955711
version "4.9.1"
56965712
resolved "https://registry.yarnpkg.com/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.9.1.tgz#beaf518ee45a196448e294ad3f823d2d4576cf35"

0 commit comments

Comments
 (0)