Skip to content

Commit 2fe04af

Browse files
committed
fix node-experimental build
1 parent 5bcc690 commit 2fe04af

File tree

3 files changed

+42
-1
lines changed

3 files changed

+42
-1
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import { makeBaseBundleConfig } from '@sentry-internal/rollup-utils';
2+
3+
function createAnrWorkerConfig(destDir, esm) {
4+
return makeBaseBundleConfig({
5+
bundleType: 'node-worker',
6+
entrypoints: ['src/integrations/anr/worker.ts'],
7+
jsVersion: 'es6',
8+
licenseTitle: '@sentry/node',
9+
outputFileBase: () => 'worker-script.js',
10+
packageSpecificConfig: {
11+
output: {
12+
dir: destDir,
13+
sourcemap: false,
14+
},
15+
plugins: [
16+
{
17+
name: 'output-base64-worker-script',
18+
renderChunk(code) {
19+
const base64Code = Buffer.from(code).toString('base64');
20+
if (esm) {
21+
return `export const base64WorkerScript = '${base64Code}';`;
22+
} else {
23+
return `exports.base64WorkerScript = '${base64Code}';`;
24+
}
25+
},
26+
},
27+
],
28+
},
29+
});
30+
}
31+
32+
export const anrWorkerConfigs = [
33+
createAnrWorkerConfig('build/esm/integrations/anr', true),
34+
createAnrWorkerConfig('build/cjs/integrations/anr', false),
35+
];
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
import { makeBaseNPMConfig, makeNPMConfigVariants } from '@sentry-internal/rollup-utils';
2+
import { anrWorkerConfigs } from './rollup.anr-worker.config.mjs';
23

3-
export default makeNPMConfigVariants(makeBaseNPMConfig());
4+
export default [
5+
...makeNPMConfigVariants(makeBaseNPMConfig()),
6+
// The ANR worker builds must come after the main build because they overwrite the worker-script.js file
7+
...anrWorkerConfigs,
8+
];

packages/node-experimental/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export { getAutoPerformanceIntegrations } from './integrations/tracing';
2626
export { getClient, getSentryRelease, defaultStackParser } from './sdk/api';
2727
export { createGetModuleFromFilename } from './utils/module';
2828
export { makeNodeTransport } from './transports';
29+
export { NodeClient } from './sdk/client';
2930
// eslint-disable-next-line deprecation/deprecation
3031
export { getCurrentHub } from './sdk/hub';
3132
export { cron } from './cron';

0 commit comments

Comments
 (0)